diff options
author | Yuri Sizov <11782833+YuriSizov@users.noreply.github.com> | 2023-03-27 20:14:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-27 20:14:47 +0200 |
commit | 19501f8eb19481b029f67ecf78e711d42f2fc431 (patch) | |
tree | 933ea3320b35bce6ba65ab1e1d1aa8ad662c90d4 /scene/2d | |
parent | cacf49999e3fb37281d66cc591ca8bebc5712d4d (diff) | |
parent | 843f5adbc523ad2511322b4f09b5ce5a3fb9e225 (diff) |
Merge pull request #75397 from YuriSizov/4.0-cherrypicks
Cherry-picks for the 4.0 branch (future 4.0.2) - 1st batch
Diffstat (limited to 'scene/2d')
-rw-r--r-- | scene/2d/animated_sprite_2d.cpp | 4 | ||||
-rw-r--r-- | scene/2d/shape_cast_2d.cpp | 13 | ||||
-rw-r--r-- | scene/2d/shape_cast_2d.h | 2 |
3 files changed, 13 insertions, 6 deletions
diff --git a/scene/2d/animated_sprite_2d.cpp b/scene/2d/animated_sprite_2d.cpp index 8f7006caca..7de6219b10 100644 --- a/scene/2d/animated_sprite_2d.cpp +++ b/scene/2d/animated_sprite_2d.cpp @@ -301,13 +301,13 @@ void AnimatedSprite2D::set_sprite_frames(const Ref<SpriteFrames> &p_frames) { frames->get_animation_list(&al); if (al.size() == 0) { set_animation(StringName()); - set_autoplay(String()); + autoplay = String(); } else { if (!frames->has_animation(animation)) { set_animation(al[0]); } if (!frames->has_animation(autoplay)) { - set_autoplay(String()); + autoplay = String(); } } } diff --git a/scene/2d/shape_cast_2d.cpp b/scene/2d/shape_cast_2d.cpp index bafb83361a..5b743e0b31 100644 --- a/scene/2d/shape_cast_2d.cpp +++ b/scene/2d/shape_cast_2d.cpp @@ -151,11 +151,18 @@ bool ShapeCast2D::is_enabled() const { } void ShapeCast2D::set_shape(const Ref<Shape2D> &p_shape) { + if (p_shape == shape) { + return; + } + if (shape.is_valid()) { + shape->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(this, &ShapeCast2D::_shape_changed)); + } shape = p_shape; - if (p_shape.is_valid()) { - shape->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &ShapeCast2D::_redraw_shape)); + if (shape.is_valid()) { + shape->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &ShapeCast2D::_shape_changed)); shape_rid = shape->get_rid(); } + update_configuration_warnings(); queue_redraw(); } @@ -186,7 +193,7 @@ bool ShapeCast2D::get_exclude_parent_body() const { return exclude_parent_body; } -void ShapeCast2D::_redraw_shape() { +void ShapeCast2D::_shape_changed() { queue_redraw(); } diff --git a/scene/2d/shape_cast_2d.h b/scene/2d/shape_cast_2d.h index 8a62b799f8..a577c351fd 100644 --- a/scene/2d/shape_cast_2d.h +++ b/scene/2d/shape_cast_2d.h @@ -61,7 +61,7 @@ class ShapeCast2D : public Node2D { real_t collision_unsafe_fraction = 1.0; Array _get_collision_result() const; - void _redraw_shape(); + void _shape_changed(); protected: void _notification(int p_what); |