MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / get_preload_scene_modification_table

Method get_preload_scene_modification_table

editor/editor_node.cpp:4735–4836  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4733}
4734
4735void EditorNode::get_preload_scene_modification_table(
4736 Node *p_edited_scene,
4737 Node *p_reimported_root,
4738 Node *p_node, InstanceModificationsEntry &p_instance_modifications) {
4739 if (is_additional_node_in_scene(p_edited_scene, p_reimported_root, p_node)) {
4740 // Only save additional nodes which have an owner since this was causing issues transient ownerless nodes
4741 // which get recreated upon scene tree entry.
4742 // For now instead, assume all ownerless nodes are transient and will have to be recreated.
4743 if (p_node->get_owner()) {
4744 HashMap<StringName, Variant> modified_properties = get_modified_properties_for_node(p_node, true);
4745 if (p_node->get_owner() == p_edited_scene) {
4746 AdditiveNodeEntry new_additive_node_entry;
4747 new_additive_node_entry.node = p_node;
4748 new_additive_node_entry.parent = p_reimported_root->get_path_to(p_node->get_parent());
4749 new_additive_node_entry.owner = p_node->get_owner();
4750 new_additive_node_entry.index = p_node->get_index();
4751
4752 Node2D *node_2d = Object::cast_to<Node2D>(p_node);
4753 if (node_2d) {
4754 new_additive_node_entry.transform_2d = node_2d->get_transform();
4755 }
4756 Node3D *node_3d = Object::cast_to<Node3D>(p_node);
4757 if (node_3d) {
4758 new_additive_node_entry.transform_3d = node_3d->get_transform();
4759 }
4760
4761 p_instance_modifications.addition_list.push_back(new_additive_node_entry);
4762 }
4763 if (!modified_properties.is_empty()) {
4764 ModificationNodeEntry modification_node_entry;
4765 modification_node_entry.property_table = modified_properties;
4766
4767 p_instance_modifications.modifications[p_reimported_root->get_path_to(p_node)] = modification_node_entry;
4768 }
4769 }
4770 } else {
4771 HashMap<StringName, Variant> modified_properties = get_modified_properties_for_node(p_node, false);
4772
4773 // Find all valid connections to other nodes.
4774 List<Connection> connections_to;
4775 p_node->get_all_signal_connections(&connections_to);
4776
4777 List<ConnectionWithNodePath> valid_connections_to;
4778 for (const Connection &c : connections_to) {
4779 Node *connection_target_node = Object::cast_to<Node>(c.callable.get_object());
4780 if (connection_target_node) {
4781 /// @todo Add support for reinstating custom callables
4782 if (!c.callable.is_custom()) {
4783 ConnectionWithNodePath connection_to;
4784 connection_to.connection = c;
4785 connection_to.node_path = p_node->get_path_to(connection_target_node);
4786 valid_connections_to.push_back(connection_to);
4787 }
4788 }
4789 }
4790
4791 // Find all valid connections from other nodes.
4792 List<Connection> connections_from;

Callers

nothing calls this directly

Calls 14

get_path_toMethod · 0.80
is_customMethod · 0.80
get_groupsMethod · 0.80
get_ownerMethod · 0.45
get_parentMethod · 0.45
get_indexMethod · 0.45
get_transformMethod · 0.45
push_backMethod · 0.45
is_emptyMethod · 0.45
get_objectMethod · 0.45

Tested by

no test coverage detected