From 88ae942029016010f35c25546b8ccc4e230dcc97 Mon Sep 17 00:00:00 2001 From: Bojidar Marinov Date: Sat, 1 Jul 2017 20:43:27 +0300 Subject: [PATCH] Readd shape_offset as an editor-only and backcompat property --- scene/resources/tile_set.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp index d00d2d96c43..dc8f6a0a691 100644 --- a/scene/resources/tile_set.cpp +++ b/scene/resources/tile_set.cpp @@ -57,7 +57,11 @@ bool TileSet::_set(const StringName &p_name, const Variant &p_value) { tile_set_region(id, p_value); else if (what == "shape") tile_set_shape(id, 0, p_value); - else if (what == "shape_transform") + else if (what == "shape_offset") { + Transform2D xform = tile_get_shape_transform(id, 0); + xform.set_origin(p_value); + tile_set_shape_transform(id, 0, xform); + } else if (what == "shape_transform") tile_set_shape_transform(id, 0, p_value); else if (what == "shape_one_way") tile_set_shape_one_way(id, 0, p_value); @@ -105,6 +109,8 @@ bool TileSet::_get(const StringName &p_name, Variant &r_ret) const { r_ret = tile_get_region(id); else if (what == "shape") r_ret = tile_get_shape(id, 0); + else if (what == "shape_offset") + r_ret = tile_get_shape_transform(id, 0).get_origin(); else if (what == "shape_transform") r_ret = tile_get_shape_transform(id, 0); else if (what == "shape_one_way") @@ -142,6 +148,7 @@ void TileSet::_get_property_list(List *p_list) const { p_list->push_back(PropertyInfo(Variant::OBJECT, pre + "occluder", PROPERTY_HINT_RESOURCE_TYPE, "OccluderPolygon2D")); p_list->push_back(PropertyInfo(Variant::VECTOR2, pre + "navigation_offset")); p_list->push_back(PropertyInfo(Variant::OBJECT, pre + "navigation", PROPERTY_HINT_RESOURCE_TYPE, "NavigationPolygon")); + p_list->push_back(PropertyInfo(Variant::VECTOR2, pre + "shape_offset", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR)); p_list->push_back(PropertyInfo(Variant::VECTOR2, pre + "shape_transform", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR)); p_list->push_back(PropertyInfo(Variant::OBJECT, pre + "shape", PROPERTY_HINT_RESOURCE_TYPE, "Shape2D", PROPERTY_USAGE_EDITOR)); p_list->push_back(PropertyInfo(Variant::BOOL, pre + "shape_one_way", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR));