From be916233f9022cb527cd053339102e141497761f Mon Sep 17 00:00:00 2001 From: Aaron Franke Date: Sat, 11 Feb 2023 02:18:10 -0600 Subject: [PATCH] Check for CanvasItem instead of Control and Node2D --- editor/editor_node.cpp | 2 +- scene/resources/tile_set.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 3adebb2f8e1..1dce65cfabf 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -3685,7 +3685,7 @@ void EditorNode::_set_main_scene_state(Dictionary p_state, Node *p_for_scene) { Node *editor_node = SceneTreeDock::get_singleton()->get_tree_editor()->get_selected(); editor_node = editor_node == nullptr ? get_edited_scene() : editor_node; - if (Object::cast_to(editor_node) || Object::cast_to(editor_node)) { + if (Object::cast_to(editor_node)) { editor_select(EDITOR_2D); } else if (Object::cast_to(editor_node)) { editor_select(EDITOR_3D); diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp index 58a638804d1..fee0a4a9107 100644 --- a/scene/resources/tile_set.cpp +++ b/scene/resources/tile_set.cpp @@ -4805,8 +4805,8 @@ void TileSetScenesCollectionSource::set_scene_tile_scene(int p_id, Refget_base_scene_state(); } ERR_FAIL_COND_MSG(type.is_empty(), vformat("Invalid PackedScene for TileSetScenesCollectionSource: %s. Could not get the type of the root node.", p_packed_scene->get_path())); - bool extends_correct_class = ClassDB::is_parent_class(type, "Control") || ClassDB::is_parent_class(type, "Node2D"); - ERR_FAIL_COND_MSG(!extends_correct_class, vformat("Invalid PackedScene for TileSetScenesCollectionSource: %s. Root node should extend Control or Node2D. Found %s instead.", p_packed_scene->get_path(), type)); + bool extends_correct_class = ClassDB::is_parent_class(type, "CanvasItem"); + ERR_FAIL_COND_MSG(!extends_correct_class, vformat("Invalid PackedScene for TileSetScenesCollectionSource: %s. Root node should extend CanvasItem. Found %s instead.", p_packed_scene->get_path(), type)); scenes[p_id].scene = p_packed_scene; } else {