aboutsummaryrefslogtreecommitdiff
path: root/tools/editor/plugins/tile_set_editor_plugin.cpp
diff options
context:
space:
mode:
authorJuan Linietsky2014-04-19 16:46:52 -0300
committerJuan Linietsky2014-04-19 16:46:52 -0300
commita4c1fa12a54df2fe332db2ab08a03c844e4dcc93 (patch)
tree0e3fa1b801c174b1e56d81d2744be05361fbcd46 /tools/editor/plugins/tile_set_editor_plugin.cpp
parent0360b454a432dc851cc1c5b0c365049ebafcec46 (diff)
downloadgodot-a4c1fa12a54df2fe332db2ab08a03c844e4dcc93.tar.gz
godot-a4c1fa12a54df2fe332db2ab08a03c844e4dcc93.tar.zst
godot-a4c1fa12a54df2fe332db2ab08a03c844e4dcc93.zip
heck
Diffstat (limited to 'tools/editor/plugins/tile_set_editor_plugin.cpp')
-rw-r--r--tools/editor/plugins/tile_set_editor_plugin.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/tools/editor/plugins/tile_set_editor_plugin.cpp b/tools/editor/plugins/tile_set_editor_plugin.cpp
index 7d9b55433..6026cda4d 100644
--- a/tools/editor/plugins/tile_set_editor_plugin.cpp
+++ b/tools/editor/plugins/tile_set_editor_plugin.cpp
@@ -72,8 +72,16 @@ void TileSetEditor::_import_scene(Node *scene, Ref<TileSet> p_library, bool p_me
p_library->tile_set_texture(id,texture);
+ Vector2 phys_offset = mi->get_offset();
+
if (mi->is_centered()) {
- p_library->tile_set_texture_offset(id,texture->get_size()/2);
+ Size2 s;
+ if (mi->is_region()) {
+ s=mi->get_region_rect().size;
+ } else {
+ s=texture->get_size();
+ }
+ phys_offset+=-s/2;
}
if (mi->is_region()) {
p_library->tile_set_region(id,mi->get_region_rect());
@@ -90,15 +98,21 @@ void TileSetEditor::_import_scene(Node *scene, Ref<TileSet> p_library, bool p_me
if (sb->get_shape_count()==0)
continue;
Ref<Shape2D> collision=sb->get_shape(0);
- if (collision.is_valid())
+ if (collision.is_valid()) {
collisions.push_back(collision);
+ }
}
if (collisions.size()) {
p_library->tile_set_shapes(id,collisions);
+ p_library->tile_set_shape_offset(id,-phys_offset);
+ } else {
+ p_library->tile_set_shape_offset(id,Vector2());
+
}
+ p_library->tile_set_texture_offset(id,Vector2());
}
}