0
$\begingroup$

I'm running a script that appends a rig and parents it to a certain mesh but every time I run it I get an error: EXCEPTION_ACCESS_VIOLATION. I believe it has to do with too many bpy.ops.object.posemode_toggle()s because when I delete some of them from the code, everything works fine except for the places where I deleted them. I have been directed here: https://docs.blender.org/api/2.78b/info_gotcha.html#help-my-script-crashes-blender but it didn't seem to help. Does anyone know how to fix this?

Additionally, if I deleted the append lines, the code works fine.

Here is my code (it's very very messy): https://pastebin.com/SEd67Q9G

$\endgroup$
1
$\begingroup$

Do not use operators from Python, where possible. You will probably need to remake your code to just operate on bpy.types.Armature.pose.bones.

The problem I think comes from the fact that are you changing things like bone parenting from the pose mode context, while Blender expects that to be done in edit mode. But it is a bad idea to switch modes and do this with operators as they are slower than just assigning data with Python directly.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.