瀏覽代碼

[hide] Hide prefabs that don't override getHideProps

Clément Espeute 8 月之前
父節點
當前提交
f4cca2b16a
共有 3 個文件被更改,包括 4 次插入2 次删除
  1. 1 0
      hide/comp/SceneEditor.hx
  2. 1 0
      hide/prefab/HideProps.hx
  3. 2 2
      hrt/prefab/Prefab.hx

+ 1 - 0
hide/comp/SceneEditor.hx

@@ -4473,6 +4473,7 @@ class SceneEditor {
 		}
 		for( ptype in allRegs.keys() ) {
 			var pinf = allRegs.get(ptype);
+			if (pinf.inf.hideInAddMenu) continue;
 
 			if (!checkAllowParent(pinf, parent)) continue;
 			if(ptype == "shader") {

+ 1 - 0
hide/prefab/HideProps.hx

@@ -5,6 +5,7 @@ typedef HideProps = {
 	var name : String;
 	var ?isGround : Bool;
 	var ?fileSource : Array<String>;
+	var ?hideInAddMenu : Bool;
 	@:optional dynamic function allowChildren( cl : Class<hrt.prefab.Prefab> ) : Bool;
 	@:optional dynamic function allowParent( p : hrt.prefab.Prefab ) : Bool;
 	@:optional dynamic function onChildUpdate( p : hrt.prefab.Prefab ) : Void;

+ 2 - 2
hrt/prefab/Prefab.hx

@@ -567,8 +567,8 @@ class Prefab {
 	/**
 		Allows to customize how the prefab object is displayed / handled within Hide
 	**/
-	public function getHideProps() : hide.prefab.HideProps {
-		return { icon : "question-circle", name : "Unknown" };
+	public function getHideProps() : Null<hide.prefab.HideProps> {
+		return { icon : "question-circle", name : Type.getClassName(Type.getClass(this)), hideInAddMenu: true };
 	}
 
 	/**