Skip to content

Commit e99dc63

Browse files
committed
Merge pull request godotengine#103764 from kleonc/multi_node_edit_update_on_property_list_changed
Update `MultiNodeEdit` property list on edited nodes' property list changed
2 parents 64f80ca + 70e5733 commit e99dc63

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
@@ -36,12 +36,15 @@ class MultiNodeEdit : public RefCounted {
3636
GDCLASS(MultiNodeEdit, RefCounted);
3737

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

4445
bool _set_impl(const StringName &p_name, const Variant &p_value, const String &p_field);
46+
void _queue_notify_property_list_changed();
47+
void _notify_property_list_changed();
4548

4649
protected:
4750
static void _bind_methods();

0 commit comments

Comments
 (0)