Object constraints with a driven influence ipo were not being evaluated
properly. The code for adding the depsgraph relation and updating without
time changes was simply missing.
This commit is contained in:
Brecht Van Lommel
2007-10-15 10:36:30 +00:00
parent ff5fd2eb38
commit 565316909e
5 changed files with 21 additions and 12 deletions

View File

@@ -76,7 +76,7 @@ void free_constraint_data(struct bConstraint *con);
/* Constraint Channel function prototypes */
struct bConstraintChannel *get_constraint_channel(ListBase *list, const char *name);
struct bConstraintChannel *verify_constraint_channel(ListBase *list, const char *name);
void do_constraint_channels(struct ListBase *conbase, struct ListBase *chanbase, float ctime);
void do_constraint_channels(struct ListBase *conbase, struct ListBase *chanbase, float ctime, int onlydrivers);
void copy_constraint_channels(ListBase *dst, ListBase *src);
void clone_constraint_channels(struct ListBase *dst, struct ListBase *src);
void free_constraint_channels(ListBase *chanbase);

View File

@@ -718,7 +718,8 @@ void extract_pose_from_action(bPose *pose, bAction *act, float ctime)
/* This call also sets the pchan flags */
execute_action_ipo(achan, pchan);
}
do_constraint_channels(&pchan->constraints, &achan->constraintChannels, ctime);
/* 0 = do all ipos, not only drivers */
do_constraint_channels(&pchan->constraints, &achan->constraintChannels, ctime, 0);
}
}

View File

@@ -886,7 +886,7 @@ void constraints_clear_evalob (bConstraintOb *cob)
/* -------------------------------- Constraint Channels ---------------------------- */
/* does IPO's of constraint channels only */
void do_constraint_channels (ListBase *conbase, ListBase *chanbase, float ctime)
void do_constraint_channels (ListBase *conbase, ListBase *chanbase, float ctime, int onlydrivers)
{
bConstraint *con;
bConstraintChannel *chan;
@@ -901,13 +901,15 @@ void do_constraint_channels (ListBase *conbase, ListBase *chanbase, float ctime)
calc_ipo(chan->ipo, ctime);
for (icu=chan->ipo->curve.first; icu; icu=icu->next) {
switch (icu->adrcode) {
case CO_ENFORCE:
{
/* Influence is clamped to 0.0f -> 1.0f range */
con->enforce = CLAMPIS(icu->curval, 0.0f, 1.0f);
if(!onlydrivers || icu->driver) {
switch (icu->adrcode) {
case CO_ENFORCE:
{
/* Influence is clamped to 0.0f -> 1.0f range */
con->enforce = CLAMPIS(icu->curval, 0.0f, 1.0f);
}
break;
}
break;
}
}
}

View File

@@ -348,6 +348,7 @@ static void dag_add_driver_relation(Ipo *ipo, DagForest *dag, DagNode *node, int
static void build_dag_object(DagForest *dag, DagNode *scenenode, Object *ob, int mask)
{
bConstraint *con;
bConstraintChannel *conchan;
DagNode * node;
DagNode * node2;
DagNode * node3;
@@ -401,9 +402,12 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Object *ob, int
if(key && key->ipo)
dag_add_driver_relation(key->ipo, dag, node, 1);
for (conchan=ob->constraintChannels.first; conchan; conchan=conchan->next)
if(conchan->ipo)
dag_add_driver_relation(conchan->ipo, dag, node, 0);
if(ob->action) {
bActionChannel *chan;
bConstraintChannel *conchan;
for (chan = ob->action->chanbase.first; chan; chan=chan->next){
if(chan->ipo)
dag_add_driver_relation(chan->ipo, dag, node, 1);

View File

@@ -1542,12 +1542,14 @@ void where_is_object_time(Object *ob, float ctime)
else
do_all_object_actions(ob);
/* do constraint ipos ..., note it needs stime */
do_constraint_channels(&ob->constraints, &ob->constraintChannels, stime);
/* do constraint ipos ..., note it needs stime (0 = all ipos) */
do_constraint_channels(&ob->constraints, &ob->constraintChannels, stime, 0);
}
else {
/* but, the drivers have to be done */
if(ob->ipo) do_ob_ipodrivers(ob, ob->ipo, stime);
/* do constraint ipos ..., note it needs stime (1 = only drivers ipos) */
do_constraint_channels(&ob->constraints, &ob->constraintChannels, stime, 1);
}
if(ob->parent) {