Skip to content
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

Saving a scene unfolds all nodes in all open scene tabs in which it has been instanced #29975

Closed
ghost opened this issue Jun 22, 2019 · 8 comments · Fixed by #32074
Closed

Saving a scene unfolds all nodes in all open scene tabs in which it has been instanced #29975

ghost opened this issue Jun 22, 2019 · 8 comments · Fixed by #32074

Comments

@ghost
Copy link

ghost commented Jun 22, 2019

Godot version:
3.2-dev 2f63811

OS/device including version:
Windows 10 x64

Issue description:
Upon saving a scene, all open scene tabs that contain it as an instance somewhere in the tree (including within other instances) will have all of its nodes unfolded when switching to their tabs. The folding state isn't actually saved to disk, so you can restore it by closing and re-opening the affected scenes.

Steps to reproduce:

  1. Create two scenes named "SceneA" and "SceneB"
  2. Instance "SceneB" in "SceneA"
  3. Fold the root node of "SceneA"
  4. Switch to "SceneB" and save
  5. Switch back to "SceneA"; the root node will be unfolded
@ghost ghost changed the title Running scenes unfolds all nodes in all open scene tabs containing inherited scenes Running scenes unfolds all nodes in all open scene tabs containing instanced scenes Jun 22, 2019
@ghost ghost changed the title Running scenes unfolds all nodes in all open scene tabs containing instanced scenes Running a scene unfolds all nodes in all open scene tabs containing instanced scenes Jun 22, 2019
@Xrayez
Copy link
Contributor

Xrayez commented Jun 25, 2019

I encounter this issue quite a lot, it starts to be annoying especially with somewhat deep hierarchy of instanced scenes.

I can reproduce this a bit differently but the result is the same eventually, namely:

  1. Save scene and close it in order save folding state (should save it anyway, another bug?)
  2. Open it again, see folding state remained.
  3. Modify one of the instanced scenes separately (just resave it).
  4. Return back to original scene and see all nodes unfolded.

So the difference is that I don't have to run the scene at all.

@ghost
Copy link
Author

ghost commented Aug 27, 2019

At a glance it seems somewhat related to #3395

Also I updated the issue to reflect @Xrayez's feedback since that's the actual root of the problem.

@ghost ghost changed the title Running a scene unfolds all nodes in all open scene tabs containing instanced scenes Saving a scene unfolds all nodes in all open scene tabs in which it has been instanced Aug 27, 2019
@Xrayez
Copy link
Contributor

Xrayez commented Sep 6, 2019

Found some commits related for this issue (from recent to oldest):

The issue is high-priority usability-wise.

@KoBeWi
Copy link
Member

KoBeWi commented Sep 9, 2019

Sooo... this annoyed me a lot recently and I decided to look into fixing this.

Node class has a data.display_folded property, which determines whether it is folded. It is modified only inside set_display_folded().

Then there's is_displayed_folded() which returns that property. The lines that make nodes in tree (un)folded on scene load/switch are these:

bool collapsed = p_node->is_displayed_folded();
if (collapsed)
item->set_collapsed(true);

For whatever reason, following the reproduction steps, is_displayed_folded() in the line above will return false, even though set_display_folded() is never called before the folding breaks. I'm lost ;_;

Unless I missed something in the investigation, display_folded can only be set to false in a constructor in this case. But nodes aren't recreated on scene switch AFAIK.

@Xrayez
Copy link
Contributor

Xrayez commented Sep 9, 2019

The fact that saving scenes is not deterministic #30538/#23766 which could mess up node indexing #28309 in tscn files may result in broken folding state saved in config file per scene.

But it might be not the case because the folding state is saved based on actual node paths:

[folding]

node_unfolds=[  ]
resource_unfolds=[  ]
nodes_folded=[ NodePath("node") ]

The folding state isn't actually saved to disk, so you can restore it by closing and re-opening the affected scenes.

So yeah, unless you manually save a scene.

@KoBeWi
Copy link
Member

KoBeWi commented Sep 9, 2019

The fact that saving scenes is not deterministic #30538/#23766 which could mess up node indexing #28309 in tscn files may result in broken folding state saved in config file per scene.

But this would only affect anything if the folding was loaded from the file, which isn't the case here. This code isn't executed between save and tab change:

if (p_scene->has_node(fold_path)) {
Node *node = p_scene->get_node(fold_path);
node->set_display_folded(true);

@VideoGirlAi
Copy link

I don't know if it's OK to revive this issue, but I want to report it's happening again in Godot 4.2.2. I fold nodes, switch a scene, save that scene, then revert to the previous scene, and all nodes are unfolded.

@akien-mga
Copy link
Member

Please open a new issue, this was fixed 5 years ago. What you experience is a different / new bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants