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/noise/fastnoise_lite.cpp | 18 +++++++++--------- modules/noise/fastnoise_lite.h | 2 +- modules/noise/noise_texture.cpp | 10 +++++----- modules/noise/noise_texture.h | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) (limited to 'modules/noise') diff --git a/modules/noise/fastnoise_lite.cpp b/modules/noise/fastnoise_lite.cpp index b21e3247d7..06d97838f6 100644 --- a/modules/noise/fastnoise_lite.cpp +++ b/modules/noise/fastnoise_lite.cpp @@ -476,24 +476,24 @@ void FastNoiseLite::_bind_methods() { BIND_ENUM_CONSTANT(DOMAIN_WARP_FRACTAL_INDEPENDENT); } -void FastNoiseLite::_validate_property(PropertyInfo &property) const { - if (property.name.begins_with("cellular") && get_noise_type() != TYPE_CELLULAR) { - property.usage = PROPERTY_USAGE_NO_EDITOR; +void FastNoiseLite::_validate_property(PropertyInfo &p_property) const { + if (p_property.name.begins_with("cellular") && get_noise_type() != TYPE_CELLULAR) { + p_property.usage = PROPERTY_USAGE_NO_EDITOR; return; } - if (property.name != "fractal_type" && property.name.begins_with("fractal") && get_fractal_type() == FRACTAL_NONE) { - property.usage = PROPERTY_USAGE_NO_EDITOR; + if (p_property.name != "fractal_type" && p_property.name.begins_with("fractal") && get_fractal_type() == FRACTAL_NONE) { + p_property.usage = PROPERTY_USAGE_NO_EDITOR; return; } - if (property.name == "fractal_ping_pong_strength" && get_fractal_type() != FRACTAL_PING_PONG) { - property.usage = PROPERTY_USAGE_NO_EDITOR; + if (p_property.name == "fractal_ping_pong_strength" && get_fractal_type() != FRACTAL_PING_PONG) { + p_property.usage = PROPERTY_USAGE_NO_EDITOR; return; } - if (property.name != "domain_warp_enabled" && property.name.begins_with("domain_warp") && !domain_warp_enabled) { - property.usage = PROPERTY_USAGE_NO_EDITOR; + if (p_property.name != "domain_warp_enabled" && p_property.name.begins_with("domain_warp") && !domain_warp_enabled) { + p_property.usage = PROPERTY_USAGE_NO_EDITOR; return; } } diff --git a/modules/noise/fastnoise_lite.h b/modules/noise/fastnoise_lite.h index fe8cd7ce6e..50c633b923 100644 --- a/modules/noise/fastnoise_lite.h +++ b/modules/noise/fastnoise_lite.h @@ -92,7 +92,7 @@ public: protected: static void _bind_methods(); - virtual void _validate_property(PropertyInfo &property) const override; + void _validate_property(PropertyInfo &p_property) const; private: _FastNoiseLite _noise; diff --git a/modules/noise/noise_texture.cpp b/modules/noise/noise_texture.cpp index 257a3ee8e6..923b420581 100644 --- a/modules/noise/noise_texture.cpp +++ b/modules/noise/noise_texture.cpp @@ -94,16 +94,16 @@ void NoiseTexture::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "noise", PROPERTY_HINT_RESOURCE_TYPE, "Noise"), "set_noise", "get_noise"); } -void NoiseTexture::_validate_property(PropertyInfo &property) const { - if (property.name == "bump_strength") { +void NoiseTexture::_validate_property(PropertyInfo &p_property) const { + if (p_property.name == "bump_strength") { if (!as_normal_map) { - property.usage = PROPERTY_USAGE_NO_EDITOR; + p_property.usage = PROPERTY_USAGE_NO_EDITOR; } } - if (property.name == "seamless_blend_skirt") { + if (p_property.name == "seamless_blend_skirt") { if (!seamless) { - property.usage = PROPERTY_USAGE_NO_EDITOR; + p_property.usage = PROPERTY_USAGE_NO_EDITOR; } } } diff --git a/modules/noise/noise_texture.h b/modules/noise/noise_texture.h index 6c088562a1..83fbcc2d10 100644 --- a/modules/noise/noise_texture.h +++ b/modules/noise/noise_texture.h @@ -75,7 +75,7 @@ private: protected: static void _bind_methods(); - virtual void _validate_property(PropertyInfo &property) const override; + void _validate_property(PropertyInfo &p_property) const; public: void set_noise(Ref p_noise); -- cgit v1.2.3