Checked some regression files (2.37) and found issues with correct backward

conversion of data still. Remains a painful issue to get things converted
and in same time prevent things from calculated twice. :)

Anyhoo, issue was that old files with armatures in hidden layers went wrong
This commit is contained in:
2005-09-12 13:02:36 +00:00
parent 45fe89364d
commit 999392e4b7
3 changed files with 17 additions and 15 deletions

View File

@@ -965,13 +965,13 @@ void armature_rebuild_pose(Object *ob, bArmature *arm)
BLI_freelinkN(&pose->chanbase, pchan); // constraints?
}
}
//printf("rebuild pose, %d bones\n", counter);
if(counter<2) return;
// printf("rebuild pose %s, %d bones\n", ob->id.name, counter);
update_pose_constraint_flags(ob->pose); // for IK detection for example
/* the sorting */
DAG_pose_sort(ob);
if(counter>1)
DAG_pose_sort(ob);
ob->pose->flag &= ~POSE_RECALC;
}

View File

@@ -306,6 +306,7 @@ static void clean_paths(Main *main)
static void setup_app_data(BlendFileData *bfd, char *filename)
{
Object *ob;
bScreen *curscreen= NULL;
Scene *curscene= NULL;
char mode;
@@ -376,6 +377,11 @@ static void setup_app_data(BlendFileData *bfd, char *filename)
G.f= bfd->globalf;
/* last stage of do_versions actually, update objects (like recalc poses) */
for(ob= G.main->object.first; ob; ob= ob->id.next) {
if(ob->recalc) object_handle_update(ob);
}
if (!G.background) {
setscreen(G.curscreen);
}

View File

@@ -1374,15 +1374,15 @@ static void direct_link_constraints(FileData *fd, ListBase *lb)
static void lib_link_pose(FileData *fd, Object *ob, bPose *pose)
{
bPoseChannel *chan;
bPoseChannel *pchan;
bArmature *arm= ob->data;
if (!pose)
return;
for (chan = pose->chanbase.first; chan; chan=chan->next) {
lib_link_constraints(fd, (ID *)ob, &chan->constraints);
for (pchan = pose->chanbase.first; pchan; pchan=pchan->next) {
lib_link_constraints(fd, (ID *)ob, &pchan->constraints);
// hurms... loop in a loop, but yah... later... (ton)
chan->bone= get_named_bone(arm, chan->name);
pchan->bone= get_named_bone(arm, pchan->name);
}
}
@@ -4193,7 +4193,6 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
bScreen *sc;
Object *ob;
/* As of now, this insures that the transition from the old Track system
to the new full constraint Track is painless for everyone. - theeth
*/
@@ -4791,10 +4790,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
// btw. armature_rebuild_pose is further only called on leave editmode
if(ob->type==OB_ARMATURE) {
if(ob->pose) {
if(ob->pose)
ob->pose->flag |= POSE_RECALC;
ob->recalc |= OB_RECALC;
}
ob->recalc |= OB_RECALC; // cannot call stuff now (pointers!), done in setup_app_data
/* new generic xray option */
arm= newlibadr(fd, lib, ob->data);
if(arm->flag & ARM_DRAWXRAY) {
@@ -4898,10 +4897,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
bPoseChannel *pchan;
bConstraint *con;
for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
/* 2.38 files can be saved wrong still... */
if(pchan->bone==NULL)
ob->pose->flag |= POSE_RECALC;
// note, pchan->bone is also lib-link stuff
if (pchan->limitmin[0] == 0.0f && pchan->limitmax[0] == 0.0f) {
pchan->limitmin[0]= pchan->limitmin[1]= pchan->limitmin[2]= -180.0f;
pchan->limitmax[0]= pchan->limitmax[1]= pchan->limitmax[2]= 180.0f;