I have a Blender project which won't allow me to use object operators (in this case bpy.ops.object.parent_clear(type='CLEAR')), without crashing.
I have tried it on different objects in my scene and get the same result. I have tried adding a cube object and trying to clear its parent and it also causes a crash. Running Blender from the command line doesn't help as Blender stops responding before printing anything to the command line. The same thing happens when I try any object operator. Trying to execute the operation from the console also causes the crash.
I've never had this problem with any other projects, but something about the way this Blender project is set up is causing Blender to crash. I try to avoid operators in general, but I need to run a script to set the object origin to a certain point and have not found a way to do so without using an object operator.
I wish I could give more information but I have no idea what's causing this.
Here's the first few lines of my code (which run fine until the dreaded operator must be used):
def origin_to_bottom(obj): ''' obj is a Blender object containing a mesh''' # pedantically make sure that I don't affect the wrong object for selected in bpy.context.selected_objects: selected.select_set(False) obj.select_set(True) bpy.context.view_layer.objects.active = obj # get parent and clear parent parent = obj.parent bpy.ops.object.parent_clear(type='CLEAR')