diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp index 484c549150d..d744196dd3c 100644 --- a/editor/plugins/tile_set_editor_plugin.cpp +++ b/editor/plugins/tile_set_editor_plugin.cpp @@ -35,24 +35,19 @@ void TileSetEditor::edit(const Ref &p_tileset) { tileset = p_tileset; } -void TileSetEditor::_import_scene(Node *scene, Ref p_library, bool p_merge) { - if (!p_merge) - p_library->clear(); +void TileSetEditor::_import_node(Node *p_node, Ref p_library) { - for (int i = 0; i < scene->get_child_count(); i++) { + for (int i = 0; i < p_node->get_child_count(); i++) { - Node *child = scene->get_child(i); + Node *child = p_node->get_child(i); - if (!child->cast_to()) { - if (child->get_child_count() > 0) { - child = child->get_child(0); - if (!child->cast_to()) { - continue; - } - - } else - continue; + if(!child->cast_to()) { + if(child->get_child_count() > 0) { + _import_node(child, p_library); + } + + continue; } Sprite *mi = child->cast_to(); @@ -136,6 +131,13 @@ void TileSetEditor::_import_scene(Node *scene, Ref p_library, bool p_me } } +void TileSetEditor::_import_scene(Node *p_scene, Ref p_library, bool p_merge) { + if (!p_merge) + p_library->clear(); + + _import_node(p_scene, p_library); +} + void TileSetEditor::_menu_confirm() { switch (option) { diff --git a/editor/plugins/tile_set_editor_plugin.h b/editor/plugins/tile_set_editor_plugin.h index 219daa76aca..fc202048def 100644 --- a/editor/plugins/tile_set_editor_plugin.h +++ b/editor/plugins/tile_set_editor_plugin.h @@ -59,6 +59,7 @@ class TileSetEditor : public Control { void _menu_confirm(); void _name_dialog_confirm(const String &name); + static void _import_node(Node *p_node, Ref p_library); static void _import_scene(Node *p_scene, Ref p_library, bool p_merge); protected: