diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-03-02 14:15:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-02 14:15:25 +0100 |
commit | 5895cd4c4fe8cf04a7109d52388be46f619b56f1 (patch) | |
tree | f9531cd1b9dd5afab64537a1e5e43d00dce14e56 /scene/2d | |
parent | 3fc5ae02aa6f50b153a1b5222046915054b88284 (diff) | |
parent | 70304f8633c8cf8faa530dadf648ecfcabf80655 (diff) |
Merge pull request #36202 from YeldhamDev/sprite_region_hide
Hide extra options from various nodes if they're not enabled
Diffstat (limited to 'scene/2d')
-rw-r--r-- | scene/2d/polygon_2d.cpp | 7 | ||||
-rw-r--r-- | scene/2d/polygon_2d.h | 4 | ||||
-rw-r--r-- | scene/2d/sprite_2d.cpp | 5 |
3 files changed, 16 insertions, 0 deletions
diff --git a/scene/2d/polygon_2d.cpp b/scene/2d/polygon_2d.cpp index ecc05fb931..a60a32f1d2 100644 --- a/scene/2d/polygon_2d.cpp +++ b/scene/2d/polygon_2d.cpp @@ -88,6 +88,12 @@ bool Polygon2D::_edit_is_selected_on_click(const Point2 &p_point, double p_toler } return Geometry2D::is_point_in_polygon(p_point - get_offset(), polygon2d); } + +void Polygon2D::_validate_property(PropertyInfo &property) const { + if (!invert && property.name == "invert_border") { + property.usage = PROPERTY_USAGE_NOEDITOR; + } +} #endif void Polygon2D::_skeleton_bone_setup_changed() { @@ -455,6 +461,7 @@ Size2 Polygon2D::get_texture_scale() const { void Polygon2D::set_invert(bool p_invert) { invert = p_invert; update(); + notify_property_list_changed(); } bool Polygon2D::get_invert() const { diff --git a/scene/2d/polygon_2d.h b/scene/2d/polygon_2d.h index ab01a4ffd0..43a66aad13 100644 --- a/scene/2d/polygon_2d.h +++ b/scene/2d/polygon_2d.h @@ -72,6 +72,10 @@ class Polygon2D : public Node2D { void _skeleton_bone_setup_changed(); +#ifdef TOOLS_ENABLED + void _validate_property(PropertyInfo &property) const override; +#endif + protected: void _notification(int p_what); static void _bind_methods(); diff --git a/scene/2d/sprite_2d.cpp b/scene/2d/sprite_2d.cpp index dde9790b44..31040020dd 100644 --- a/scene/2d/sprite_2d.cpp +++ b/scene/2d/sprite_2d.cpp @@ -206,6 +206,7 @@ void Sprite2D::set_region(bool p_region) { region = p_region; update(); + notify_property_list_changed(); } bool Sprite2D::is_region() const { @@ -383,6 +384,10 @@ void Sprite2D::_validate_property(PropertyInfo &property) const { if (property.name == "frame_coords") { property.usage |= PROPERTY_USAGE_KEYING_INCREMENTS; } + + if (!region && (property.name == "region_rect" || property.name == "region_filter_clip")) { + property.usage = PROPERTY_USAGE_NOEDITOR; + } } void Sprite2D::_texture_changed() { |