Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added compatibility for Blend Mode in Light2D/PointLight2D when converting from Godot 3 to 4. #86811

Merged
merged 1 commit into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions scene/2d/light_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
TheSofox marked this conversation as resolved.
Show resolved Hide resolved
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);
Expand Down
3 changes: 3 additions & 0 deletions scene/2d/light_2d.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ class PointLight2D : public Light2D {
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:
Expand Down
Loading