11 [
Attribute(
"1",
desc:
"Set when the entity is visible. If false will hide itself in editor and show outside of editor. This component is ignored if attached to an EditableEntity or if parent is editable entity", uiwidget: UIWidgets.Flags, enums: ParamEnumArray.FromEnum(
EShowHideInEditor))]
14 [
Attribute(
"0",
desc:
"If true will also Show/Hide children when entity is hidden")]
15 protected bool m_bShowHideChildren;
17 [
Attribute(
"1",
desc:
"If true will also Show/Hide when editor UI is hidden")]
18 protected bool m_bHideWhenEditorUiHidden;
21 protected bool m_bEditorMenuVisible =
true;
24 protected bool m_bSubscribedToOnEditorCreate;
27 protected void OnEditorOpen()
33 protected void OnEditorClosed()
45 protected void OnEditorMenuVisibilityChanged(
bool isVisible)
47 m_bEditorMenuVisible = isVisible;
49 if (!m_bEditorMenuVisible)
51 GetOwner().ClearFlags(EntityFlags.VISIBLE, m_bShowHideChildren);
56 if (!editorManagerEntity)
58 GetOwner().ClearFlags(EntityFlags.VISIBLE, m_bShowHideChildren);
70 if (!m_bEditorMenuVisible || !editorIsOpen)
72 GetOwner().ClearFlags(EntityFlags.VISIBLE, m_bShowHideChildren);
76 bool isLimited = !mode || mode.IsLimited();
81 GetOwner().SetFlags(EntityFlags.VISIBLE, m_bShowHideChildren);
83 GetOwner().ClearFlags(EntityFlags.VISIBLE, m_bShowHideChildren);
88 GetOwner().SetFlags(EntityFlags.VISIBLE, m_bShowHideChildren);
90 GetOwner().ClearFlags(EntityFlags.VISIBLE, m_bShowHideChildren);
95 override void EOnInit(IEntity owner)
102 IEntity parent = owner.GetParent();
107 GetOwner().ClearFlags(EntityFlags.VISIBLE, m_bShowHideChildren);
109 if (m_eShowHideInEditor <= 0)
121 if (editorManagerCore)
122 editorManagerCore.Event_OnEditorManagerInitOwner.Insert(Init);
128 if (m_bSubscribedToOnEditorCreate)
131 if (editorManagerCore)
133 m_bSubscribedToOnEditorCreate =
false;
134 editorManagerCore.Event_OnEditorManagerInitOwner.Remove(Init);
138 editorManagerEntity.GetOnOpened().Insert(OnEditorOpen);
139 editorManagerEntity.GetOnClosed().Insert(OnEditorClosed);
140 editorManagerEntity.GetOnModeChange().Insert(OnEditorModeChanged);
142 if (m_bHideWhenEditorUiHidden)
147 menuManager.GetOnVisibilityChange().Insert(OnEditorMenuVisibilityChanged);
149 m_bEditorMenuVisible = menuManager.IsVisible();
150 if (!m_bEditorMenuVisible)
151 GetOwner().ClearFlags(EntityFlags.VISIBLE, m_bShowHideChildren);
155 if (editorManagerEntity.IsOpened())
162 override void OnDelete(IEntity owner)
173 IEntity parent = owner.GetParent();
177 if (m_eShowHideInEditor <= 0)
181 if (m_bSubscribedToOnEditorCreate)
184 if (editorManagerCore)
185 editorManagerCore.Event_OnEditorManagerInitOwner.Remove(Init);
189 if (!editorManagerEntity)
192 editorManagerEntity.GetOnOpened().Remove(OnEditorOpen);
193 editorManagerEntity.GetOnClosed().Remove(OnEditorClosed);
194 editorManagerEntity.GetOnModeChange().Remove(OnEditorModeChanged);
198 override void OnPostInit(IEntity owner)
204 SetEventMask(owner, EntityEvent.INIT);