Skip to content

Commit

Permalink
[hide] Hide prefabs that don't override getHideProps
Browse files Browse the repository at this point in the history
  • Loading branch information
EspeuteClement committed Dec 19, 2024
1 parent 6b5d34d commit f4cca2b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions hide/comp/SceneEditor.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down
1 change: 1 addition & 0 deletions hide/prefab/HideProps.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions hrt/prefab/Prefab.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
}

/**
Expand Down

0 comments on commit f4cca2b

Please sign in to comment.