在Child Of约束的目标对象中设置逆矩阵。逆矩阵用于保留Child Of约束的保留位置和方向。
bpy.ops.constraint.childof_set_inverse(constraint="", owner='', matrix=(), matrix_basis=(), matrix_local=(), matrix_parent_inverse=())
import bpy
from mathutils import Matrix
ob = bpy.context.object
constraint = ob.constraints.get("Child Of")
if constraint:
inverse_matrix = Matrix.Identity(4)
bpy.ops.constraint.childof_set_inverse(constraint=constraint.name,
owner=constraint.target.name,
matrix=inverse_matrix)