Conversation
|
Please remove the special characters from the commit message and make it match the title of the PR Also please open a proper proposal as asked on the issue, having a proper proposal where the proper arguments for this feature is important to gauge if this is needed |
|
@twaritwaikar do you recall if exposing this (i.e. making public) in 3.x was meant to be used in scripting, or was it renamed since it was made public on the c++ side? This was done in #53900 but only for the 3.x side, so the fact that this was not done in 4.x to me implies that it was not intended to be exposed as such Edit: these changes were ported to 4.x in #62157 where this was not exposed |
|
This is useful (and used) for all plugins that modify any (active) scripts. |
|
Exposing internal methods, especially in the editor, binds the development to maintain compatibility and stability, so that's why I asked for a proposal to gauge the need and justification for this If it can be worked around, how needed it is, etc. Because exposing a method isn't a trivial thing that comes with possible issues and a burden of maintenance |
2f93ffe to
3a245a9
Compare
|
What can I do to make the Linux check pass? |
|
See the error message, you need to reorder the entries of the documentation, they need to be ge sorted |
|
Sorry for that unnecessary check, I hope I got it now 😅 |
|
Don't see a solid reason against exposing this for plugins, but I'm thinking we should start moving away from the So we should bind it as |
467d9ea to
5e07dcb
Compare
ScriptEditor.reload_scripts()reload_scripts as reload_open_files
|
Thanks, @Paulb23 - I went ahead and changed it to your suggestion. Is there something to do now on the project converter side? |
04d8004 to
7631d87
Compare
|
I added the function to the rename map, I hope we can get this merged for 4.3 👀 |
e369043 to
2687a6c
Compare
Expose the reload_scripts method to match the current state of the 3.x branch. Bind it as `reload_open_files` in contrast to `reload_scripts` in 3.x to more accurately reflect its function. closes godotengine/godot-proposals#8111 clarifies the description of the method's internals Co-authored-by: Chris Cranford <ccranfor@redhat.com>
2687a6c to
8c32133
Compare
|
The absence of this feature is painful to me. Two of my plugins would benefit from it. I hope it can get merged soon! |
|
I also need this, my usecase is generating gdscript code in open files. the file on disk and the data in memory is updated, but the opened scripts in the editor do not get updated |
|
Correct me, but isn't this now exposed in |
|
I did try that before but it didn't work. I suspect it's referring to script resources, and not the open script in the script editor, or maybe it's broken or I'm using it wrong 😂 |
|
reload_open_files reloads script editors, not the scripts themselves. changes to the script are applied just fine, but if a script is changed programmatically (ex: preprocessors) and still open in a text editor, the editor doesn't update, forcing you to close and reopen to get the new changes. if you accidentally save it'll just override those changes |
There was a problem hiding this comment.
This can cause unsaved changes to be lost without confirmation.
It would be better to expose _test_script_times_on_disk (and maybe _update_modified_scripts_for_external_editor which is usually called after it?, effectively _on_find_in_files_modified_files) if needed.
text_editor/behavior/files/auto_reload_scripts_on_external_change is now true by default, so it won't show the confirmation dialog unless its unsaved.
A workaround is to send the ScriptEditor NOTIFICATION_APPLICATION_FOCUS_IN, since it calls _test_script_times_on_disk:
EditorInterface.get_script_editor().notification(Window.NOTIFICATION_APPLICATION_FOCUS_IN)| <param index="0" name="refresh_only" type="bool" default="false" /> | ||
| <description> | ||
| Reload all currently opened files if [param refresh_only] is [code]false[/code]. When [param refresh_only] is [code]true[/code], only modified files are reloaded. | ||
| [b]Note:[/b] This method has no effect if an external editor is currently active. |
There was a problem hiding this comment.
This does work when an external editor is active.
|
@kitbdev Thanks for your comment, sounds good to me. If you have a full picture of how to best expose this to plugin devs, feel free to open a new PR with your suggestions. It has been a while since I looked at the engine code, but I am also happy to dive back in if necessary. |
|
Superseded by #116187; thanks for your contribution! |
Expose the
reload_scriptsmethod to match the current state of the 3.x branch.As described in #83118, it is possible to replicate this method with GDScript:
and set the
text_editor/behavior/files/auto_reload_scripts_on_external_changesetting totrue.Personally, I would prefer calling
EditorInterface.get_script_editor().reload_scripts(), but I might not be aware of possible pitfalls caused by exposing this method.This would also improve the porting of existing 3.5 plugins.
closes godotengine/godot-proposals#8111