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
+2 -3
View File
@@ -30,7 +30,6 @@
#include "multimesh_instance_2d.h"
#include "core/core_string_names.h"
#include "scene/scene_string_names.h"
void MultiMeshInstance2D::_notification(int p_what) {
@@ -59,13 +58,13 @@ void MultiMeshInstance2D::_bind_methods() {
void MultiMeshInstance2D::set_multimesh(const Ref<MultiMesh> &p_multimesh) {
// Cleanup previous connection if any.
if (multimesh.is_valid()) {
multimesh->disconnect(CoreStringNames::get_singleton()->changed, callable_mp((CanvasItem *)this, &CanvasItem::queue_redraw));
multimesh->disconnect_changed(callable_mp((CanvasItem *)this, &CanvasItem::queue_redraw));
}
multimesh = p_multimesh;
// Connect to the multimesh so the AABB can update when instance transforms are changed.
if (multimesh.is_valid()) {
multimesh->connect(CoreStringNames::get_singleton()->changed, callable_mp((CanvasItem *)this, &CanvasItem::queue_redraw));
multimesh->connect_changed(callable_mp((CanvasItem *)this, &CanvasItem::queue_redraw));
}
queue_redraw();
}