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:
authorJoshua Leung <aligorith@gmail.com>2008-03-25 08:32:04 +0300
committerJoshua Leung <aligorith@gmail.com>2008-03-25 08:32:04 +0300
commit88c2358f4f0829b95ad2f9d94c3e077e9dc7fcb5 (patch)
tree0de9f2f5a6dd25a076f17b20d8d74849fd8ee5fd /source/blender/blenkernel
parent7de584337ff8470efcec277908ed2e69e7d5bf74 (diff)
Bugfix #8736: Follow Path constraints does not work for Bones
This appears to be a long-standing bug, and it only affected the Follow-Path constraint as it was the only one which was dependant on time-based changes. An oversight in the depsgraph code meant that Follow-Path constraints on armature bones were not evaluated, unless there was an Action or some NLA-Strips for that armature. I've added a new flag to pose->flag (POSE_CONSTRAINTS_TIMEDEPEND) which only gets set/cleared by update_pose_constraint_flags. This flag indicates that the depsgraph needs to do an update for such cases, and will require going in/out of EditMode to set this for old files. It's been implemented as such to avoid having costly searches when trying to run animations realtime (as is done for modifiers).
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/intern/action.c29
-rw-r--r--source/blender/blenkernel/intern/depsgraph.c1
2 files changed, 24 insertions, 6 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;