fix: occasional segmentation fault
This commit is contained in:
+5
-7
@@ -9,13 +9,11 @@ class Mesh_JoinMesh(blender_node.ObjectOps):
|
||||
CUSTOM_NAME = "Join Meshes"
|
||||
|
||||
def blender_process(self, bpy, BPY_OBJ, **props):
|
||||
|
||||
prop_values = props.values()
|
||||
|
||||
override = bpy.context.copy()
|
||||
override["active_object"] = BPY_OBJ
|
||||
override["selected_editable_objects"] = list(prop_values) + [BPY_OBJ]
|
||||
bpy.ops.object.join(override)
|
||||
prop_values = props.values()
|
||||
for obj in list(prop_values) + [BPY_OBJ]:
|
||||
obj.select_set(True)
|
||||
bpy.context.view_layer.objects.active = BPY_OBJ
|
||||
bpy.ops.object.join()
|
||||
|
||||
return (BPY_OBJ,)
|
||||
|
||||
|
||||
+23
-21
@@ -1,37 +1,39 @@
|
||||
import bpy
|
||||
global_bpy = bpy
|
||||
|
||||
def get_bpy():
|
||||
|
||||
def get_bpy():
|
||||
global global_bpy
|
||||
return global_bpy
|
||||
|
||||
|
||||
def reset_bpy():
|
||||
global global_bpy
|
||||
bpy = global_bpy
|
||||
# not using this cause this cause seg fault frequently
|
||||
# global_bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
|
||||
# check if there's no object, return
|
||||
if len(bpy.data.objects) == 0:
|
||||
return
|
||||
# # 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')
|
||||
# # enter object mode
|
||||
# if bpy.context.mode != 'OBJECT':
|
||||
# bpy.ops.object.mode_set(mode='OBJECT')
|
||||
|
||||
# Delete all objects
|
||||
bpy.ops.object.select_all(action='DESELECT')
|
||||
bpy.ops.object.select_all(action='SELECT')
|
||||
bpy.ops.object.delete()
|
||||
# # Delete all objects
|
||||
# bpy.ops.object.select_all(action='DESELECT')
|
||||
# bpy.ops.object.select_all(action='SELECT')
|
||||
# bpy.ops.object.delete()
|
||||
|
||||
# Delete all meshes
|
||||
for mesh in bpy.data.meshes:
|
||||
bpy.data.meshes.remove(mesh)
|
||||
# # Delete all meshes
|
||||
# for mesh in bpy.data.meshes:
|
||||
# bpy.data.meshes.remove(mesh)
|
||||
|
||||
# Delete all materials
|
||||
for material in bpy.data.materials:
|
||||
bpy.data.materials.remove(material)
|
||||
# # Delete all materials
|
||||
# for material in bpy.data.materials:
|
||||
# bpy.data.materials.remove(material)
|
||||
|
||||
# Delete all textures
|
||||
for texture in bpy.data.textures:
|
||||
bpy.data.textures.remove(texture)
|
||||
# # Delete all textures
|
||||
# for texture in bpy.data.textures:
|
||||
# bpy.data.textures.remove(texture)
|
||||
|
||||
Reference in New Issue
Block a user