1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-21 14:57:09 +00:00

Add indicator to linked Resources

This commit is contained in:
Sat
2025-11-04 14:12:42 -03:00
parent ba3b024765
commit 804188d320
8 changed files with 354 additions and 14 deletions

View File

@@ -69,6 +69,7 @@ bool MultiNodeEdit::_set_impl(const StringName &p_name, const Variant &p_value,
continue;
}
Variant new_value;
if (p_value.get_type() == Variant::NODE_PATH) {
NodePath path;
if (node_path_target) {
@@ -81,7 +82,6 @@ bool MultiNodeEdit::_set_impl(const StringName &p_name, const Variant &p_value,
n->set(name, path);
}
} else {
Variant new_value;
if (p_field.is_empty()) {
// whole value
new_value = p_value;
@@ -99,6 +99,16 @@ bool MultiNodeEdit::_set_impl(const StringName &p_name, const Variant &p_value,
if (p_undo_redo) {
ur->add_undo_property(n, name, n->get(name));
Variant old_value = n->get(p_name);
Variant::Type type = old_value.get_type();
if ((type == Variant::OBJECT || type == Variant::ARRAY || type == Variant::DICTIONARY) && old_value != new_value) {
ur->add_do_method(EditorNode::get_singleton(), "update_node_reference", old_value, n, true);
ur->add_do_method(EditorNode::get_singleton(), "update_node_reference", new_value, n, false);
// Perhaps an inefficient way of updating the resource count.
// We could go in depth and check which Resource values changed/got removed and which ones stayed the same, but this is more readable at the moment.
ur->add_undo_method(EditorNode::get_singleton(), "update_node_reference", new_value, n, true);
ur->add_undo_method(EditorNode::get_singleton(), "update_node_reference", old_value, n, false);
}
}
}