Results 1 to 2 of 2

Thread: Setting a 'CHILD_OF' constraint and setting an inverse on an object.

  1. #1

    Setting a 'CHILD_OF' constraint and setting an inverse on an object.

    context_copy = bpy.context.copy()
    context_copy["constraint"] =['temp2'].constraints["Child Of"];
    context_copy["constraint"].target =['temp1'];
    #>>>RuntimeError: Error: Could not find constraint data for Child-Of Set Inverse

    Everything seems to go as planned until the inverse is set. The error coming out in the console is denoted above. The button can be clicked manually to 'Set Inverse' after the script fails at childof_set_inverse() successfully. Is there some reason why yhe constraint data can not be found?

    Thank you

  2. #2
    You might need to add a manual update inbetween before accessing the constraint?
    I would also recommend a low-level access without operators, like:

    temp1 =['temp1']
    temp2 =['temp2']
    const ='CHILD_OF') = temp1 
    #just a guess
    const.inverse_matrix = temp1.matrix_world.inverted()
    A similar issue seems to have been discussed here, and there it also was an update problem:

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts