diff options
author | Ranoller <davarrcal@hotmail.com> | 2019-06-05 23:23:36 +0200 |
---|---|---|
committer | Ranoller <davarrcal@hotmail.com> | 2019-06-05 23:23:36 +0200 |
commit | f26e9daab53da723a8fb0306b72781c492a5c83c (patch) | |
tree | ae7166dc09711875062c7d246030e9e089e5d810 /editor/plugins/tile_map_editor_plugin.cpp | |
parent | 197b65f32ac811f79bc5599fbfe8cf83914b6873 (diff) | |
download | redot-engine-f26e9daab53da723a8fb0306b72781c492a5c83c.tar.gz |
Make tilemap texture origin point top-left.
Fix https://github.com/godotengine/godot/issues/29487. In this commit: https://github.com/godotengine/godot/pull/28896 bad offset of textures and shapes was fixed, but a center of texture was added too, and this seems not dessired by default because breaks too much compatibility with demos and user projects. A future Check box for center texture can be added
Diffstat (limited to 'editor/plugins/tile_map_editor_plugin.cpp')
-rw-r--r-- | editor/plugins/tile_map_editor_plugin.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp index 3f513de30f..5e1d818ce9 100644 --- a/editor/plugins/tile_map_editor_plugin.cpp +++ b/editor/plugins/tile_map_editor_plugin.cpp @@ -780,7 +780,8 @@ void TileMapEditor::_draw_cell(Control *p_viewport, int p_cell, const Point2i &p r.position += (r.size + Vector2(spacing, spacing)) * offset; } Size2 sc = p_xform.get_scale(); - Size2 cell_size = node->get_cell_size(); + /* For a future CheckBox to Center Texture: + Size2 cell_size = node->get_cell_size(); */ Rect2 rect = Rect2(); rect.position = node->map_to_world(p_point) + node->get_cell_draw_offset(); @@ -792,10 +793,11 @@ void TileMapEditor::_draw_cell(Control *p_viewport, int p_cell, const Point2i &p if (p_transpose) { SWAP(tile_ofs.x, tile_ofs.y); + /* For a future CheckBox to Center Texture: rect.position.x += cell_size.x / 2 - rect.size.y / 2; rect.position.y += cell_size.y / 2 - rect.size.x / 2; } else { - rect.position += cell_size / 2 - rect.size / 2; + rect.position += cell_size / 2 - rect.size / 2; */ } if (p_flip_h) { |