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

« back to all changes in this revision

Viewing changes to source/blender/src/header_action.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:
4
4
 * Functions to draw the "Action Editor" window header
5
5
 * and handle user events sent to it.
6
6
 * 
7
 
 * $Id: header_action.c,v 1.13 2004/05/06 19:42:38 ton Exp $
 
7
 * $Id: header_action.c,v 1.23 2005/03/19 21:08:12 zuster Exp $
8
8
 *
9
9
 * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
10
10
 *
43
43
#include <config.h>
44
44
#endif
45
45
 
46
 
#ifdef WIN32
47
 
#include "BLI_winstuff.h"
48
 
#endif
49
 
 
50
 
#include "BMF_Api.h"
51
 
#include "BIF_language.h"
52
 
#ifdef INTERNATIONAL
53
 
#include "FTF_Api.h"
54
 
#endif
55
 
 
56
46
#include "DNA_ID.h"
57
47
#include "DNA_action_types.h"
58
48
#include "DNA_ipo_types.h"
74
64
#include "BKE_main.h"
75
65
#include "BKE_constraint.h"
76
66
#include "BKE_armature.h"
 
67
#include "BKE_utildefines.h"
77
68
 
78
69
#include "BSE_drawipo.h"
79
70
#include "BSE_editaction.h"
99
90
#define ACTMENU_KEY_DELETE        1
100
91
#define ACTMENU_KEY_BAKE          2
101
92
 
 
93
#define ACTMENU_KEY_TRANSFORM_MOVE      0
 
94
#define ACTMENU_KEY_TRANSFORM_SCALE     1
 
95
 
102
96
#define ACTMENU_KEY_HANDLE_AUTO   0
103
97
#define ACTMENU_KEY_HANDLE_ALIGN  1
104
98
#define ACTMENU_KEY_HANDLE_FREE   2
135
129
                        G.v2d->cur.ymin=-SCROLLB;
136
130
 
137
131
                        if (!G.saction->action){        // here the mesh rvk?
138
 
                                G.v2d->cur.xmax=0;
139
 
                                G.v2d->cur.xmax=100;
 
132
                                G.v2d->cur.xmax= -5;
 
133
                                G.v2d->cur.xmax= 100;
140
134
                        }
141
135
                        else {
142
136
                                float extra;
145
139
                                extra= 0.05*(G.v2d->cur.xmax - G.v2d->cur.xmin);
146
140
                                G.v2d->cur.xmin-= extra;
147
141
                                G.v2d->cur.xmax+= extra;
 
142
                                
 
143
                                if(G.v2d->cur.xmin==G.v2d->cur.xmax) {
 
144
                                        G.v2d->cur.xmax= -5;
 
145
                                        G.v2d->cur.xmax= 100;
 
146
                                }
148
147
                        }
149
148
 
150
149
                        G.v2d->tot= G.v2d->cur;
209
208
                        play_anim(1);
210
209
                        break;  
211
210
                case ACTMENU_VIEW_ALL: /* View All */
212
 
                        do_action_buttons(B_SIMAGEHOME);
 
211
                        do_action_buttons(B_ACTHOME);
213
212
                        break;
214
213
                case ACTMENU_VIEW_MAXIMIZE: /* Maximize Window */
215
214
                        /* using event B_FULL */
378
377
        return block;
379
378
}
380
379
 
 
380
static void do_action_keymenu_transformmenu(void *arg, int event)
 
381
{
 
382
        SpaceAction *saction;
 
383
        bAction *act;
 
384
        Key *key;
 
385
        
 
386
        key = get_action_mesh_key();
 
387
        saction= curarea->spacedata.first;
 
388
        
 
389
        act=saction->action;
 
390
        
 
391
        switch(event)
 
392
        {
 
393
                case ACTMENU_KEY_TRANSFORM_MOVE:
 
394
                        if (key) {
 
395
                                transform_meshchannel_keys('g', key);
 
396
                        } 
 
397
                        else if (act) { 
 
398
                                transform_actionchannel_keys ('g');
 
399
                        }
 
400
                        break;
 
401
                case ACTMENU_KEY_TRANSFORM_SCALE:
 
402
                        if (key) {
 
403
                                transform_meshchannel_keys('s', key);
 
404
                        } 
 
405
                        else if (act) {
 
406
                                transform_actionchannel_keys ('s');
 
407
                        }
 
408
                        break;
 
409
        }
 
410
 
 
411
        scrarea_queue_winredraw(curarea);
 
412
}
 
413
 
 
414
static uiBlock *action_keymenu_transformmenu(void *arg_unused)
 
415
{
 
416
        uiBlock *block;
 
417
        short yco= 0, menuwidth=120;
 
418
 
 
419
        block= uiNewBlock(&curarea->uiblocks, "action_keymenu_transformmenu", 
 
420
                                          UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
 
421
        uiBlockSetButmFunc(block, do_action_keymenu_transformmenu, NULL);
 
422
 
 
423
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, 
 
424
                                         "Grab/Move|G", 0, yco-=20, 
 
425
                                         menuwidth, 19, NULL, 0.0, 0.0, 0, 
 
426
                                         ACTMENU_KEY_TRANSFORM_MOVE, "");
 
427
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, 
 
428
                                         "Scale|S", 0, yco-=20, 
 
429
                                         menuwidth, 19, NULL, 0.0, 0.0, 0, 
 
430
                                         ACTMENU_KEY_TRANSFORM_SCALE, "");
 
