fix: when there's no object, skip blender clean up

This commit is contained in:
BennyKok
2023-09-05 17:11:38 +08:00
parent 9f9494337b
commit 5f7e8898bb
+4
View File
@@ -11,6 +11,10 @@ def reset_bpy():
# not using this cause this cause seg fault frequently
# global_bpy.ops.wm.read_factory_settings(use_empty=True)
# check if there's no object, return
if len(bpy.data.objects) == 0:
return
# enter object mode
if bpy.context.mode != 'OBJECT':
bpy.ops.object.mode_set(mode='OBJECT')