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

« back to all changes in this revision

Viewing changes to source/blender/src/usiblender.c

  • Committer: Bazaar Package Importer
  • Author(s): Florian Ernst
  • Date: 2007-05-17 11:47:59 UTC
  • mfrom: (1.2.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20070517114759-yp4ybrnhp2u7pk66
Tags: 2.44-1
* New upstream release.
* Drop debian/patches/01_64bits_stupidity, not needed anymore: as of this
  version blender is 64 bits safe again. Adjust README.Debian accordingly.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/**
2
 
 * $Id: usiblender.c,v 1.140 2007/01/19 20:33:00 ton Exp $
 
2
 * $Id: usiblender.c,v 1.148 2007/04/16 07:01:51 broken Exp $
3
3
 *
4
4
 * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
5
5
 *
79
79
#include "BKE_global.h"
80
80
#include "BKE_main.h"
81
81
#include "BKE_mball.h"
 
82
#include "BKE_node.h"
82
83
#include "BKE_packedFile.h"
83
84
#include "BKE_utildefines.h"
84
85
 
305
306
                                SETCOL(btheme->tnode.syntaxv, 142, 138, 145, 255);      /* generator */
306
307
                                SETCOL(btheme->tnode.syntaxc, 120, 145, 120, 255);      /* group */
307
308
                        }
308
 
                        /* Group theme colours */
 
309
                        /* Group theme colors */
309
310
                        if(btheme->tv3d.group[3]==0) {
310
311
                                SETCOL(btheme->tv3d.group, 0x10, 0x40, 0x10, 255);
311
312
                                SETCOL(btheme->tv3d.group_active, 0x66, 0xFF, 0x66, 255);
339
340
                bTheme *btheme;
340
341
                
341
342
                for(btheme= U.themes.first; btheme; btheme= btheme->next) {
342
 
                        /* long keyframe colour */
 
343
                        /* long keyframe color */
343
344
                        /* check for alpha==0 is safe, then color was never set */
344
345
                        if(btheme->tact.strip[3]==0) {
345
346
                                SETCOL(btheme->tv3d.edge_sharp, 255, 32, 32, 255);
353
354
                        }
354
355
                }
355
356
        }
 
357
        if (G.main->versionfile <= 243) {
 
358
                /* set default number of recently-used files (if not set) */
 
359
                if (U.recent_files == 0) U.recent_files = 10;
 
360
        }
356
361
        
357
362
        /* GL Texture Garbage Collection (variable abused above!) */
358
363
        if (U.textimeout == 0) {
470
475
}
471
476
 
472
477
/* only here settings for fullscreen */
473
 
int BIF_read_homefile(void)
 
478
int BIF_read_homefile(int from_memory)
474
479
{
475
480
        char tstr[FILE_MAXDIR+FILE_MAXFILE], scestr[FILE_MAXDIR];
476
481
        char *home= BLI_gethome();
490
495
        BLI_freelistN(&G.ttfdata);
491
496
                
492
497
        G.relbase_valid = 0;
493
 
        BLI_make_file_string(G.sce, tstr, home, ".B.blend");
 
498
        if (!from_memory) BLI_make_file_string(G.sce, tstr, home, ".B.blend");
494
499
        strcpy(scestr, G.sce);  /* temporal store */
495
500
        
496
501
        /* prevent loading no UI */
497
502
        G.fileflags &= ~G_FILE_NO_UI;
498
503
        
499
 
        if (BLI_exists(tstr)) {
 
504
        if (!from_memory && BLI_exists(tstr)) {
500
505
                success = BKE_read_file(tstr, NULL);
501
506
        } else {
502
507
                success = BKE_read_file_from_memory(datatoc_B_blend, datatoc_B_blend_size, NULL);
521
526
 
522
527
static void get_autosave_location(char buf[FILE_MAXDIR+FILE_MAXFILE])
523
528
{
524
 
        char pidstr[32];
 
529
        char pidstr[32];
 
530
        char subdir[9];
 
531
        char savedir[FILE_MAXDIR];
525
532
 
526
 
        sprintf(pidstr, "%d.blend", abs(getpid()));
 
533
        sprintf(pidstr, "%d.blend", abs(getpid()));
 
534
        
 
535
#ifdef WIN32
 
536
        if (!BLI_exists(U.tempdir)) {
 
537
                BLI_strncpy(subdir, "autosave", sizeof(subdir));
 
538
                BLI_make_file_string("/", savedir, BLI_gethome(), subdir);
 
539
                
 
540
                /* create a new autosave dir
 
541
                 * function already checks for existence or not */
 
542
                BLI_recurdir_fileops(savedir);
 
543
        
 
544
                BLI_make_file_string("/", buf, savedir, pidstr);
 
545
                return;
 
546
        }
 
547
#endif
 
548
        
527
549
        BLI_make_file_string("/", buf, U.tempdir, pidstr);
528
550
}
529
551
 
567
589
        G.recent_files.first = G.recent_files.last = NULL;
568
590
 
569
591
        /* read list of recent opend files from .Blog to memory */
570
 
        for (l= lines, num= 0; l && (num<10); l= l->next, num++) {
 
592
        for (l= lines, num= 0; l && (num<U.recent_files); l= l->next, num++) {
571
593
                line = l->link;
572
594
                if (!BLI_streq(line, "")) {
573
595
                        if (num==0) 
666
688
                        recent = recent->next;
667
689
                        i=1;
668
690
                        /* write rest of recent opened files to .Blog */
669
 
                        while((i<10) && (recent)){
 
691
                        while((i<U.recent_files) && (recent)){
670
692
                                /* this prevents to have duplicities in list */
671
693
                                if (strcmp(recent->filename, G.sce)!=0) {
672
694
                                        fprintf(fp, "%s\n", recent->filename);
858
880
        init_node_butfuncs();
859
881
        
860
882
        BIF_preview_init_dbase();
861
 
        BIF_read_homefile();
 
883
        BIF_read_homefile(0);
862
884
 
863
885
        BIF_resources_init();   /* after homefile, to dynamically load an icon file based on theme settings */
864
886
        
963
985
        
964
986
        BLI_freelistN(&U.themes);
965
987
        BIF_preview_free_dbase();
966
 
                
 
988
        
967
989
        if(totblock!=0) {
968
990
                printf("Error Totblock: %d\n",totblock);
969
991
                MEM_printmemlist();
982
1004
 
983
1005
 
984
1006
        SYS_DeleteSystem(SYS_GetSystem());
985
 
 
 
1007
        
986
1008
        exit(G.afbreek==1);
987
1009
}