From 999392e4b7fa73afe271a0429dc1618cd869617b Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Mon, 12 Sep 2005 13:02:36 +0000 Subject: [PATCH] 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 --- source/blender/blenkernel/intern/armature.c | 6 +++--- source/blender/blenkernel/intern/blender.c | 6 ++++++ source/blender/blenloader/intern/readfile.c | 20 ++++++++------------ 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index d5e087c44f9..fefc9a042b3 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -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; } diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index f439a124460..b08b99a4010 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -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); } diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 06e0f38ec0f..96e10a71479 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -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;