diff options
-rw-r--r-- | source/blender/blenkernel/intern/blender.c | 25 | ||||
-rw-r--r-- | source/blender/src/usiblender.c | 240 | ||||
-rw-r--r-- | source/creator/creator.c | 2 | ||||
-rw-r--r-- | source/nan_compile.mk | 4 | ||||
-rw-r--r-- | source/nan_definitions.mk | 2 |
5 files changed, 144 insertions, 129 deletions
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index bd14e6c58e2..69363f4d9af 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -303,20 +303,13 @@ static void setup_app_data(BlendFileData *bfd, char *filename) G.main= bfd->main; if (bfd->user) { + + /* only here free userdef themes... */ + BLI_freelistN(&U.themes); + U= *bfd->user; MEM_freeN(bfd->user); - /* the UserDef struct is not corrected with do_versions() .... ugh! */ - if(U.wheellinescroll == 0) U.wheellinescroll = 3; - if(U.menuthreshold1==0) { - U.menuthreshold1= 5; - U.menuthreshold2= 2; - } - if(U.tb_leftmouse==0) { - U.tb_leftmouse= 5; - U.tb_rightmouse= 5; - } - if(U.mixbufsize==0) U.mixbufsize= 2048; } /* case G_FILE_NO_UI or no screens in file */ @@ -374,16 +367,24 @@ static void setup_app_data(BlendFileData *bfd, char *filename) MEM_freeN(bfd); } +/* returns: + 0: no load file + 1: OK + 2: OK, and with new user settings +*/ + int BKE_read_file(char *dir, void *type_r) { BlendReadError bre; BlendFileData *bfd; + int retval= 1; if (!G.background) waitcursor(1); bfd= BLO_read_from_file(dir, &bre); if (bfd) { + if(bfd->user) retval= 2; if (type_r) *((BlenFileType*)type_r)= bfd->type; @@ -395,7 +396,7 @@ int BKE_read_file(char *dir, void *type_r) if (!G.background) waitcursor(0); - return (bfd?1:0); + return (bfd?retval:0); } int BKE_read_file_from_memory(char* filebuf, int filelength, void *type_r) diff --git a/source/blender/src/usiblender.c b/source/blender/src/usiblender.c index 8c1632b88d9..9bc8a1a152a 100644 --- a/source/blender/src/usiblender.c +++ b/source/blender/src/usiblender.c @@ -125,6 +125,104 @@ /***/ +/* patching UserDef struct, set globals for UI stuff */ +static void init_userdef_file(void) +{ + + BIF_InitTheme(); // sets default again + + mainwindow_set_filename_to_title(""); // empty string re-initializes title to "Blender" + countall(); + G.save_over = 0; // start with save preference untitled.blend + + /* disable autoplay in .B.blend... */ + G.fileflags &= ~G_FILE_AUTOPLAY; + + /* the UserDef struct is not corrected with do_versions() .... ugh! */ + if(U.wheellinescroll == 0) U.wheellinescroll = 3; + if(U.menuthreshold1==0) { + U.menuthreshold1= 5; + U.menuthreshold2= 2; + } + if(U.tb_leftmouse==0) { + U.tb_leftmouse= 5; + U.tb_rightmouse= 5; + } + if(U.mixbufsize==0) U.mixbufsize= 2048; + if (BLI_streq(U.tempdir, "/")) { + char *tmp= getenv("TEMP"); + + strcpy(U.tempdir, tmp?tmp:"/tmp/"); + } + if (U.savetime <= 0) { + U.savetime = 1; + error(".B.blend is buggy, please consider removing it.\n"); + } + if (G.main->versionfile <= 191) { + strcpy(U.plugtexdir, U.textudir); + strcpy(U.sounddir, "/"); + } + + /* patch to set Dupli Armature */ + if (G.main->versionfile < 220) { + U.dupflag |= USER_DUP_ARM; + } + + /* userdef new option */ + if (G.main->versionfile <= 222) { + U.vrmlflag= USER_VRML_LAYERS; + } + + /* added seam, normal color, undo */ + if (G.main->versionfile <= 234) { + bTheme *btheme; + + U.uiflag |= USER_GLOBALUNDO; + + for(btheme= U.themes.first; btheme; btheme= btheme->next) { + /* check for alpha==0 is safe, then color was never set */ + if(btheme->tv3d.edge_seam[3]==0) { + btheme->tv3d.edge_seam[0]= 230; + btheme->tv3d.edge_seam[1]= 150; + btheme->tv3d.edge_seam[2]= 50; + btheme->tv3d.edge_seam[3]= 255; + } + if(btheme->tv3d.normal[3]==0) { + btheme->tv3d.normal[0]= 0x22; + btheme->tv3d.normal[1]= 0xDD; + btheme->tv3d.normal[2]= 0xDD; + btheme->tv3d.normal[3]= 255; + } + if(btheme->tv3d.face_dot[3]==0) { + btheme->tv3d.face_dot[0]= 255; + btheme->tv3d.face_dot[1]= 138; + btheme->tv3d.face_dot[2]= 48; + btheme->tv3d.face_dot[3]= 255; + btheme->tv3d.facedot_size= 4; + } + } + } + if (G.main->versionfile <= 235) { + /* illegal combo... */ + if (U.flag & USER_LMOUSESELECT) + U.flag &= ~USER_TWOBUTTONMOUSE; + } + + if (U.undosteps==0) U.undosteps=32; + + reset_autosave(); + +#ifdef INTERNATIONAL + read_languagefile(); + + if(U.transopts & USER_DOTRANSLATE) + start_interface_font(); + else + G.ui_international = FALSE; +#endif // INTERNATIONAL + +} + void BIF_read_file(char *name) { extern short winqueue_break; /* editscreen.c */ @@ -137,15 +235,16 @@ void BIF_read_file(char *name) /* we didn't succeed, now try to read Blender file calls readfile, calls toolbox, throws one more, on failure calls the stream, and that is stubbed.... */ - BKE_read_file(name, NULL); + int retval= BKE_read_file(name, NULL); - mainwindow_set_filename_to_title(G.main->name); countall(); sound_initialize_sounds(); winqueue_break= 1; /* leave queues everywhere */ + if(retval==2) init_userdef_file(); // in case a userdef is read from regular .blend + undo_editmode_clear(); BKE_reset_undo(); BKE_write_undo("original"); /* save current state */ @@ -153,6 +252,7 @@ void BIF_read_file(char *name) else BIF_undo_push("Import file"); } +/* only here settings for fullscreen */ int BIF_read_homefile(void) { char tstr[FILE_MAXDIR+FILE_MAXFILE], scestr[FILE_MAXDIR]; @@ -160,15 +260,12 @@ int BIF_read_homefile(void) int success; #ifdef _WIN32 // FULLSCREEN static int screenmode = -1; - + screenmode = U.uiflag & USER_FLIPFULLSCREEN; #endif - + BLI_make_file_string(G.sce, tstr, home, ".B.blend"); strcpy(scestr, G.sce); /* temporal store */ - - /* only here free userdef themes... */ - BLI_freelistN(&U.themes); /* prevent loading no UI */ G.fileflags &= ~G_FILE_NO_UI; @@ -179,118 +276,37 @@ int BIF_read_homefile(void) success = BKE_read_file_from_memory(datatoc_B_blend, datatoc_B_blend_size, NULL); } strcpy(G.sce, scestr); - - BIF_InitTheme(); // sets default again - - if (success) { - mainwindow_set_filename_to_title(tstr); - countall(); - G.save_over = 0; - - /* disable autoplay in .B.blend... */ - G.fileflags &= ~G_FILE_AUTOPLAY; - + #ifdef _WIN32 // FULLSCREEN - /* choose window startmode */ - switch (G.windowstate){ - case G_WINDOWSTATE_USERDEF: /* use the usersetting */ - break; - case G_WINDOWSTATE_FULLSCREEN: /* force fullscreen */ - U.uiflag |= USER_FLIPFULLSCREEN; - break; - case G_WINDOWSTATE_BORDER: /* force with borders */ - U.uiflag &= ~USER_FLIPFULLSCREEN; - } - - if(screenmode != (U.uiflag & USER_FLIPFULLSCREEN)) { - mainwindow_toggle_fullscreen ((U.uiflag & USER_FLIPFULLSCREEN)); - screenmode = (U.uiflag & USER_FLIPFULLSCREEN); - } -#endif - - if (BLI_streq(U.tempdir, "/")) { - char *tmp= getenv("TEMP"); - - strcpy(U.tempdir, tmp?tmp:"/tmp/"); - } - if (U.savetime <= 0) { - U.savetime = 1; - error("%s is buggy, please consider removing it.\n", - tstr); - } - if (G.main->versionfile <= 191) { - strcpy(U.plugtexdir, U.textudir); - strcpy(U.sounddir, "/"); - } - - /* patch to set Dupli Armature */ - if (G.main->versionfile < 220) { - U.dupflag |= USER_DUP_ARM; - } - - /* userdef new option */ - if (G.main->versionfile <= 222) { - U.vrmlflag= USER_VRML_LAYERS; - } - - /* added seam, normal color, undo */ - if (G.main->versionfile <= 234) { - bTheme *btheme; - - U.uiflag |= USER_GLOBALUNDO; - - for(btheme= U.themes.first; btheme; btheme= btheme->next) { - /* check for alpha==0 is safe, then color was never set */ - if(btheme->tv3d.edge_seam[3]==0) { - btheme->tv3d.edge_seam[0]= 230; - btheme->tv3d.edge_seam[1]= 150; - btheme->tv3d.edge_seam[2]= 50; - btheme->tv3d.edge_seam[3]= 255; - } - if(btheme->tv3d.normal[3]==0) { - btheme->tv3d.normal[0]= 0x22; - btheme->tv3d.normal[1]= 0xDD; - btheme->tv3d.normal[2]= 0xDD; - btheme->tv3d.normal[3]= 255; - } - if(btheme->tv3d.face_dot[3]==0) { - btheme->tv3d.face_dot[0]= 255; - btheme->tv3d.face_dot[1]= 138; - btheme->tv3d.face_dot[2]= 48; - btheme->tv3d.face_dot[3]= 255; - btheme->tv3d.facedot_size= 4; - } - } - } - if (G.main->versionfile <= 235) { - /* illegal combo... */ - if (U.flag & USER_LMOUSESELECT) - U.flag &= ~USER_TWOBUTTONMOUSE; - } - - space_set_commmandline_options(); - - if (U.undosteps==0) U.undosteps=32; - undo_editmode_clear(); - BKE_reset_undo(); - BKE_write_undo("original"); /* save current state */ - - reset_autosave(); - -#ifdef INTERNATIONAL - read_languagefile(); + /* choose window startmode */ + switch (G.windowstate){ + case G_WINDOWSTATE_USERDEF: /* use the usersetting */ + break; + case G_WINDOWSTATE_FULLSCREEN: /* force fullscreen */ + U.uiflag |= USER_FLIPFULLSCREEN; + break; + case G_WINDOWSTATE_BORDER: /* force with borders */ + U.uiflag &= ~USER_FLIPFULLSCREEN; + } - if(U.transopts & USER_DOTRANSLATE) - start_interface_font(); - else - G.ui_international = FALSE; -#endif // INTERNATIONAL - + if(screenmode != (U.uiflag & USER_FLIPFULLSCREEN)) { + mainwindow_toggle_fullscreen ((U.uiflag & USER_FLIPFULLSCREEN)); + screenmode = (U.uiflag & USER_FLIPFULLSCREEN); } +#endif + + space_set_commmandline_options(); + + init_userdef_file(); + undo_editmode_clear(); + BKE_reset_undo(); + BKE_write_undo("original"); /* save current state */ + return success; } + static void get_autosave_location(char buf[FILE_MAXDIR+FILE_MAXFILE]) { char pidstr[32]; diff --git a/source/creator/creator.c b/source/creator/creator.c index acc5f28281b..e7d7e815566 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -72,8 +72,6 @@ #include "BLO_writefile.h" #include "BLO_readfile.h" -#include "BSE_headerbuttons.h" // for BIF_read_homefile - #include "BDR_drawmesh.h" #include "IMB_imbuf.h" // for quicktime_init diff --git a/source/nan_compile.mk b/source/nan_compile.mk index 17f05e46e2a..83cc501f147 100644 --- a/source/nan_compile.mk +++ b/source/nan_compile.mk @@ -78,8 +78,8 @@ endif ifeq ($(OS),darwin) CC = gcc CCC = g++ - CFLAGS += -pipe -fPIC -ffast-math - CCFLAGS += -pipe -fPIC + CFLAGS += -pipe -fPIC -ffast-math -mcpu=7450 -mtune=7450 + CCFLAGS += -pipe -fPIC REL_CFLAGS += -O2 REL_CCFLAGS += -O2 CPPFLAGS += -D_THREAD_SAFE diff --git a/source/nan_definitions.mk b/source/nan_definitions.mk index 721bb694b59..9b5e093a6bf 100644 --- a/source/nan_definitions.mk +++ b/source/nan_definitions.mk @@ -137,7 +137,7 @@ endif export ID = $(shell whoami) export HOST = $(shell hostname -s) - export PY_FRAMEWORK = 1 +# export PY_FRAMEWORK = 1 ifdef PY_FRAMEWORK export NAN_PYTHON ?= /System/Library/Frameworks/Python.framework/Versions/2.3 |