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

Tools (export(tool=True)) do not reload on save #170

Closed
matheus2740 opened this issue May 9, 2020 · 1 comment · Fixed by #180
Closed

Tools (export(tool=True)) do not reload on save #170

matheus2740 opened this issue May 9, 2020 · 1 comment · Fixed by #180

Comments

@matheus2740
Copy link
Contributor

I have a tool script (created with export(tool=True)).
When I make changes to the script, and save, I get the following error:

ERROR: set_path: Another resource is loaded from path 'res://worldgen/WorldGen.py' (possible cyclic resource inclusion).
   At: core/resource.cpp:81.
ERROR: reload: Condition "!p_keep_state && _instances.size()" is true. Returned: ERR_ALREADY_IN_USE
   At: modules/gdnative/pluginscript/pluginscript_script.cpp:232.

I then have to restart the editor in order for my tool to update.

@matheus2740
Copy link
Contributor Author

matheus2740 commented May 16, 2020

this appears to be: godotengine/godot#10946

The solution seems to be:
use the gdnative c++ and create a PluginScript subclass, like the ECMAScript guys are doing. See: https://github.com/Geequlim/ECMAScript/blob/master/ecmascript.h

This way we can override PluginScript::reload and remove the line ERR_FAIL_COND_V(!p_keep_state && _instances.size(), ERR_ALREADY_IN_USE); which is preventing the reload.

We could also simplify the logic in this method, and only call importlib.reload.

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

Successfully merging a pull request may close this issue.

1 participant