summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-05-25 15:59:07 +0200
committerRémi Verschelde <rverschelde@gmail.com>2023-05-25 15:59:07 +0200
commit2eec9a67d564b11326f44c5ef8b6b6f9aec251b9 (patch)
tree78c707fa5f696f9ec383651227dbac7bcea18810
parent89913c4e9367c393f6d6c49b4e7fbedf2ea8e1bc (diff)
parente5b6b3e1e3b5a9e9d201d27e13089869e4fff1da (diff)
downloadredot-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.cpp6
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) {