diff options
author | Joshua Leung <aligorith@gmail.com> | 2008-03-25 13:36:36 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2008-03-25 13:36:36 +0300 |
commit | 74e835342e6559905f4cdebe6191799629e6fd32 (patch) | |
tree | 7107fce58cf514646c0728469c2de6e61c333983 /source/blender/blenkernel | |
parent | 34494425fa484c98199b7b1fadc5cbaa894473f6 (diff) |
Two constraints related fixes
* Bugfix #8599d:
When using the ChildOf constraint on bones without parents, with cyclic-offset in action the effect of the cyclic-offset was applied twice. Added a bone option to make the effect of cyclic-offset not be applied to rootbones which have the option 'enabled'.
In the UI, this is presented in the opposite way. It is represented by the 'Offs' button beside the parent-bone selector in the Armature Bones panel when in EditMode.
* Head/Tail setting and Constraint Channels:
Added back in checks to see if the head/tail IPO-curves for Constraint Channels can get applied for the target constraint. I had removed these when applying the patch, but I'd overlooked the fact that users could add an IPO-curve for this from the IPO-editor, potentially mucking up the behaviour of some constraints.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/armature.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/constraint.c | 33 |
2 files changed, 29 insertions, 10 deletions
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index 4bb31c1e9b9..24819f44ac1 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -2172,8 +2172,10 @@ static void where_is_pose_bone(Object *ob, bPoseChannel *pchan, float ctime) } else { Mat4MulMat4(pchan->pose_mat, pchan->chan_mat, bone->arm_mat); - /* only rootbones get the cyclic offset */ - VecAddf(pchan->pose_mat[3], pchan->pose_mat[3], ob->pose->cyclic_offset); + + /* only rootbones get the cyclic offset (unless user doesn't want that) */ + if ((bone->flag & BONE_NO_CYCLICOFFSET) == 0) + VecAddf(pchan->pose_mat[3], pchan->pose_mat[3], ob->pose->cyclic_offset); } /* do NLA strip modifiers - i.e. curve follow */ diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 4a0c799d2be..6cd2147391e 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -84,10 +84,10 @@ /* ******************* Constraint Channels ********************** */ /* Constraint Channels exist in one of two places: * - Under Action Channels in an Action (act->chanbase->achan->constraintChannels) - * - Under Object without object-level action yet (ob->constraintChannels) + * - Under Object without Object-level Action yet (ob->constraintChannels) * - * The main purpose that constraint channels serve is to act as a link - * between an IPO-block which + * The main purpose that Constraint Channels serve is to act as a link + * between an IPO-block (which provides values to interpolate between for some settings) */ /* ------------ Data Management ----------- */ @@ -143,7 +143,7 @@ bConstraintChannel *get_constraint_channel (ListBase *list, const char name[]) { bConstraintChannel *chan; - if(list) { + if (list) { for (chan = list->first; chan; chan=chan->next) { if (!strcmp(name, chan->name)) { return chan; @@ -183,11 +183,11 @@ void do_constraint_channels (ListBase *conbase, ListBase *chanbase, float ctime, for (con=conbase->first; con; con=con->next) { Ipo *ipo= NULL; - if(con->flag & CONSTRAINT_OWN_IPO) + if (con->flag & CONSTRAINT_OWN_IPO) ipo= con->ipo; else { bConstraintChannel *chan = get_constraint_channel(chanbase, con->name); - if(chan) ipo= chan->ipo; + if (chan) ipo= chan->ipo; } if (ipo) { @@ -206,7 +206,24 @@ void do_constraint_channels (ListBase *conbase, ListBase *chanbase, float ctime, break; case CO_HEADTAIL: { - con->headtail = icu->curval; + /* we need to check types of constraints that can get this here, as user + * may have created an IPO-curve for this from IPO-editor but for a constraint + * that cannot support this + */ + switch (con->type) { + /* supported constraints go here... */ + case CONSTRAINT_TYPE_LOCLIKE: + case CONSTRAINT_TYPE_TRACKTO: + case CONSTRAINT_TYPE_MINMAX: + case CONSTRAINT_TYPE_STRETCHTO: + case CONSTRAINT_TYPE_DISTLIMIT: + con->headtail = icu->curval; + break; + + default: + /* not supported */ + break; + } } break; } @@ -438,7 +455,7 @@ void constraint_mat_convertspace (Object *ob, bPoseChannel *pchan, float mat[][4 /* we need the posespace_matrix = local_matrix + (parent_posespace_matrix + restpos) */ if (pchan->parent) { float offs_bone[4][4]; - + /* construct offs_bone the same way it is done in armature.c */ Mat4CpyMat3(offs_bone, pchan->bone->bone_mat); VECCOPY(offs_bone[3], pchan->bone->head); |