Skip to content

Commit a704cb8

Browse files
committed
block_canvas: Select the new block code node in add block code
This fixes an issue where the blocks picker incorrectly generates its list of blocks before the block code node's block script is ready.
1 parent 36eaba5 commit a704cb8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

addons/block_code/ui/main_panel.gd

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ func _on_block_canvas_add_block_code():
216216
undo_redo.create_action("Add block code for %s" % edited_node.name, UndoRedo.MERGE_DISABLE, edited_node)
217217

218218
undo_redo.add_do_method(edited_node, "add_child", block_code, true)
219+
undo_redo.add_do_method(self, "_select_node", block_code)
219220
undo_redo.add_do_property(block_code, "owner", scene_root)
220221
undo_redo.add_do_property(_context, "block_code_node", block_code)
221222
undo_redo.add_do_reference(block_code)
@@ -225,6 +226,11 @@ func _on_block_canvas_add_block_code():
225226
undo_redo.commit_action()
226227

227228

229+
func _select_node(node: Node):
230+
EditorInterface.get_selection().clear()
231+
EditorInterface.get_selection().add_node(node)
232+
233+
228234
func _on_block_canvas_open_scene():
229235
var edited_node: Node = EditorInterface.get_inspector().get_edited_object() as Node
230236

0 commit comments

Comments
 (0)