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

Fix threading and publishing in background mode #2238

merged 4 commits into from Jun 25, 2021


Copy link

@MoritzBrueckner MoritzBrueckner commented Jun 24, 2021

Fixes #2237. Please refer to that issue for a detailed explanation of this PR.

Short summary of the changes:

  • If Blender is run in the background, there is no longer threading to wait for subprocesses, instead the main thread waits and blocks execution. There is no UI that can freeze and threading leads to problems because Blender finishes with the executing script before the thread ends, resulting in crashes and error messages.
  • If Blender is run with UI, the done callback that is executed after a subprocess has finished is no longer called in the thread that waits for the subprocess but instead is called in the main thread to have access to Blender data without crashing. This is solved via a queue between the threads that sends the callback to the main thread. For this the main thread has to use a poll function which does not work in background mode (timers don't seem to work then).

While testing the linked issue I found another small issue that allowed the build operators to be called without having an exporter configuration which this PR also fixes.

…g from outside of UI

If there was no exporter, calling `bpy.ops.arm.publish_project()` would result in an exception before. Now the call is simply ignored and a "poll failed" message is emitted instead.
@luboslenco luboslenco merged commit 20540cc into armory3d:master Jun 25, 2021
@MoritzBrueckner MoritzBrueckner deleted the background-mode branch June 25, 2021 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

Build project in background mode
2 participants