Skip to content

Commit

Permalink
block_canvas: Select the new block code node in add block code
Browse files Browse the repository at this point in the history
This fixes an issue where the blocks picker incorrectly generates its
list of blocks before the block code node's block script is ready.
  • Loading branch information
dylanmccall committed Oct 11, 2024
1 parent 36eaba5 commit a704cb8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions addons/block_code/ui/main_panel.gd
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ func _on_block_canvas_add_block_code():
undo_redo.create_action("Add block code for %s" % edited_node.name, UndoRedo.MERGE_DISABLE, edited_node)

undo_redo.add_do_method(edited_node, "add_child", block_code, true)
undo_redo.add_do_method(self, "_select_node", block_code)
undo_redo.add_do_property(block_code, "owner", scene_root)
undo_redo.add_do_property(_context, "block_code_node", block_code)
undo_redo.add_do_reference(block_code)
Expand All @@ -225,6 +226,11 @@ func _on_block_canvas_add_block_code():
undo_redo.commit_action()


func _select_node(node: Node):
EditorInterface.get_selection().clear()
EditorInterface.get_selection().add_node(node)


func _on_block_canvas_open_scene():
var edited_node: Node = EditorInterface.get_inspector().get_edited_object() as Node

Expand Down

0 comments on commit a704cb8

Please sign in to comment.