Unify and streamline connecting to Resource changes

This commit is contained in:
kobewi
2023-07-03 21:29:37 +02:00
parent 2c55214068
commit de4a3fa151
98 changed files with 341 additions and 434 deletions

View File

@@ -31,7 +31,6 @@
#include "shape_cast_2d.h"
#include "core/config/engine.h"
#include "core/core_string_names.h"
#include "scene/2d/collision_object_2d.h"
#include "scene/2d/physics_body_2d.h"
#include "scene/resources/circle_shape_2d.h"
@@ -155,11 +154,11 @@ void ShapeCast2D::set_shape(const Ref<Shape2D> &p_shape) {
return;
}
if (shape.is_valid()) {
shape->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(this, &ShapeCast2D::_shape_changed));
shape->disconnect_changed(callable_mp(this, &ShapeCast2D::_shape_changed));
}
shape = p_shape;
if (shape.is_valid()) {
shape->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &ShapeCast2D::_shape_changed));
shape->connect_changed(callable_mp(this, &ShapeCast2D::_shape_changed));
shape_rid = shape->get_rid();
}