diff options
author | Michael Alexsander <michaelalexsander@protonmail.com> | 2020-02-13 23:34:59 -0300 |
---|---|---|
committer | Michael Alexsander <michaelalexsander@protonmail.com> | 2021-03-02 09:25:09 -0300 |
commit | 70304f8633c8cf8faa530dadf648ecfcabf80655 (patch) | |
tree | 1e306ddea59b2b81d9db3637b7fb3efa999e5d6f /scene/main | |
parent | 8fbe644b6e6548dc2c9f9d675bc17f13b74e747b (diff) |
Hide extra options from various nodes if they're not enabled
Diffstat (limited to 'scene/main')
-rw-r--r-- | scene/main/canvas_layer.cpp | 9 | ||||
-rw-r--r-- | scene/main/canvas_layer.h | 4 |
2 files changed, 13 insertions, 0 deletions
diff --git a/scene/main/canvas_layer.cpp b/scene/main/canvas_layer.cpp index 91daa08ff8..d9b29daf26 100644 --- a/scene/main/canvas_layer.cpp +++ b/scene/main/canvas_layer.cpp @@ -231,6 +231,7 @@ void CanvasLayer::set_follow_viewport(bool p_enable) { follow_viewport = p_enable; _update_follow_viewport(); + notify_property_list_changed(); } bool CanvasLayer::is_following_viewport() const { @@ -257,6 +258,14 @@ void CanvasLayer::_update_follow_viewport(bool p_force_exit) { } } +#ifdef TOOLS_ENABLED +void CanvasLayer::_validate_property(PropertyInfo &property) const { + if (!follow_viewport && property.name == "follow_viewport_scale") { + property.usage = PROPERTY_USAGE_NOEDITOR; + } +} +#endif + void CanvasLayer::_bind_methods() { ClassDB::bind_method(D_METHOD("set_layer", "layer"), &CanvasLayer::set_layer); ClassDB::bind_method(D_METHOD("get_layer"), &CanvasLayer::get_layer); diff --git a/scene/main/canvas_layer.h b/scene/main/canvas_layer.h index 181d1dd659..b20b291367 100644 --- a/scene/main/canvas_layer.h +++ b/scene/main/canvas_layer.h @@ -61,6 +61,10 @@ class CanvasLayer : public Node { void _update_locrotscale(); void _update_follow_viewport(bool p_force_exit = false); +#ifdef TOOLS_ENABLED + void _validate_property(PropertyInfo &property) const override; +#endif + protected: void _notification(int p_what); static void _bind_methods(); |