Merge pull request #70136 from bmolyneaux/multimesh
Queue redraw when MultiMesh instance transform changes
This commit is contained in:
commit
49a60b1d1c
@ -30,6 +30,7 @@
|
||||
|
||||
#include "multimesh_instance_2d.h"
|
||||
|
||||
#include "core/core_string_names.h"
|
||||
#include "scene/scene_string_names.h"
|
||||
|
||||
void MultiMeshInstance2D::_notification(int p_what) {
|
||||
@ -60,7 +61,16 @@ 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 = 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));
|
||||
}
|
||||
queue_redraw();
|
||||
}
|
||||
|
||||
|
@ -242,6 +242,7 @@ void MultiMesh::set_instance_transform(int p_instance, const Transform3D &p_tran
|
||||
|
||||
void MultiMesh::set_instance_transform_2d(int p_instance, const Transform2D &p_transform) {
|
||||
RenderingServer::get_singleton()->multimesh_instance_set_transform_2d(multimesh, p_instance, p_transform);
|
||||
emit_changed();
|
||||
}
|
||||
|
||||
Transform3D MultiMesh::get_instance_transform(int p_instance) const {
|
||||
|
Loading…
Reference in New Issue
Block a user