Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiika Hamalainen <blender@miikah.org>2011-11-05 12:04:49 +0400
committerMiika Hamalainen <blender@miikah.org>2011-11-05 12:04:49 +0400
commit2ed6f077b3952123d56916980d18a379ecb3e5ac (patch)
tree1aa273e5566c95214739fb224d4c6cf115417882 /source/blender/blenloader
parentb9c83456b27da57a14bcf8d274b460e670d49990 (diff)
parent62f22185546e80b661424b45c88006f8b592d8b1 (diff)
Merge with trunk r41545
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r--source/blender/blenloader/BLO_readfile.h1
-rw-r--r--source/blender/blenloader/intern/readfile.c175
-rw-r--r--source/blender/blenloader/intern/writefile.c19
3 files changed, 97 insertions, 98 deletions
diff --git a/source/blender/blenloader/BLO_readfile.h b/source/blender/blenloader/BLO_readfile.h
index 1777979c3ab..38925ea5238 100644
--- a/source/blender/blenloader/BLO_readfile.h
+++ b/source/blender/blenloader/BLO_readfile.h
@@ -44,7 +44,6 @@ struct MemFile;
struct ReportList;
struct Scene;
struct SpaceFile;
-struct SpaceImaSel;
struct UserDef;
struct bContext;
struct BHead;
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 629c6e8d3ca..2711c072a8f 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -141,6 +141,8 @@
#include "BLO_readfile.h"
#include "BLO_undofile.h"
+#include "RE_engine.h"
+
#include "readfile.h"
#include "PIL_time.h"
@@ -2181,6 +2183,7 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open))
for(ntree= main->nodetree.first; ntree; ntree= ntree->id.next)
if (ntree->update)
ntreeUpdateTree(ntree);
+
for (i=0; i < NUM_NTREE_TYPES; ++i) {
ntreetype= ntreeGetType(i);
if (ntreetype && ntreetype->foreach_nodetree)
@@ -2506,6 +2509,9 @@ static void lib_link_lamp(FileData *fd, Main *main)
}
la->ipo= newlibadr_us(fd, la->id.lib, la->ipo); // XXX depreceated - old animation system
+
+ if(la->nodetree)
+ lib_link_ntree(fd, &la->id, la->nodetree);
la->id.flag -= LIB_NEEDLINK;
}
@@ -2527,6 +2533,10 @@ static void direct_link_lamp(FileData *fd, Lamp *la)
la->curfalloff= newdataadr(fd, la->curfalloff);
if(la->curfalloff)
direct_link_curvemapping(fd, la->curfalloff);
+
+ la->nodetree= newdataadr(fd, la->nodetree);
+ if(la->nodetree)
+ direct_link_nodetree(fd, la->nodetree);
la->preview = direct_link_preview_image(fd, la->preview);
}
@@ -2669,6 +2679,9 @@ static void lib_link_world(FileData *fd, Main *main)
mtex->object= newlibadr(fd, wrld->id.lib, mtex->object);
}
}
+
+ if(wrld->nodetree)
+ lib_link_ntree(fd, &wrld->id, wrld->nodetree);
wrld->id.flag -= LIB_NEEDLINK;
}
@@ -2686,6 +2699,11 @@ static void direct_link_world(FileData *fd, World *wrld)
for(a=0; a<MAX_MTEX; a++) {
wrld->mtex[a]= newdataadr(fd, wrld->mtex[a]);
}
+
+ wrld->nodetree= newdataadr(fd, wrld->nodetree);
+ if(wrld->nodetree)
+ direct_link_nodetree(fd, wrld->nodetree);
+
wrld->preview = direct_link_preview_image(fd, wrld->preview);
}
@@ -4962,15 +4980,6 @@ static void lib_link_screen(FileData *fd, Main *main)
sfile->folders_prev= NULL;
sfile->folders_next= NULL;
}
- else if(sl->spacetype==SPACE_IMASEL) {
- SpaceImaSel *simasel= (SpaceImaSel *)sl;
-
- simasel->files = NULL;
- simasel->returnfunc= NULL;
- simasel->menup= NULL;
- simasel->pupmenu= NULL;
- simasel->img= NULL;
- }
else if(sl->spacetype==SPACE_ACTION) {
SpaceAction *saction= (SpaceAction *)sl;
bDopeSheet *ads= &saction->ads;
@@ -5034,11 +5043,6 @@ static void lib_link_screen(FileData *fd, Main *main)
}
}
}
- else if(sl->spacetype==SPACE_SOUND) {
- SpaceSound *ssound= (SpaceSound *)sl;
-
- ssound->sound= newlibadr_us(fd, sc->id.lib, ssound->sound);
- }
else if(sl->spacetype==SPACE_NODE) {
SpaceNode *snode= (SpaceNode *)sl;
@@ -5051,6 +5055,10 @@ static void lib_link_screen(FileData *fd, Main *main)
if(snode->id) {
if(GS(snode->id->name)==ID_MA)
snode->nodetree= ((Material *)snode->id)->nodetree;
+ else if(GS(snode->id->name)==ID_WO)
+ snode->nodetree= ((World *)snode->id)->nodetree;
+ else if(GS(snode->id->name)==ID_LA)
+ snode->nodetree= ((Lamp *)snode->id)->nodetree;
else if(GS(snode->id->name)==ID_SCE)
snode->nodetree= ((Scene *)snode->id)->nodetree;
else if(GS(snode->id->name)==ID_TE)
@@ -5138,6 +5146,7 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene)
if(sl->spacetype==SPACE_VIEW3D) {
View3D *v3d= (View3D*) sl;
BGpic *bgpic;
+ ARegion *ar;
if(v3d->scenelock)
v3d->camera= NULL; /* always get from scene */
@@ -5173,6 +5182,15 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene)
/* not very nice, but could help */
if((v3d->layact & v3d->lay)==0) v3d->layact= v3d->lay;
+ /* free render engines for now */
+ for(ar= sa->regionbase.first; ar; ar= ar->next) {
+ RegionView3D *rv3d= ar->regiondata;
+
+ if(rv3d && rv3d->render_engine) {
+ RE_engine_free(rv3d->render_engine);
+ rv3d->render_engine= NULL;
+ }
+ }
}
else if(sl->spacetype==SPACE_IPO) {
SpaceIpo *sipo= (SpaceIpo *)sl;
@@ -5195,12 +5213,6 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene)
SpaceFile *sfile= (SpaceFile *)sl;
sfile->op= NULL;
}
- else if(sl->spacetype==SPACE_IMASEL) {
- SpaceImaSel *simasel= (SpaceImaSel *)sl;
- if (simasel->files) {
- //XXX BIF_filelist_freelib(simasel->files);
- }
- }
else if(sl->spacetype==SPACE_ACTION) {
SpaceAction *saction= (SpaceAction *)sl;
@@ -5267,11 +5279,6 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene)
}
}
}
- else if(sl->spacetype==SPACE_SOUND) {
- SpaceSound *ssound= (SpaceSound *)sl;
-
- ssound->sound= restore_pointer_by_name(newmain, (ID *)ssound->sound, 1);
- }
else if(sl->spacetype==SPACE_NODE) {
SpaceNode *snode= (SpaceNode *)sl;
@@ -5322,6 +5329,7 @@ static void direct_link_region(FileData *fd, ARegion *ar, int spacetype)
rv3d->depths= NULL;
rv3d->ri= NULL;
+ rv3d->render_engine= NULL;
rv3d->sms= NULL;
rv3d->smooth_timer= NULL;
}
@@ -5463,6 +5471,10 @@ static void direct_link_screen(FileData *fd, bScreen *sc)
v3d->afterdraw_xray.first= v3d->afterdraw_xray.last= NULL;
v3d->afterdraw_xraytransp.first= v3d->afterdraw_xraytransp.last= NULL;
v3d->properties_storage= NULL;
+
+ /* render can be quite heavy, set to wire on load */
+ if(v3d->drawtype == OB_RENDER)
+ v3d->drawtype = OB_WIRE;
view3d_split_250(v3d, &sl->regionbase);
}
@@ -6659,16 +6671,6 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
//ar->v2d.flag |= V2D_IS_INITIALISED;
break;
}
- case SPACE_SOUND:
- {
- SpaceSound *ssound= (SpaceSound *)sl;
- memcpy(&ar->v2d, &ssound->v2d, sizeof(View2D));
-
- ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
- ar->v2d.scroll |= (V2D_SCROLL_LEFT);
- //ar->v2d.flag |= V2D_IS_INITIALISED;
- break;
- }
case SPACE_NLA:
{
SpaceNla *snla= (SpaceNla *)sl;
@@ -6784,11 +6786,17 @@ static void do_versions_windowmanager_2_50(bScreen *screen)
area_add_window_regions(sa, sa->spacedata.first, &sa->regionbase);
- /* space imageselect is depricated */
+ /* space imageselect is deprecated */
for(sl= sa->spacedata.first; sl; sl= sl->next) {
if(sl->spacetype==SPACE_IMASEL)
- sl->spacetype= SPACE_INFO; /* spacedata then matches */
- }
+ sl->spacetype= SPACE_EMPTY; /* spacedata then matches */
+ }
+
+ /* space sound is deprecated */
+ for(sl= sa->spacedata.first; sl; sl= sl->next) {
+ if(sl->spacetype==SPACE_SOUND)
+ sl->spacetype= SPACE_EMPTY; /* spacedata then matches */
+ }
/* it seems to be possible in 2.5 to have this saved, filewindow probably */
sa->butspacetype= sa->spacetype;
@@ -7456,9 +7464,9 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
if(main->versionfile <= 200) {
Object *ob= main->object.first;
while(ob) {
- ob->scaflag = ob->gameflag & (64+128+256+512+1024+2048);
+ ob->scaflag = ob->gameflag & (OB_DO_FH|OB_ROT_FH|OB_ANISOTROPIC_FRICTION|OB_GHOST|OB_RIGID_BODY|OB_BOUNDS);
/* 64 is do_fh */
- ob->gameflag &= ~(128+256+512+1024+2048);
+ ob->gameflag &= ~(OB_ROT_FH|OB_ANISOTROPIC_FRICTION|OB_GHOST|OB_RIGID_BODY|OB_BOUNDS);
ob = ob->id.next;
}
}
@@ -8272,7 +8280,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
if(main->versionfile <= 233) {
bScreen *sc;
Material *ma= main->mat.first;
- Object *ob= main->object.first;
+ /* Object *ob= main->object.first; */
while(ma) {
if(ma->rampfac_col==0.0f) ma->rampfac_col= 1.0;
@@ -8282,11 +8290,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
/* this should have been done loooong before! */
+#if 0 /* deprecated in 2.5+ */
while(ob) {
if(ob->ipowin==0) ob->ipowin= ID_OB;
ob= ob->id.next;
}
-
+#endif
for (sc= main->screen.first; sc; sc= sc->id.next) {
ScrArea *sa;
for (sa= sc->areabase.first; sa; sa= sa->next) {
@@ -9188,7 +9197,6 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
if(main->versionfile <= 245) {
Scene *sce;
- bScreen *sc;
Object *ob;
Image *ima;
Lamp *la;
@@ -9278,49 +9286,6 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
for(ima= main->image.first; ima; ima= ima->id.next) {
ima->preview = NULL;
}
-
- /* repair imasel space - completely reworked */
- for(sc= main->screen.first; sc; sc= sc->id.next) {
- ScrArea *sa;
- sa= sc->areabase.first;
- while(sa) {
- SpaceLink *sl;
-
- for (sl= sa->spacedata.first; sl; sl= sl->next) {
- if(sl->spacetype==SPACE_IMASEL) {
- SpaceImaSel *simasel= (SpaceImaSel*) sl;
- simasel->blockscale= 0.7f;
- /* view 2D */
- simasel->v2d.tot.xmin= -10.0f;
- simasel->v2d.tot.ymin= -10.0f;
- simasel->v2d.tot.xmax= (float)sa->winx + 10.0f;
- simasel->v2d.tot.ymax= (float)sa->winy + 10.0f;
- simasel->v2d.cur.xmin= 0.0f;
- simasel->v2d.cur.ymin= 0.0f;
- simasel->v2d.cur.xmax= (float)sa->winx;
- simasel->v2d.cur.ymax= (float)sa->winy;
- simasel->v2d.min[0]= 1.0;
- simasel->v2d.min[1]= 1.0;
- simasel->v2d.max[0]= 32000.0f;
- simasel->v2d.max[1]= 32000.0f;
- simasel->v2d.minzoom= 0.5f;
- simasel->v2d.maxzoom= 1.21f;
- simasel->v2d.scroll= 0;
- simasel->v2d.keepzoom= V2D_LIMITZOOM|V2D_KEEPASPECT;
- simasel->v2d.keeptot= 0;
- simasel->prv_h = 96;
- simasel->prv_w = 96;
- simasel->flag = 7; /* ??? elubie */
- BLI_strncpy (simasel->dir, U.textudir, sizeof(simasel->dir)); /* TON */
- simasel->file[0]= '\0';
-
- simasel->returnfunc = NULL;
- simasel->title[0] = 0;
- }
- }
- sa = sa->next;
- }
- }
}
/* add point caches */
@@ -10804,7 +10769,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
Object *ob=main->object.first;
while (ob) {
/* shaded mode disabled for now */
- if (ob->dt == OB_SHADED) ob->dt = OB_TEXTURE;
+ if (ob->dt == OB_MATERIAL) ob->dt = OB_TEXTURE;
ob=ob->id.next;
}
}
@@ -10819,7 +10784,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
for(sl= sa->spacedata.first; sl; sl= sl->next) {
if(sl->spacetype==SPACE_VIEW3D) {
View3D *v3d = (View3D *)sl;
- if (v3d->drawtype == OB_SHADED) v3d->drawtype = OB_SOLID;
+ if (v3d->drawtype == OB_MATERIAL) v3d->drawtype = OB_SOLID;
}
}
}
@@ -12192,8 +12157,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
- /* put compatibility code here until next subversion bump */
- {
+ if (main->versionfile < 260){
{
/* set default alpha value of Image outputs in image and render layer nodes to 0 */
Scene *sce;
@@ -12226,6 +12190,31 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
}
+
+ }
+
+ if (main->versionfile < 260 || (main->versionfile == 260 && main->subversionfile < 1)){
+ Object *ob;
+
+ for (ob= main->object.first; ob; ob= ob->id.next) {
+ ob->collision_boundtype= ob->boundtype;
+ }
+
+ {
+ Camera *cam;
+ for(cam= main->camera.first; cam; cam= cam->id.next) {
+ if (cam->sensor_x < 0.01)
+ cam->sensor_x = DEFAULT_SENSOR_WIDTH;
+
+ if (cam->sensor_y < 0.01)
+ cam->sensor_y = DEFAULT_SENSOR_HEIGHT;
+ }
+ }
+ }
+
+ /* put compatibility code here until next subversion bump */
+ {
+
}
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
@@ -12814,6 +12803,9 @@ static void expand_lamp(FileData *fd, Main *mainvar, Lamp *la)
if (la->adt)
expand_animdata(fd, mainvar, la->adt);
+
+ if(la->nodetree)
+ expand_nodetree(fd, mainvar, la->nodetree);
}
static void expand_lattice(FileData *fd, Main *mainvar, Lattice *lt)
@@ -12841,6 +12833,9 @@ static void expand_world(FileData *fd, Main *mainvar, World *wrld)
if (wrld->adt)
expand_animdata(fd, mainvar, wrld->adt);
+
+ if(wrld->nodetree)
+ expand_nodetree(fd, mainvar, wrld->nodetree);
}
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 6d7bac9ed44..cb94ebcf8f1 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -1883,6 +1883,12 @@ static void write_worlds(WriteData *wd, ListBase *idbase)
for(a=0; a<MAX_MTEX; a++) {
if(wrld->mtex[a]) writestruct(wd, DATA, "MTex", 1, wrld->mtex[a]);
}
+
+ /* nodetree is integral part of lamps, no libdata */
+ if(wrld->nodetree) {
+ writestruct(wd, DATA, "bNodeTree", 1, wrld->nodetree);
+ write_nodetree(wd, wrld->nodetree);
+ }
write_previews(wd, wrld->preview);
}
@@ -1912,6 +1918,12 @@ static void write_lamps(WriteData *wd, ListBase *idbase)
if(la->curfalloff)
write_curvemapping(wd, la->curfalloff);
+ /* nodetree is integral part of lamps, no libdata */
+ if(la->nodetree) {
+ writestruct(wd, DATA, "bNodeTree", 1, la->nodetree);
+ write_nodetree(wd, la->nodetree);
+ }
+
write_previews(wd, la->preview);
}
@@ -2231,10 +2243,6 @@ static void write_screens(WriteData *wd, ListBase *scrbase)
if(sima->cumap)
write_curvemapping(wd, sima->cumap);
}
- else if(sl->spacetype==SPACE_IMASEL) {
- // XXX: depreceated... do we still want to keep this?
- writestruct(wd, DATA, "SpaceImaSel", 1, sl);
- }
else if(sl->spacetype==SPACE_TEXT) {
writestruct(wd, DATA, "SpaceText", 1, sl);
}
@@ -2246,9 +2254,6 @@ static void write_screens(WriteData *wd, ListBase *scrbase)
else if(sl->spacetype==SPACE_ACTION) {
writestruct(wd, DATA, "SpaceAction", 1, sl);
}
- else if(sl->spacetype==SPACE_SOUND) {
- writestruct(wd, DATA, "SpaceSound", 1, sl);
- }
else if(sl->spacetype==SPACE_NLA){
SpaceNla *snla= (SpaceNla *)sl;