diff --git a/addons/popochiu/editor/canvas_editor_menu/popochiu_canvas_editor_menu.gd b/addons/popochiu/editor/canvas_editor_menu/popochiu_canvas_editor_menu.gd index 5ba81860..af32f640 100644 --- a/addons/popochiu/editor/canvas_editor_menu/popochiu_canvas_editor_menu.gd +++ b/addons/popochiu/editor/canvas_editor_menu/popochiu_canvas_editor_menu.gd @@ -142,9 +142,16 @@ func _on_selection_changed() -> void: if PopochiuEditorHelper.is_popochiu_obj_polygon(selected_node): _active_popochiu_object = selected_node.get_parent() elif PopochiuEditorHelper.is_popochiu_room_object(selected_node): + var polygon = PopochiuEditorHelper.get_first_child_by_group( + _active_popochiu_object, + PopochiuEditorHelper.POPOCHIU_OBJECT_POLYGON_GROUP + ) + if (polygon != null): + polygon.hide() + btn_interaction_polygon.set_pressed_no_signal(false) _active_popochiu_object = selected_node else: - _active_popochiu_object = null + _active_popochiu_object = null # Case 2: # We have more than one node selected. This can happen because the user selected diff --git a/addons/popochiu/editor/helpers/popochiu_editor_helper.gd b/addons/popochiu/editor/helpers/popochiu_editor_helper.gd index 59f7cde8..247bd8b3 100644 --- a/addons/popochiu/editor/helpers/popochiu_editor_helper.gd +++ b/addons/popochiu/editor/helpers/popochiu_editor_helper.gd @@ -193,6 +193,8 @@ static func is_editing_room() -> bool: # Quick-access functions static func get_first_child_by_group(node: Node, group: StringName) -> Node: + if (node == null): + return null for n in node.get_children(): if n.is_in_group(group): return n