fix for error in the blenderplayer caused by r54727 (can't assume G.main is valid on load).

This commit is contained in:
Campbell Barton 2013-02-23 01:33:47 +00:00
parent c00191dbe3
commit 9ef5d2d905
3 changed files with 11 additions and 7 deletions

@ -118,6 +118,7 @@ void DAG_scene_flush_update(struct Main *bmain, struct Scene *sce, unsigned i
void DAG_on_visible_update(struct Main *bmain, const short do_time);
/* tag datablock to get updated for the next redraw */
void DAG_id_tag_update_ex(struct Main *bmain, struct ID *id, short flag);
void DAG_id_tag_update(struct ID *id, short flag);
/* flush all tagged updates */
void DAG_ids_flush_tagged(struct Main *bmain);

@ -2914,12 +2914,10 @@ void DAG_ids_clear_recalc(Main *bmain)
memset(bmain->id_tag_update, 0, sizeof(bmain->id_tag_update));
}
void DAG_id_tag_update(ID *id, short flag)
void DAG_id_tag_update_ex(Main *bmain, ID *id, short flag)
{
Main *bmain = G.main;
if (id == NULL) return;
/* tag ID for update */
if (flag) {
if (flag & OB_RECALC_OB)
@ -2974,6 +2972,11 @@ void DAG_id_tag_update(ID *id, short flag)
}
}
void DAG_id_tag_update(ID *id, short flag)
{
DAG_id_tag_update_ex(G.main, id, flag);
}
void DAG_id_type_tag(Main *bmain, short idtype)
{
if (idtype == ID_NT) {

@ -2712,7 +2712,7 @@ static void direct_link_constraints(FileData *fd, ListBase *lb)
}
}
static void lib_link_pose(FileData *fd, Object *ob, bPose *pose)
static void lib_link_pose(FileData *fd, Main *bmain, Object *ob, bPose *pose)
{
bPoseChannel *pchan;
bArmature *arm = ob->data;
@ -2756,7 +2756,7 @@ static void lib_link_pose(FileData *fd, Object *ob, bPose *pose)
}
if (rebuild) {
DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
DAG_id_tag_update_ex(bmain, &ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
pose->flag |= POSE_RECALC;
}
}
@ -4221,7 +4221,7 @@ static void lib_link_object(FileData *fd, Main *main)
/* if id.us==0 a new base will be created later on */
/* WARNING! Also check expand_object(), should reflect the stuff below. */
lib_link_pose(fd, ob, ob->pose);
lib_link_pose(fd, main, ob, ob->pose);
lib_link_constraints(fd, &ob->id, &ob->constraints);
// XXX deprecated - old animation system <<<