Childof_set_inverse #39891

Closed
opened 2014-04-25 12:39:43 +02:00 by Alexander KHozyashev · 4 comments

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.

child_of2.blend

Ty. =)

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. [child_of2.blend](https://archive.blender.org/developer/F85884/child_of2.blend) Ty. =)

Changed status to: 'Open'

Changed status to: 'Open'

Added subscriber: @AleksandrKhozyashev

Added subscriber: @AleksandrKhozyashev

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Campbell Barton self-assigned this 2014-04-25 14:07:00 +02:00

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 blender/blender@bef1edb322 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'
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 blender/blender@bef1edb322 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'
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#39891
No description provided.