MCPcopy Create free account
hub / github.com/GDRETools/gdsdecomp / evaluate_node_differences

Method evaluate_node_differences

utility/diff_result.cpp:398–440  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

396}
397
398Ref<NodeDiffResult> NodeDiffResult::evaluate_node_differences(Node *scene1, Node *scene2, const NodePath &path, const Dictionary &p_structured_changes) {
399 Ref<NodeDiffResult> result;
400 result.instantiate();
401 bool is_root = path == NodePath(".") || path.is_empty();
402 Node *node1 = scene1;
403 Node *node2 = scene2;
404 if (!is_root) {
405 if (node1->has_node(path)) {
406 node1 = node1->get_node(path);
407 } else {
408 node1 = nullptr;
409 }
410 if (node2->has_node(path)) {
411 node2 = node2->get_node(path);
412 } else {
413 node2 = nullptr;
414 }
415 result->set_path(path);
416 } else {
417 result->set_path({ "." });
418 }
419 result->set_old_object(node1);
420 result->set_new_object(node2);
421 if (node1 == nullptr) {
422 result->set_type("node_added");
423 return result;
424 }
425 if (node2 == nullptr) {
426 result->set_type("node_deleted");
427 return result;
428 }
429
430 // Pass options to get_diff_obj
431 bool exclude_non_storage = p_structured_changes.has("exclude_non_storage") ? (bool)p_structured_changes["exclude_non_storage"] : true;
432 auto diff = ObjectDiffResult::get_diff_obj(node1, node2, exclude_non_storage);
433
434 if (diff->get_property_diffs().size() > 0) {
435 result->set_type("node_changed");
436 result->set_props(diff);
437 return result;
438 }
439 return Ref<NodeDiffResult>();
440}
441
442void PropertyDiffResult::_bind_methods() {
443 ClassDB::bind_method(D_METHOD("set_name", "name"), &PropertyDiffResult::set_name);

Callers

nothing calls this directly

Calls 7

set_pathMethod · 0.80
set_old_objectMethod · 0.80
set_new_objectMethod · 0.80
get_property_diffsMethod · 0.80
set_propsMethod · 0.80
set_typeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected