From 1028739690fdeb89dbaa400a279a9fbaf13a18d5 Mon Sep 17 00:00:00 2001 From: Sean Bohan Date: Sun, 11 Jun 2017 09:29:47 +0800 Subject: [PATCH] Subtract body position from shape offset during tileset convert To be able to adjust tile offset by changing position of StaticBody instead of modifying it maunally from the tres file or by calling a script. --- editor/plugins/tile_set_editor_plugin.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp index d744196dd3c..13515abed43 100644 --- a/editor/plugins/tile_set_editor_plugin.cpp +++ b/editor/plugins/tile_set_editor_plugin.cpp @@ -35,18 +35,17 @@ void TileSetEditor::edit(const Ref &p_tileset) { tileset = p_tileset; } - void TileSetEditor::_import_node(Node *p_node, Ref p_library) { for (int i = 0; i < p_node->get_child_count(); i++) { Node *child = p_node->get_child(i); - if(!child->cast_to()) { - if(child->get_child_count() > 0) { + if (!child->cast_to()) { + if (child->get_child_count() > 0) { _import_node(child, p_library); } - + continue; } @@ -113,6 +112,8 @@ void TileSetEditor::_import_node(Node *p_node, Ref p_library) { collisions.push_back(collision); } } + + phys_offset -= sb->get_pos(); } if (collisions.size()) {