Avoid duplicating signals from scene instances into packed scenes
This commit is contained in:
@ -1034,6 +1034,7 @@ Error SceneState::_parse_node(Node *p_owner, Node *p_node, int p_parent_idx, Has
|
||||
}
|
||||
|
||||
Error SceneState::_parse_connections(Node *p_owner, Node *p_node, HashMap<StringName, int> &name_map, HashMap<Variant, int, VariantHasher, VariantComparator> &variant_map, HashMap<Node *, int> &node_map, HashMap<Node *, int> &nodepath_map) {
|
||||
// Ignore nodes that are within a scene instance.
|
||||
if (p_node != p_owner && p_node->get_owner() && p_node->get_owner() != p_owner && !p_owner->is_editable_instance(p_node->get_owner())) {
|
||||
return OK;
|
||||
}
|
||||
@ -1054,7 +1055,14 @@ Error SceneState::_parse_connections(Node *p_owner, Node *p_node, HashMap<String
|
||||
for (const Node::Connection &F : conns) {
|
||||
const Node::Connection &c = F;
|
||||
|
||||
if (!(c.flags & CONNECT_PERSIST)) { //only persistent connections get saved
|
||||
// Don't save connections that are not persistent.
|
||||
if (!(c.flags & CONNECT_PERSIST)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Don't include signals that are from scene instances
|
||||
// (they are already saved in the scenes themselves).
|
||||
if (c.flags & CONNECT_INHERITED) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1220,9 +1228,10 @@ Error SceneState::_parse_connections(Node *p_owner, Node *p_node, HashMap<String
|
||||
}
|
||||
}
|
||||
|
||||
// Recursively parse child connections.
|
||||
for (int i = 0; i < p_node->get_child_count(); i++) {
|
||||
Node *c = p_node->get_child(i);
|
||||
Error err = _parse_connections(p_owner, c, name_map, variant_map, node_map, nodepath_map);
|
||||
Node *child = p_node->get_child(i);
|
||||
Error err = _parse_connections(p_owner, child, name_map, variant_map, node_map, nodepath_map);
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user