Fix redundant connections saved in sub-inheritance
This commit is contained in:
parent
6289997724
commit
148566b31b
2 changed files with 31 additions and 24 deletions
|
@ -1548,34 +1548,41 @@ Array SceneState::get_connection_binds(int p_idx) const {
|
||||||
return binds;
|
return binds;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SceneState::has_connection(const NodePath& p_node_from, const StringName& p_signal, const NodePath& p_node_to, const StringName& p_method) const {
|
bool SceneState::has_connection(const NodePath& p_node_from, const StringName& p_signal, const NodePath& p_node_to, const StringName& p_method) {
|
||||||
|
|
||||||
for(int i=0;i<connections.size();i++) {
|
// this method cannot be const because of this
|
||||||
const ConnectionData &c = connections[i];
|
Ref<SceneState> ss=this;
|
||||||
|
|
||||||
NodePath np_from;
|
do {
|
||||||
|
for(int i=0;i<ss->connections.size();i++) {
|
||||||
|
const ConnectionData &c = ss->connections[i];
|
||||||
|
|
||||||
if (c.from&FLAG_ID_IS_PATH) {
|
NodePath np_from;
|
||||||
np_from=node_paths[c.from&FLAG_MASK];
|
|
||||||
} else {
|
if (c.from&FLAG_ID_IS_PATH) {
|
||||||
np_from=get_node_path(c.from);
|
np_from=ss->node_paths[c.from&FLAG_MASK];
|
||||||
|
} else {
|
||||||
|
np_from=ss->get_node_path(c.from);
|
||||||
|
}
|
||||||
|
|
||||||
|
NodePath np_to;
|
||||||
|
|
||||||
|
if (c.to&FLAG_ID_IS_PATH) {
|
||||||
|
np_to=ss->node_paths[c.to&FLAG_MASK];
|
||||||
|
} else {
|
||||||
|
np_to=ss->get_node_path(c.to);
|
||||||
|
}
|
||||||
|
|
||||||
|
StringName sn_signal=ss->names[c.signal];
|
||||||
|
StringName sn_method=ss->names[c.method];
|
||||||
|
|
||||||
|
if (np_from==p_node_from && sn_signal==p_signal && np_to==p_node_to && sn_method==p_method) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NodePath np_to;
|
ss=ss->_get_base_scene_state();
|
||||||
|
} while (ss.is_valid());
|
||||||
if (c.to&FLAG_ID_IS_PATH) {
|
|
||||||
np_to=node_paths[c.to&FLAG_MASK];
|
|
||||||
} else {
|
|
||||||
np_to=get_node_path(c.to);
|
|
||||||
}
|
|
||||||
|
|
||||||
StringName sn_signal=names[c.signal];
|
|
||||||
StringName sn_method=names[c.method];
|
|
||||||
|
|
||||||
if (np_from==p_node_from && sn_signal==p_signal && np_to==p_node_to && sn_method==p_method) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,7 +165,7 @@ public:
|
||||||
int get_connection_flags(int p_idx) const;
|
int get_connection_flags(int p_idx) const;
|
||||||
Array get_connection_binds(int p_idx) const;
|
Array get_connection_binds(int p_idx) const;
|
||||||
|
|
||||||
bool has_connection(const NodePath &p_node_from, const StringName& p_signal, const NodePath &p_node_to, const StringName& p_method) const;
|
bool has_connection(const NodePath &p_node_from, const StringName& p_signal, const NodePath &p_node_to, const StringName& p_method);
|
||||||
|
|
||||||
Vector<NodePath> get_editable_instances() const;
|
Vector<NodePath> get_editable_instances() const;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue