From 70e5733c44473d3abeb2473b25e6a93667c7040a Mon Sep 17 00:00:00 2001 From: kleonc <9283098+kleonc@users.noreply.github.com> Date: Fri, 7 Mar 2025 15:16:56 +0100 Subject: [PATCH] Update MultiNodeEdit property list on edited nodes' property list changed --- editor/multi_node_edit.cpp | 21 +++++++++++++++++++++ editor/multi_node_edit.h | 3 +++ 2 files changed, 24 insertions(+) diff --git a/editor/multi_node_edit.cpp b/editor/multi_node_edit.cpp index ef6a9c9a88..d9432eadea 100644 --- a/editor/multi_node_edit.cpp +++ b/editor/multi_node_edit.cpp @@ -219,8 +219,29 @@ bool MultiNodeEdit::_property_get_revert(const StringName &p_name, Variant &r_pr return false; } +void MultiNodeEdit::_queue_notify_property_list_changed() { + if (notify_property_list_changed_pending) { + return; + } + notify_property_list_changed_pending = true; + callable_mp(this, &MultiNodeEdit::_notify_property_list_changed).call_deferred(); +} + +void MultiNodeEdit::_notify_property_list_changed() { + notify_property_list_changed_pending = false; + notify_property_list_changed(); +} + void MultiNodeEdit::add_node(const NodePath &p_node) { nodes.push_back(p_node); + + Node *es = EditorNode::get_singleton()->get_edited_scene(); + if (es) { + Node *node = es->get_node_or_null(p_node); + if (node) { + node->connect(CoreStringName(property_list_changed), callable_mp(this, &MultiNodeEdit::_queue_notify_property_list_changed)); + } + } } int MultiNodeEdit::get_node_count() const { diff --git a/editor/multi_node_edit.h b/editor/multi_node_edit.h index 07bdaa84d1..989bfd0b4a 100644 --- a/editor/multi_node_edit.h +++ b/editor/multi_node_edit.h @@ -37,12 +37,15 @@ class MultiNodeEdit : public RefCounted { GDCLASS(MultiNodeEdit, RefCounted); LocalVector nodes; + bool notify_property_list_changed_pending = false; struct PLData { int uses = 0; PropertyInfo info; }; bool _set_impl(const StringName &p_name, const Variant &p_value, const String &p_field); + void _queue_notify_property_list_changed(); + void _notify_property_list_changed(); protected: static void _bind_methods();