From 1a24c9e14bf1f9578eda338344c12faf66fb0e65 Mon Sep 17 00:00:00 2001 From: Yuri Sizov Date: Fri, 12 Aug 2022 23:57:11 +0300 Subject: Make `_validate_property` a multilevel method --- modules/csg/csg_shape.cpp | 27 ++++++++++++--------------- modules/csg/csg_shape.h | 4 ++-- 2 files changed, 14 insertions(+), 17 deletions(-) (limited to 'modules/csg') diff --git a/modules/csg/csg_shape.cpp b/modules/csg/csg_shape.cpp index 7fc6608770..457d1288f1 100644 --- a/modules/csg/csg_shape.cpp +++ b/modules/csg/csg_shape.cpp @@ -584,15 +584,14 @@ bool CSGShape3D::is_calculating_tangents() const { return calculate_tangents; } -void CSGShape3D::_validate_property(PropertyInfo &property) const { - bool is_collision_prefixed = property.name.begins_with("collision_"); - if ((is_collision_prefixed || property.name.begins_with("use_collision")) && is_inside_tree() && !is_root_shape()) { +void CSGShape3D::_validate_property(PropertyInfo &p_property) const { + bool is_collision_prefixed = p_property.name.begins_with("collision_"); + if ((is_collision_prefixed || p_property.name.begins_with("use_collision")) && is_inside_tree() && !is_root_shape()) { //hide collision if not root - property.usage = PROPERTY_USAGE_NO_EDITOR; + p_property.usage = PROPERTY_USAGE_NO_EDITOR; } else if (is_collision_prefixed && !bool(get("use_collision"))) { - property.usage = PROPERTY_USAGE_NO_EDITOR; + p_property.usage = PROPERTY_USAGE_NO_EDITOR; } - GeometryInstance3D::_validate_property(property); } Array CSGShape3D::get_meshes() const { @@ -2058,18 +2057,16 @@ void CSGPolygon3D::_notification(int p_what) { } } -void CSGPolygon3D::_validate_property(PropertyInfo &property) const { - if (property.name.begins_with("spin") && mode != MODE_SPIN) { - property.usage = PROPERTY_USAGE_NONE; +void CSGPolygon3D::_validate_property(PropertyInfo &p_property) const { + if (p_property.name.begins_with("spin") && mode != MODE_SPIN) { + p_property.usage = PROPERTY_USAGE_NONE; } - if (property.name.begins_with("path") && mode != MODE_PATH) { - property.usage = PROPERTY_USAGE_NONE; + if (p_property.name.begins_with("path") && mode != MODE_PATH) { + p_property.usage = PROPERTY_USAGE_NONE; } - if (property.name == "depth" && mode != MODE_DEPTH) { - property.usage = PROPERTY_USAGE_NONE; + if (p_property.name == "depth" && mode != MODE_DEPTH) { + p_property.usage = PROPERTY_USAGE_NONE; } - - CSGShape3D::_validate_property(property); } void CSGPolygon3D::_path_changed() { diff --git a/modules/csg/csg_shape.h b/modules/csg/csg_shape.h index 0b49dc4609..308d2afdc5 100644 --- a/modules/csg/csg_shape.h +++ b/modules/csg/csg_shape.h @@ -117,7 +117,7 @@ protected: friend class CSGCombiner3D; CSGBrush *_get_brush(); - virtual void _validate_property(PropertyInfo &property) const override; + void _validate_property(PropertyInfo &p_property) const; public: Array get_meshes() const; @@ -383,7 +383,7 @@ private: protected: static void _bind_methods(); - virtual void _validate_property(PropertyInfo &property) const override; + void _validate_property(PropertyInfo &p_property) const; void _notification(int p_what); public: -- cgit v1.2.3