-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
Live-reload nodes in a running game when files from their scene_file_path
are reimported
#9519
Comments
|
Then I'm wrong about it not being exposed to GDScript. If so, we just need to answer the question of whether it should work out of the box with no plugins. I'll probably be able to tell once I try to implement it as a plugin. If it's easy then it would probably make sense to have in editor because other operations like node creation/deletion work and users will probably expect reimport to work as well (I did) But the problem of editor needing focus for asset reimport will still need to be addressed for this workflow to be feasible |
Tested a very barebones version of an I'm currently rescanning the filesystem on timer which isn't great, not to mention the bug that opens vscode after reimport which forced me to switch to the internal script editor to be able to record those videos. Godot also steals window focus when reimporting assets (for no apparent reason) it will even maximize the window if it's minimized, so I had to set the minimum window size to (100, 100) to be able to move it out of the way to make sure it doesn't pop up on top of blender and godot game. So even with an addon this is all very scuffed and there are a lot of problems to solve here. It will probably be best to solve one at a time starting with allowing reimports with no focus. Then we can return to this |
I was thinking we should do away with the reimport popup progress and make it a progress bar that appears at the bottom of the editor instead (like when you save a file in LibreOffice), but importing in Godot is intentionally a blocking process. This is done so you can't end up with inconsistent scene state (which could happen if you're making changes while the editor is reimporting a resource). We could use this approach for saving though – this would make Save on Focus Loss much more reliable. |
Yeah that's what I thought. so you're saying that godot gets focus and gets maximized because the popup window is shown? could we maybe delay showing the reimport popup until godot gets focus from the user? Because even with the problem with the focus stealing aside, the popup is shown in the middle of the screen right now no matter where the editor window is, which is very intrusive. I don't think any app should do this, at the very least the popup should appear in the center of the editor window, not in the center of the screen. But if we don't show the popup at all while godot has no focus that shouldn't be a problem |
That was my initial thought, but if the reimport is taking a long time, you may not have focus on Godot at first but you might alt-tab to it later while it's still reimporting. In this case, you wouldn't have any visible progress feedback and Godot would appear to be frozen. |
Maybe godot should do import non-blockingly and disable input artificially while importing? Then you can support the progressbar in the main window and a cancel button if it's ever needed I guess user input isn't the only thing that can change things, but since the editor is basically a godot game it should be relatively easy to pause editor tools and such, right? 🤔 |
Would that also work for 2D? For example redrawing something in Photoshop and seeing changes on game without reloading it? |
I haven't done much 2d in godot but I expect this to be easier to do than 3d because you'd just be updating images instead of entire scene tree branches |
Correction: When reimport happens the editor window doesn't get focus so it doesn't go over blender's window, it only gets in front of the game window. Does anyone know why this is happening and how to fix this? Screen.Recording.mp4Edit: opened an issue for this godotengine/godot#90940 |
Opened several issues that are related to this proposal. They are all about the resource import, but on the editor side: godotengine/godot#90659 |
Related to this proposal: noticed that signals aren't synced too. Opened a proposal for that: #9675 |
Describe the project you are working on
Any project
Describe the problem or limitation you are having in your project
Level design is an iterative process and Iteration is slow when you need to restart the game every time you make a change to a glTF file. This is especially relevant when you're using an external 3d editor (like blender) as a level editor, be it either for quick blockouts or entire levels if you take advantage of custom import plugins
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Reload resources in the running game when reimport happens in editor
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
After some testing I discovered that even though glTF models aren't synced with the running game when reimport happens, if you delete the scene node and then drop it back in from the FileSystem dock it does update in-game, which means that there is already a mechanism to hot-load resources from disc in a running game
After taking a quick look at the source code it seems like all it would take is to either add a new message (i.e
scene:live_reload_node
) or just use the existingscene:live_remove_node
andscene:live_instantiate_node
messages to recreate the node when the file from itsscene_file_path
is reimported (Edit: it's probably better to go with a new message because it will allow more flexibility, i.e adding logic to preserve child nodes on the nodes that we're recreating)Edit: a short video from twitter to show this proposal in action
wild.mp4
Also could consider the possibility of reloading in the running game without any message from the editor because it seems like all it needs is a file path (and the ability to watch for changes).(Edit: after some quick experiments with a plugin it seems like this wouldn't be worth the extra effort since it works pretty well when reimported through editor)The problem is that right now for the reimport to trigger you need to give the editor focus. It can be worked around by continuously reimporting assets on timer, but it's clunky (maybe it makes sense to stop requiring window focus for asset reimport, or at least make it an editor setting?).(Edit: this is now fixed in master)Ideally you'd only need to switch between blender and the running game to make levels
If this enhancement will not be used often, can it be worked around with a few lines of script?
I don't think so
Is there a reason why this should be core and not an add-on in the asset library?
I don't think live debugging is exposed to GDScript at all(Edit: it is exposed and can be a plugin but this is a basic and useful feature to have alongside other existing live debugging features)
The text was updated successfully, but these errors were encountered: