~ubuntu-branches/ubuntu/gutsy/blender/gutsy-security

« back to all changes in this revision

Viewing changes to source/creator/creator.c

  • Committer: Bazaar Package Importer
  • Author(s): Florian Ernst
  • Date: 2005-11-06 12:40:03 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051106124003-3pgs7tcg5rox96xg
Tags: 2.37a-1.1
* Non-maintainer upload.
* Split out parts of 01_SConstruct_debian.dpatch again: root_build_dir
  really needs to get adjusted before the clean target runs - closes: #333958,
  see #288882 for reference

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * $Id: creator.c,v 1.36 2004/04/21 14:15:37 ton Exp $
 
2
 * $Id: creator.c,v 1.51 2005/05/08 21:20:34 ianwill Exp $
3
3
 *
4
4
 * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
5
5
 *
32
32
#include <stdlib.h>
33
33
#include <string.h>
34
34
 
35
 
#ifdef HAVE_CONFIG_H
36
 
#include <config.h>
37
 
#endif
38
 
 
39
35
/* This little block needed for linking to Blender... */
40
36
 
41
37
#include "MEM_guardedalloc.h"
72
68
#include "BLO_writefile.h"
73
69
#include "BLO_readfile.h"
74
70
 
75
 
#include "BSE_headerbuttons.h" // for BIF_read_homefile
76
 
 
77
71
#include "BDR_drawmesh.h"
78
72
 
79
73
#include "IMB_imbuf.h"  // for quicktime_init
109
103
static void print_help();
110
104
static void print_version();
111
105
 
 
106
 
 
107
/* defined in ghostwinlay and winlay, we can't include carbon here, conflict with DNA */
 
108
#ifdef __APPLE__
 
109
extern int checkAppleVideoCard(void);
 
110
extern void getMacAvailableBounds(short *top, short *left, short *bottom, short *right);
 
111
extern void     winlay_get_screensize(int *width_r, int *height_r);
 
112
extern void     winlay_process_events(int wait_for_event);
 
113
#endif
 
114
 
 
115
 
112
116
/* for the callbacks: */
113
117
 
114
118
extern int pluginapi_force_ref(void);  /* from blenpluginapi:pluginapi.c */
115
119
 
116
120
char bprogname[FILE_MAXDIR+FILE_MAXFILE]; /* from blenpluginapi:pluginapi.c */
117
121
 
 
122
 
118
123
/* Initialise callbacks for the modules that need them */
119
124
void setCallbacks(void); 
120
125
 
 
126
#if defined(__sgi) || defined(__alpha__)
121
127
static void fpe_handler(int sig)
122
128
{
123
129
        // printf("SIGFPE trapped\n");
124
130
}
 
131
#endif
125
132
 
126
133
/* handling ctrl-c event in console */
127
134
static void blender_esc(int sig)
181
188
        printf ("  -d\t\tTurn debugging on\n");
182
189
        printf ("  -noaudio\tDisable audio on systems that support audio\n");
183
190
        printf ("  -h\t\tPrint this help text\n");
184
 
        printf ("  -y\t\tDisable OnLoad scene scripts, use -Y to find out why its -y\n");
185
 
        printf ("  -P <filename>\tRun the given Python script\n");
 
191
        printf ("  -y\t\tDisable script links, use -Y to find out why its -y\n");
 
192
        printf ("  -P <filename>\tRun the given Python script (filename or Blender Text)\n");
186
193
#ifdef WIN32
187
194
        printf ("  -R\t\tRegister .blend extension\n");
188
195
#endif
192
199
 
193
200
double PIL_check_seconds_timer(void);
194
201
extern void winlay_get_screensize(int *width_r, int *height_r);
 
202
 
195
203
int main(int argc, char **argv)
196
204
{
197
205
        int a, i, stax, stay, sizx, sizy;
214
222
 
215
223
                argc= 1;
216
224
 
 
225
        /* first let us check if we are hardware accelerated and with VRAM > 16 Mo */
 
226
        
 
227
        if (checkAppleVideoCard()) {
 
228
                        short top, left, bottom, right;
 
229
                        
 
230
                        winlay_get_screensize(&scr_x, &scr_y); 
 
231
                        getMacAvailableBounds(&top, &left, &bottom, &right);
 
232
                        setprefsize(left +10,scr_y - bottom +10,right-left -20,bottom - 64);
 
233
 
 
234
        } else {
 
235
                                winlay_get_screensize(&scr_x, &scr_y);
 
236
 
217
237
                /* 40 + 684 + (headers) 22 + 22 = 768, the powerbook screen height */
218
238
                setprefsize(120, 40, 850, 684);
219
 
 
220
 
                winlay_get_screensize(&scr_x, &scr_y);
 
239
        }
 
240
    
221
241
                winlay_process_events(0);
222
242
                if (GHOST_HACK_getFirstFile(firstfilebuf)) {
223
243
                        argc= 2;
243
263
        // need this.
244
264
 
245
265
        BLI_where_am_i(bprogname, argv[0]);
246
 
        
 
266
 
247
267
                /* Hack - force inclusion of the plugin api functions,
248
268
                 * see blenpluginapi:pluginapi.c
249
269
                 */
255
275
        GEN_init_messaging_system();
256
276
 
257
277
        /* first test for background */
258
 
        G.f |= G_SCENESCRIPT; /* scenescript always set! */
 
278
 
 
279
        G.f |= G_DOSCRIPTLINKS; /* script links enabled by default */
 
280
 
259
281
        for(a=1; a<argc; a++) {
260
282
 
261
283
                /* Handle unix and windows style help requests */
283
305
                                a= argc;
284
306
                                break;
285
307
 
286
 
         case 'm':
287
 
             /* unified render pipeline */
288
 
/*               G.magic = 1; has become obsolete */
289
 
                         printf("-m: enable unified renderer has become obsolete. Set \n");
290
 
                         printf("\tthis option per individual file now.\n");
291
 
             break;
292
 
 
293
308
                        case 'y':
294
 
                                G.f &= ~G_SCENESCRIPT;
 
309
                                G.f &= ~G_DOSCRIPTLINKS;
295
310
                                break;
296
311
 
297
312
                        case 'Y':
298
 
                                printf ("-y was used to disable scene scripts because,\n");
 
313
                                printf ("-y was used to disable script links because,\n");
299
314
                                printf ("\t-p being taken, Ton was of the opinion that Y\n");
300
315
                                printf ("\tlooked like a split (disabled) snake, and also\n");
301
316
                                printf ("\twas similar to a python's tongue (unproven).\n\n");
333
348
 
334
349
                /* background render uses this font too */
335
350
        BKE_font_register_builtin(datatoc_Bfont, datatoc_Bfont_size);
336
 
                /* must be called here because R.winpos from default file */
 
351
                /* init struct R, Osa, defmaterial, filters */
337
352
        RE_init_render_data();
338
353
 
339
354
        if(G.background==0) {
376
391
                                         */ 
377
392
                                        winlay_get_screensize(&sizx, &sizy);
378
393
                                        setprefsize(0, 0, sizx, sizy);
379
 
#ifdef _WIN32   // FULLSCREEN
 
394
#if 0
 
395
//#ifdef _WIN32 // FULLSCREEN
380
396
                                        G.windowstate = G_WINDOWSTATE_BORDER;
381
397
#endif
382
398
                                        break;
383
399
                                case 'W':
384
400
                                                /* XXX, fixme zr, borderless on win32 */
385
 
#ifdef _WIN32   // FULLSCREEN
 
401
#if 0
 
402
//#ifdef _WIN32 // FULLSCREEN
386
403
                                        G.windowstate = G_WINDOWSTATE_FULLSCREEN;
387
404
#endif
388
405
                                        break;
394
411
                                        break;
395
412
                                case 'n':
396
413
                                case 'N':
397
 
                                        if (strcasecmp(argv[a], "-noaudio") == 0|| strcasecmp(argv[a], "-nosound") == 0) {
 
414
                                        if (BLI_strcasecmp(argv[a], "-noaudio") == 0|| BLI_strcasecmp(argv[a], "-nosound") == 0) {
398
415
                                                /**
399
416
                                                        notify the gameengine that no audio is wanted, even if the user didn't give
400
417
                                                        the flag -g noaudio.
404
421
                                                audio = 0;
405
422
                                                if (G.f & G_DEBUG) printf("setting audio to: %d\n", audio);
406
423
                                        }
407
 
                                        else if (strcasecmp(argv[a], "-nofrozen") == 0) {
408
 
                                                /* disable initialization of frozen python modules */
409
 
                                                if (G.f & G_DEBUG) printf("disable frozen modules\n");
410
 
                                                G.f |= G_NOFROZEN;
411
 
                                        }
412
424
                                        break;
413
425
                                }
414
426
                        }
415
427
                }
416
428
 
417
 
                BPY_start_python();
 
429
                BPY_start_python(argc, argv);
418
430
                
419
431
                /**
420
432
                 * NOTE: sound_init_audio() *must be* after start_python,
424
436
 
425
437
                BIF_init();
426
438
 
427
 
                /**
428
 
                 * NOTE: the U.pythondir string is NULL until BIF_init() is executed,
429
 
                 * so we provide the BPY_ function below to append the user defined
430
 
                 * pythondir to Python's sys.path at this point.  Simply putting
431
 
                 * BIF_init() before BPY_start_python() crashes Blender at startup.
432
 
                 * Update: now this function also inits the bpymenus, which also depend
433
 
                 * on U.pythondir.
434
 
                 */
435
 
 
436
 
                BPY_post_start_python();
437
439
        }
438
440
        else {
439
 
                BPY_start_python();
 
441
                BPY_start_python(argc, argv);
440
442
                
441
443
                // (ton) Commented out. I have no idea whats thisfor... will mail around!
442
444
                // SYS_WriteCommandLineInt(syshandle,"noaudio",1);
445
447
        // if (G.f & G_DEBUG) printf("setting audio to: %d\n", audio);
446
448
        }
447
449
 
448
 
        RE_init_filt_mask();
 
450
        /**
 
451
         * NOTE: the U.pythondir string is NULL until BIF_init() is executed,
 
452
         * so we provide the BPY_ function below to append the user defined
 
453
         * pythondir to Python's sys.path at this point.  Simply putting
 
454
         * BIF_init() before BPY_start_python() crashes Blender at startup.
 
455
         * Update: now this function also inits the bpymenus, which also depend
 
456
         * on U.pythondir.
 
457
         */
 
458
        BPY_post_start_python();
449
459
 
450
460
#ifdef WITH_QUICKTIME
451
461