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

Implement basic addon reloading #2298

Merged
merged 1 commit into from Aug 7, 2021

Conversation

MoritzBrueckner
Copy link
Collaborator

Fixes #2261 and requires armory3d/armsdk#26.

This PR adds the possibility to reload the Armory addon via Blender's Reload Scripts operator (tip: create a keybinding for this, prior to Blender 2.8 it could be executed with F8). It is meant to ease development and not meant for regular users and should be used with care, as for example there might be cases with global variables etc. that are re-initialized even if they shouldn't. Also, other addons might misbehave suddenly. If something feels wrong after reloading, restart Blender.

Unfortunately there is now a bit of boilerplate code roughly the size of imports at the header of each module, but I haven't found a way around it yet. The logic nodes package doesn't need custom reloading as arm.logicnode.init_nodes() automatically reloads all logic nodes. This method is called after reloading when everything is re-registered again, so the node modules also don't need to handle reloading of imported modules because Python already cached the reloaded modules and will return them on import.

Regular usage of the addon (without reloading) is not affected by this change. I also tested this change with custom node libraries and the celshade driver.

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 this pull request may close these issues.

Blender 'Reload Scripts' error
2 participants