diff options
-rw-r--r-- | source/blender/blenkernel/intern/action.c | 29 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/depsgraph.c | 1 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_action_types.h | 4 | ||||
-rw-r--r-- | source/blender/src/editconstraint.c | 2 |
4 files changed, 28 insertions, 8 deletions
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 3b4de305545..21a15fd5a4a 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -353,7 +353,9 @@ static void copy_pose_channel_data(bPoseChannel *pchan, const bPoseChannel *chan } } -/* checks for IK constraint, can do more constraints flags later */ +/* checks for IK constraint, and also for Follow-Path constraint. + * can do more constraints flags later + */ /* pose should be entirely OK */ void update_pose_constraint_flags(bPose *pose) { @@ -361,13 +363,15 @@ void update_pose_constraint_flags(bPose *pose) bConstraint *con; /* clear */ - for (pchan = pose->chanbase.first; pchan; pchan=pchan->next) { + for (pchan= pose->chanbase.first; pchan; pchan= pchan->next) { pchan->constflag= 0; } + pose->flag &= ~POSE_CONSTRAINTS_TIMEDEPEND; + /* detect */ - for (pchan = pose->chanbase.first; pchan; pchan=pchan->next) { - for(con= pchan->constraints.first; con; con= con->next) { - if(con->type==CONSTRAINT_TYPE_KINEMATIC) { + for (pchan= pose->chanbase.first; pchan; pchan=pchan->next) { + for (con= pchan->constraints.first; con; con= con->next) { + if (con->type==CONSTRAINT_TYPE_KINEMATIC) { bKinematicConstraint *data = (bKinematicConstraint*)con->data; pchan->constflag |= PCHAN_HAS_IK; @@ -390,7 +394,20 @@ void update_pose_constraint_flags(bPose *pose) } } } - else pchan->constflag |= PCHAN_HAS_CONST; + else if (con->type == CONSTRAINT_TYPE_FOLLOWPATH) { + bFollowPathConstraint *data= (bFollowPathConstraint *)con->data; + + /* for drawing constraint colors when color set allows this */ + pchan->constflag |= PCHAN_HAS_CONST; + + /* if we have a valid target, make sure that this will get updated on frame-change + * (needed for when there is no anim-data for this pose) + */ + if ((data->tar) && (data->tar->type==OB_CURVE)) + pose->flag |= POSE_CONSTRAINTS_TIMEDEPEND; + } + else + pchan->constflag |= PCHAN_HAS_CONST; } } } diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 32927b6058c..5f95ce61aca 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -1848,6 +1848,7 @@ static void dag_object_time_update_flags(Object *ob) } else if(modifiers_isSoftbodyEnabled(ob)) ob->recalc |= OB_RECALC_DATA; else if(object_modifiers_use_time(ob)) ob->recalc |= OB_RECALC_DATA; + else if((ob->pose) && (ob->pose->flag & POSE_CONSTRAINTS_TIMEDEPEND)) ob->recalc |= OB_RECALC_DATA; else { Mesh *me; Curve *cu; diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h index d1951e67661..9fef59b948f 100644 --- a/source/blender/makesdna/DNA_action_types.h +++ b/source/blender/makesdna/DNA_action_types.h @@ -258,7 +258,9 @@ typedef enum POSE_FLAG { /* prevents any channel from getting overridden by anim from IPO */ POSE_LOCKED = (1<<1), /* clears the POSE_LOCKED flag for the next time the pose is evaluated */ - POSE_DO_UNLOCK = (1<<2) + POSE_DO_UNLOCK = (1<<2), + /* pose has constraints which depend on time (used when depsgraph updates for a new frame) */ + POSE_CONSTRAINTS_TIMEDEPEND = (1<<3) } POSE_FLAG; /* PoseChannel (transform) flags */ diff --git a/source/blender/src/editconstraint.c b/source/blender/src/editconstraint.c index 542b31b1157..506d9f14937 100644 --- a/source/blender/src/editconstraint.c +++ b/source/blender/src/editconstraint.c @@ -661,7 +661,7 @@ static void test_constraints (Object *owner, const char substring[]) if (owner==NULL) return; /* Check parents */ - if (strlen (substring)) { + if (strlen(substring)) { switch (owner->type) { case OB_ARMATURE: type = CONSTRAINT_OBTYPE_BONE; |