Scripted Constraints on Bones fail #19422
Labels
No Label
Interest
Animation & Rigging
Interest
Blender Cloud
Interest
Collada
Interest
Core
Interest
Documentation
Interest
Eevee & Viewport
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
Import and Export
Interest
Modeling
Interest
Modifiers
Interest
Nodes & Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds, Tests & Devices
Interest
Python API
Interest
Rendering & Cycles
Interest
Sculpt, Paint & Texture
Interest
Translations
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Meta
Good First Issue
Meta
Papercut
Module
Add-ons (BF-Blender)
Module
Add-ons (Community)
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender-addons#19422
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
%%%When you try to apply constraints to bones using the python wrappers two things happen:
they get applied to the general armature object instead of the bone
Instead of going to the desired target they go to a newly created empty.
the second problem happens with all constraints that I can tell but the first one doesn't effect IK constraints. In my blend file, if you just run the script at the bottom you can see the problem at work. The script should copyLoc the offset bone to the main chain but instead it creates a new empty and constrains the armature object to it.
OS-- Mac OSX 10.6.1 (same problem happened on 10.5 though)
RAM -- 2GB
Blender: 2.5 --confirmed on 23237 and 23358%%%
Changed status to: 'Open'
%%%Assigning to self. I'll check this out when I get time.
Just reading the description, I think I should mention a few things:
%%%The armature is in pose mode and the desired bones ".selected" flags are toggled to true. As far as which operator, I used the same operator that the console reports is used when you implement the constraint manually. %%%
%%%Ok, checking this out a bit, my first point still stands.
You should be using
bpy.ops.pose.constraint_add...
instead of the 'object' version.
This solves the issue of which context the constraint gets added in.
Secondly, this appears to be related to the 'context' bugs we have (i.e. constraint operators rely on some context info which is only available in 3D-View). One way to currently get around this is to define you script as an operator. To do this, add the
following code before your existing script lines (make sure you indent your code properly
though)
import bpy;
Define the operator
class POSE_OT_my_rigging_operator(bpy.types.Operator):
'''
Add description here
'''
idname = "pose.my_rigging_operator"
label = "Add constraint (special)"
%%%
%%%This has probably been fixed for Durian already in the last few weeks.%%%
Changed status from 'Open' to: 'Resolved'