summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2017-05-20 09:50:33 +0200
committerGitHub <noreply@github.com>2017-05-20 09:50:33 +0200
commitc19902f753c90971f3709a2fab530dc017816669 (patch)
treec7bfe5e080471ee37c2b757bfb0bdacd093050d3 /editor
parentc7650c363bb843e3e99aef87db449ff8fa1c58a5 (diff)
parentc97c733779e4061313ea57804f24f646c3b1228c (diff)
Merge pull request #8838 from zlsa/master
Export nested nodes in TileSet scenes; resolves #8819.
Diffstat (limited to 'editor')
-rw-r--r--editor/plugins/tile_set_editor_plugin.cpp26
-rw-r--r--editor/plugins/tile_set_editor_plugin.h1
2 files changed, 15 insertions, 12 deletions
diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp
index e79cbd0d35..0b088f7171 100644
--- a/editor/plugins/tile_set_editor_plugin.cpp
+++ b/editor/plugins/tile_set_editor_plugin.cpp
@@ -37,24 +37,18 @@ 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();
+void TileSetEditor::_import_node(Node *p_node, Ref<TileSet> 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<Sprite>()) {
if (child->get_child_count() > 0) {
- child = child->get_child(0);
- if (!child->cast_to<Sprite>()) {
- continue;
- }
+ _import_node(child, p_library);
+ }
- } else
- continue;
+ continue;
}
Sprite *mi = child->cast_to<Sprite>();
@@ -138,6 +132,14 @@ void TileSetEditor::_import_scene(Node *scene, Ref<TileSet> p_library, bool p_me
}
}
+void TileSetEditor::_import_scene(Node *scene, Ref<TileSet> p_library, bool p_merge) {
+
+ if (!p_merge)
+ p_library->clear();
+
+ _import_node(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 42084c05a3..d04ebc7197 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<TileSet> p_library);
static void _import_scene(Node *p_scene, Ref<TileSet> p_library, bool p_merge);
protected: