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 scripts with the shortcut (CTRL+S) does not work with empty scene #9069

Closed
kerskuchen opened this issue Jun 6, 2017 · 10 comments · Fixed by #48578
Closed

Saving scripts with the shortcut (CTRL+S) does not work with empty scene #9069

kerskuchen opened this issue Jun 6, 2017 · 10 comments · Fixed by #48578

Comments

@kerskuchen
Copy link
Contributor

Operating system or device - Godot version:
Ubuntu Linux 16.04 - Godot 3.0 master branch (cloned 4 hours ago)

Issue description:

Trying to save scripts with the save shortcut (CTRL+S) does not work until an existing scene is
opened or a valid scene with root node is saved.
Message: "This operation can't be done without a tree root"

Steps to reproduce:

Open an empty or existing project and close all open scenes. Open an empty or existing script in
the script editor and press (CTRL+S).

@vnen
Copy link
Member

vnen commented Jun 6, 2017

This is not a bug, Ctrl+S saves the scene, which can't be done if there's no scene to save. The shortcut to save script is Ctrl+Alt+S.

@vnen vnen closed this as completed Jun 6, 2017
@vnen vnen added the archived label Jun 6, 2017
@kerskuchen
Copy link
Contributor Author

Okay but Ctrl+S also saves the currently open script in the script editor, if there is a scene open in the background (that is already saved). So by that logic Ctrl+S is also kind of for saving scripts. I think that this is a mild inconsistency from the user's perspective.
If the editor allows the user to save scripts with Ctrl+S anyway most of the time, why not allow the user to save scripts with Ctrl+S without needing to open a scene first?

@bojidar-bg
Copy link
Contributor

Reopening as there seems to be interest for discussion. (and discussing on closed issues is a mess)

@vnen
Copy link
Member

vnen commented Jun 7, 2017

Ctrl+S to save only the script sounds sensible, but this has been discussed a few times and I don't know if something changed since them.

@eon-s
Copy link
Contributor

eon-s commented Jun 7, 2017

I think context based shortcuts (current focused scene/script/resource) should be the shorter ones and global shortcuts be the more complex combinations (to make it harder to do a global mess).

@kubecz3k
Copy link
Contributor

kubecz3k commented Apr 4, 2018

First of all thank you for your report and sorry for the delay.

We released Godot 3.0 in January 2018 after 18 months of work, fixing many old issues either directly, or by obsoleting/replacing the features they were referring to.

We still have hundreds of issues whose relevance/reproducibility needs to be checked against the current stable version, and that's where you can help us.
Could you check if the issue that you described initially is still relevant/reproducible in Godot 3.0 or any newer version, and comment about its current status here?

For bug reports, please also make sure that the issue contains detailed steps to reproduce the bug and, if possible, a zipped project that can be used to reproduce it right away. This greatly speeds up debugging and bugfixing tasks for our contributors.

Our Bugsquad will review this issue more in-depth in 15 days, and potentially close it if its relevance could not be confirmed.

Thanks in advance.

Note: This message is being copy-pasted to many "stale" issues (90+ days without activity). It might happen that it is not meaningful for this specific issue or appears oblivious of the issue's context, if so please comment to notify the Bugsquad about it.

@nickcernis
Copy link

nickcernis commented Apr 4, 2018

I am still able to reproduce this in Godot 3.0.2.stable.official on Mac:

godot-error2

Reproducible with the “Kinematic Collision” project:

  1. Open project.godot.
  2. Close all open scenes.
  3. Edit the player.gd script.
  4. Attempt to save it with Ctrl / Cmd + S.
  • Expected behaviour: the modified script is saved.
  • Actual behaviour: “this operation can't be done without a tree root” message appears.

I agree with this proposal above:

I think context based shortcuts (current focused scene/script/resource) should be the shorter ones and global shortcuts be the more complex combinations (to make it harder to do a global mess).

@Zylann
Copy link
Contributor

Zylann commented Jun 18, 2018

Still happens in 3.0.3. I also agree with @eon-s who formulated it better than my earlier issue about the save shortcut.

It has been a long lasting one. See also:

People are confused by both not being able to save a script with no scene opened, and the fact that Ctrl+S is not contextual.

@dark-penguin
Copy link

dark-penguin commented Jan 26, 2020

I have found even more "usability problems" with this. If I'm editing a script embedded in a scene, a shortcut to "Save script" opens a dialog for saving this script in a separate file. What's more, the extensions are different:
save_dialog
I understand that this might be "technically correct" at least from some standpoint. But I would have expected the "Save" command to save my script where it currently is, and "Save As" to open a dialog. This may be confusing, especially if you don't remember where this script is stored, especially for the new users.

By the way, I remap Ctrl+S to act as both "Save scene" and "Save script", too. And I agree that it really should save what you're currently editing. Unless you are editing a script that's embedded in a scene - then it should understand this and save the scene instead. (Or maybe save the script into the scene, but don't save any other changes in that scene, for consistent behavior?..)

@d0rf3n
Copy link

d0rf3n commented Mar 1, 2020

Shouldn't the tabs switch to being scripts instead of scenes when using the script editor?

EDIT: This would alleviate problems with ctrl-tab switching, saving, and so one. Atm, being able to select scenes while editing a script only switches the last used script with that scene, which both makes sense and is kind of confusing. (Since all recenlty open scripts are all open anyway)

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.