diff options
author | Gilles Roudière <gilles.roudiere@gmail.com> | 2021-10-07 15:29:48 +0200 |
---|---|---|
committer | Gilles Roudière <gilles.roudiere@gmail.com> | 2021-10-07 15:29:48 +0200 |
commit | 9c1b1e9a7e8c01a826af0543be7b177e68f49e14 (patch) | |
tree | fb886d4a011ec68e3240878d2e6a55a12e24714e /scene/resources | |
parent | 0e9d5a41d25383089b74c4dece1f93b2aace588e (diff) |
Set TileSet layout and half-offset as read-only when using square shape
Diffstat (limited to 'scene/resources')
-rw-r--r-- | scene/resources/tile_set.cpp | 9 | ||||
-rw-r--r-- | scene/resources/tile_set.h | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp index 40eedb63c1..e19ca38b82 100644 --- a/scene/resources/tile_set.cpp +++ b/scene/resources/tile_set.cpp @@ -72,6 +72,7 @@ void TileSet::set_tile_shape(TileSet::TileShape p_shape) { terrain_bits_meshes_dirty = true; tile_meshes_dirty = true; + notify_property_list_changed(); emit_changed(); } TileSet::TileShape TileSet::get_tile_shape() const { @@ -2685,6 +2686,14 @@ void TileSet::_get_property_list(List<PropertyInfo> *p_list) const { p_list->push_back(PropertyInfo(Variant::ARRAY, "tile_proxies/alternative_level", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); } +void TileSet::_validate_property(PropertyInfo &property) const { + if (property.name == "tile_layout" && tile_shape == TILE_SHAPE_SQUARE) { + property.usage ^= PROPERTY_USAGE_READ_ONLY; + } else if (property.name == "tile_offset_axis" && tile_shape == TILE_SHAPE_SQUARE) { + property.usage ^= PROPERTY_USAGE_READ_ONLY; + } +} + void TileSet::_bind_methods() { // Sources management. ClassDB::bind_method(D_METHOD("get_next_source_id"), &TileSet::get_next_source_id); diff --git a/scene/resources/tile_set.h b/scene/resources/tile_set.h index 2b4929b3df..716b66405f 100644 --- a/scene/resources/tile_set.h +++ b/scene/resources/tile_set.h @@ -180,6 +180,7 @@ protected: bool _set(const StringName &p_name, const Variant &p_value); bool _get(const StringName &p_name, Variant &r_ret) const; void _get_property_list(List<PropertyInfo> *p_list) const; + virtual void _validate_property(PropertyInfo &property) const override; private: // --- TileSet data --- |