diff options
author | Emmanuel Barroga <emmanuelbarroga@gmail.com> | 2019-08-03 00:41:36 -0700 |
---|---|---|
committer | Emmanuel Barroga <emmanuelbarroga@gmail.com> | 2019-08-04 12:05:23 -0700 |
commit | 625b87633efa2d67cfbc49f0060f27fedd2e0245 (patch) | |
tree | 7a705565b1c5383b217e1f4dd0ece2f985c93f2c /scene/resources | |
parent | 4d08f72b767fa8ea9c3118b48a205dc87417df2e (diff) |
Fix Wrong Shape Offsets in Tileset
Closes #30994
When modifying the properties of a tileset in the editor, some properties only apply to the first tile (such as the shape offset).
This change resolves that issue by traversing the changes to all of the shapes in the tileset instead of the first one.
Diffstat (limited to 'scene/resources')
-rw-r--r-- | scene/resources/tile_set.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp index bd5ce91e77..eed255fd6e 100644 --- a/scene/resources/tile_set.cpp +++ b/scene/resources/tile_set.cpp @@ -148,15 +148,20 @@ bool TileSet::_set(const StringName &p_name, const Variant &p_value) { } } } else if (what == "shape") - tile_set_shape(id, 0, p_value); + for (int i = 0; i < tile_get_shape_count(id); i++) + tile_set_shape(id, i, p_value); else if (what == "shape_offset") - tile_set_shape_offset(id, 0, p_value); + for (int i = 0; i < tile_get_shape_count(id); i++) + tile_set_shape_offset(id, i, p_value); else if (what == "shape_transform") - tile_set_shape_transform(id, 0, p_value); + for (int i = 0; i < tile_get_shape_count(id); i++) + tile_set_shape_transform(id, i, p_value); else if (what == "shape_one_way") - tile_set_shape_one_way(id, 0, p_value); + for (int i = 0; i < tile_get_shape_count(id); i++) + tile_set_shape_one_way(id, i, p_value); else if (what == "shape_one_way_margin") - tile_set_shape_one_way_margin(id, 0, p_value); + for (int i = 0; i < tile_get_shape_count(id); i++) + tile_set_shape_one_way_margin(id, i, p_value); else if (what == "shapes") _tile_set_shapes(id, p_value); else if (what == "occluder") |