@@ -20,7 +20,7 @@ use crate::entity_name_resolution::EntityName;
2020use crate :: extension_methods:: WorldInspectionExtensionTrait ;
2121use crate :: gui:: config:: InspectorConfig ;
2222use crate :: gui:: semantic_names:: SemanticFieldNames ;
23- use crate :: gui:: state:: { DetailTab , InspectableObject , InspectorCache , InspectorState } ;
23+ use crate :: gui:: state:: { DetailTab , InspectorCache , InspectorState } ;
2424use crate :: gui:: widgets:: drag_value:: { DragValue , DragValueDragState , FieldPath , FieldPathSegment } ;
2525use crate :: inspection:: component_inspection:: {
2626 ComponentDetailLevel , ComponentInspectionSettings , ComponentMetadataMap ,
@@ -66,7 +66,7 @@ fn on_hierarchy_node_click(
6666 nodes : Query < & HierarchyNode > ,
6767) {
6868 if let Ok ( node) = nodes. get ( activate. entity ) {
69- state. selected_object = Some ( InspectableObject :: Entity ( node. 0 ) ) ;
69+ state. selected_object = Some ( node. 0 ) ;
7070 }
7171}
7272
@@ -131,29 +131,14 @@ pub fn sync_detail_panel(world: &mut World) {
131131 } ;
132132
133133 // Check if entity still exists
134- match selected_object {
135- InspectableObject :: Entity ( entity) => {
136- if !world. entities ( ) . contains ( entity) {
137- spawn_error_message (
138- world,
139- content_entity,
140- & config,
141- "Selected entity no longer exists" ,
142- ) ;
143- return ;
144- }
145- }
146- InspectableObject :: Resource ( id) => {
147- if !world. contains_resource_by_id ( id) {
148- spawn_error_message (
149- world,
150- content_entity,
151- & config,
152- "Selected resource no longer exists" ,
153- ) ;
154- return ;
155- }
156- }
134+ if !world. entities ( ) . contains ( selected_object) {
135+ spawn_error_message (
136+ world,
137+ content_entity,
138+ & config,
139+ "Selected entity no longer exists" ,
140+ ) ;
141+ return ;
157142 }
158143
159144 // Ensure we have a metadata map - take it out to avoid borrow conflicts
@@ -171,32 +156,16 @@ pub fn sync_detail_panel(world: &mut World) {
171156 // Render based on active tab
172157 match active_tab {
173158 DetailTab :: Components => {
174- let InspectableObject :: Entity ( selected_entity) = selected_object else {
175- warn_once ! (
176- "Components tab selected for non-entity object: {:?}" ,
177- selected_object
178- ) ;
179- return ;
180- } ;
181-
182159 if let Some ( ref mut mm) = metadata_map {
183- spawn_components_tab_exclusive ( world, content_entity, selected_entity , mm, & config) ;
160+ spawn_components_tab_exclusive ( world, content_entity, selected_object , mm, & config) ;
184161 }
185162 }
186163 DetailTab :: Relationships => {
187- let InspectableObject :: Entity ( selected_entity) = selected_object else {
188- warn_once ! (
189- "Relationships tab selected for non-entity object: {:?}" ,
190- selected_object
191- ) ;
192- return ;
193- } ;
194-
195164 if let Some ( ref mm) = metadata_map {
196165 spawn_relationships_tab_exclusive (
197166 world,
198167 content_entity,
199- selected_entity ,
168+ selected_object ,
200169 mm,
201170 & config,
202171 ) ;
0 commit comments