Armature related fixes and cleanups:

* Armatures that had constraint targets inside other armatures
  weren't transform()-ing correctly

* Issues with lattice deformed objects that are parents of bones
  when rendering an animation. Seems to be mostly OK now with the
  exception of the first rendered frame -- weird bugs like this have
  plagued blender for ages, which leads me to believe that
  RE_rotateBlenderScene() is a piece of garbage that nobody understands
  (especially me).

* made a few helper functions to clean up some repeated code related
  to clearing constraint status and rebuilding displists.
This commit is contained in:
Chris Want
2004-01-27 06:08:37 +00:00
parent c225bf1240
commit e8aaea0b63
7 changed files with 68 additions and 54 deletions

View File

@@ -2629,21 +2629,23 @@ static void clear_pose_update_flag(Object *ob) {
}
}
static void pose_flags_reset_done(Object *ob) {
static int pose_flags_reset_done(Object *ob) {
/* Clear the constraint done status for every pose channe;
* that has been flagged as needing constant updating
*/
bPoseChannel *chan;
int numreset = 0;
if (ob->pose) {
for (chan = ob->pose->chanbase.first; chan; chan=chan->next){
if (chan->flag & PCHAN_TRANS_UPDATE) {
chan->flag &= ~PCHAN_DONE;
numreset++;
}
}
}
return numreset;
}
static int is_ob_constraint_target(Object *ob, ListBase *conlist) {
@@ -2998,6 +3000,22 @@ static int pose_do_update_flag(Object *ob) {
return do_update;
}
void figure_pose_updating(void)
{
Base *base;
flag_moving_objects();
for (base= FIRSTBASE; base; base= base->next) {
/* Recalculate the pose if necessary, regardless of
* whether the layer is visible or not.
*/
if (pose_do_update_flag(base->object))
base->flag |= BA_WHERE_UPDATE;
}
}
/*** POSE FIGURIN' -- END ***/
@@ -3014,18 +3032,10 @@ static void setbaseflags_for_editing(int mode) /* 0,'g','r','s' */
Base *base;
copy_baseflags();
flag_moving_objects();
for (base= FIRSTBASE; base; base= base->next) {
base->flag &= ~(BA_PARSEL+BA_WASSEL);
/* Recalculate the pose if necessary, regardless of
* whether the layer is visible or not.
*/
if (pose_do_update_flag(base->object))
base->flag |= BA_WHERE_UPDATE;
if( (base->lay & G.vd->lay) && base->object->id.lib==0) {
Object *ob= base->object;
Object *parsel= is_a_parent_selected(ob);
@@ -3700,10 +3710,6 @@ void special_trans_update(int keyflags)
base->object->partype |= PARSLOW;
}
else if(base->flag & BA_WHERE_UPDATE) {
/* deal with the armature case */
pose_flags_reset_done(base->object);
make_displists_by_armature(base->object);
where_is_object(base->object);
if(base->object->type==OB_IKA) {
itterate_ika(base->object);
@@ -3724,6 +3730,16 @@ void special_trans_update(int keyflags)
}
base= FIRSTBASE;
while(base) {
if (pose_flags_reset_done(base->object)) {
if (!is_delay_deform())
make_displists_by_armature(base->object);
}
base= base->next;
}
#if 1
if (G.obpose && G.obpose->type == OB_ARMATURE)
clear_pose_constraint_status(G.obpose);
@@ -4486,6 +4502,7 @@ void transform(int mode)
case OB_ARMATURE:
/* figure out which bones need calculating */
figure_bone_nocalc(G.obpose);
figure_pose_updating();
make_trans_bones(mode);
break;
}
@@ -4497,7 +4514,7 @@ void transform(int mode)
else if (mode=='s' || mode=='S') opt= 's';
setbaseflags_for_editing(opt);
figure_pose_updating();
make_trans_objects();
}