diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-05-25 15:59:07 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-05-25 15:59:07 +0200 |
commit | 2eec9a67d564b11326f44c5ef8b6b6f9aec251b9 (patch) | |
tree | 78c707fa5f696f9ec383651227dbac7bcea18810 | |
parent | 89913c4e9367c393f6d6c49b4e7fbedf2ea8e1bc (diff) | |
parent | e5b6b3e1e3b5a9e9d201d27e13089869e4fff1da (diff) | |
download | redot-engine-2eec9a67d564b11326f44c5ef8b6b6f9aec251b9.tar.gz |
Merge pull request #77473 from KoBeWi/get_tree().get_root().get_tree().get_root().get_tree().get_root().get_tree().get_root().get_tree().get_root().get_tree().get_root().get_tree().get_root().get_tree().get_edited_scene_root()
Don't create bones from empty scene
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 368c81a0f4..dcf3dc5b1b 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -4587,7 +4587,11 @@ void CanvasItemEditor::_popup_callback(int p_op) { } break; case SKELETON_MAKE_BONES: { HashMap<Node *, Object *> &selection = editor_selection->get_selection(); - Node *editor_root = EditorNode::get_singleton()->get_edited_scene()->get_tree()->get_edited_scene_root(); + Node *editor_root = get_tree()->get_edited_scene_root(); + + if (!editor_root || selection.is_empty()) { + return; + } undo_redo->create_action(TTR("Create Custom Bone2D(s) from Node(s)")); for (const KeyValue<Node *, Object *> &E : selection) { |