godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.95k stars 21.15k forks source link

Disabling the Godot script editor does not automatically disable the loading of dominant scripts on scene change. #91659

Open PowerfulBacon opened 6 months ago

PowerfulBacon commented 6 months ago

Tested versions

System information

Godot v4.2.1.stable.mono - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1060 3GB (NVIDIA; 31.0.15.3623) - Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz (4 Threads)

Issue description

When disabling the godot engine's script editor through Editor > Manage Editor Features, the editor continues to open up files automatically. This is particularly annoying if you are working with an external IDE, as you will continue to get popups from script files asking if they should reload.

When switching between scenes, the script editor will randomly open code files. This is annoying in of itself, but when the script editor is disabled this makes it impossible to go and close those scripts.

I should note that this only appears to happen if the script is in the root node of a scene, but it is incredibly annoying and is driving me nuts.

Steps to reproduce

Workaround

Disable open_dominant_script_on_scene_change OR Enable use_external_editor

These will completely fix the issue, however I am leaving this issue open since if the script editor is disabled then all functionality of the script editor should be disabled regardless of if you have the setting to open dominant scripts or not. If you have disabled the script editor, then you would never want the Godot script editor to open up files in the background as you can never close them again.

Minimal reproduction project (MRP)

Reproduction.zip

AThousandShips commented 6 months ago

Do you have distraction free mode active? If so this would be a duplicate of:

And should be fixed in 4.3 by:

PowerfulBacon commented 6 months ago

Do you have distraction free mode active?

No, this happens with distraction free mode is enabled or disabled. This happens because when you switch to another scene, if the root node has a script attached to it then it will automatically open in the script editor. This is really annoying if you are using an external IDE for editing scripts as it will constantly ask you if you want to reload or overwrite the changes, and causes loss of data ocassionally even if you reload.

kitbdev commented 6 months ago

Can reproduce in Godot v4.2.1.stable and master v4.3.dev.custom_build [2042420bd] - Windows 10.0.22631 I don't think #90654 is related.

It looks like the Script Editor opens it and keeps working even if it is disabled.

What external editor are you using? I can only get it to happen with certain ones like notepad but not VSCode.

Try turning off this Editor Setting that opens the root node's script: text_editor/behavior/files/open_dominant_script_on_scene_change

Also, there is an external editor setting that doesn't have this issue: text_editor/external/use_external_editor But this requires the Script Editor EditorFeature to be enabled to work.

PowerfulBacon commented 6 months ago

With open_dominant_script_on_scene_change disabled, the issue no longer happens as scripts are not opened in the background anymore.

I am using visual studio 2022, however I believe this will work with all editors since the message pops up whenever the file is edited while it is open in the Godot script editor. The issue is that even if the script editor is disabled, it will continue to open up the dominant script on scene change and while files are open in Godot's script editor, the file change message will continue to appear when you modify those files.

If you disable the script editor, then all functionality of the script editor should be disabled, including the checking for files being changed in an external editor (of course, you would always want to reload since those files shouldn't be open in Godot at all if you disable script editing functionality).