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

« back to all changes in this revision

Viewing changes to source/blender/src/buttons_logic.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: buttons_logic.c,v 1.42 2007/02/06 07:11:44 campbellbarton Exp $ 
 
2
 * $Id: buttons_logic.c,v 1.46 2007/04/24 17:28:40 campbellbarton Exp $ 
3
3
 *
4
4
 * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
5
5
 *
81
81
 
82
82
 
83
83
#include "BDR_editcurve.h"
 
84
#include "BDR_editobject.h"
84
85
#include "BSE_headerbuttons.h"
85
86
#include "BSE_filesel.h"
86
87
 
92
93
/* internals */
93
94
void buttons_enji(uiBlock *, Object *);
94
95
void buttons_ketsji(uiBlock *, Object *);
 
96
void buttons_bullet(uiBlock *, Object *);
95
97
 
96
98
/****/
97
99
 
1681
1683
 
1682
1684
                                if(sa->sound) {
1683
1685
                                        char dummy_str[] = "Sound mode %t|Play Stop %x0|Play End %x1|Loop Stop %x2|Loop End %x3|Loop Ping Pong Stop %x5|Loop Ping Pong %x4";
1684
 
                                        uiDefBut(block, TEX, B_IDNAME, "SO:",xco+30,yco-22,width-40,19, sa->sound->id.name+2,    0.0, 18.0, 0, 0, "");
 
1686
                                        uiDefBut(block, TEX, B_IDNAME, "SO:",xco+30,yco-22,width-40,19, sa->sound->id.name+2,    0.0, 21.0, 0, 0, "");
1685
1687
                                        uiDefButS(block, MENU, 1, dummy_str,xco+10,yco-44,width-20, 19, &sa->type, 0.0, 0.0, 0, 0, "");
1686
1688
                                        uiDefButF(block, NUM, 0, "Volume:", xco+10,yco-66,wval, 19, &sa->sound->volume, 0.0,  1.0, 0, 0, "Sets the volume of this sound");
1687
1689
                                        uiDefButF(block, NUM, 0, "Pitch:",xco+wval+10,yco-66,wval, 19, &sa->sound->pitch,-12.0, 12.0, 0, 0, "Sets the pitch of this sound");
2389
2391
                                  "Motion defined by laws of physics");
2390
2392
        
2391
2393
                if(ob->gameflag & OB_DYNAMIC) {
2392
 
                        uiDefButBitI(block, TOG, OB_RIGID_BODY, B_REDR, "Rigid Body", 180,205,70,19, 
 
2394
                        uiDefButBitI(block, TOG, OB_RIGID_BODY, B_REDR, "Rigid Body", 190,205,80,19, 
2393
2395
                                          &ob->gameflag, 0, 0, 0, 0, 
2394
2396
                                          "Enable rolling physics");
2395
 
                        uiDefButBitI(block, TOG, OB_COLLISION_RESPONSE, B_REDR, "No sleeping", 250,205,100,19, 
 
2397
                        uiDefButBitI(block, TOG, OB_COLLISION_RESPONSE, B_REDR, "No sleeping", 270,205,80,19, 
2396
2398
                                          &ob->gameflag, 0, 0, 0, 0, 
2397
2399
                                          "Disable auto (de)activation");
2398
2400
 
2437
2439
                }
2438
2440
        }
2439
2441
 
2440
 
        //if (!(ob->gameflag & OB_GHOST)) 
2441
 
        //Ghost can be any bound type in Bullet
2442
 
        {
 
2442
        if (!(ob->gameflag & OB_GHOST)) {
2443
2443
                uiBlockBeginAlign(block);
2444
2444
                uiDefButBitI(block, TOG, OB_BOUNDS, B_REDR, "Bounds", 10, 125, 75, 19,
2445
2445
                                &ob->gameflag, 0, 0,0, 0,
2446
2446
                                "Specify a bounds object for physics");
2447
2447
                if (ob->gameflag & OB_BOUNDS) {
2448
2448
                        uiDefButS(block, MENU, REDRAWVIEW3D, "Boundary Display%t|Box%x0|Sphere%x1|Cylinder%x2|Cone%x3|Convex Hull Polytope%x5|Static TriangleMesh %x4",
2449
 
                        //almost ready to enable this one:                      uiDefButS(block, MENU, REDRAWVIEW3D, "Boundary Display%t|Box%x0|Sphere%x1|Cylinder%x2|Cone%x3|Convex Hull Polytope%x5|Static TriangleMesh %x4|Dynamic Mesh %x5|",
2450
2449
                                85, 125, 160, 19, &ob->boundtype, 0, 0, 0, 0, "Selects the collision type");
2451
2450
                        uiDefButBitI(block, TOG, OB_CHILD, B_REDR, "Compound", 250,125,100,19, 
2452
2451
                                          &ob->gameflag, 0, 0, 0, 0, 
2456
2455
        }
2457
2456
}
2458
2457
 
 
2458
void buttons_bullet(uiBlock *block, Object *ob)
 
2459
{
 
2460
        uiBlockBeginAlign(block);
 
2461
        uiDefButBitI(block, TOG, OB_ACTOR, B_REDR, "Actor",
 
2462
                          10,205,55,19, &ob->gameflag, 0, 0, 0, 0,
 
2463
                          "Objects that are evaluated by the engine ");
 
2464
        if(ob->gameflag & OB_ACTOR) {   
 
2465
                uiDefButBitI(block, TOG, OB_GHOST, B_REDR, "Ghost", 65,205,55,19, 
 
2466
                                  &ob->gameflag, 0, 0, 0, 0, 
 
2467
                                  "Objects that don't restitute collisions (like a ghost)");
 
2468
                uiDefButBitI(block, TOG, OB_DYNAMIC, B_REDR, "Dynamic", 120,205,70,19, 
 
2469
                                  &ob->gameflag, 0, 0, 0, 0, 
 
2470
                                  "Motion defined by laws of physics");
 
2471
        
 
2472
                if(ob->gameflag & OB_DYNAMIC) {
 
2473
                        uiDefButBitI(block, TOG, OB_RIGID_BODY, B_REDR, "Rigid Body", 190,205,80,19, 
 
2474
                                          &ob->gameflag, 0, 0, 0, 0, 
 
2475
                                          "Enable rolling physics");
 
2476
                        uiDefButBitI(block, TOG, OB_COLLISION_RESPONSE, B_REDR, "No sleeping", 270,205,80,19, 
 
2477
                                          &ob->gameflag, 0, 0, 0, 0, 
 
2478
                                          "Disable auto (de)activation");
 
2479
 
 
2480
                        uiDefButF(block, NUM, B_DIFF, "Mass:", 10, 185, 170, 19, 
 
2481
                                          &ob->mass, 0.01, 10000.0, 10, 2, 
 
2482
                                          "The mass of the Object");
 
2483
                        uiDefButF(block, NUM, REDRAWVIEW3D, "Radius:", 180, 185, 170, 19, 
 
2484
                                          &ob->inertia, 0.01, 10.0, 10, 2, 
 
2485
                                          "Bounding sphere radius");
 
2486
 
 
2487
                        uiDefButF(block, NUMSLI, B_DIFF, "Damp ", 10, 165, 150, 19, 
 
2488
                                          &ob->damping, 0.0, 1.0, 10, 0, 
 
2489
                                          "General movement damping");
 
2490
                        uiDefButF(block, NUMSLI, B_DIFF, "RotDamp ", 160, 165, 190, 19, 
 
2491
                                          &ob->rdamping, 0.0, 1.0, 10, 0, 
 
2492
                                          "General rotation damping");
 
2493
                }
 
2494
        }
 
2495
        uiBlockEndAlign(block);
 
2496
 
 
2497
        uiBlockBeginAlign(block);
 
2498
        uiDefButBitI(block, TOG, OB_BOUNDS, B_REDR, "Bounds", 10, 125, 75, 19,
 
2499
                     &ob->gameflag, 0, 0,0, 0,
 
2500
                     "Specify a bounds object for physics");
 
2501
        if (ob->gameflag & OB_BOUNDS) {
 
2502
                uiDefButS(block, MENU, REDRAWVIEW3D, "Boundary Display%t|Box%x0|Sphere%x1|Cylinder%x2|Cone%x3|Convex Hull Polytope%x5|Static TriangleMesh %x4",
 
2503
                  //almost ready to enable this one:                    uiDefButS(block, MENU, REDRAWVIEW3D, "Boundary Display%t|Box%x0|Sphere%x1|Cylinder%x2|Cone%x3|Convex Hull Polytope%x5|Static TriangleMesh %x4|Dynamic Mesh %x5|",
 
2504
                          85, 125, 160, 19, &ob->boundtype, 0, 0, 0, 0, "Selects the collision type");
 
2505
                uiDefButBitI(block, TOG, OB_CHILD, B_REDR, "Compound", 250,125,100,19, 
 
2506
                             &ob->gameflag, 0, 0, 0, 0, 
 
2507
                             "Add Children");
 
2508
        }
 
2509
        uiBlockEndAlign(block);
 
2510
}
 
2511
 
2459
2512
/* never used, see CVS 1.134 for the code */
2460
2513
/*  static FreeCamera *new_freecamera(void) */
2461
2514
 
2484
2537
        ob= OBACT;
2485
2538
 
2486
2539
        if(ob==0) return;
2487
 
        uiSetButLock(ob->id.lib!=0, "Can't edit library data");
 
2540
        uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
2488
2541
 
2489
2542
        sprintf(name, "buttonswin %d", curarea->win);
2490
2543
        block= uiNewBlock(&curarea->uiblocks, name, UI_EMBOSS, UI_HELV, curarea->win);
2492
2545
        uiBlockSetCol(block, TH_BUT_SETTING2);
2493
2546
 
2494
2547
        if(wrld) {
2495
 
                if 
2496
 
                        (wrld->physicsEngine == 1) buttons_enji(block, ob);
2497
 
                else
 
2548
                switch(wrld->physicsEngine) {
 
2549
                case WOPHY_ENJI:
 
2550
                        buttons_enji(block, ob);
 
2551
                        break;
 
2552
                case WOPHY_BULLET:
 
2553
                        buttons_bullet(block, ob);
 
2554
                        break;
 
2555
                default:
2498
2556
                        buttons_ketsji(block, ob);
 
2557
                        break;
 
2558
                }
2499
2559
        }
2500
2560
        else buttons_ketsji(block, ob);
2501
2561
        
2502
2562
        uiBlockSetCol(block, TH_AUTO);
 
2563
        uiBlockBeginAlign(block);
2503
2564
        uiDefBut(block, BUT, B_ADD_PROP, "Add Property",                10, 90, 340, 24,
2504
2565
                         NULL, 0.0, 100.0, 100, 0,
2505
2566
                         "");
2508
2569
        
2509
2570
        a= 0;
2510
2571
        prop= ob->prop.first;
2511
 
//      uiBlockBeginAlign(block);
2512
2572
        while(prop) {
2513
 
                uiBlockBeginAlign(block);
2514
 
                but= uiDefBut(block, BUT, 1, "Del",             10, (short)(70-20*a), 40, 19, NULL, 0.0, 0.0, 1, (float)a, "");
 
2573
                but= uiDefBut(block, BUT, 1, "Del",             10, (short)(70-20*a), 40, 20, NULL, 0.0, 0.0, 1, (float)a, "");
2515
2574
                uiButSetFunc(but, del_property, prop, NULL);
2516
 
                uiDefButS(block, MENU, B_CHANGE_PROP, pupstr,           50, (short)(70-20*a), 60, 19, &prop->type, 0, 0, 0, 0, "");
2517
 
                but= uiDefBut(block, TEX, 1, "Name:",                                   110, (short)(70-20*a), 105, 19, prop->name, 0, 31, 0, 0, "");
 
2575
                uiDefButS(block, MENU, B_CHANGE_PROP, pupstr,           50, (short)(70-20*a), 60, 20, &prop->type, 0, 0, 0, 0, "");
 
2576
                but= uiDefBut(block, TEX, 1, "Name:",                                   110, (short)(70-20*a), 110, 20, prop->name, 0, 31, 0, 0, "");
2518
2577
                uiButSetFunc(but, make_unique_prop_names_cb, prop->name, (void*) 1);
2519
2578
                
2520
2579
                if (strcmp(prop->name, "Text") == 0) {
2524
2583
                }
2525
2584
 
2526
2585
                if(prop->type==PROP_BOOL) {
2527
 
                        uiDefButBitI(block, TOG, 1, B_REDR, "True",             215, (short)(70-20*a), 55, 19, &prop->data, 0, 0, 0, 0, "");
2528
 
                        uiDefButBitI(block, TOGN, 1, B_REDR, "False",   270, (short)(70-20*a), 55, 19, &prop->data, 0, 0, 0, 0, "");
 
2586
                        uiDefButBitI(block, TOG, 1, B_REDR, "True",             220, (short)(70-20*a), 55, 20, &prop->data, 0, 0, 0, 0, "");
 
2587
                        uiDefButBitI(block, TOGN, 1, B_REDR, "False",   270, (short)(70-20*a), 55, 20, &prop->data, 0, 0, 0, 0, "");
2529
2588
                }
2530
2589
                else if(prop->type==PROP_INT) 
2531
 
                        uiDefButI(block, NUM, butreturn, "",                    215, (short)(70-20*a), 110, 19, &prop->data, -10000, 10000, 0, 0, "");
 
2590
                        uiDefButI(block, NUM, butreturn, "",                    220, (short)(70-20*a), 110, 20, &prop->data, -10000, 10000, 0, 0, "");
2532
2591
                else if(prop->type==PROP_FLOAT) 
2533
 
                        uiDefButF(block, NUM, butreturn, "",                    215, (short)(70-20*a), 110, 19, (float*) &prop->data, -10000, 10000, 100, 3, "");
 
2592
                        uiDefButF(block, NUM, butreturn, "",                    220, (short)(70-20*a), 110, 20, (float*) &prop->data, -10000, 10000, 100, 3, "");
2534
2593
                else if(prop->type==PROP_STRING) 
2535
 
                        uiDefBut(block, TEX, butreturn, "",                             215, (short)(70-20*a), 110, 19, prop->poin, 0, 127, 0, 0, "");
 
2594
                        uiDefBut(block, TEX, butreturn, "",                             220, (short)(70-20*a), 110, 20, prop->poin, 0, 127, 0, 0, "");
2536
2595
                else if(prop->type==PROP_TIME) 
2537
 
                        uiDefButF(block, NUM, butreturn, "",                    215, (short)(70-20*a), 110, 19, (float*) &prop->data, -10000, 10000, 0, 0, "");
 
2596
                        uiDefButF(block, NUM, butreturn, "",                    220, (short)(70-20*a), 110, 20, (float*) &prop->data, -10000, 10000, 0, 0, "");
2538
2597
                
2539
 
                uiDefButBitS(block, TOG, PROP_DEBUG, 0, "D",            325, (short)(70-20*a), 20, 19, &prop->flag, 0, 0, 0, 0, "Print Debug info");
2540
 
                uiBlockEndAlign(block);
 
2598
                uiDefButBitS(block, TOG, PROP_DEBUG, 0, "D",            330, (short)(70-20*a), 20, 20, &prop->flag, 0, 0, 0, 0, "Print Debug info");
2541
2599
                
2542
2600
                a++;
2543
2601
                prop= prop->next;
2544
2602
                
2545
2603
        }
2546
 
//      uiBlockEndAlign(block);
2547
 
//  Note: something is wrong with alignment... it attempts to align the next buttons now? will check later...
 
2604
        uiBlockEndAlign(block);
 
2605
 
2548
2606
        uiClearButLock();
2549
2607
 
2550
2608
        idar= get_selected_and_linked_obs(&count, G.buts->scaflag);
2565
2623
        for(a=0; a<count; a++) {
2566
2624
                ob= (Object *)idar[a];
2567
2625
                uiClearButLock();
2568
 
                uiSetButLock(ob->id.lib!=0, "Can't edit library data");
 
2626
                uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
2569
2627
                
2570
2628
                if( (ob->scavisflag & OB_VIS_SENS) == 0) continue;
2571
2629
                
2636
2694
        for(a=0; a<count; a++) {
2637
2695
                ob= (Object *)idar[a];
2638
2696
                uiClearButLock();
2639
 
                uiSetButLock(ob->id.lib!=0, "Can't edit library data");
 
2697
                uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
2640
2698
                if( (ob->scavisflag & OB_VIS_CONT) == 0) continue;
2641
2699
 
2642
2700
                /* presume it is only objects for now */
2704
2762
        for(a=0; a<count; a++) {
2705
2763
                ob= (Object *)idar[a];
2706
2764
                uiClearButLock();
2707
 
                uiSetButLock(ob->id.lib!=0, "Can't edit library data");
 
2765
                uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
2708
2766
                if( (ob->scavisflag & OB_VIS_ACT) == 0) continue;
2709
2767
 
2710
2768
                /* presume it is only objects for now */