summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorMicky <micheledevita2@gmail.com>2022-09-30 12:28:39 +0200
committerMicky <micheledevita2@gmail.com>2022-10-13 20:13:05 +0200
commit6a77563b25bd8d71b4b091ba048905e190ee3955 (patch)
treee009afde1a33d41d0562605e354b5ffde1721cb3 /scene
parent166df0896c4e601c58f7261145afba5ee4a088a5 (diff)
Do not allow editing Scene-inherited signal connections
Inherited connections are also highlighted with the warning color in the Node dock.
Diffstat (limited to 'scene')
-rw-r--r--scene/resources/packed_scene.cpp6
-rw-r--r--scene/resources/packed_scene.h2
2 files changed, 6 insertions, 2 deletions
diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp
index e0bedad595..85a207b34e 100644
--- a/scene/resources/packed_scene.cpp
+++ b/scene/resources/packed_scene.cpp
@@ -1546,7 +1546,7 @@ Array SceneState::get_connection_binds(int p_idx) const {
return binds;
}
-bool SceneState::has_connection(const NodePath &p_node_from, const StringName &p_signal, const NodePath &p_node_to, const StringName &p_method) {
+bool SceneState::has_connection(const NodePath &p_node_from, const StringName &p_signal, const NodePath &p_node_to, const StringName &p_method, bool p_no_inheritance) {
// this method cannot be const because of this
Ref<SceneState> ss = this;
@@ -1578,6 +1578,10 @@ bool SceneState::has_connection(const NodePath &p_node_from, const StringName &p
}
}
+ if (p_no_inheritance) {
+ break;
+ }
+
ss = ss->get_base_scene_state();
} while (ss.is_valid());
diff --git a/scene/resources/packed_scene.h b/scene/resources/packed_scene.h
index 8e1a1d29b6..c6f82ddd5e 100644
--- a/scene/resources/packed_scene.h
+++ b/scene/resources/packed_scene.h
@@ -176,7 +176,7 @@ public:
int get_connection_unbinds(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);
+ bool has_connection(const NodePath &p_node_from, const StringName &p_signal, const NodePath &p_node_to, const StringName &p_method, bool p_no_inheritance = false);
Vector<NodePath> get_editable_instances() const;