From b0fccd135b946e74c88ca2d70436a20ba914ed0a Mon Sep 17 00:00:00 2001 From: soupday <79094830+soupday@users.noreply.github.com> Date: Mon, 31 Jan 2022 00:12:29 +0000 Subject: [PATCH 1/2] 1.0.3 baking operator crash fix from script. --- README.md | 8 ++++++++ __init__.py | 2 +- bake.py | 12 +++++++++--- cc3_bake_updater/cc3_bake_updater_status.json | 9 +++++++++ 4 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 cc3_bake_updater/cc3_bake_updater_status.json diff --git a/README.md b/README.md index f94921d..b4ae299 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,15 @@ https://youtu.be/RzVxKjc1AWU Currently requires CC3 Blender Tools version **1.1.6** [Link](https://github.com/soupday/cc3_blender_tools) +Links +===== +[CC3/iClone Blender Tools](https://github.com/soupday/cc3_blender_tools) +[CC3 Round-trip Import Plugin](https://github.com/soupday/CC3-Blender-Tools-Plugin) + ## Changelog +### 1.0.3 +- Fixed a crash invoking Baking operator from script. + ### 1.0.2 - Fixed a crash issue in Blender 2.93 when changing image file format. - Keeps and restores normal strength in baked materials. diff --git a/__init__.py b/__init__.py index 4bfaacf..93316a8 100644 --- a/__init__.py +++ b/__init__.py @@ -20,7 +20,7 @@ bl_info = { "name": "CC3 Bake", "author": "Victor Soupday", - "version": (1, 0, 2), + "version": (1, 0, 3), "blender": (2, 80, 0), "category": "Character", "location": "3D View > Properties> CC3 Bake", diff --git a/bake.py b/bake.py index c6ada10..cbc8bcb 100644 --- a/bake.py +++ b/bake.py @@ -1248,8 +1248,11 @@ def bake_selected_objects(): # use mesh geometry this means we can bake the entirety of the textures with an even sampling. # go into wireframe mode: - shading = bpy.context.space_data.shading.type - bpy.context.space_data.shading.type = 'WIREFRAME' + try: + shading = bpy.context.space_data.shading.type + bpy.context.space_data.shading.type = 'WIREFRAME' + except: + pass # set cycles bake engine = bpy.context.scene.render.engine bpy.context.scene.render.engine = 'CYCLES' @@ -1267,7 +1270,10 @@ def bake_selected_objects(): bpy.data.objects.remove(bake_surface) bpy.context.scene.render.engine = engine - bpy.context.space_data.shading.type = shading + try: + bpy.context.space_data.shading.type = shading + except: + pass # restore selection utils.try_select_objects(objects, True) diff --git a/cc3_bake_updater/cc3_bake_updater_status.json b/cc3_bake_updater/cc3_bake_updater_status.json new file mode 100644 index 0000000..952445e --- /dev/null +++ b/cc3_bake_updater/cc3_bake_updater_status.json @@ -0,0 +1,9 @@ +{ + "last_check": "", + "backup_date": "", + "update_ready": false, + "ignore": false, + "just_restored": false, + "just_updated": false, + "version_text": {} +} \ No newline at end of file From b7f20dccc70e514759cf652f848960d9a6cd9387 Mon Sep 17 00:00:00 2001 From: Victor Soupday <79094830+soupday@users.noreply.github.com> Date: Mon, 31 Jan 2022 00:13:30 +0000 Subject: [PATCH 2/2] Delete cc3_bake_updater_status.json --- cc3_bake_updater/cc3_bake_updater_status.json | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 cc3_bake_updater/cc3_bake_updater_status.json diff --git a/cc3_bake_updater/cc3_bake_updater_status.json b/cc3_bake_updater/cc3_bake_updater_status.json deleted file mode 100644 index 952445e..0000000 --- a/cc3_bake_updater/cc3_bake_updater_status.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "last_check": "", - "backup_date": "", - "update_ready": false, - "ignore": false, - "just_restored": false, - "just_updated": false, - "version_text": {} -} \ No newline at end of file