Skip to content

Commit 70e5733

Browse files
committed
Update MultiNodeEdit property list on edited nodes' property list changed
1 parent f2cc3f1 commit 70e5733

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

editor/multi_node_edit.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,29 @@ bool MultiNodeEdit::_property_get_revert(const StringName &p_name, Variant &r_pr
219219
return false;
220220
}
221221

222+
void MultiNodeEdit::_queue_notify_property_list_changed() {
223+
if (notify_property_list_changed_pending) {
224+
return;
225+
}
226+
notify_property_list_changed_pending = true;
227+
callable_mp(this, &MultiNodeEdit::_notify_property_list_changed).call_deferred();
228+
}
229+
230+
void MultiNodeEdit::_notify_property_list_changed() {
231+
notify_property_list_changed_pending = false;
232+
notify_property_list_changed();
233+
}
234+
222235
void MultiNodeEdit::add_node(const NodePath &p_node) {
223236
nodes.push_back(p_node);
237+
238+
Node *es = EditorNode::get_singleton()->get_edited_scene();
239+
if (es) {
240+
Node *node = es->get_node_or_null(p_node);
241+
if (node) {
242+
node->connect(CoreStringName(property_list_changed), callable_mp(this, &MultiNodeEdit::_queue_notify_property_list_changed));
243+
}
244+
}
224245
}
225246

226247
int MultiNodeEdit::get_node_count() const {

editor/multi_node_edit.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,15 @@ class MultiNodeEdit : public RefCounted {
3737
GDCLASS(MultiNodeEdit, RefCounted);
3838

3939
LocalVector<NodePath> nodes;
40+
bool notify_property_list_changed_pending = false;
4041
struct PLData {
4142
int uses = 0;
4243
PropertyInfo info;
4344
};
4445

4546
bool _set_impl(const StringName &p_name, const Variant &p_value, const String &p_field);
47+
void _queue_notify_property_list_changed();
48+
void _notify_property_list_changed();
4649

4750
protected:
4851
static void _bind_methods();

0 commit comments

Comments
 (0)