summaryrefslogtreecommitdiff
path: root/scene/resources
diff options
context:
space:
mode:
authorBojidar Marinov <bojidar.marinov.bg@gmail.com>2017-07-01 20:43:27 +0300
committerBojidar Marinov <bojidar.marinov.bg@gmail.com>2017-07-01 20:58:35 +0300
commit88ae942029016010f35c25546b8ccc4e230dcc97 (patch)
tree43c4fcb195d562fa423dcf9341a9b7798c4e8d9f /scene/resources
parent4d2642b666ad8bbb39a2c9e44cab221e8a4a7546 (diff)
Readd shape_offset as an editor-only and backcompat property
Diffstat (limited to 'scene/resources')
-rw-r--r--scene/resources/tile_set.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp
index d00d2d96c4..dc8f6a0a69 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<PropertyInfo> *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));