diff options
Diffstat (limited to 'source/blender/blenloader/intern/readfile.c')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 71 |
1 files changed, 30 insertions, 41 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 606fd48dc2b..6b06f1cc96d 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -206,7 +206,7 @@ * - join all Mains * - link all LibBlocks and indirect pointers to libblocks * - initialize FileGlobal and copy pointers to Global - */ +*/ /* also occurs in library.c */ /* GS reads the memory pointed at in a specific ordering. There are, @@ -3841,6 +3841,35 @@ static void direct_link_mesh(FileData *fd, Mesh *mesh) direct_link_customdata(fd, &mesh->ldata, mesh->totloop); direct_link_customdata(fd, &mesh->pdata, mesh->totpoly); + +#ifdef USE_BMESH_FORWARD_COMPAT + /* NEVER ENABLE THIS CODE INTO BMESH! + * THIS IS FOR LOADING BMESH INTO OLDER FILES ONLY */ + mesh->mpoly = newdataadr(fd, mesh->mpoly); + mesh->mloop = newdataadr(fd, mesh->mloop); + + direct_link_customdata(fd, &mesh->pdata, mesh->totpoly); + direct_link_customdata(fd, &mesh->ldata, mesh->totloop); + + if (mesh->mpoly) { + /* be clever and load polygons as mfaces */ + mesh->totface= BKE_mesh_mpoly_to_mface(&mesh->fdata, &mesh->ldata, &mesh->pdata, + mesh->totface, mesh->totloop, mesh->totpoly); + + CustomData_free(&mesh->pdata, mesh->totpoly); + memset(&mesh->pdata, 0, sizeof(CustomData)); + mesh->totpoly = 0; + + CustomData_free(&mesh->ldata, mesh->totloop); + memset(&mesh->ldata, 0, sizeof(CustomData)); + mesh->totloop = 0; + + mesh_update_customdata_pointers(mesh); + } + +#endif + + mesh->bb = NULL; mesh->edit_btmesh = NULL; @@ -7038,15 +7067,6 @@ static void do_version_ntree_keying_despill_balance(void *UNUSED(data), ID *UNUS } } -static void do_version_ntree_tex_coord_from_dupli_264(void *UNUSED(data), ID *UNUSED(id), bNodeTree *ntree) -{ - bNode *node; - - for (node = ntree->nodes.first; node; node = node->next) - if (node->type == SH_NODE_TEX_COORD) - node->flag |= NODE_OPTIONS; -} - static void do_versions(FileData *fd, Library *lib, Main *main) { /* WATCH IT!!!: pointers from libdata have not been converted */ @@ -8004,37 +8024,6 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } - if (main->versionfile < 264 || (main->versionfile == 264 && main->subversionfile < 1)) { - bNodeTreeType *ntreetype = ntreeGetType(NTREE_SHADER); - bNodeTree *ntree; - - if (ntreetype && ntreetype->foreach_nodetree) - ntreetype->foreach_nodetree(main, NULL, do_version_ntree_tex_coord_from_dupli_264); - - for (ntree=main->nodetree.first; ntree; ntree=ntree->id.next) - if (ntree->type==NTREE_SHADER) - do_version_ntree_tex_coord_from_dupli_264(NULL, NULL, ntree); - } - - if (main->versionfile < 264 || (main->versionfile == 264 && main->subversionfile < 2)) { - MovieClip *clip; - - for (clip = main->movieclip.first; clip; clip = clip->id.next) { - MovieTracking *tracking = &clip->tracking; - MovieTrackingObject *tracking_object; - - for (tracking_object = tracking->objects.first; - tracking_object; - tracking_object = tracking_object->next) - { - if (tracking_object->keyframe1 == 0 && tracking_object->keyframe2 == 0) { - tracking_object->keyframe1 = tracking->settings.keyframe1; - tracking_object->keyframe2 = tracking->settings.keyframe2; - } - } - } - } - /* WATCH IT!!!: pointers from libdata have not been converted yet here! */ /* WATCH IT 2!: Userdef struct init has to be in editors/interface/resources.c! */ |