From 2fce27f8cb26aa2689f942c5d0a28f62c8b198af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Fri, 1 Jun 2018 17:22:49 +0200 Subject: [PATCH] Made the add-on not immediately crash on Blender 2.8 --- CHANGELOG.md | 1 + blender_cloud/attract/__init__.py | 17 +++++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f83dacc..4b30c70 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - Replace BAM with BAT🦇. - Don't crash the texture browser when an invalid texture is seen. - Support colour strips as Attract shots. +- Blender 2.8 support (work in progress). ## Version 1.8 (2018-01-03) diff --git a/blender_cloud/attract/__init__.py b/blender_cloud/attract/__init__.py index bd6183f..66b368c 100644 --- a/blender_cloud/attract/__init__.py +++ b/blender_cloud/attract/__init__.py @@ -931,7 +931,10 @@ def activate(): log.info('Activating Attract') attract_is_active = True - bpy.app.handlers.scene_update_post.append(scene_update_post_handler) + + # 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) draw.callback_enable() @@ -942,11 +945,13 @@ def deactivate(): attract_is_active = False draw.callback_disable() - try: - bpy.app.handlers.scene_update_post.remove(scene_update_post_handler) - except ValueError: - # This is thrown when scene_update_post_handler does not exist in the handler list. - pass + # TODO: properly fix 2.8 compatibility; this is just a workaround. + if hasattr(bpy.app.handlers, 'scene_update_post'): + try: + bpy.app.handlers.scene_update_post.remove(scene_update_post_handler) + except ValueError: + # This is thrown when scene_update_post_handler does not exist in the handler list. + pass def register():