Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-11-26 12:48:53 +0300
committerCampbell Barton <ideasman42@gmail.com>2009-11-26 12:48:53 +0300
commit9712e3a670659874ef303f45f03b7df6e1d8d649 (patch)
tree83ceb0d5c6e6603b67cb13b5a550b53193b9ecde /source/blender/editors/object/object_constraint.c
parent8d9fba656869795d9d0135d2bc3b279e9176f9a1 (diff)
fix for adding drivers to constraints via python.
the RNA constraint api was checking the current context when getting the constraint driver path and renaming constraints. this made scripts not work properly so changed this to search for the constraint pose channel user within the object (if the object its self is not the user).
Diffstat (limited to 'source/blender/editors/object/object_constraint.c')
-rw-r--r--source/blender/editors/object/object_constraint.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c
index 6d4706d02b3..eababfe8080 100644
--- a/source/blender/editors/object/object_constraint.c
+++ b/source/blender/editors/object/object_constraint.c
@@ -98,6 +98,33 @@ ListBase *get_active_constraints (Object *ob)
return NULL;
}
+ListBase *get_constraint_lb (Object *ob, bConstraint *con, bPoseChannel **pchan_r)
+{
+ if(pchan_r)
+ *pchan_r= NULL;
+
+ if (ELEM(NULL, ob, con))
+ return NULL;
+
+ if((BLI_findindex(&ob->constraints, con) != -1)) {
+ return &ob->constraints;
+ }
+ else if(ob->pose) {
+ bPoseChannel *pchan;
+ for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
+ if((BLI_findindex(&pchan->constraints, con) != -1)) {
+
+ if(pchan_r)
+ *pchan_r= pchan;
+
+ return &pchan->constraints;
+ }
+ }
+ }
+
+ return NULL;
+}
+
/* single constraint */
bConstraint *get_active_constraint (Object *ob)
{