431
 
 
432
        uiBlockSetDirection(block, UI_RIGHT);
 
433
        uiTextBoundsBlock(block, 60);
 
434
 
 
435
        return block;
 
436
}
 
437
 
381
438
static void do_action_keymenu_handlemenu(void *arg, int event)
382
439
{
383
440
        Key *key;
521
578
        if (!saction)
522
579
                return;
523
580
 
524
 
 
525
581
        act = saction->action;
526
582
        key = get_action_mesh_key();
527
583
 
531
587
                        if (key) {
532
588
                                duplicate_meshchannel_keys(key);
533
589
                        }
534
 
                        else {
 
590
                        else if (act) {
535
591
                                duplicate_actionchannel_keys();
536
592
                                remake_action_ipos(act);
537
593
                        }
541
597
                        if (key) {
542
598
                                delete_meshchannel_keys(key);
543
599
                        }
544
 
                        else {
 
600
                        else if (act) {
545
601
                                delete_actionchannel_keys ();
546
602
                        }
547
603
                        break;
548
604
                case ACTMENU_KEY_BAKE:
549
605
                        bake_action_with_client (G.saction->action, OBACT, 0.01);
550
606
                        break;
551
 
 
552
 
                        break;
553
607
        }
554
608
}
555
609
 
561
615
        block= uiNewBlock(&curarea->uiblocks, "action_keymenu", 
562
616
                                          UI_EMBOSSP, UI_HELV, curarea->headwin);
563
617
        uiBlockSetButmFunc(block, do_action_keymenu, NULL);
 
618
        
 
619
        uiDefIconTextBlockBut(block, action_keymenu_transformmenu, 
 
620
                                        NULL, ICON_RIGHTARROW_THIN, 
 
621
                                        "Transform", 0, yco-=20, 120, 20, "");
 
622
                                                  
 
623
        uiDefBut(block, SEPR, 0, "", 0, yco-=6, 
 
624
                                        menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
564
625
 
565
626
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, 
566
 
                                         "Duplicate|Shift D", 0, yco-=20, 
567
 
                                         menuwidth, 19, NULL, 0.0, 0.0, 0, 
568
 
                                         ACTMENU_KEY_DUPLICATE, "");
 
627
                                        "Duplicate|Shift D", 0, yco-=20, 
 
628
                                        menuwidth, 19, NULL, 0.0, 0.0, 0, 
 
629
                                        ACTMENU_KEY_DUPLICATE, "");
569
630
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, 
570
 
                                         "Delete|X", 0, yco-=20, 
571
 
                                         menuwidth, 19, NULL, 0.0, 0.0, 0, 
572
 
                                         ACTMENU_KEY_DELETE, "");
 
631
                                        "Delete|X", 0, yco-=20, 
 
632
                                        menuwidth, 19, NULL, 0.0, 0.0, 0, 
 
633
                                        ACTMENU_KEY_DELETE, "");
573
634
 
574
635
        uiDefBut(block, SEPR, 0, "", 0, yco-=6, 
575
636
                         menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
665
726
                uiBlockSetEmboss(block, UI_EMBOSSP);
666
727
        
667
728
                xmax= GetButStringLength("View");
668
 
                uiDefBlockBut(block, action_viewmenu, NULL, 
 
729
                uiDefPulldownBut(block, action_viewmenu, NULL, 
669
730
                                          "View", xco, -2, xmax-3, 24, "");
670
731
                xco+= xmax;
671
732
                
672
733
                xmax= GetButStringLength("Select");
673
 
                uiDefBlockBut(block, action_selectmenu, NULL, 
 
734
                uiDefPulldownBut(block, action_selectmenu, NULL, 
674
735
                                          "Select", xco, -2, xmax-3, 24, "");
675
736
                xco+= xmax;
676
737
        
677
738
                xmax= GetButStringLength("Key");
678
 
                uiDefBlockBut(block, action_keymenu, NULL, 
 
739
                uiDefPulldownBut(block, action_keymenu, NULL, 
679
740
                                          "Key", xco, -2, xmax-3, 24, "");
680
741
                xco+= xmax;
681
742
        }
683
744
        uiBlockSetEmboss(block, UI_EMBOSSX);
684
745
        
685
746
        // object action is allowed to be zero!
686
 
        if (!get_action_mesh_key()) {
 
747
        /* (ton) commented out below line, since people can apparently link Action to any object (mesh) and
 
748
                not unlink anymore when theres a mesh key. Needs to be rethought this stuff! */
 
749
        //if (!get_action_mesh_key()) {
687
750
        
688
751
                /* NAME ETC */
689
752
                ob=OBACT;
703
766
                                 "converted into Ipo keys");
704
767
                xco+=64;
705
768
 
706
 
        }
 
769
        //}
707
770
        uiClearButLock();
708
771
 
709
772
        /* draw LOCK */