Page MenuHome

Childof_set_inverse
Closed, ResolvedPublic

Description

Ubuntu mint 13
Broken: 2.70, 2.70.4
Worked: 2.69

So, simple code, need to apply(press) Set Inverse.

Run Script - go to 3D view - select bone(pose mode) - press "space" - write "constr" - choose "constr" and enjoy or not.

Ty. =)

Event Timeline

Campbell Barton (campbellbarton) changed the task status from Unknown Status to Resolved.Apr 25 2014, 2:07 PM

Constraint operators are not really that useful to be called from Python.

For this to work you need to set the constraint in the context...

eg:

context_py = bpy.context.copy()
context_py["constraint"] = constraint
bpy.ops.constraint.childof_set_inverse(context_py, constraint="Child Of", owner='BONE')

This was very hidden, so I have added a message rBbef1edb3222bed589b670a77acbc0d5ce7b2148a which now shows:

Traceback (most recent call last):
  File "/d/child_of2.blend/Text", line 21, in execute
  File "/src/blender/release/scripts/modules/bpy/ops.py", line 188, in __call__
    ret = op_call(self.idname_py(), None, kw)
RuntimeError: Operator bpy.ops.constraint.childof_set_inverse.poll() Context missing 'constraint'