|
@@ -35,24 +35,19 @@ void TileSetEditor::edit(const Ref<TileSet> &p_tileset) {
|
|
|
tileset = p_tileset;
|
|
|
}
|
|
|
|
|
|
-void TileSetEditor::_import_scene(Node *scene, Ref<TileSet> p_library, bool p_merge) {
|
|
|
|
|
|
- if (!p_merge)
|
|
|
- p_library->clear();
|
|
|
-
|
|
|
- for (int i = 0; i < scene->get_child_count(); i++) {
|
|
|
+void TileSetEditor::_import_node(Node *p_node, Ref<TileSet> p_library) {
|
|
|
|
|
|
- Node *child = scene->get_child(i);
|
|
|
+ for (int i = 0; i < p_node->get_child_count(); i++) {
|
|
|
|
|
|
- if (!child->cast_to<Sprite>()) {
|
|
|
- if (child->get_child_count() > 0) {
|
|
|
- child = child->get_child(0);
|
|
|
- if (!child->cast_to<Sprite>()) {
|
|
|
- continue;
|
|
|
- }
|
|
|
+ Node *child = p_node->get_child(i);
|
|
|
|
|
|
- } else
|
|
|
- continue;
|
|
|
+ if(!child->cast_to<Sprite>()) {
|
|
|
+ if(child->get_child_count() > 0) {
|
|
|
+ _import_node(child, p_library);
|
|
|
+ }
|
|
|
+
|
|
|
+ continue;
|
|
|
}
|
|
|
|
|
|
Sprite *mi = child->cast_to<Sprite>();
|
|
@@ -136,6 +131,13 @@ void TileSetEditor::_import_scene(Node *scene, Ref<TileSet> p_library, bool p_me
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+void TileSetEditor::_import_scene(Node *p_scene, Ref<TileSet> p_library, bool p_merge) {
|
|
|
+ if (!p_merge)
|
|
|
+ p_library->clear();
|
|
|
+
|
|
|
+ _import_node(p_scene, p_library);
|
|
|
+}
|
|
|
+
|
|
|
void TileSetEditor::_menu_confirm() {
|
|
|
|
|
|
switch (option) {
|