-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix unable to disconnect signal in Editor once created #69661
Fix unable to disconnect signal in Editor once created #69661
Conversation
740fb70
to
37a0a76
Compare
Seems like this PR makes it possible to disconnect foreign connections again... |
Alright, back to work. |
37a0a76
to
0b9ce00
Compare
ab132b4
to
ea93098
Compare
ea93098
to
f08cfaa
Compare
@@ -450,7 +450,11 @@ Node *SceneState::instantiate(GenEditState p_edit_state) const { | |||
callable = callable.bindp(argptrs, binds.size()); | |||
} | |||
|
|||
#ifdef TOOLS_ENABLED | |||
cfrom->connect(snames[c.signal], callable, CONNECT_PERSIST | c.flags | (p_edit_state == GEN_EDIT_STATE_MAIN ? 0 : CONNECT_INHERITED)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't this possibly be useful at runtime too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could be useful if someone uses custom scene serialization, but it's rather corner-case.
scene/resources/packed_scene.cpp
Outdated
@@ -450,7 +450,11 @@ Node *SceneState::instantiate(GenEditState p_edit_state) const { | |||
callable = callable.bindp(argptrs, binds.size()); | |||
} | |||
|
|||
#ifdef TOOLS_ENABLED |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would remove this ifdef too, probably not worth it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just to clarify, PERSIST is also editor only, so no point of having one with ifdef and the other without.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know... CONNECT_PERSIST can technically also be used in release builds when building PackedScenes at run-time
Adds a CONNECT_INHERITED flag to connections, only available in editor builds. This flag denotes that the signal has been inherited from a previous Scene in the instancing hierarchy.
f08cfaa
to
885f2a4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There might be a case for actually exposing the new enum value to be consistent, since users may want to use it in editor plugins?
Otherwise seems good to me.
Thanks! |
Seems like discarding instancing (using the Make Local option) doesn't remove the flag and the connections cannot be disconnected at all. EDIT: |
Fixes #69348.
#66665 implementation was a bit too stupid and didn't account all cases. Most importantly, signals that had yet to be saved.
To solve this in the least chaotic, slow and intrusive way, I basically gave up. This PR adds a CONNECT_INHERITED flag to connections, only available in editor builds. This flag denotes that the signal has been inherited from a previous Scene in the instancing hierarchy. Signals deemed to be inherited cannot be edited or deleted in the editor.