-
-
Notifications
You must be signed in to change notification settings - Fork 428
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 Generating from Opened Blend File #730
Conversation
@@ -64,7 +64,7 @@ def cancel(self): | |||
def _run_on_main_thread(self, func): | |||
try: | |||
import bpy | |||
bpy.app.timers.register(func) | |||
bpy.app.timers.register(func, persistent=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sure that model fetching completes when loading a file. Often when loading a file first it would fetch the models, then it gets queued in this timer, then the file actually loads and discards the timer. On rare occasions model fetching would complete along with the timer before the .blend file loads.
@@ -123,7 +123,7 @@ class model_lookup: | |||
|
|||
@classmethod | |||
def get(cls, item): | |||
return cls._models.get(item, item) | |||
return cls._models.get(item, None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't want to default to returning the model id string in case if the id is invalid or the models haven't loaded yet.
except Exception as e: | ||
print(e) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These exceptions can be safely propagated since its at the end of the draw function, now it can properly show traceback info on errors it encounters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch
fixes #729