diff options
Diffstat (limited to 'scene/2d')
-rw-r--r-- | scene/2d/camera_2d.cpp | 7 | ||||
-rw-r--r-- | scene/2d/camera_2d.h | 2 | ||||
-rw-r--r-- | scene/2d/light_2d.cpp | 7 | ||||
-rw-r--r-- | scene/2d/light_2d.h | 1 | ||||
-rw-r--r-- | scene/2d/polygon_2d.cpp | 2 | ||||
-rw-r--r-- | scene/2d/polygon_2d.h | 5 |
6 files changed, 19 insertions, 5 deletions
diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp index c5ac4e1a05..9030cc4263 100644 --- a/scene/2d/camera_2d.cpp +++ b/scene/2d/camera_2d.cpp @@ -569,6 +569,7 @@ void Camera2D::_set_old_smoothing(float p_enable) { void Camera2D::set_enable_follow_smoothing(bool p_enabled) { smoothing_enabled = p_enabled; + notify_property_list_changed(); } bool Camera2D::is_follow_smoothing_enabled() const { @@ -642,6 +643,12 @@ bool Camera2D::is_margin_drawing_enabled() const { return margin_drawing_enabled; } +void Camera2D::_validate_property(PropertyInfo &property) const { + if (!smoothing_enabled && property.name == "smoothing_speed") { + property.usage = PROPERTY_USAGE_NOEDITOR; + } +} + void Camera2D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_offset", "offset"), &Camera2D::set_offset); ClassDB::bind_method(D_METHOD("get_offset"), &Camera2D::get_offset); diff --git a/scene/2d/camera_2d.h b/scene/2d/camera_2d.h index 252d2686fc..220e208eb0 100644 --- a/scene/2d/camera_2d.h +++ b/scene/2d/camera_2d.h @@ -97,8 +97,10 @@ protected: protected: virtual Transform2D get_camera_transform(); + void _notification(int p_what); static void _bind_methods(); + void _validate_property(PropertyInfo &property) const override; public: void set_offset(const Vector2 &p_offset); diff --git a/scene/2d/light_2d.cpp b/scene/2d/light_2d.cpp index 15fcb08422..58e15e3cca 100644 --- a/scene/2d/light_2d.cpp +++ b/scene/2d/light_2d.cpp @@ -159,6 +159,7 @@ int Light2D::get_item_shadow_cull_mask() const { void Light2D::set_shadow_enabled(bool p_enabled) { shadow = p_enabled; RS::get_singleton()->canvas_light_set_shadow_enabled(canvas_light, shadow); + notify_property_list_changed(); } bool Light2D::is_shadow_enabled() const { @@ -221,6 +222,12 @@ float Light2D::get_shadow_smooth() const { return shadow_smooth; } +void Light2D::_validate_property(PropertyInfo &property) const { + if (!shadow && (property.name == "shadow_color" || property.name == "shadow_filter" || property.name == "shadow_filter_smooth" || property.name == "shadow_item_cull_mask")) { + property.usage = PROPERTY_USAGE_NOEDITOR; + } +} + void Light2D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_enabled", "enabled"), &Light2D::set_enabled); ClassDB::bind_method(D_METHOD("is_enabled"), &Light2D::is_enabled); diff --git a/scene/2d/light_2d.h b/scene/2d/light_2d.h index 4279baf15b..de8a2bb6d0 100644 --- a/scene/2d/light_2d.h +++ b/scene/2d/light_2d.h @@ -77,6 +77,7 @@ protected: _FORCE_INLINE_ RID _get_light() const { return canvas_light; } void _notification(int p_what); static void _bind_methods(); + void _validate_property(PropertyInfo &property) const override; public: void set_enabled(bool p_enabled); diff --git a/scene/2d/polygon_2d.cpp b/scene/2d/polygon_2d.cpp index a60a32f1d2..2bb75e5967 100644 --- a/scene/2d/polygon_2d.cpp +++ b/scene/2d/polygon_2d.cpp @@ -88,13 +88,13 @@ 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); } +#endif 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() { update(); diff --git a/scene/2d/polygon_2d.h b/scene/2d/polygon_2d.h index 43a66aad13..b329251277 100644 --- a/scene/2d/polygon_2d.h +++ b/scene/2d/polygon_2d.h @@ -72,13 +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(); + void _validate_property(PropertyInfo &property) const override; public: #ifdef TOOLS_ENABLED |