Skip to content

Commit

Permalink
refs #134: polygon disappears when selecting another object on scene. (
Browse files Browse the repository at this point in the history
  • Loading branch information
drbbgh authored Jul 14, 2024
1 parent 53d956c commit 39af850
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions addons/popochiu/editor/helpers/popochiu_editor_helper.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 39af850

Please sign in to comment.