Made the add-on not immediately crash on Blender 2.8

This commit is contained in:
Sybren A. Stüvel 2018-06-01 17:22:49 +02:00
parent 59e6491110
commit 2fce27f8cb
2 changed files with 12 additions and 6 deletions

View File

@ -5,6 +5,7 @@
- Replace BAM with BAT🦇. - Replace BAM with BAT🦇.
- Don't crash the texture browser when an invalid texture is seen. - Don't crash the texture browser when an invalid texture is seen.
- Support colour strips as Attract shots. - Support colour strips as Attract shots.
- Blender 2.8 support (work in progress).
## Version 1.8 (2018-01-03) ## Version 1.8 (2018-01-03)

View File

@ -931,6 +931,9 @@ def activate():
log.info('Activating Attract') log.info('Activating Attract')
attract_is_active = True attract_is_active = True
# TODO: properly fix 2.8 compatibility; this is just a workaround.
if hasattr(bpy.app.handlers, 'scene_update_post'):
bpy.app.handlers.scene_update_post.append(scene_update_post_handler) bpy.app.handlers.scene_update_post.append(scene_update_post_handler)
draw.callback_enable() draw.callback_enable()
@ -942,6 +945,8 @@ def deactivate():
attract_is_active = False attract_is_active = False
draw.callback_disable() draw.callback_disable()
# TODO: properly fix 2.8 compatibility; this is just a workaround.
if hasattr(bpy.app.handlers, 'scene_update_post'):
try: try:
bpy.app.handlers.scene_update_post.remove(scene_update_post_handler) bpy.app.handlers.scene_update_post.remove(scene_update_post_handler)
except ValueError: except ValueError: