Skip to content

Commit

Permalink
Revert "Avoid duplicating signals from scene instances into packed sc…
Browse files Browse the repository at this point in the history
…enes"

This partially reverts commit 8a42e3d.

Comment improvements and the test case were kept, with one part commented out.
  • Loading branch information
akien-mga authored and WhalesState committed Dec 15, 2024
1 parent 940cf67 commit f60dad4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion core/object/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ class Object {
CONNECT_PERSIST = 2, // hint for scene to save this connection
CONNECT_ONE_SHOT = 4,
CONNECT_REFERENCE_COUNTED = 8,
CONNECT_INHERITED = 16, // Whether or not the connection is in an instance of a scene.
CONNECT_INHERITED = 16, // Used in editor builds.
};

struct Connection {
Expand Down
6 changes: 0 additions & 6 deletions scene/resources/packed_scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1060,12 +1060,6 @@ Error SceneState::_parse_connections(Node *p_owner, Node *p_node, HashMap<String
continue;
}

// Don't include signals that are from scene instances
// (they are already saved in the scenes themselves).
if (c.flags & CONNECT_INHERITED) {
continue;
}

// only connections that originate or end into main saved scene are saved
// everything else is discarded

Expand Down
3 changes: 3 additions & 0 deletions tests/scene/test_packed_scene.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ TEST_CASE("[PackedScene] Signals Preserved when Packing Scene") {
CHECK_EQ(state->get_connection_count(), 3);
}

/*
// FIXME: This subcase requires GH-48064 to be fixed.
SUBCASE("Signals that should not be saved") {
int subscene_flags = Object::CONNECT_PERSIST | Object::CONNECT_INHERITED;
// subscene node to itself
Expand All @@ -115,6 +117,7 @@ TEST_CASE("[PackedScene] Signals Preserved when Packing Scene") {
Ref<SceneState> state = packed_scene->get_state();
CHECK_EQ(state->get_connection_count(), 0);
}
*/

memdelete(main_scene_root);
}
Expand Down

0 comments on commit f60dad4

Please sign in to comment.