diff options
Diffstat (limited to 'source/creator/creator.c')
-rw-r--r-- | source/creator/creator.c | 110 |
1 files changed, 43 insertions, 67 deletions
diff --git a/source/creator/creator.c b/source/creator/creator.c index e17b0f66977..84ee7c319f9 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -70,14 +70,14 @@ #include "BLO_writefile.h" #include "BLO_readfile.h" -#include "BDR_drawmesh.h" - #include "IMB_imbuf.h" // for quicktime_init #include "BPY_extern.h" #include "RE_pipeline.h" +#include "GPU_draw.h" + #include "playanim_ext.h" #include "mydevice.h" #include "nla.h" @@ -107,8 +107,8 @@ extern char * build_type; #endif /* Local Function prototypes */ -static void print_help(); -static void print_version(); +static void print_help(void); +static void print_version(void); /* defined in ghostwinlay and winlay, we can't include carbon here, conflict with DNA */ @@ -128,7 +128,7 @@ char bprogname[FILE_MAXDIR+FILE_MAXFILE]; /* from blenpluginapi:pluginapi.c */ char btempdir[FILE_MAXDIR+FILE_MAXFILE]; /* Initialise callbacks for the modules that need them */ -void setCallbacks(void); +static void setCallbacks(void); #if defined(__sgi) || defined(__alpha__) static void fpe_handler(int sig) @@ -202,6 +202,7 @@ static void print_help(void) printf (" -p <sx> <sy>\tOpen with lower left corner at <sx>, <sy>\n"); printf (" -m\t\tRead from disk (Don't buffer)\n"); printf (" -f <fps> <fps-base>\t\tSpecify FPS to start with\n"); + printf (" -j <frame>\tSet frame step to <frame>\n"); printf ("\nWindow options:\n"); printf (" -w\t\tForce opening with borders (default)\n"); @@ -218,6 +219,7 @@ static void print_help(void) printf ("\nMisc options:\n"); printf (" -d\t\tTurn debugging on\n"); printf (" -noaudio\tDisable audio on systems that support audio\n"); + printf (" -nojoystick\tDisable joystick support\n"); printf (" -h\t\tPrint this help text\n"); printf (" -y\t\tDisable automatic python script execution (scriptlinks, pydrivers, pyconstraints, pynodes)\n"); printf (" -P <filename>\tRun the given Python script (filename or Blender Text)\n"); @@ -267,7 +269,7 @@ static void main_init_screen( void ) int main(int argc, char **argv) { - int a, i, stax=0, stay=0, sizx, sizy, scr_init = 0; + int a, i, stax, stay, sizx, sizy, scr_init = 0; SYS_SystemHandle syshandle; #if defined(WIN32) || defined (__linux__) @@ -301,10 +303,10 @@ int main(int argc, char **argv) setprefsize(left +10,scr_y - bottom +10,right-left -20,bottom - 64, 0); } else { - winlay_get_screensize(&scr_x, &scr_y); + winlay_get_screensize(&scr_x, &scr_y); - /* 40 + 684 + (headers) 22 + 22 = 768, the powerbook screen height */ - setprefsize(120, 40, 850, 684, 0); + /* 40 + 684 + (headers) 22 + 22 = 768, the powerbook screen height */ + setprefsize(120, 40, 850, 684, 0); } winlay_process_events(0); @@ -430,11 +432,11 @@ int main(int argc, char **argv) init_def_material(); - winlay_get_screensize(&sizx, &sizy); - stax=0; - stay=0; - if(G.background==0) { + winlay_get_screensize(&sizx, &sizy); + stax=0; + stay=0; + for(a=1; a<argc; a++) { if(argv[a][0] == '-') { switch(argv[a][1]) { @@ -492,6 +494,14 @@ int main(int argc, char **argv) audio = 0; if (G.f & G_DEBUG) printf("setting audio to: %d\n", audio); } + if (BLI_strcasecmp(argv[a], "-nojoystick") == 0) { + /** + don't initialize joysticks if user doesn't want to use joysticks + failed joystick initialization delays over 5 seconds, before game engine start + */ + SYS_WriteCommandLineInt(syshandle,"nojoystick",1); + if (G.f & G_DEBUG) printf("disabling nojoystick\n"); + } break; } } @@ -600,12 +610,12 @@ int main(int argc, char **argv) /* doMipMap */ if (!strcmp(argv[a],"nomipmap")) { - set_mipmap(0); //doMipMap = 0; + GPU_set_mipmap(0); //doMipMap = 0; } /* linearMipMap */ if (!strcmp(argv[a],"linearmipmap")) { - set_linear_mipmap(1); //linearMipMap = 1; + GPU_set_linear_mipmap(1); //linearMipMap = 1; } @@ -618,23 +628,14 @@ int main(int argc, char **argv) if (G.scene) { if (a < argc) { int frame= MIN2(MAXFRAME, MAX2(1, atoi(argv[a]))); - int slink_flag= 0; Render *re= RE_NewRender(G.scene->id.name); - if (G.f & G_DOSCRIPTLINKS) { - BPY_do_all_scripts(SCRIPT_RENDER); - /* avoid FRAMECHANGED slink event - * (should only be triggered in anims): */ - G.f &= ~G_DOSCRIPTLINKS; - slink_flag= 1; - } + if (G.f & G_DOSCRIPTLINKS) + BPY_do_all_scripts(SCRIPT_RENDER, 0); - RE_BlenderAnim(re, G.scene, frame, frame); + RE_BlenderAnim(re, G.scene, frame, frame, G.scene->frame_step); - if (slink_flag) { - G.f |= G_DOSCRIPTLINKS; - BPY_do_all_scripts(SCRIPT_POSTRENDER); - } + BPY_do_all_scripts(SCRIPT_POSTRENDER, 0); } } else { printf("\nError: no blend loaded. cannot use '-f'.\n"); @@ -645,12 +646,12 @@ int main(int argc, char **argv) Render *re= RE_NewRender(G.scene->id.name); if (G.f & G_DOSCRIPTLINKS) - BPY_do_all_scripts(SCRIPT_RENDER); + BPY_do_all_scripts(SCRIPT_RENDER, 1); - RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra); + RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra, G.scene->frame_step); if (G.f & G_DOSCRIPTLINKS) - BPY_do_all_scripts(SCRIPT_POSTRENDER); + BPY_do_all_scripts(SCRIPT_POSTRENDER, 1); } else { printf("\nError: no blend loaded. cannot use '-a'.\n"); } @@ -678,6 +679,15 @@ int main(int argc, char **argv) printf("\nError: no blend loaded. cannot use '-e'.\n"); } break; + case 'j': + a++; + if(G.scene) { + int fstep= MIN2(MAXFRAME, MAX2(1, atoi(argv[a]))); + if (a < argc) (G.scene->frame_step) = fstep; + } else { + printf("\nError: no blend loaded. cannot use '-j'.\n"); + } + break; case 'P': a++; if (a < argc) { @@ -772,44 +782,10 @@ int main(int argc, char **argv) else { /* Make the path absolute because its needed for relative linked blends to be found */ - int abs = 0; - int filelen; - char cwd[FILE_MAXDIR + FILE_MAXFILE]; char filename[FILE_MAXDIR + FILE_MAXFILE]; - cwd[0] = filename[0] = '\0'; BLI_strncpy(filename, argv[a], sizeof(filename)); - filelen = strlen(filename); - - /* relative path checks, could do more tests here... */ -#ifdef WIN32 - /* Account for X:/ and X:\ - should be enough */ - if (filelen >= 3 && filename[1] == ':' && (filename[2] == '\\' || filename[2] == '/')) - abs = 1; -#else - if (filelen >= 2 && filename[0] == '/') - abs = 1 ; -#endif - if (!abs) { - BLI_getwdN(cwd); /* incase the full path to the blend isnt used */ - - if (cwd[0] == '\0') { - printf( - "Could not get the current working directory - $PWD for an unknown reason.\n\t" - "Relative linked files will not load if the entire blend path is not used.\n\t" - "The 'Play' button may also fail.\n" - ); - } else { - /* uses the blend path relative to cwd important for loading relative linked files. - * - * cwd should contain c:\ etc on win32 so the relbase can be NULL - * relbase being NULL also prevents // being misunderstood as relative to the current - * blend file which isnt a feature we want to use in this case since were dealing - * with a path from the command line, rather then from inside Blender */ - - BLI_make_file_string(NULL, filename, cwd, argv[a]); - } - } + BLI_convertstringcwd(filename); if (G.background) { int retval = BKE_read_file(filename, NULL); @@ -855,7 +831,7 @@ static void mem_error_cb(char *errorStr) fflush(stderr); } -void setCallbacks(void) +static void setCallbacks(void) { /* Error output from the alloc routines: */ MEM_set_error_callback(mem_error_cb); |