diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-01-08 11:57:07 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-01-08 11:57:07 +0100 |
commit | c7fb7273c53757739259341152f8f3628b87b2c4 (patch) | |
tree | 2057bff2d8bb5df08e171ae352eb01d6fe64cf95 | |
parent | 4aa8e87e5023949c22fe84f35f6da80e7042b215 (diff) | |
parent | 58ae3c577c6baeaae559f71eaa402098250128d9 (diff) | |
download | redot-engine-c7fb7273c53757739259341152f8f3628b87b2c4.tar.gz |
Merge pull request #86811 from TheSofox/light2d-blend-3to4
Added compatibility for Blend Mode in `Light2D`/`PointLight2D` when converting from Godot 3 to 4.
-rw-r--r-- | scene/2d/light_2d.cpp | 11 | ||||
-rw-r--r-- | scene/2d/light_2d.h | 3 |
2 files changed, 14 insertions, 0 deletions
diff --git a/scene/2d/light_2d.cpp b/scene/2d/light_2d.cpp index 15b638ed92..c03786caef 100644 --- a/scene/2d/light_2d.cpp +++ b/scene/2d/light_2d.cpp @@ -425,6 +425,17 @@ real_t PointLight2D::get_texture_scale() const { return _scale; } +#ifndef DISABLE_DEPRECATED +bool PointLight2D::_set(const StringName &p_name, const Variant &p_value) { + if (p_name == "mode" && p_value.is_num()) { // Compatibility with Godot 3.x. + set_blend_mode((BlendMode)(int)p_value); + return true; + } + + return false; +} +#endif // DISABLE_DEPRECATED + void PointLight2D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_texture", "texture"), &PointLight2D::set_texture); ClassDB::bind_method(D_METHOD("get_texture"), &PointLight2D::get_texture); diff --git a/scene/2d/light_2d.h b/scene/2d/light_2d.h index 6a454a421e..3c1171deae 100644 --- a/scene/2d/light_2d.h +++ b/scene/2d/light_2d.h @@ -146,6 +146,9 @@ private: Vector2 texture_offset; protected: +#ifndef DISABLE_DEPRECATED + bool _set(const StringName &p_name, const Variant &p_value); +#endif // DISABLE_DEPRECATED static void _bind_methods(); public: |