@@ -165,7 +165,7 @@ private void DrawFlatNode(ActorComponent component, bool warn, bool isSearching)
165165 if ( ! hasChildren ) flags |= ImGuiTreeNodeFlags . Leaf | ImGuiTreeNodeFlags . NoTreePushOnOpen ;
166166 else ImGui . SetNextItemOpen ( component . IsNodeOpen , ImGuiCond . Always ) ;
167167
168- if ( warn ) ImGui . PushStyleColor ( ImGuiCol . Text , new Vector4 ( 1f , 0.75f , 0f , 1f ) ) ;
168+ if ( warn ) ImGui . PushStyleColor ( ImGuiCol . Text , Settings . OrangeColor ) ;
169169 var nodeOpen = ImGui . TreeNodeEx ( "##Component" , flags , $ "{ ( warn ? $ "{ WarnIcon } " : "" ) } { component . Icon } { component . Name } ") ;
170170 component . IsNodeOpen = nodeOpen ;
171171 if ( warn ) ImGui . PopStyleColor ( ) ;
@@ -188,7 +188,11 @@ private void DrawFlatNode(ActorComponent component, bool warn, bool isSearching)
188188 if ( ImGui . MenuItem ( "\uf185 Make Sun Light" ) ) lightSystem ! . DirectionalLight = dirLight ;
189189 ImGui . EndDisabled ( ) ;
190190 }
191- if ( ImGui . MenuItem ( "\uf124 Teleport To" ) && component is SpatialComponent spatial ) spatial . TeleportTo ( ) ;
191+ if ( component is SpatialComponent spatial )
192+ {
193+ if ( ImGui . MenuItem ( $ "{ Settings . EyeIcon } Toggle Visibility") ) spatial . SetVisibility ( ! spatial . IsVisible , ImGui . GetIO ( ) . KeyShift ) ;
194+ if ( ImGui . MenuItem ( "\uf124 Teleport To" ) ) spatial . TeleportTo ( ) ;
195+ }
192196 if ( ImGui . MenuItem ( "\uf1c9 Open JSON" ) )
193197 {
194198 if ( component . Actor ? . ActorManager is EditorManager manager )
@@ -230,7 +234,7 @@ private void DrawFlatNode(ActorComponent component, bool warn, bool isSearching)
230234 {
231235 if ( warn )
232236 {
233- ImGui . PushStyleColor ( ImGuiCol . Text , new Vector4 ( 1f , 0.75f , 0f , 1f ) ) ;
237+ ImGui . PushStyleColor ( ImGuiCol . Text , Settings . OrangeColor ) ;
234238 ImGui . TextUnformatted ( $ "{ WarnIcon } Orphaned component not attached to the tree.") ;
235239 ImGui . PopStyleColor ( ) ;
236240 ImGui . Separator ( ) ;
@@ -276,17 +280,31 @@ private void DrawFlatNode(ActorComponent component, bool warn, bool isSearching)
276280 if ( nodeOpen ) ImGui . TreePop ( ) ;
277281 }
278282
279- var btnW = ImGui . CalcTextSize ( FileIcon ) . X + style . FramePadding . X * 2 ;
280- ImGui . SameLine ( rightEdge - btnW ) ;
281- ImGui . PushStyleVar ( ImGuiStyleVar . ItemSpacing , style . ItemSpacing with { X = 0 } ) ;
282- ImGui . PushStyleColor ( ImGuiCol . Button , Vector4 . Zero ) ;
283- if ( ImGui . Button ( FileIcon ) )
284283 {
285- if ( component . Actor ? . ActorManager is EditorManager manager )
286- manager . _jsonViewer . Open ( component ) ;
284+ ImGui . PushStyleVar ( ImGuiStyleVar . ItemSpacing , style . ItemSpacing with { X = 0 } ) ;
285+ ImGui . PushStyleColor ( ImGuiCol . Button , Vector4 . Zero ) ;
286+ if ( component is SpatialComponent spatial )
287+ {
288+ var btnW = ImGui . CalcTextSize ( spatial . VisibilityIcon ) . X + style . FramePadding . X * 2 ;
289+ ImGui . SameLine ( rightEdge - btnW ) ;
290+ var textColor = spatial . VisibilityColor ;
291+ if ( textColor != null ) ImGui . PushStyleColor ( ImGuiCol . Text , textColor . Value ) ;
292+ if ( ImGui . Button ( spatial . VisibilityIcon ) ) spatial . SetVisibility ( ! spatial . IsVisible , ImGui . GetIO ( ) . KeyShift ) ;
293+ if ( textColor != null ) ImGui . PopStyleColor ( ) ;
294+ }
295+ else
296+ {
297+ var btnW = ImGui . CalcTextSize ( FileIcon ) . X + style . FramePadding . X * 2 ;
298+ ImGui . SameLine ( rightEdge - btnW ) ;
299+ if ( ImGui . Button ( FileIcon ) )
300+ {
301+ if ( component . Actor ? . ActorManager is EditorManager manager )
302+ manager . _jsonViewer . Open ( component ) ;
303+ }
304+ }
305+ ImGui . PopStyleColor ( ) ;
306+ ImGui . PopStyleVar ( ) ;
287307 }
288- ImGui . PopStyleColor ( ) ;
289- ImGui . PopStyleVar ( ) ;
290308
291309 ImGui . PopID ( ) ;
292310 }
0 commit comments