diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-02-18 19:41:47 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-02-18 19:41:47 +0300 |
commit | 3142c4367cc3648c30c57a070f8bc22513dafaa9 (patch) | |
tree | 943b580a7582957d0f43254a4cf1221ca443d726 /source/blender/editors/object/object_constraint.c | |
parent | f4b3d2dc9c4da8e6ef86ae426ed225e74dd0b52e (diff) |
another speedup to constraint checking, skip the bone list and only lookup pose channels that have constraints.
Diffstat (limited to 'source/blender/editors/object/object_constraint.c')
-rw-r--r-- | source/blender/editors/object/object_constraint.c | 40 |
1 files changed, 11 insertions, 29 deletions
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index a64e21d26ae..96ba419704a 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -251,9 +251,8 @@ static void set_constraint_nth_target (bConstraint *con, Object *target, char su /* checks validity of object pointers, and NULLs, * if Bone doesnt exist it sets the CONSTRAINT_DISABLE flag. - * 'data' saves a bone name lookup. */ -static void test_constraints (Object *owner, const char substring[], void *data) +static void test_constraints (Object *owner, bPoseChannel *pchan) { bConstraint *curcon; ListBase *conlist= NULL; @@ -262,7 +261,7 @@ static void test_constraints (Object *owner, const char substring[], void *data) if (owner==NULL) return; /* Check parents */ - if (strlen(substring)) { + if (pchan) { switch (owner->type) { case OB_ARMATURE: type = CONSTRAINT_OBTYPE_BONE; @@ -281,16 +280,7 @@ static void test_constraints (Object *owner, const char substring[], void *data) conlist = &owner->constraints; break; case CONSTRAINT_OBTYPE_BONE: - { - Bone *bone; - bPoseChannel *chan; - - bone = data ? data : get_named_bone( ((bArmature *)owner->data), substring ); - chan = get_pose_channel(owner->pose, substring); - if (bone && chan) { - conlist = &chan->constraints; - } - } + conlist = &pchan->constraints; break; } @@ -432,25 +422,17 @@ static void test_constraints (Object *owner, const char substring[], void *data) } } -static void test_bonelist_constraints (Object *owner, ListBase *list) -{ - Bone *bone; - - for (bone = list->first; bone; bone = bone->next) { - test_constraints(owner, bone->name, (void *)bone); - test_bonelist_constraints(owner, &bone->childbase); - } -} - void object_test_constraints (Object *owner) { - test_constraints(owner, "", NULL); + if(owner->constraints.first) + test_constraints(owner, NULL); - if (owner->type==OB_ARMATURE) { - bArmature *arm= get_armature(owner); - - if (arm) - test_bonelist_constraints(owner, &arm->bonebase); + if (owner->type==OB_ARMATURE && owner->pose) { + bPoseChannel *pchan; + + for (pchan= owner->pose->chanbase.first; pchan; pchan= pchan->next) + if(pchan->constraints.first) + test_constraints(owner, pchan); } } |