~ubuntu-branches/ubuntu/trusty/blender/trusty

« back to all changes in this revision

Viewing changes to source/blender/editors/space_logic/logic_window.c

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2013-03-06 12:08:47 UTC
  • mfrom: (1.5.1) (14.1.8 experimental)
  • Revision ID: package-import@ubuntu.com-20130306120847-frjfaryb2zrotwcg
Tags: 2.66a-1ubuntu1
* Resynchronize with Debian (LP: #1076930, #1089256, #1052743, #999024,
  #1122888, #1147084)
* debian/control:
  - Lower build-depends on libavcodec-dev since we're not
    doing the libav9 transition in Ubuntu yet

Show diffs side-by-side

added added

removed removed

Lines of Context:
56
56
#include "BKE_library.h"
57
57
#include "BKE_main.h"
58
58
#include "BKE_sca.h"
 
59
#include "BKE_screen.h"
59
60
 
60
61
#include "ED_util.h"
61
62
 
63
64
 
64
65
#include "BIF_gl.h"
65
66
 
 
67
#include "BLF_translation.h"
 
68
 
66
69
#include "UI_interface.h"
 
70
#include "UI_view2d.h"
67
71
 
68
72
#include "RNA_access.h"
69
73
 
72
76
 
73
77
#include "logic_intern.h"
74
78
 
75
 
 
76
 
#define MAX_RENDER_PASS   100
77
79
#define B_REDR          1
78
 
#define B_IDNAME        2
79
80
 
80
81
#define B_ADD_SENS              2703
81
82
#define B_CHANGE_SENS           2704
91
92
 
92
93
#define B_SOUNDACT_BROWSE       2712
93
94
 
94
 
#define B_SETSECTOR             2713
95
95
#define B_SETPROP               2714
96
96
#define B_SETACTOR              2715
97
97
#define B_SETMAINACTOR          2716
106
106
{
107
107
        char **x1, **x2;
108
108
        
109
 
        x1= (char **)v1;
110
 
        x2= (char **)v2;
 
109
        x1 = (char **)v1;
 
110
        x2 = (char **)v2;
111
111
        
112
 
        return strcmp(*x1, *x2);
 
112
        return BLI_natstrcmp(*x1, *x2);
113
113
}
114
114
 
115
115
void make_unique_prop_names(bContext *C, char *str)
138
138
                propcount+= BLI_countlist(&ob->sensors);
139
139
                propcount+= BLI_countlist(&ob->controllers);
140
140
                propcount+= BLI_countlist(&ob->actuators);
141
 
        }       
 
141
        }
142
142
        if (propcount==0) {
143
143
                if (idar) MEM_freeN(idar);
144
144
                return;
153
153
                ob= (Object *)idar[a];
154
154
                prop= ob->prop.first;
155
155
                while (prop) {
156
 
                        names[nr++]= prop->name;
 
156
                        names[nr++] = prop->name;
157
157
                        prop= prop->next;
158
158
                }
159
159
                sens= ob->sensors.first;
160
160
                while (sens) {
161
 
                        names[nr++]= sens->name;
 
161
                        names[nr++] = sens->name;
162
162
                        sens= sens->next;
163
163
                }
164
164
                cont= ob->controllers.first;
165
165
                while (cont) {
166
 
                        names[nr++]= cont->name;
 
166
                        names[nr++] = cont->name;
167
167
                        cont= cont->next;
168
168
                }
169
169
                act= ob->actuators.first;
170
170
                while (act) {
171
 
                        names[nr++]= act->name;
 
171
                        names[nr++] = act->name;
172
172
                        act= act->next;
173
173
                }
174
174
        }
187
187
        MEM_freeN(names);
188
188
}
189
189
 
190
 
static void make_unique_prop_names_cb(bContext *C, void *strv, void *UNUSED(redraw_view3d_flagv))
191
 
{
192
 
        char *str= strv;
193
 
//      int redraw_view3d_flag= GET_INT_FROM_POINTER(redraw_view3d_flagv);
194
 
        
195
 
        make_unique_prop_names(C, str);
196
 
}
197
 
 
198
 
 
199
 
static void old_sca_move_sensor(bContext *C, void *datav, void *move_up)
200
 
{
201
 
        /* deprecated, no longer using it (moved to sca.c) */
202
 
        Scene *scene= CTX_data_scene(C);
203
 
        bSensor *sens_to_delete= datav;
204
 
        int val;
205
 
        Base *base;
206
 
        bSensor *sens, *tmp;
207
 
        
208
 
        // val= pupmenu("Move up%x1|Move down %x2");
209
 
        val = move_up ? 1:2;
210
 
        
211
 
        if (val>0) {
212
 
                /* now find out which object has this ... */
213
 
                base= FIRSTBASE;
214
 
                while (base) {
215
 
                
216
 
                        sens= base->object->sensors.first;
217
 
                        while (sens) {
218
 
                                if (sens == sens_to_delete) break;
219
 
                                sens= sens->next;
220
 
                        }
221
 
                        
222
 
                        if (sens) {
223
 
                                if ( val==1 && sens->prev) {
224
 
                                        for (tmp=sens->prev; tmp; tmp=tmp->prev) {
225
 
                                                if (tmp->flag & SENS_VISIBLE)
226
 
                                                        break;
227
 
                                        }
228
 
                                        if (tmp) {
229
 
                                                BLI_remlink(&base->object->sensors, sens);
230
 
                                                BLI_insertlinkbefore(&base->object->sensors, tmp, sens);
231
 
                                        }
232
 
                                }
233
 
                                else if ( val==2 && sens->next) {
234
 
                                        for (tmp=sens->next; tmp; tmp=tmp->next) {
235
 
                                                if (tmp->flag & SENS_VISIBLE)
236
 
                                                        break;
237
 
                                        }
238
 
                                        if (tmp) {
239
 
                                                BLI_remlink(&base->object->sensors, sens);
240
 
                                                BLI_insertlink(&base->object->sensors, tmp, sens);
241
 
                                        }
242
 
                                }
243
 
                                ED_undo_push(C, "Move sensor");
244
 
                                break;
245
 
                        }
246
 
                        
247
 
                        base= base->next;
248
 
                }
249
 
        }
250
 
}
251
 
 
252
 
static void old_sca_move_controller(bContext *C, void *datav, void *move_up)
253
 
{
254
 
        /* deprecated, no longer using it (moved to sca.c) */
255
 
        Scene *scene= CTX_data_scene(C);
256
 
        bController *controller_to_del= datav;
257
 
        int val;
258
 
        Base *base;
259
 
        bController *cont, *tmp;
260
 
        
261
 
        //val= pupmenu("Move up%x1|Move down %x2");
262
 
        val = move_up ? 1:2;
263
 
        
264
 
        if (val>0) {
265
 
                /* now find out which object has this ... */
266
 
                base= FIRSTBASE;
267
 
                while (base) {
268
 
                
269
 
                        cont= base->object->controllers.first;
270
 
                        while (cont) {
271
 
                                if (cont == controller_to_del) break;
272
 
                                cont= cont->next;
273
 
                        }
274
 
                        
275
 
                        if (cont) {
276
 
                                if ( val==1 && cont->prev) {
277
 
                                        /* locate the controller that has the same state mask but is earlier in the list */
278
 
                                        tmp = cont->prev;
279
 
                                        while (tmp) {
280
 
                                                if (tmp->state_mask & cont->state_mask)
281
 
                                                        break;
282
 
                                                tmp = tmp->prev;
283
 
                                        }
284
 
                                        if (tmp) {
285
 
                                                BLI_remlink(&base->object->controllers, cont);
286
 
                                                BLI_insertlinkbefore(&base->object->controllers, tmp, cont);
287
 
                                        }
288
 
                                }
289
 
                                else if ( val==2 && cont->next) {
290
 
                                        tmp = cont->next;
291
 
                                        while (tmp) {
292
 
                                                if (tmp->state_mask & cont->state_mask)
293
 
                                                        break;
294
 
                                                tmp = tmp->next;
295
 
                                        }
296
 
                                        BLI_remlink(&base->object->controllers, cont);
297
 
                                        BLI_insertlink(&base->object->controllers, tmp, cont);
298
 
                                }
299
 
                                ED_undo_push(C, "Move controller");
300
 
                                break;
301
 
                        }
302
 
                        
303
 
                        base= base->next;
304
 
                }
305
 
        }
306
 
}
307
 
 
308
 
static void old_sca_move_actuator(bContext *C, void *datav, void *move_up)
309
 
{
310
 
        /* deprecated, no longer using it (moved to sca.c) */
311
 
        Scene *scene= CTX_data_scene(C);
312
 
        bActuator *actuator_to_move= datav;
313
 
        int val;
314
 
        Base *base;
315
 
        bActuator *act, *tmp;
316
 
        
317
 
        //val= pupmenu("Move up%x1|Move down %x2");
318
 
        val = move_up ? 1:2;
319
 
        
320
 
        if (val>0) {
321
 
                /* now find out which object has this ... */
322
 
                base= FIRSTBASE;
323
 
                while (base) {
324
 
                
325
 
                        act= base->object->actuators.first;
326
 
                        while (act) {
327
 
                                if (act == actuator_to_move) break;
328
 
                                act= act->next;
329
 
                        }
330
 
                        
331
 
                        if (act) {
332
 
                                if ( val==1 && act->prev) {
333
 
                                        /* locate the first visible actuators before this one */
334
 
                                        for (tmp = act->prev; tmp; tmp=tmp->prev) {
335
 
                                                if (tmp->flag & ACT_VISIBLE)
336
 
                                                        break;
337
 
                                        }
338
 
                                        if (tmp) {
339
 
                                                BLI_remlink(&base->object->actuators, act);
340
 
                                                BLI_insertlinkbefore(&base->object->actuators, tmp, act);
341
 
                                        }
342
 
                                }
343
 
                                else if ( val==2 && act->next) {
344
 
                                        for (tmp=act->next; tmp; tmp=tmp->next) {
345
 
                                                if (tmp->flag & ACT_VISIBLE)
346
 
                                                        break;
347
 
                                        }
348
 
                                        if (tmp) {
349
 
                                                BLI_remlink(&base->object->actuators, act);
350
 
                                                BLI_insertlink(&base->object->actuators, tmp, act);
351
 
                                        }
352
 
                                }
353
 
                                ED_undo_push(C, "Move actuator");
354
 
                                break;
355
 
                        }
356
 
                        
357
 
                        base= base->next;
358
 
                }
359
 
        }
360
 
}
361
 
 
362
190
static void do_logic_buts(bContext *C, void *UNUSED(arg), int event)
363
191
{
364
192
        Main *bmain= CTX_data_main(C);
371
199
        ob= CTX_data_active_object(C);
372
200
        if (ob==NULL) return;
373
201
        
374
 
        switch(event) {
 
202
        switch (event) {
375
203
 
376
204
        case B_SETPROP:
377
205
                /* check for inconsistent types */
551
379
                didit= 0;
552
380
                for (ob=bmain->object.first; ob; ob=ob->id.next) {
553
381
                        act= ob->actuators.first;
554
 
                        while (act)
555
 
                        {
556
 
                                if (act->type==ACT_SOUND)
557
 
                                {
 
382
                        while (act) {
 
383
                                if (act->type==ACT_SOUND) {
558
384
                                        bSoundActuator *sa= act->data;
559
 
                                        if (sa->sndnr)
560
 
                                        {
 
385
                                        if (sa->sndnr) {
561
386
                                                ID *sound= bmain->sound.first;
562
387
                                                int nr= 1;
563
388
 
567
392
                                                        break;
568
393
                                                }
569
394
 
570
 
                                                while (sound)
571
 
                                                {
 
395
                                                while (sound) {
572
396
                                                        if (nr==sa->sndnr)
573
397
                                                                break;
574
398
                                                        nr++;
635
459
        return "unknown";
636
460
}
637
461
 
638
 
static const char *sensor_pup(void)
639
 
{
640
 
        /* the number needs to match defines in DNA_sensor_types.h */
641
 
        return "Sensors %t|Always %x0|Delay %x13|Keyboard %x3|Mouse %x5|"
642
 
                "Touch %x1|Collision %x6|Near %x2|Radar %x7|"
643
 
                "Property %x4|Random %x8|Ray %x9|Message %x10|Joystick %x11|Actuator %x12|Armature %x14";
644
 
}
645
 
 
646
462
static const char *controller_name(int type)
647
463
{
648
464
        switch (type) {
666
482
        return "unknown";
667
483
}
668
484
 
669
 
static const char *controller_pup(void)
670
 
{
671
 
        return "Controllers   %t|AND %x0|OR %x1|XOR %x6|NAND %x4|NOR %x5|XNOR %x7|Expression %x2|Python %x3";
672
 
}
673
 
 
674
485
static const char *actuator_name(int type)
675
486
{
676
487
        switch (type) {
717
528
        case ACT_ARMATURE:
718
529
                return "Armature";
719
530
        case ACT_STEERING:
720
 
                return "Steering";              
 
531
                return "Steering";
721
532
        }
722
533
        return "unknown";
723
534
}
724
535
 
725
 
 
726
 
 
727
 
 
728
 
static const char *actuator_pup(Object *owner)
729
 
{
730
 
        switch (owner->type)
731
 
        {
732
 
        case OB_ARMATURE:
733
 
                return "Actuators  %t|Action %x15|Armature %x23|Motion %x0|Constraint %x9|Ipo %x1"
734
 
                        "|Camera %x3|Sound %x5|Property %x6|Edit Object %x10"
735
 
                                                "|Scene %x11|Random %x13|Message %x14|Game %x17"
736
 
                        "|Visibility %x18|2D Filter %x19|Parent %x20|State %x22";
737
 
                break;
738
 
 
739
 
        case OB_MESH:
740
 
                return "Actuators  %t|Shape Action %x21|Motion %x0|Constraint %x9|Ipo %x1"
741
 
                        "|Camera %x3|Sound %x5|Property %x6|Edit Object %x10"
742
 
                                                "|Scene %x11|Random %x13|Message %x14|Game %x17"
743
 
                        "|Visibility %x18|2D Filter %x19|Parent %x20|State %x22";
744
 
                break;
745
 
 
746
 
        default:
747
 
                return "Actuators  %t|Motion %x0|Constraint %x9|Ipo %x1"
748
 
                        "|Camera %x3|Sound %x5|Property %x6|Edit Object %x10"
749
 
                                                "|Scene %x11|Random %x13|Message %x14|Game %x17"
750
 
                        "|Visibility %x18|2D Filter %x19|Parent %x20|State %x22";
751
 
        }
752
 
}
753
 
 
754
 
 
755
 
 
756
536
static void set_sca_ob(Object *ob)
757
537
{
758
538
        bController *cont;
780
560
        bSensor *sens;
781
561
        bController *cont;
782
562
        unsigned int lay;
783
 
        int a, nr, doit;
 
563
        int a, nr, do_it;
784
564
        
785
565
        /* we need a sorted object list */
786
566
        /* set scavisflags flags in Objects to indicate these should be evaluated */
820
600
        
821
601
        /* BUTS_XXX_STATE are similar to BUTS_XXX_LINK for selecting the object */
822
602
        if (scavisflag & (BUTS_SENS_LINK|BUTS_CONT_LINK|BUTS_ACT_LINK|BUTS_SENS_STATE|BUTS_ACT_STATE)) {
823
 
                doit= 1;
824
 
                while (doit) {
825
 
                        doit= 0;
 
603
                do_it = TRUE;
 
604
                while (do_it) {
 
605
                        do_it = FALSE;
826
606
                        
827
607
                        ob= bmain->object.first;
828
608
                        while (ob) {
835
615
                                                        if (sens->links[a]) {
836
616
                                                                obt= (Object *)sens->links[a]->mynew;
837
617
                                                                if (obt && (obt->scavisflag & OB_VIS_CONT)) {
838
 
                                                                        doit= 1;
 
618
                                                                        do_it = TRUE;
839
619
                                                                        ob->scavisflag |= OB_VIS_SENS;
840
620
                                                                        break;
841
621
                                                                }
842
622
                                                        }
843
623
                                                }
844
 
                                                if (doit) break;
 
624
                                                if (do_it) break;
845
625
                                                sens= sens->next;
846
626
                                        }
847
627
                                }
848
628
                                
849
629
                                /* 2nd case: select cont when act selected */
850
 
                                if ((scavisflag & BUTS_CONT_LINK)  && (ob->scavisflag & OB_VIS_CONT)==0) {
 
630
                                if ((scavisflag & BUTS_CONT_LINK) && (ob->scavisflag & OB_VIS_CONT)==0) {
851
631
                                        cont= ob->controllers.first;
852
632
                                        while (cont) {
853
633
                                                for (a=0; a<cont->totlinks; a++) {
854
634
                                                        if (cont->links[a]) {
855
635
                                                                obt= (Object *)cont->links[a]->mynew;
856
636
                                                                if (obt && (obt->scavisflag & OB_VIS_ACT)) {
857
 
                                                                        doit= 1;
 
637
                                                                        do_it = TRUE;
858
638
                                                                        ob->scavisflag |= OB_VIS_CONT;
859
639
                                                                        break;
860
640
                                                                }
861
641
                                                        }
862
642
                                                }
863
 
                                                if (doit) break;
 
643
                                                if (do_it) break;
864
644
                                                cont= cont->next;
865
645
                                        }
866
646
                                }
873
653
                                                        if (sens->links[a]) {
874
654
                                                                obt= (Object *)sens->links[a]->mynew;
875
655
                                                                if (obt && (obt->scavisflag & OB_VIS_CONT)==0) {
876
 
                                                                        doit= 1;
 
656
                                                                        do_it = TRUE;
877
657
                                                                        obt->scavisflag |= OB_VIS_CONT;
878
658
                                                                }
879
659
                                                        }
883
663
                                }
884
664
                                
885
665
                                /* 4th case: select actuator when controller selected */
886
 
                                if ( (scavisflag & (BUTS_ACT_LINK|BUTS_ACT_STATE))  && (ob->scavisflag & OB_VIS_CONT)) {
 
666
                                if ((scavisflag & (BUTS_ACT_LINK|BUTS_ACT_STATE)) && (ob->scavisflag & OB_VIS_CONT)) {
887
667
                                        cont= ob->controllers.first;
888
668
                                        while (cont) {
889
669
                                                for (a=0; a<cont->totlinks; a++) {
890
670
                                                        if (cont->links[a]) {
891
671
                                                                obt= (Object *)cont->links[a]->mynew;
892
672
                                                                if (obt && (obt->scavisflag & OB_VIS_ACT)==0) {
893
 
                                                                        doit= 1;
 
673
                                                                        do_it = TRUE;
894
674
                                                                        obt->scavisflag |= OB_VIS_ACT;
895
675
                                                                }
896
676
                                                        }
902
682
                                ob= ob->id.next;
903
683
                        }
904
684
                }
905
 
        } 
 
685
        }
906
686
        
907
687
        /* now we count */
908
688
        ob= bmain->object.first;
911
691
                ob= ob->id.next;
912
692
        }
913
693
 
914
 
        if (*count==0) return NULL;
915
 
        if (*count>24) *count= 24;              /* temporal */
 
694
        if (*count == 0) return NULL;
 
695
        if (*count > 24) *count = 24;  /* temporal */
916
696
        
917
 
        idar= MEM_callocN( (*count)*sizeof(void *), "idar");
 
697
        idar= MEM_callocN((*count)*sizeof(void *), "idar");
918
698
        
919
699
        ob= bmain->object.first;
920
700
        nr= 0;
921
701
 
922
702
        /* make the active object always the first one of the list */
923
703
        if (obact) {
924
 
                idar[0]= (ID *)obact;
 
704
                idar[0] = (ID *)obact;
925
705
                nr++;
926
706
        }
927
707
 
928
708
        while (ob) {
929
 
                if ( (ob->scavisflag) && (ob != obact)) {
930
 
                        idar[nr]= (ID *)ob;
 
709
                if ((ob->scavisflag) && (ob != obact)) {
 
710
                        idar[nr] = (ID *)ob;
931
711
                        nr++;
932
712
                }
933
 
                if (nr>=24) break;
 
713
                if (nr >= 24) break;
934
714
                ob= ob->id.next;
935
715
        }
936
716
        
940
720
        return idar;
941
721
}
942
722
 
943
 
 
944
 
static int get_col_sensor(int type)
945
 
{
946
 
        /* XXX themecolors not here */
947
 
        
948
 
        switch(type) {
949
 
        case SENS_ALWAYS:               return TH_PANEL;
950
 
        case SENS_DELAY:                return TH_PANEL;
951
 
        case SENS_TOUCH:                return TH_PANEL;
952
 
        case SENS_COLLISION:    return TH_PANEL;
953
 
        case SENS_NEAR:                 return TH_PANEL; 
954
 
        case SENS_KEYBOARD:             return TH_PANEL;
955
 
        case SENS_PROPERTY:             return TH_PANEL;
956
 
        case SENS_ARMATURE:             return TH_PANEL;
957
 
        case SENS_ACTUATOR:             return TH_PANEL;
958
 
        case SENS_MOUSE:                return TH_PANEL;
959
 
        case SENS_RADAR:                return TH_PANEL;
960
 
        case SENS_RANDOM:               return TH_PANEL;
961
 
        case SENS_RAY:                  return TH_PANEL;
962
 
        case SENS_MESSAGE:              return TH_PANEL;
963
 
        case SENS_JOYSTICK:             return TH_PANEL;
964
 
        default:                                return TH_PANEL;
965
 
        }
966
 
}
967
 
static void set_col_sensor(int type, int medium)
968
 
{
969
 
        int col= get_col_sensor(type);
970
 
        UI_ThemeColorShade(col, medium?30:0);
971
 
}
972
 
 
973
 
 
974
 
static void verify_logicbutton_func(bContext *UNUSED(C), void *data1, void *data2)
975
 
{
976
 
        bSensor *sens= (bSensor*)data1;
977
 
        
978
 
        if (sens->level && sens->tap) {
979
 
                if (data2 == &(sens->level))
980
 
                        sens->tap= 0;
981
 
                else
982
 
                        sens->level= 0;
983
 
        }
984
 
}
985
 
 
986
 
static void test_scriptpoin_but(struct bContext *C, const char *name, ID **idpp)
987
 
{
988
 
        *idpp= BLI_findstring(&CTX_data_main(C)->text, name, offsetof(ID, name) + 2);
989
 
}
990
 
 
991
 
static void test_actionpoin_but(struct bContext *C, const char *name, ID **idpp)
992
 
{
993
 
        *idpp= BLI_findstring(&CTX_data_main(C)->action, name, offsetof(ID, name) + 2);
994
 
        if (*idpp)
995
 
                id_us_plus(*idpp);
996
 
}
997
 
 
998
 
 
999
 
static void test_obpoin_but(struct bContext *C, const char *name, ID **idpp)
1000
 
{
1001
 
        *idpp= BLI_findstring(&CTX_data_main(C)->object, name, offsetof(ID, name) + 2);
1002
 
        if (*idpp)
1003
 
                id_lib_extern(*idpp);   /* checks lib data, sets correct flag for saving then */
1004
 
}
1005
 
 
1006
 
static void test_meshpoin_but(struct bContext *C, const char *name, ID **idpp)
1007
 
{
1008
 
        *idpp= BLI_findstring(&CTX_data_main(C)->mesh, name, offsetof(ID, name) + 2);
1009
 
        if (*idpp)
1010
 
                id_us_plus(*idpp);
1011
 
}
1012
 
 
1013
 
static void test_matpoin_but(struct bContext *C, const char *name, ID **idpp)
1014
 
{
1015
 
        *idpp= BLI_findstring(&CTX_data_main(C)->mat, name, offsetof(ID, name) + 2);
1016
 
        if (*idpp)
1017
 
                id_us_plus(*idpp);
1018
 
}
1019
 
 
1020
 
static void test_scenepoin_but(struct bContext *C, const char *name, ID **idpp)
1021
 
{
1022
 
        *idpp= BLI_findstring(&CTX_data_main(C)->scene, name, offsetof(ID, name) + 2);
1023
 
        if (*idpp)
1024
 
                id_us_plus(*idpp);
1025
 
}
1026
 
 
1027
 
static void test_keyboard_event(struct bContext *UNUSED(C), void *arg_ks, void *UNUSED(arg))
1028
 
{
1029
 
        bKeyboardSensor *ks= (bKeyboardSensor*)arg_ks;
1030
 
        
1031
 
        if (!ISKEYBOARD(ks->key))
1032
 
                ks->key= 0;
1033
 
        if (!ISKEYBOARD(ks->qual))
1034
 
                ks->qual= 0;
1035
 
        if (!ISKEYBOARD(ks->qual2))
1036
 
                ks->qual2= 0;
1037
 
}
1038
 
 
1039
 
/**
1040
 
 * Draws a toggle for pulse mode, a frequency field and a toggle to invert
1041
 
 * the value of this sensor. Operates on the shared data block of sensors.
1042
 
 */
1043
 
static void draw_default_sensor_header(bSensor *sens,
1044
 
                                                                uiBlock *block,
1045
 
                                                                short x,
1046
 
                                                                short y,
1047
 
                                                                short w) 
1048
 
{
1049
 
        uiBut *but;
1050
 
        
1051
 
        /* Pulsing and frequency */
1052
 
        uiBlockBeginAlign(block);
1053
 
        uiDefIconButBitS(block, TOG, SENS_PULSE_REPEAT, 1, ICON_DOTSUP,
1054
 
                         (short)(x + 10 + 0.0 * (w - 20)), (short)(y - 21), (short)(0.1 * (w - 20)), 19,
1055
 
                         &sens->pulse, 0.0, 0.0, 0, 0,
1056
 
                         "Activate TRUE level triggering (pulse mode)");
1057
 
 
1058
 
        uiDefIconButBitS(block, TOG, SENS_NEG_PULSE_MODE, 1, ICON_DOTSDOWN,
1059
 
                         (short)(x + 10 + 0.1 * (w-20)), (short)(y - 21), (short)(0.1 * (w-20)), 19,
1060
 
                         &sens->pulse, 0.0, 0.0, 0, 0,
1061
 
                         "Activate FALSE level triggering (pulse mode)");
1062
 
        uiDefButS(block, NUM, 1, "f:",
1063
 
                         (short)(x + 10 + 0.2 * (w-20)), (short)(y - 21), (short)(0.275 * (w-20)), 19,
1064
 
                         &sens->freq, 0.0, 10000.0, 0, 0,
1065
 
                         "Delay between repeated pulses (in logic tics, 0 = no delay)");
1066
 
        uiBlockEndAlign(block);
1067
 
        
1068
 
        /* value or shift? */
1069
 
        uiBlockBeginAlign(block);
1070
 
        but = uiDefButS(block, TOG, 1, "Level",
1071
 
                         (short)(x + 10 + 0.5 * (w-20)), (short)(y - 21), (short)(0.20 * (w-20)), 19,
1072
 
                         &sens->level, 0.0, 0.0, 0, 0,
1073
 
                         "Level detector, trigger controllers of new states (only applicable upon logic state transition)");
1074
 
        uiButSetFunc(but, verify_logicbutton_func, sens, &(sens->level));
1075
 
        but = uiDefButS(block, TOG, 1, "Tap",
1076
 
                         (short)(x + 10 + 0.702 * (w-20)), (short)(y - 21), (short)(0.12 * (w-20)), 19,
1077
 
                         &sens->tap, 0.0, 0.0, 0, 0,
1078
 
                         "Trigger controllers only for an instant, even while the sensor remains true");
1079
 
        uiButSetFunc(but, verify_logicbutton_func, sens, &(sens->tap));
1080
 
        uiBlockEndAlign(block);
1081
 
        
1082
 
        uiDefButS(block, TOG, 1, "Inv",
1083
 
                         (short)(x + 10 + 0.85 * (w-20)), (short)(y - 21), (short)(0.15 * (w-20)), 19,
1084
 
                         &sens->invert, 0.0, 0.0, 0, 0,
1085
 
                         "Invert the level (output) of this sensor");
1086
 
}
1087
 
 
1088
723
static void get_armature_bone_constraint(Object *ob, const char *posechannel, const char *constraint_name, bConstraint **constraint)
1089
724
{
1090
725
        /* check that bone exist in the active object */
1091
726
        if (ob->type == OB_ARMATURE && ob->pose) {
1092
 
                bPoseChannel *pchan= get_pose_channel(ob->pose, posechannel);
 
727
                bPoseChannel *pchan= BKE_pose_channel_find_name(ob->pose, posechannel);
1093
728
                if (pchan) {
1094
729
                        bConstraint *con= BLI_findstring(&pchan->constraints, constraint_name, offsetof(bConstraint, name));
1095
730
                        if (con) {
1099
734
        }
1100
735
        /* didn't find any */
1101
736
}
1102
 
static void check_armature_bone_constraint(Object *ob, char *posechannel, char *constraint)
1103
 
{
1104
 
        /* check that bone exist in the active object */
1105
 
        if (ob->type == OB_ARMATURE && ob->pose) {
1106
 
                bPoseChannel *pchan;
1107
 
                bPose *pose = ob->pose;
1108
 
                for (pchan=pose->chanbase.first; pchan; pchan=pchan->next) {
1109
 
                        if (!strcmp(pchan->name, posechannel)) {
1110
 
                                /* found it, now look for constraint channel */
1111
 
                                bConstraint *con;
1112
 
                                for (con=pchan->constraints.first; con; con=con->next) {
1113
 
                                        if (!strcmp(con->name, constraint)) {
1114
 
                                                /* found it, all ok */
1115
 
                                                return;                                         
1116
 
                                        }
1117
 
                                }
1118
 
                                /* didn't find constraint, make empty */
1119
 
                                constraint[0] = 0;
1120
 
                                return;
1121
 
                        }
1122
 
                }
1123
 
        }
1124
 
        /* didn't find any */
1125
 
        posechannel[0] = 0;
1126
 
        constraint[0] = 0;
1127
 
}
1128
 
 
1129
 
static void check_armature_sensor(bContext *C, void *arg1_but, void *arg2_sens)
1130
 
{
1131
 
        bArmatureSensor *sens = arg2_sens;
1132
 
        uiBut *but = arg1_but;
1133
 
        Object *ob= CTX_data_active_object(C);
1134
 
 
1135
 
        /* check that bone exist in the active object */
1136
 
        but->retval = B_REDR;
1137
 
        check_armature_bone_constraint(ob, sens->posechannel, sens->constraint);
1138
 
}
1139
 
 
1140
 
static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short xco, short yco, short width)
1141
 
{
1142
 
        bNearSensor      *ns           = NULL;
1143
 
        bTouchSensor     *ts           = NULL;
1144
 
        bKeyboardSensor  *ks           = NULL;
1145
 
        bPropertySensor  *ps           = NULL;
1146
 
        bArmatureSensor  *arm          = NULL;
1147
 
        bMouseSensor     *ms           = NULL;
1148
 
        bCollisionSensor *cs           = NULL;
1149
 
        bRadarSensor     *rs           = NULL;
1150
 
        bRandomSensor    *randomSensor = NULL;
1151
 
        bRaySensor       *raySens      = NULL;
1152
 
        bMessageSensor   *mes          = NULL;
1153
 
        bJoystickSensor  *joy              = NULL;
1154
 
        bActuatorSensor  *as           = NULL;
1155
 
        bDelaySensor     *ds               = NULL;
1156
 
        uiBut *but;
1157
 
        short ysize;
1158
 
        const char *str;
1159
 
        
1160
 
        /* yco is at the top of the rect, draw downwards */
1161
 
        
1162
 
        set_col_sensor(sens->type, 0);
1163
 
        
1164
 
        switch (sens->type)
1165
 
        {
1166
 
        case SENS_ALWAYS:
1167
 
                {
1168
 
                        ysize= 24;
1169
 
                        
1170
 
                        glRects(xco, yco-ysize, xco+width, yco);
1171
 
                        uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1172
 
                        
1173
 
                        draw_default_sensor_header(sens, block, xco, yco, width);
1174
 
                        
1175
 
                        yco-= ysize;
1176
 
                        
1177
 
                        break;
1178
 
                }
1179
 
        case SENS_TOUCH:
1180
 
                {
1181
 
                        ysize= 48; 
1182
 
                        
1183
 
                        glRects(xco, yco-ysize, xco+width, yco); 
1184
 
                        uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1); 
1185
 
                        
1186
 
                        draw_default_sensor_header(sens, block, xco, yco, width);
1187
 
                        
1188
 
                        ts= sens->data; 
1189
 
                        
1190
 
                        // uiDefBut(block, TEX, 1, "Property:", xco,yco-22,width, 19, &ts->name, 0, MAX_NAME, 0, 0, "Only look for Objects with this property");
1191
 
                        uiDefIDPoinBut(block, test_matpoin_but, ID_MA, 1, "MA:",(short)(xco + 10),(short)(yco-44), (short)(width - 20), 19, &ts->ma,  "Only look for floors with this Material"); 
1192
 
                        // uiDefButF(block, NUM, 1, "Margin:",  xco+width/2,yco-44,width/2, 19, &ts->dist, 0.0, 10.0, 100, 0, "Extra margin (distance) for larger sensitivity"); 
1193
 
                        yco-= ysize; 
1194
 
                        break; 
1195
 
                }
1196
 
        case SENS_COLLISION:
1197
 
                {
1198
 
                        ysize= 48;
1199
 
                        
1200
 
                        glRects(xco, yco-ysize, xco+width, yco);
1201
 
                        uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1202
 
                        
1203
 
                        draw_default_sensor_header(sens, block, xco, yco, width);
1204
 
                        cs= sens->data;
1205
 
                        
1206
 
                        /* The collision sensor will become a generic collision (i.e. it     */
1207
 
                        /* absorb the old touch sensor).                                     */
1208
 
 
1209
 
                        uiDefButBitS(block, TOG, SENS_COLLISION_PULSE, B_REDR, "Pulse",(short)(xco + 10),(short)(yco - 44),
1210
 
                                (short)(0.20 * (width-20)), 19, &cs->mode, 0.0, 0.0, 0, 0,
1211
 
                                "Changes to the set of colliding objects generated pulses");
1212
 
                        
1213
 
                        uiDefButBitS(block, TOG, SENS_COLLISION_MATERIAL, B_REDR, "M/P",(short)(xco + 10 + (0.20 * (width-20))),(short)(yco - 44),
1214
 
                                (short)(0.20 * (width-20)), 19, &cs->mode, 0.0, 0.0, 0, 0,
1215
 
                                "Toggle collision on material or property");
1216
 
                        
1217
 
                        if (cs->mode & SENS_COLLISION_MATERIAL) {
1218
 
                                uiDefBut(block, TEX, 1, "Material:", (short)(xco + 10 + 0.40 * (width-20)),
1219
 
                                        (short)(yco-44), (short)(0.6*(width-20)), 19, &cs->materialName, 0, MAX_NAME, 0, 0,
1220
 
                                        "Only look for Objects with this material");
1221
 
                        }
1222
 
                        else {
1223
 
                                uiDefBut(block, TEX, 1, "Property:", (short)(xco + 10 + 0.40 * (width-20)), (short)(yco-44),
1224
 
                                        (short)(0.6*(width-20)), 19, &cs->name, 0, MAX_NAME, 0, 0,
1225
 
                                        "Only look for Objects with this property");
1226
 
                        }
1227
 
        
1228
 
                        /*              uiDefButS(block, NUM, 1, "Damp:",       xco+10+width-90,yco-24, 70, 19, &cs->damp, 0, 250, 0, 0, "For 'damp' time don't detect another collision"); */
1229
 
                        
1230
 
                        yco-= ysize;
1231
 
                        break;
1232
 
                }
1233
 
        case SENS_NEAR:
1234
 
                {
1235
 
                        ysize= 72;
1236
 
                        
1237
 
                        glRects(xco, yco-ysize, xco+width, yco);
1238
 
                        uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1239
 
                        
1240
 
                        draw_default_sensor_header(sens, block, xco, yco, width);
1241
 
                        ns= sens->data;
1242
 
                        
1243
 
                        uiDefBut(block, TEX, 1, "Property:",(short)(10+xco),(short)(yco-44), (short)(width-20), 19,
1244
 
                                &ns->name, 0, MAX_NAME, 0, 0, "Only look for Objects with this property");
1245
 
                        uiDefButF(block, NUM, 1, "Dist",(short)(10+xco),(short)(yco-68),(short)((width-22)/2), 19,
1246
 
                                &ns->dist, 0.0, 1000.0, 1000, 0, "Trigger distance");
1247
 
                        uiDefButF(block, NUM, 1, "Reset",(short)(10+xco+(width-22)/2), (short)(yco-68), (short)((width-22)/2), 19,
1248
 
                                &ns->resetdist, 0.0, 1000.0, 1000, 0, "Reset distance"); 
1249
 
                        yco-= ysize;
1250
 
                        break;
1251
 
                }
1252
 
        case SENS_RADAR:
1253
 
                {
1254
 
                        ysize= 72; 
1255
 
                        
1256
 
                        glRects(xco, yco-ysize, xco+width, yco);
1257
 
                        uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1258
 
                        
1259
 
                        draw_default_sensor_header(sens, block, xco, yco, width);
1260
 
                        
1261
 
                        rs= sens->data;
1262
 
                        
1263
 
                        uiDefBut(block, TEX, 1, "Prop:",
1264
 
                                         (short)(10+xco),(short)(yco-44), (short)(0.7 * (width-20)), 19,
1265
 
                                         &rs->name, 0, MAX_NAME, 0, 0,
1266
 
                                         "Only look for Objects with this property");
1267
 
 
1268
 
                        str = "Type %t|+X axis %x0|+Y axis %x1|+Z axis %x2|-X axis %x3|-Y axis %x4|-Z axis %x5"; 
1269
 
                        uiDefButS(block, MENU, B_REDR, str,
1270
 
                                (short)(10+xco+0.7 * (width-20)), (short)(yco-44), (short)(0.3 * (width-22)), 19,
1271
 
                                &rs->axis, 2.0, 31, 0, 0,
1272
 
                                "Specify along which axis the radar cone is cast");
1273
 
                                
1274
 
                        uiDefButF(block, NUM, 1, "Ang:",
1275
 
                                         (short)(10+xco), (short)(yco-68), (short)((width-20)/2), 19,
1276
 
                                         &rs->angle, 0.0, 179.9, 10, 0,
1277
 
                                         "Opening angle of the radar cone");
1278
 
                        uiDefButF(block, NUM, 1, "Dist:",
1279
 
                                         (short)(xco+10 + (width-20)/2), (short)(yco-68), (short)((width-20)/2), 19,
1280
 
                                         &rs->range, 0.01, 10000.0, 100, 0,
1281
 
                                         "Depth of the radar cone");
1282
 
                        yco-= ysize;
1283
 
                        break;
1284
 
                }
1285
 
        case SENS_KEYBOARD:
1286
 
                {
1287
 
                        ks= sens->data;
1288
 
                        
1289
 
                        /* 5 lines: 120 height */
1290
 
                        ysize= (ks->type&1) ? 96:120;
1291
 
                        
1292
 
                        glRects(xco, yco-ysize, xco+width, yco);
1293
 
                        uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1294
 
                        
1295
 
                        /* header line */
1296
 
                        draw_default_sensor_header(sens, block, xco, yco, width);
1297
 
                        
1298
 
                        /* part of line 1 */
1299
 
                        uiDefBut(block, LABEL, 0, "Key",          xco, yco-44, 40, 19, NULL, 0, 0, 0, 0, "");
1300
 
                        uiDefButBitS(block, TOG, 1, B_REDR, "All keys",   xco+40+(width/2), yco-44, (width/2)-50, 19,
1301
 
                                &ks->type, 0, 0, 0, 0, "");
1302
 
                        
1303
 
                        
1304
 
                        if ((ks->type&1)==0) { /* is All Keys option off? */
1305
 
                                /* line 2: hotkey and allkeys toggle */
1306
 
                                but = uiDefKeyevtButS(block, 0, "", xco+40, yco-44, (width)/2, 19, &ks->key, "Key code");
1307
 
                                uiButSetFunc(but, test_keyboard_event, ks, NULL);
1308
 
                                
1309
 
                                /* line 3: two key modifyers (qual1, qual2) */
1310
 
                                uiDefBut(block, LABEL, 0, "Hold",         xco, yco-68, 40, 19, NULL, 0, 0, 0, 0, "");
1311
 
                                but = uiDefKeyevtButS(block, 0, "", xco+40, yco-68, (width-50)/2, 19, &ks->qual, "Modifier key code");
1312
 
                                uiButSetFunc(but, test_keyboard_event, ks, NULL);
1313
 
                                but = uiDefKeyevtButS(block, 0, "", xco+40+(width-50)/2, yco-68, (width-50)/2, 19, &ks->qual2, "Second Modifier key code");
1314
 
                                uiButSetFunc(but, test_keyboard_event, ks, NULL);
1315
 
                        }
1316
 
                        
1317
 
                        /* line 4: toggle property for string logging mode */
1318
 
                        uiDefBut(block, TEX, 1, "LogToggle: ",
1319
 
                                xco+10, yco-((ks->type&1) ? 68:92), (width-20), 19,
1320
 
                                ks->toggleName, 0, MAX_NAME, 0, 0,
1321
 
                                "Property that indicates whether to log "
1322
 
                                "keystrokes as a string");
1323
 
                        
1324
 
                        /* line 5: target property for string logging mode */
1325
 
                        uiDefBut(block, TEX, 1, "Target: ",
1326
 
                                xco+10, yco-((ks->type&1) ? 92:116), (width-20), 19,
1327
 
                                ks->targetName, 0, MAX_NAME, 0, 0,
1328
 
                                "Property that receives the keystrokes in case "
1329
 
                                "a string is logged");
1330
 
                        
1331
 
                        yco-= ysize;
1332
 
                        break;
1333
 
                }
1334
 
        case SENS_PROPERTY:
1335
 
                {
1336
 
                        ysize= 96;
1337
 
                        
1338
 
                        glRects(xco, yco-ysize, xco+width, yco);
1339
 
                        uiEmboss((float)xco, (float)yco-ysize,
1340
 
                                (float)xco+width, (float)yco, 1);
1341
 
                        
1342
 
                        draw_default_sensor_header(sens, block, xco, yco, width);
1343
 
                        ps= sens->data;
1344
 
                        
1345
 
                        str= "Type %t|Equal %x0|Not Equal %x1|Interval %x2|Changed %x3"; 
1346
 
                        /* str= "Type %t|Equal %x0|Not Equal %x1"; */
1347
 
                        uiDefButI(block, MENU, B_REDR, str,                     xco+30,yco-44,width-60, 19,
1348
 
                                &ps->type, 0, 31, 0, 0, "Type");
1349
 
                        
1350
 
                        if (ps->type != SENS_PROP_EXPRESSION)
1351
 
                        {
1352
 
                                uiDefBut(block, TEX, 1, "Prop: ",                       xco+30,yco-68,width-60, 19,
1353
 
                                        ps->name, 0, MAX_NAME, 0, 0,  "Property name");
1354
 
                        }
1355
 
                        
1356
 
                        if (ps->type == SENS_PROP_INTERVAL)
1357
 
                        {
1358
 
                                uiDefBut(block, TEX, 1, "Min: ",                xco,yco-92,width/2, 19,
1359
 
                                        ps->value, 0, MAX_NAME, 0, 0, "check for min value");
1360
 
                                uiDefBut(block, TEX, 1, "Max: ",                xco+width/2,yco-92,width/2, 19,
1361
 
                                        ps->maxvalue, 0, MAX_NAME, 0, 0, "check for max value");
1362
 
                        }
1363
 
                        else if (ps->type == SENS_PROP_CHANGED) {
1364
 
                                /* pass */
1365
 
                        }
1366
 
                        else {
1367
 
                                uiDefBut(block, TEX, 1, "Value: ",              xco+30,yco-92,width-60, 19,
1368
 
                                         ps->value, 0, MAX_NAME, 0, 0, "check for value");
1369
 
                        }
1370
 
                        
1371
 
                        yco-= ysize;
1372
 
                        break;
1373
 
                }
1374
 
        case SENS_ARMATURE:
1375
 
                {
1376
 
                        ysize= 70;
1377
 
                        
1378
 
                        glRects(xco, yco-ysize, xco+width, yco);
1379
 
                        uiEmboss((float)xco, (float)yco-ysize,
1380
 
                                (float)xco+width, (float)yco, 1);
1381
 
                        
1382
 
                        draw_default_sensor_header(sens, block, xco, yco, width);
1383
 
                        arm= sens->data;
1384
 
 
1385
 
                        if (ob->type == OB_ARMATURE) {
1386
 
                                uiBlockBeginAlign(block);
1387
 
                                but = uiDefBut(block, TEX, 1, "Bone: ",
1388
 
                                                (xco+10), (yco-44), (width-20)/2, 19,
1389
 
                                                arm->posechannel, 0, MAX_NAME, 0, 0,
1390
 
                                                "Bone on which you want to check a constraint");
1391
 
                                uiButSetFunc(but, check_armature_sensor, but, arm);
1392
 
                                but = uiDefBut(block, TEX, 1, "Cons: ",
1393
 
                                                (xco+10)+(width-20)/2, (yco-44), (width-20)/2, 19,
1394
 
                                                arm->constraint, 0, MAX_NAME, 0, 0,
1395
 
                                                "Name of the constraint you want to control");
1396
 
                                uiButSetFunc(but, check_armature_sensor, but, arm);
1397
 
                                uiBlockEndAlign(block);
1398
 
 
1399
 
                                str= "Type %t|State changed %x0|Lin error below %x1|Lin error above %x2|Rot error below %x3|Rot error above %x4"; 
1400
 
 
1401
 
                                uiDefButI(block, MENU, B_REDR, str,                     xco+10,yco-66,0.4*(width-20), 19,
1402
 
                                        &arm->type, 0, 31, 0, 0, "Type");
1403
 
                        
1404
 
                                if (arm->type != SENS_ARM_STATE_CHANGED)
1405
 
                                {
1406
 
                                        uiDefButF(block, NUM, 1, "Value: ",             xco+10+0.4*(width-20),yco-66,0.6*(width-20), 19,
1407
 
                                        &arm->value, -10000.0, 10000.0, 100, 0, "Test the error against this value");
1408
 
                                }
1409
 
                        }
1410
 
                        yco-= ysize;
1411
 
                        break;
1412
 
                }
1413
 
        case SENS_ACTUATOR:
1414
 
                {
1415
 
                        ysize= 48;
1416
 
                        
1417
 
                        glRects(xco, yco-ysize, xco+width, yco);
1418
 
                        uiEmboss((float)xco, (float)yco-ysize,
1419
 
                                (float)xco+width, (float)yco, 1);
1420
 
                        
1421
 
                        draw_default_sensor_header(sens, block, xco, yco, width);
1422
 
                        as= sens->data;
1423
 
                        
1424
 
                        uiDefBut(block, TEX, 1, "Act: ",                        xco+30,yco-44,width-60, 19,
1425
 
                                        as->name, 0, MAX_NAME, 0, 0,  "Actuator name, actuator active state modifications will be detected");
1426
 
                        yco-= ysize;
1427
 
                        break;
1428
 
                }
1429
 
        case SENS_DELAY:
1430
 
                {
1431
 
                        ysize= 48;
1432
 
                        
1433
 
                        glRects(xco, yco-ysize, xco+width, yco);
1434
 
                        uiEmboss((float)xco, (float)yco-ysize,
1435
 
                                (float)xco+width, (float)yco, 1);
1436
 
                        
1437
 
                        draw_default_sensor_header(sens, block, xco, yco, width);
1438
 
                        ds = sens->data;
1439
 
                        
1440
 
                        uiDefButS(block, NUM, 0, "Delay",(short)(10+xco),(short)(yco-44),(short)((width-22)*0.4+10), 19,
1441
 
                                &ds->delay, 0.0, 5000.0, 0, 0, "Delay in number of logic tics before the positive trigger (default 60 per second)");
1442
 
                        uiDefButS(block, NUM, 0, "Dur",(short)(10+xco+(width-22)*0.4+10),(short)(yco-44),(short)((width-22)*0.4-10), 19,
1443
 
                                &ds->duration, 0.0, 5000.0, 0, 0, "If >0, delay in number of logic tics before the negative trigger following the positive trigger");
1444
 
                        uiDefButBitS(block, TOG, SENS_DELAY_REPEAT, 0, "REP",(short)(xco + 10 + (width-22)*0.8),(short)(yco - 44),
1445
 
                                (short)(0.20 * (width-22)), 19, &ds->flag, 0.0, 0.0, 0, 0,
1446
 
                                "Toggle repeat option. If selected, the sensor restarts after Delay+Dur logic tics");
1447
 
                        yco-= ysize;
1448
 
                        break;
1449
 
                }
1450
 
        case SENS_MOUSE:
1451
 
                {
1452
 
                        ms= sens->data;
1453
 
                        /* Two lines: 48 pixels high. */
1454
 
                        ysize = 48;
1455
 
                        
1456
 
                        glRects(xco, yco-ysize, xco+width, yco);
1457
 
                        uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1458
 
                        
1459
 
                        /* line 1: header */
1460
 
                        draw_default_sensor_header(sens, block, xco, yco, width);
1461
 
                        
1462
 
                        /* Line 2: type selection. The number are a bit mangled to get
1463
 
                         * proper compatibility with older .blend files. */
1464
 
 
1465
 
                        /* Any sensor type default is 0 but the ms enum starts in 1.
1466
 
                         * Therefore the mouse sensor is initialized to 1 in sca.c */
1467
 
                        str= "Type %t|Left button %x1|Middle button %x2|"
1468
 
                                "Right button %x4|Wheel Up %x5|Wheel Down %x6|Movement %x8|Mouse over %x16|Mouse over any%x32"; 
1469
 
                        uiDefButS(block, MENU, B_REDR, str, xco+10, yco-44, (width*0.8f)-20, 19,
1470
 
                                &ms->type, 0, 31, 0, 0,
1471
 
                                "Specify the type of event this mouse sensor should trigger on");
1472
 
                        
1473
 
                        if (ms->type==32) {
1474
 
                                uiDefButBitS(block, TOG, SENS_MOUSE_FOCUS_PULSE, B_REDR, "Pulse",(short)(xco + 10) + (width*0.8f)-20,(short)(yco - 44),
1475
 
                                        (short)(0.20 * (width-20)), 19, &ms->flag, 0.0, 0.0, 0, 0,
1476
 
                                        "Moving the mouse over a different object generates a pulse");  
1477
 
                        }
1478
 
                        
1479
 
                        yco-= ysize;
1480
 
                        break;
1481
 
                }
1482
 
        case SENS_RANDOM:
1483
 
                {
1484
 
                        ysize = 48;
1485
 
                        
1486
 
                        glRects(xco, yco-ysize, xco+width, yco);
1487
 
                        uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1488
 
                        
1489
 
                        draw_default_sensor_header(sens, block, xco, yco, width);
1490
 
                        randomSensor = sens->data;
1491
 
                        /* some files were wrongly written, avoid crash now */
1492
 
                        if (randomSensor)
1493
 
                        {
1494
 
                                uiDefButI(block, NUM, 1, "Seed: ",              xco+10,yco-44,(width-20), 19,
1495
 
                                        &randomSensor->seed, 0, 1000, 0, 0,
1496
 
                                        "Initial seed of the generator. (Choose 0 for not random)");
1497
 
                        }
1498
 
                        yco-= ysize;
1499
 
                        break;
1500
 
                }
1501
 
        case SENS_RAY:
1502
 
                {
1503
 
                        ysize = 72;
1504
 
                        glRects(xco, yco-ysize, xco+width, yco);
1505
 
                        uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1506
 
                        
1507
 
                        draw_default_sensor_header(sens, block, xco, yco, width);
1508
 
                        raySens = sens->data;
1509
 
                        
1510
 
                        /* 1. property or material */
1511
 
                        uiDefButBitS(block, TOG, SENS_COLLISION_MATERIAL, B_REDR, "M/P",
1512
 
                                xco + 10,yco - 44, 0.20 * (width-20), 19,
1513
 
                                &raySens->mode, 0.0, 0.0, 0, 0,
1514
 
                                "Toggle collision on material or property");
1515
 
                        
1516
 
                        if (raySens->mode & SENS_COLLISION_MATERIAL) {
1517
 
                                uiDefBut(block, TEX, 1, "Material:", xco + 10 + 0.20 * (width-20), yco-44, 0.8*(width-20), 19,
1518
 
                                        &raySens->matname, 0, MAX_NAME, 0, 0,
1519
 
                                        "Only look for Objects with this material");
1520
 
                        }
1521
 
                        else {
1522
 
                                uiDefBut(block, TEX, 1, "Property:", xco + 10 + 0.20 * (width-20), yco-44, 0.8*(width-20), 19,
1523
 
                                        &raySens->propname, 0, MAX_NAME, 0, 0,
1524
 
                                        "Only look for Objects with this property");
1525
 
                        }
1526
 
 
1527
 
                        /* X-Ray option */
1528
 
                        uiDefButBitS(block, TOG, SENS_RAY_XRAY, 1, "X",
1529
 
                                xco + 10,yco - 68, 0.10 * (width-20), 19,
1530
 
                                &raySens->mode, 0.0, 0.0, 0, 0,
1531
 
                                "Toggle X-Ray option (see through objects that don't have the property)");
1532
 
                        /* 2. sensing range */
1533
 
                        uiDefButF(block, NUM, 1, "Range", xco+10 + 0.10 * (width-20), yco-68, 0.5 * (width-20), 19,
1534
 
                                &raySens->range, 0.01, 10000.0, 100, 0,
1535
 
                                "Sense objects no farther than this distance");
1536
 
                        
1537
 
                        /* 3. axis choice */
1538
 
                        str = "Type %t|+ X axis %x1|+ Y axis %x0|+ Z axis %x2|- X axis %x3|- Y axis %x4|- Z axis %x5"; 
1539
 
                        uiDefButI(block, MENU, B_REDR, str, xco+10 + 0.6 * (width-20), yco-68, 0.4 * (width-20), 19,
1540
 
                                &raySens->axisflag, 2.0, 31, 0, 0,
1541
 
                                "Specify along which axis the ray is cast");
1542
 
                        
1543
 
                        yco-= ysize;            
1544
 
                        break;
1545
 
                }
1546
 
        case SENS_MESSAGE:
1547
 
                {
1548
 
                        mes = sens->data;
1549
 
                        ysize = 2 * 24; /* total number of lines * 24 pixels/line */
1550
 
                        
1551
 
                        glRects(xco, yco-ysize, xco+width, yco);
1552
 
                        uiEmboss((float)xco, (float)yco-ysize,
1553
 
                                (float)xco+width, (float)yco, 1);
1554
 
                        
1555
 
                        /* line 1: header line */
1556
 
                        draw_default_sensor_header(sens, block, xco, yco, width);
1557
 
                        
1558
 
                        /* line 2: Subject filter */
1559
 
                        uiDefBut(block, TEX, 1, "Subject: ",
1560
 
                                (xco+10), (yco-44), (width-20), 19,
1561
 
                                mes->subject, 0, MAX_NAME, 0, 0,
1562
 
                                "Optional subject filter: only accept messages with this subject"
1563
 
                                ", or empty for all");
1564
 
                        
1565
 
                        yco -= ysize;
1566
 
                        break;
1567
 
                }
1568
 
                case SENS_JOYSTICK:
1569
 
                {
1570
 
 
1571
 
                        ysize =  72;
1572
 
                        
1573
 
                        glRects(xco, yco-ysize, xco+width, yco);
1574
 
                        uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1575
 
                        
1576
 
                        /* line 1: header */
1577
 
                        draw_default_sensor_header(sens, block, xco, yco, width);
1578
 
 
1579
 
                        joy= sens->data;
1580
 
 
1581
 
                        uiDefButC(block, NUM, 1, "Index:", xco+10, yco-44, 0.33 * (width-20), 19,
1582
 
                        &joy->joyindex, 0, SENS_JOY_MAXINDEX-1, 100, 0,
1583
 
                        "Specify which joystick to use");                       
1584
 
 
1585
 
                        str= "Type %t|Button %x0|Axis %x1|Single Axis %x3|Hat%x2"; 
1586
 
                        uiDefButC(block, MENU, B_REDR, str, xco+87, yco-44, 0.26 * (width-20), 19,
1587
 
                                &joy->type, 0, 31, 0, 0,
1588
 
                                "The type of event this joystick sensor is triggered on");
1589
 
                        
1590
 
                        if (joy->type != SENS_JOY_AXIS_SINGLE) {
1591
 
                                if (joy->flag & SENS_JOY_ANY_EVENT) {
1592
 
                                        switch (joy->type) {
1593
 
                                        case SENS_JOY_AXIS:     
1594
 
                                                str = "All Axis Events";
1595
 
                                                break;
1596
 
                                        case SENS_JOY_BUTTON:   
1597
 
                                                str = "All Button Events";
1598
 
                                                break;
1599
 
                                        default:
1600
 
                                                str = "All Hat Events";
1601
 
                                                break;
1602
 
                                        }
1603
 
                                }
1604
 
                                else {
1605
 
                                        str = "All";
1606
 
                                }
1607
 
                                
1608
 
                                uiDefButBitS(block, TOG, SENS_JOY_ANY_EVENT, B_REDR, str,
1609
 
                                        xco+10 + 0.475 * (width-20), yco-68, ((joy->flag & SENS_JOY_ANY_EVENT) ? 0.525 : 0.12) * (width-20), 19,
1610
 
                                        &joy->flag, 0, 0, 0, 0,
1611
 
                                        "Triggered by all events on this joysticks current type (axis/button/hat)");
1612
 
                        }
1613
 
                        if (joy->type == SENS_JOY_BUTTON)
1614
 
                        {
1615
 
                                if ((joy->flag & SENS_JOY_ANY_EVENT)==0) {
1616
 
                                        uiDefButI(block, NUM, 1, "Number:", xco+10 + 0.6 * (width-20), yco-68, 0.4 * (width-20), 19,
1617
 
                                        &joy->button, 0, 18, 100, 0,
1618
 
                                        "Specify which button to use");
1619
 
                                }
1620
 
                        }
1621
 
                        else if (joy->type == SENS_JOY_AXIS) {
1622
 
                                uiDefButS(block, NUM, 1, "Number:", xco+10, yco-68, 0.46 * (width-20), 19,
1623
 
                                &joy->axis, 1, 8.0, 100, 0,
1624
 
                                "Specify which axis pair to use, 1 is useually the main direction input");
1625
 
 
1626
 
                                uiDefButI(block, NUM, 1, "Threshold:", xco+10 + 0.6 * (width-20),yco-44, 0.4 * (width-20), 19,
1627
 
                                &joy->precision, 0, 32768.0, 100, 0,
1628
 
                                "Specify the precision of the axis");
1629
 
 
1630
 
                                if ((joy->flag & SENS_JOY_ANY_EVENT)==0) {
1631
 
                                        str = "Type %t|Up Axis %x1 |Down Axis %x3|Left Axis %x2|Right Axis %x0"; 
1632
 
                                        uiDefButI(block, MENU, B_REDR, str, xco+10 + 0.6 * (width-20), yco-68, 0.4 * (width-20), 19,
1633
 
                                        &joy->axisf, 2.0, 31, 0, 0,
1634
 
                                        "The direction of the axis, use 'All Events' to receive events on any direction");
1635
 
                                }
1636
 
                        }
1637
 
                        else if (joy->type == SENS_JOY_HAT) {
1638
 
                                uiDefButI(block, NUM, 1, "Number:", xco+10, yco-68, 0.46 * (width-20), 19,
1639
 
                                &joy->hat, 1, 4.0, 100, 0,
1640
 
                                "Specify which hat to use");
1641
 
                                
1642
 
                                if ((joy->flag & SENS_JOY_ANY_EVENT)==0) {
1643
 
                                        str = "Direction%t|Up%x1|Down%x4|Left%x8|Right%x2|%l|Up/Right%x3|Down/Left%x12|Up/Left%x9|Down/Right%x6"; 
1644
 
                                        uiDefButI(block, MENU, 0, str, xco+10 + 0.6 * (width-20), yco-68, 0.4 * (width-20), 19,
1645
 
                                        &joy->hatf, 2.0, 31, 0, 0,
1646
 
                                        "The direction of the hat, use 'All Events' to receive events on any direction");
1647
 
                                }
1648
 
                        }
1649
 
                        else { /* (joy->type == SENS_JOY_AXIS_SINGLE)*/
1650
 
                                uiDefButS(block, NUM, 1, "Number:", xco+10, yco-68, 0.46 * (width-20), 19,
1651
 
                                &joy->axis_single, 1, 16.0, 100, 0,
1652
 
                                "Specify a single axis (verticle/horizontal/other) to detect");
1653
 
                                
1654
 
                                uiDefButI(block, NUM, 1, "Threshold:", xco+10 + 0.6 * (width-20),yco-44, 0.4 * (width-20), 19,
1655
 
                                &joy->precision, 0, 32768.0, 100, 0,
1656
 
                                "Specify the precision of the axis");
1657
 
                        }
1658
 
                        yco-= ysize;
1659
 
                        break;
1660
 
                }
1661
 
        }
1662
 
        
1663
 
        return yco-4;
1664
 
}
1665
 
 
1666
 
 
1667
 
 
1668
 
static short draw_controllerbuttons(bController *cont, uiBlock *block, short xco, short yco, short width)
1669
 
{
1670
 
        bExpressionCont *ec;
1671
 
        bPythonCont *pc;
1672
 
        short ysize;
1673
 
        
1674
 
        switch (cont->type) {
1675
 
        case CONT_EXPRESSION:
1676
 
                ysize= 28;
1677
 
 
1678
 
                UI_ThemeColor(TH_PANEL);
1679
 
                glRects(xco, yco-ysize, xco+width, yco);
1680
 
                uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1681
 
                
1682
 
                /* uiDefBut(block, LABEL, 1, "Not yet...", xco,yco-24,80, 19, NULL, 0, 0, 0, 0, ""); */
1683
 
                ec= cont->data; 
1684
 
                /* uiDefBut(block, BUT, 1, "Variables", xco,yco-24,80, 19, NULL, 0, 0, 0, 0, "Available variables for expression"); */
1685
 
                uiDefBut(block, TEX, 1, "Exp:",         xco + 10 , yco-21, width-20, 19,
1686
 
                                 ec->str, 0, sizeof(ec->str), 0, 0,
1687
 
                                 "Expression"); 
1688
 
                
1689
 
                yco-= ysize;
1690
 
                break;
1691
 
        case CONT_PYTHON:
1692
 
                ysize= 28;
1693
 
                
1694
 
                if (cont->data==NULL) init_controller(cont);
1695
 
                pc= cont->data;
1696
 
                
1697
 
                UI_ThemeColor(TH_PANEL);
1698
 
                glRects(xco, yco-ysize, xco+width, yco);
1699
 
                uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1700
 
 
1701
 
        
1702
 
                uiBlockBeginAlign(block);
1703
 
                uiDefButI(block, MENU, B_REDR, "Execution Method%t|Script%x0|Module%x1", xco+4,yco-23, 66, 19, &pc->mode, 0, 0, 0, 0, "Python script type (textblock or module - faster)");
1704
 
                if (pc->mode==0)
1705
 
                        uiDefIDPoinBut(block, test_scriptpoin_but, ID_TXT, 1, "", xco+70,yco-23,width-74, 19, &pc->text, "Blender textblock to run as a script");
1706
 
                else {
1707
 
                        uiDefBut(block, TEX, 1, "", xco+70,yco-23,(width-70)-25, 19, pc->module, 0, sizeof(pc->module), 0, 0, "Module name and function to run e.g. \"someModule.main\". Internal texts and external python files can be used");
1708
 
                        uiDefButBitI(block, TOG, CONT_PY_DEBUG, B_REDR, "D", (xco+width)-25, yco-23, 19, 19, &pc->flag, 0, 0, 0, 0, "Continuously reload the module from disk for editing external modules without restarting");
1709
 
                }
1710
 
                uiBlockEndAlign(block);
1711
 
                
1712
 
                yco-= ysize;
1713
 
                break;
1714
 
                
1715
 
        default:
1716
 
                ysize= 4;
1717
 
 
1718
 
                UI_ThemeColor(TH_PANEL);
1719
 
                glRects(xco, yco-ysize, xco+width, yco);
1720
 
                uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1721
 
                
1722
 
                yco-= ysize;
1723
 
        }
1724
 
        
1725
 
        return yco;
1726
 
}
1727
 
 
1728
 
static int get_col_actuator(int type)
1729
 
{
1730
 
        switch(type) {
1731
 
        case ACT_ACTION:                return TH_PANEL;
1732
 
        case ACT_SHAPEACTION:   return TH_PANEL;
1733
 
        case ACT_OBJECT:                return TH_PANEL;
1734
 
        case ACT_IPO:                   return TH_PANEL;
1735
 
        case ACT_PROPERTY:              return TH_PANEL;
1736
 
        case ACT_SOUND:                 return TH_PANEL;
1737
 
        case ACT_CAMERA:                return TH_PANEL;
1738
 
        case ACT_EDIT_OBJECT:           return TH_PANEL;
1739
 
        case ACT_GROUP:                 return TH_PANEL;
1740
 
        case ACT_RANDOM:                return TH_PANEL;
1741
 
        case ACT_SCENE:                 return TH_PANEL;
1742
 
        case ACT_MESSAGE:               return TH_PANEL;
1743
 
        case ACT_GAME:                  return TH_PANEL;
1744
 
        case ACT_VISIBILITY:            return TH_PANEL;
1745
 
        case ACT_CONSTRAINT:            return TH_PANEL;
1746
 
        case ACT_STATE:                 return TH_PANEL;
1747
 
        case ACT_ARMATURE:                      return TH_PANEL;
1748
 
        case ACT_STEERING:              return TH_PANEL;
1749
 
        default:                                return TH_PANEL;
1750
 
        }
1751
 
}
1752
 
static void set_col_actuator(int item, int medium) 
1753
 
{
1754
 
        int col= get_col_actuator(item);
1755
 
        UI_ThemeColorShade(col, medium?30:10);
1756
 
        
1757
 
}
1758
 
 
1759
 
static void change_object_actuator(bContext *UNUSED(C), void *act, void *UNUSED(arg))
1760
 
{
1761
 
        bObjectActuator *oa = act;
1762
 
 
1763
 
        if (oa->type != oa->otype) {
1764
 
                switch (oa->type) {
1765
 
                case ACT_OBJECT_NORMAL:
1766
 
                        memset(oa, 0, sizeof(bObjectActuator));
1767
 
                        oa->flag = ACT_FORCE_LOCAL|ACT_TORQUE_LOCAL|ACT_DLOC_LOCAL|ACT_DROT_LOCAL;
1768
 
                        oa->type = ACT_OBJECT_NORMAL;
1769
 
                        break;
1770
 
 
1771
 
                case ACT_OBJECT_SERVO:
1772
 
                        memset(oa, 0, sizeof(bObjectActuator));
1773
 
                        oa->flag = ACT_LIN_VEL_LOCAL;
1774
 
                        oa->type = ACT_OBJECT_SERVO;
1775
 
                        oa->forcerot[0] = 30.0f;
1776
 
                        oa->forcerot[1] = 0.5f;
1777
 
                        oa->forcerot[2] = 0.0f;
1778
 
                        break;
1779
 
                }
1780
 
        }
1781
 
}
1782
 
 
1783
 
static void change_ipo_actuator(bContext *UNUSED(C), void *arg1_but, void *arg2_ia)
1784
 
{
1785
 
        bIpoActuator *ia = arg2_ia;
1786
 
        uiBut *but = arg1_but;
1787
 
 
1788
 
        if (but->retval & ACT_IPOFORCE)
1789
 
                ia->flag &= ~ACT_IPOADD;
1790
 
        else if (but->retval & ACT_IPOADD)
1791
 
                ia->flag &= ~ACT_IPOFORCE;
1792
 
        but->retval = B_REDR;
1793
 
}
1794
 
 
1795
 
static void update_object_actuator_PID(bContext *UNUSED(C), void *act, void *UNUSED(arg))
1796
 
{
1797
 
        bObjectActuator *oa = act;
1798
 
        oa->forcerot[0] = 60.0f*oa->forcerot[1];
1799
 
}
1800
 
 
1801
 
static char *get_state_name(Object *ob, short bit)
1802
 
{
1803
 
        bController *cont;
1804
 
        unsigned int mask;
1805
 
 
1806
 
        mask = (1<<bit);
1807
 
        cont = ob->controllers.first;
1808
 
        while (cont) {
1809
 
                if (cont->state_mask & mask) {
1810
 
                        return cont->name;
1811
 
                }
1812
 
                cont = cont->next;
1813
 
        }
1814
 
        return (char*)"";
1815
 
}
1816
 
 
1817
 
static void check_state_mask(bContext *C, void *arg1_but, void *arg2_mask)
1818
 
{
1819
 
        wmWindow *win= CTX_wm_window(C);
1820
 
        int shift= win->eventstate->shift;
1821
 
        unsigned int *cont_mask = arg2_mask;
1822
 
        uiBut *but = arg1_but;
1823
 
 
1824
 
        if (*cont_mask == 0 || !(shift))
1825
 
                *cont_mask = (1<<but->retval);
1826
 
        but->retval = B_REDR;
1827
 
}
1828
 
 
1829
 
static void check_armature_actuator(bContext *C, void *arg1_but, void *arg2_act)
1830
 
{
1831
 
        bArmatureActuator *act = arg2_act;
1832
 
        uiBut *but = arg1_but;
1833
 
        Object *ob= CTX_data_active_object(C);
1834
 
 
1835
 
        /* check that bone exist in the active object */
1836
 
        but->retval = B_REDR;
1837
 
        check_armature_bone_constraint(ob, act->posechannel, act->constraint);
1838
 
}
1839
 
 
1840
 
 
1841
 
static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlock *block, short xco, short yco, short width)
1842
 
{
1843
 
        bSoundActuator      *sa      = NULL;
1844
 
        bObjectActuator     *oa      = NULL;
1845
 
        bIpoActuator        *ia      = NULL;
1846
 
        bPropertyActuator   *pa      = NULL;
1847
 
        bCameraActuator     *ca      = NULL;
1848
 
        bEditObjectActuator *eoa     = NULL;
1849
 
        bConstraintActuator *coa     = NULL;
1850
 
        bSceneActuator      *sca     = NULL;
1851
 
        bGroupActuator      *ga      = NULL;
1852
 
        bRandomActuator     *randAct = NULL;
1853
 
        bMessageActuator    *ma      = NULL;
1854
 
        bActionActuator     *aa      = NULL;
1855
 
        bGameActuator       *gma     = NULL;
1856
 
        bVisibilityActuator *visAct  = NULL;
1857
 
        bTwoDFilterActuator     *tdfa    = NULL;
1858
 
        bParentActuator     *parAct  = NULL;
1859
 
        bStateActuator          *staAct  = NULL;
1860
 
        bArmatureActuator   *armAct  = NULL;
1861
 
        
1862
 
        float *fp;
1863
 
        short ysize = 0, wval;
1864
 
        const char *str;
1865
 
        int myline, stbit;
1866
 
        uiBut *but;
1867
 
 
1868
 
 
1869
 
        /* yco is at the top of the rect, draw downwards */
1870
 
        set_col_actuator(act->type, 0);
1871
 
        
1872
 
        switch (act->type)
1873
 
        {
1874
 
        case ACT_OBJECT:
1875
 
                {
1876
 
                        oa = act->data;
1877
 
                        wval = (width-100)/3;
1878
 
                        if (oa->type == ACT_OBJECT_NORMAL)
1879
 
                        {
1880
 
                                if (ob->gameflag & OB_DYNAMIC) {
1881
 
                                        ysize= 175;
1882
 
                                }
1883
 
                                else {
1884
 
                                        ysize= 72;
1885
 
                                }
1886
 
 
1887
 
                                glRects(xco, yco-ysize, xco+width, yco);
1888
 
                                uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1889
 
                                
1890
 
                                uiBlockBeginAlign(block);
1891
 
                                uiDefBut(block, LABEL, 0, "Loc",        xco, yco-45, 45, 19, NULL, 0, 0, 0, 0, "Sets the location");
1892
 
                                uiDefButF(block, NUM, 0, "",            xco+45, yco-45, wval, 19, oa->dloc, -10000.0, 10000.0, 10, 0, "");
1893
 
                                uiDefButF(block, NUM, 0, "",            xco+45+wval, yco-45, wval, 19, oa->dloc+1, -10000.0, 10000.0, 10, 0, "");
1894
 
                                uiDefButF(block, NUM, 0, "",            xco+45+2*wval, yco-45, wval, 19, oa->dloc+2, -10000.0, 10000.0, 10, 0, "");
1895
 
                                uiBlockEndAlign(block);
1896
 
                                
1897
 
                                uiDefBut(block, LABEL, 0, "Rot",        xco, yco-64, 45, 19, NULL, 0, 0, 0, 0, "Sets the rotation");
1898
 
                                uiBlockBeginAlign(block);
1899
 
                                uiDefButF(block, NUM, 0, "",            xco+45, yco-64, wval, 19, oa->drot, -10000.0, 10000.0, 10, 0, "");
1900
 
                                uiDefButF(block, NUM, 0, "",            xco+45+wval, yco-64, wval, 19, oa->drot+1, -10000.0, 10000.0, 10, 0, "");
1901
 
                                uiDefButF(block, NUM, 0, "",            xco+45+2*wval, yco-64, wval, 19, oa->drot+2, -10000.0, 10000.0, 10, 0, "");
1902
 
                                uiBlockEndAlign(block);
1903
 
 
1904
 
                                uiDefButBitS(block, TOG, ACT_DLOC_LOCAL, 0, "L",                xco+45+3*wval, yco-45, 15, 19, &oa->flag, 0.0, 0.0, 0, 0, "Local transformation");
1905
 
                                uiDefButBitS(block, TOG, ACT_DROT_LOCAL, 0, "L",                xco+45+3*wval, yco-64, 15, 19, &oa->flag, 0.0, 0.0, 0, 0, "Local transformation");
1906
 
        
1907
 
                                if ( ob->gameflag & OB_DYNAMIC )
1908
 
                                {
1909
 
                                        uiDefBut(block, LABEL, 0, "Force",      xco, yco-87, 55, 19, NULL, 0, 0, 0, 0, "Sets the force");
1910
 
                                        uiBlockBeginAlign(block);
1911
 
                                        uiDefButF(block, NUM, 0, "",            xco+45, yco-87, wval, 19, oa->forceloc, -10000.0, 10000.0, 10, 0, "");
1912
 
                                        uiDefButF(block, NUM, 0, "",            xco+45+wval, yco-87, wval, 19, oa->forceloc+1, -10000.0, 10000.0, 10, 0, "");
1913
 
                                        uiDefButF(block, NUM, 0, "",            xco+45+2*wval, yco-87, wval, 19, oa->forceloc+2, -10000.0, 10000.0, 10, 0, "");
1914
 
                                        uiBlockEndAlign(block);
1915
 
 
1916
 
                                        uiDefBut(block, LABEL, 0, "Torque", xco, yco-106, 55, 19, NULL, 0, 0, 0, 0, "Sets the torque");
1917
 
                                        uiBlockBeginAlign(block);
1918
 
                                        uiDefButF(block, NUM, 0, "",            xco+45, yco-106, wval, 19, oa->forcerot, -10000.0, 10000.0, 10, 0, "");
1919
 
                                        uiDefButF(block, NUM, 0, "",            xco+45+wval, yco-106, wval, 19, oa->forcerot+1, -10000.0, 10000.0, 10, 0, "");
1920
 
                                        uiDefButF(block, NUM, 0, "",            xco+45+2*wval, yco-106, wval, 19, oa->forcerot+2, -10000.0, 10000.0, 10, 0, "");                                
1921
 
                                        uiBlockEndAlign(block);
1922
 
                                }
1923
 
                                
1924
 
                                if ( ob->gameflag & OB_DYNAMIC )
1925
 
                                {
1926
 
                                        uiDefBut(block, LABEL, 0, "LinV",       xco, yco-129, 45, 19, NULL, 0, 0, 0, 0, "Sets the linear velocity");
1927
 
                                        uiBlockBeginAlign(block);
1928
 
                                        uiDefButF(block, NUM, 0, "",            xco+45, yco-129, wval, 19, oa->linearvelocity, -10000.0, 10000.0, 10, 0, "");
1929
 
                                        uiDefButF(block, NUM, 0, "",            xco+45+wval, yco-129, wval, 19, oa->linearvelocity+1, -10000.0, 10000.0, 10, 0, "");
1930
 
                                        uiDefButF(block, NUM, 0, "",            xco+45+2*wval, yco-129, wval, 19, oa->linearvelocity+2, -10000.0, 10000.0, 10, 0, "");
1931
 
                                        uiBlockEndAlign(block);
1932
 
                                
1933
 
                                        uiDefBut(block, LABEL, 0, "AngV",       xco, yco-148, 45, 19, NULL, 0, 0, 0, 0, "Sets the angular velocity");
1934
 
                                        uiBlockBeginAlign(block);
1935
 
                                        uiDefButF(block, NUM, 0, "",            xco+45, yco-148, wval, 19, oa->angularvelocity, -10000.0, 10000.0, 10, 0, "");
1936
 
                                        uiDefButF(block, NUM, 0, "",            xco+45+wval, yco-148, wval, 19, oa->angularvelocity+1, -10000.0, 10000.0, 10, 0, "");
1937
 
                                        uiDefButF(block, NUM, 0, "",            xco+45+2*wval, yco-148, wval, 19, oa->angularvelocity+2, -10000.0, 10000.0, 10, 0, "");
1938
 
                                        uiBlockEndAlign(block);
1939
 
                                
1940
 
                                        uiDefBut(block, LABEL, 0, "Damp",       xco, yco-171, 45, 19, NULL, 0, 0, 0, 0, "Number of frames to reach the target velocity");
1941
 
                                        uiDefButS(block, NUM, 0, "",            xco+45, yco-171, wval, 19, &oa->damping, 0.0, 1000.0, 100, 0, "");
1942
 
 
1943
 
                                        uiDefButBitS(block, TOG, ACT_FORCE_LOCAL, 0, "L",               xco+45+3*wval, yco-87, 15, 19, &oa->flag, 0.0, 0.0, 0, 0, "Local transformation");
1944
 
                                        uiDefButBitS(block, TOG, ACT_TORQUE_LOCAL, 0, "L",              xco+45+3*wval, yco-106, 15, 19, &oa->flag, 0.0, 0.0, 0, 0, "Local transformation");
1945
 
                                        uiDefButBitS(block, TOG, ACT_LIN_VEL_LOCAL, 0, "L",             xco+45+3*wval, yco-129, 15, 19, &oa->flag, 0.0, 0.0, 0, 0, "Local transformation");
1946
 
                                        uiDefButBitS(block, TOG, ACT_ANG_VEL_LOCAL, 0, "L",             xco+45+3*wval, yco-148, 15, 19, &oa->flag, 0.0, 0.0, 0, 0, "Local transformation");
1947
 
                                
1948
 
                                        uiDefButBitS(block, TOG, ACT_ADD_LIN_VEL, 0, "use_additive",xco+45+3*wval+15, yco-129, 35, 19, &oa->flag, 0.0, 0.0, 0, 0, "Toggles between ADD and SET linV");
1949
 
                                }                               
1950
 
                        }
1951
 
                        else if (oa->type == ACT_OBJECT_SERVO)
1952
 
                        {
1953
 
                                ysize= 195;
1954
 
                                
1955
 
                                glRects(xco, yco-ysize, xco+width, yco);
1956
 
                                uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1957
 
                                
1958
 
                                uiDefBut(block, LABEL, 0, "Ref",        xco, yco-45, 45, 19, NULL, 0, 0, 0, 0, "");
1959
 
                                uiDefIDPoinBut(block, test_obpoin_but, ID_OB, 1, "OB:",         xco+45, yco-45, wval*3, 19, &(oa->reference), "Reference object for velocity calculation, leave empty for world reference");
1960
 
                                uiDefBut(block, LABEL, 0, "linV",       xco, yco-68, 45, 19, NULL, 0, 0, 0, 0, "Sets the target relative linear velocity, it will be achieved by automatic application of force. Null velocity is a valid target");
1961
 
                                uiBlockBeginAlign(block);
1962
 
                                uiDefButF(block, NUM, 0, "",            xco+45, yco-68, wval, 19, oa->linearvelocity, -10000.0, 10000.0, 10, 0, "");
1963
 
                                uiDefButF(block, NUM, 0, "",            xco+45+wval, yco-68, wval, 19, oa->linearvelocity+1, -10000.0, 10000.0, 10, 0, "");
1964
 
                                uiDefButF(block, NUM, 0, "",            xco+45+2*wval, yco-68, wval, 19, oa->linearvelocity+2, -10000.0, 10000.0, 10, 0, "");
1965
 
                                uiBlockEndAlign(block);
1966
 
                                uiDefButBitS(block, TOG, ACT_LIN_VEL_LOCAL, 0, "L",             xco+45+3*wval, yco-68, 15, 19, &oa->flag, 0.0, 0.0, 0, 0, "Velocity is defined in local coordinates");
1967
 
 
1968
 
                                uiDefBut(block, LABEL, 0, "Limit",      xco, yco-91, 45, 19, NULL, 0, 0, 0, 0, "Select if the force needs to be limited along certain axis (local or global depending on LinV Local flag)");
1969
 
                                uiBlockBeginAlign(block);
1970
 
                                uiDefButBitS(block, TOG, ACT_SERVO_LIMIT_X, B_REDR, "X",                xco+45, yco-91, wval, 19, &oa->flag, 0.0, 0.0, 0, 0, "Set limit to force along the X axis");
1971
 
                                uiDefButBitS(block, TOG, ACT_SERVO_LIMIT_Y, B_REDR, "Y",                xco+45+wval, yco-91, wval, 19, &oa->flag, 0.0, 0.0, 0, 0, "Set limit to force along the Y axis");
1972
 
                                uiDefButBitS(block, TOG, ACT_SERVO_LIMIT_Z, B_REDR, "Z",                xco+45+2*wval, yco-91, wval, 19, &oa->flag, 0.0, 0.0, 0, 0, "Set limit to force along the Z axis");
1973
 
                                uiBlockEndAlign(block);
1974
 
                                uiDefBut(block, LABEL, 0, "Max",        xco, yco-110, 45, 19, NULL, 0, 0, 0, 0, "Set the upper limit for force");
1975
 
                                uiDefBut(block, LABEL, 0, "Min",        xco, yco-129, 45, 19, NULL, 0, 0, 0, 0, "Set the lower limit for force");
1976
 
                                if (oa->flag & ACT_SERVO_LIMIT_X) {
1977
 
                                        uiDefButF(block, NUM, 0, "",            xco+45, yco-110, wval, 19, oa->dloc, -10000.0, 10000.0, 10, 0, "");
1978
 
                                        uiDefButF(block, NUM, 0, "",            xco+45, yco-129, wval, 19, oa->drot, -10000.0, 10000.0, 10, 0, "");
1979
 
                                }
1980
 
                                if (oa->flag & ACT_SERVO_LIMIT_Y) {
1981
 
                                        uiDefButF(block, NUM, 0, "",            xco+45+wval, yco-110, wval, 19, oa->dloc+1, -10000.0, 10000.0, 10, 0, "");
1982
 
                                        uiDefButF(block, NUM, 0, "",            xco+45+wval, yco-129, wval, 19, oa->drot+1, -10000.0, 10000.0, 10, 0, "");
1983
 
                                }
1984
 
                                if (oa->flag & ACT_SERVO_LIMIT_Z) {
1985
 
                                        uiDefButF(block, NUM, 0, "",            xco+45+2*wval, yco-110, wval, 19, oa->dloc+2, -10000.0, 10000.0, 10, 0, "");
1986
 
                                        uiDefButF(block, NUM, 0, "",            xco+45+2*wval, yco-129, wval, 19, oa->drot+2, -10000.0, 10000.0, 10, 0, "");
1987
 
                                }
1988
 
                                uiDefBut(block, LABEL, 0, "Servo",      xco, yco-152, 45, 19, NULL, 0, 0, 0, 0, "Coefficients of the PID servo controller");
1989
 
                                uiDefButF(block, NUMSLI, B_REDR, "P: ",         xco+45, yco-152, wval*3, 19, oa->forcerot, 0.00, 200.0, 100, 0, "Proportional coefficient, typical value is 60x Integral coefficient");
1990
 
                                uiDefBut(block, LABEL, 0, "Slow",       xco, yco-171, 45, 19, NULL, 0, 0, 0, 0, "Low value of I coefficient correspond to slow response");
1991
 
                                but = uiDefButF(block, NUMSLI, B_REDR, " I : ",         xco+45, yco-171, wval*3, 19, oa->forcerot+1, 0.0, 3.0, 1, 0, "Integral coefficient, low value (0.01) for slow response, high value (0.5) for fast response");
1992
 
                                uiButSetFunc(but, update_object_actuator_PID, oa, NULL);
1993
 
                                uiDefBut(block, LABEL, 0, "Fast",       xco+45+3*wval, yco-171, 45, 19, NULL, 0, 0, 0, 0, "High value of I coefficient correspond to fast response");
1994
 
                                uiDefButF(block, NUMSLI, B_REDR, "D: ",         xco+45, yco-190, wval*3, 19, oa->forcerot+2, -100.0, 100.0, 100, 0, "Derivate coefficient, not required, high values can cause instability");
1995
 
                        }
1996
 
                        str= "Motion Type %t|Simple motion %x0|Servo Control %x1";
1997
 
                        but = uiDefButS(block, MENU, B_REDR, str,               xco+40, yco-23, (width-80), 19, &oa->type, 0.0, 0.0, 0, 0, "");
1998
 
                        oa->otype = oa->type;
1999
 
                        uiButSetFunc(but, change_object_actuator, oa, NULL);
2000
 
                        yco-= ysize;
2001
 
                        break;
2002
 
                }
2003
 
        case ACT_ACTION:
2004
 
        case ACT_SHAPEACTION:
2005
 
                {
2006
 
                        /* DrawAct */
2007
 
#ifdef __NLA_ACTION_BY_MOTION_ACTUATOR
2008
 
                        ysize = 112;
2009
 
#else
2010
 
                        ysize= 92;
2011
 
#endif
2012
 
                        
2013
 
                        glRects(xco, yco-ysize, xco+width, yco);
2014
 
                        uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2015
 
                        
2016
 
                        aa = act->data;
2017
 
                        wval = (width-60)/3;
2018
 
                        
2019
 
                        //              str= "Action types   %t|Play %x0|Ping Pong %x1|Flipper %x2|Loop Stop %x3|Loop End %x4|Property %x6";
2020
 
#ifdef __NLA_ACTION_BY_MOTION_ACTUATOR
2021
 
                        str= "Action types   %t|Play %x0|Flipper %x2|Loop Stop %x3|Loop End %x4|Property %x6|Displacement %x7";
2022
 
#else
2023
 
                        str= "Action types   %t|Play %x0|Flipper %x2|Loop Stop %x3|Loop End %x4|Property %x6";
2024
 
#endif
2025
 
                        uiDefButS(block, MENU, B_REDR, str, xco+10, yco-24, width/3, 19, &aa->type, 0.0, 0.0, 0.0, 0.0, "Action playback type");
2026
 
                        uiDefIDPoinBut(block, test_actionpoin_but, ID_AC, 1, "AC: ", xco+10+ (width/3), yco-24, ((width/3)*2) - (20 + 60), 19, &aa->act, "Action name");
2027
 
                        
2028
 
                        uiDefButBitS(block, TOGN, 1, 0, "Continue", xco+((width/3)*2)+20, yco-24, 60, 19,
2029
 
                                         &aa->end_reset, 0.0, 0.0, 0, 0, "Restore last frame when switching on/off, otherwise play from the start each time");
2030
 
                        
2031
 
                        
2032
 
                        if (aa->type == ACT_ACTION_FROM_PROP) {
2033
 
                                uiDefBut(block, TEX, 0, "Prop: ",xco+10, yco-44, width-20, 19, aa->name, 0.0, MAX_NAME, 0, 0, "Use this property to define the Action position");
2034
 
                        }
2035
 
                        else {
2036
 
                                uiDefButF(block, NUM, 0, "Sta: ",xco+10, yco-44, (width-20)/2, 19, &aa->sta, 1.0, MAXFRAMEF, 0, 0, "Start frame");
2037
 
                                uiDefButF(block, NUM, 0, "End: ",xco+10+(width-20)/2, yco-44, (width-20)/2, 19, &aa->end, 1.0, MAXFRAMEF, 0, 0, "End frame");
2038
 
                        }
2039
 
                                                
2040
 
                        uiDefButS(block, NUM, 0, "Blendin: ", xco+10, yco-64, (width-20)/2, 19, &aa->blendin, 0.0, 32767, 0.0, 0.0, "Number of frames of motion blending");
2041
 
                        uiDefButS(block, NUM, 0, "Priority: ", xco+10+(width-20)/2, yco-64, (width-20)/2, 19, &aa->priority, 0.0, 100.0, 0.0, 0.0, "Execution priority - lower numbers will override actions with higher numbers, With 2 or more actions at once, the overriding channels must be lower in the stack");
2042
 
                        
2043
 
                        uiDefBut(block, TEX, 0, "FrameProp: ",xco+10, yco-84, width-20, 19, aa->frameProp, 0.0, MAX_NAME, 0, 0, "Assign the action's current frame number to this property");
2044
 
 
2045
 
                        
2046
 
#ifdef __NLA_ACTION_BY_MOTION_ACTUATOR
2047
 
                        if (aa->type == ACT_ACTION_MOTION) {
2048
 
                                uiDefButF(block, NUM, 0, "Cycle: ",xco+30, yco-84, (width-60)/2, 19, &aa->stridelength, 0.0, 2500.0, 0, 0, "Distance covered by a single cycle of the action");
2049
 
                        }
2050
 
#endif
2051
 
                        
2052
 
                        
2053
 
                        
2054
 
                        yco-=ysize;
2055
 
                        break;
2056
 
                }
2057
 
        case ACT_IPO:
2058
 
                {
2059
 
                        ia= act->data;
2060
 
                        
2061
 
                        ysize= 72;
2062
 
                        
2063
 
                        glRects(xco, yco-ysize, xco+width, yco);
2064
 
                        uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2065
 
                        
2066
 
                        str = "Ipo types   %t|Play %x0|Ping Pong %x1|Flipper %x2|Loop Stop %x3|Loop End %x4|Property %x6";
2067
 
                        
2068
 
                        uiDefButS(block, MENU, B_REDR, str,             xco+10, yco-24, (width-20)/2, 19, &ia->type, 0, 0, 0, 0, "");
2069
 
 
2070
 
                        but = uiDefButBitS(block, TOG, ACT_IPOFORCE, ACT_IPOFORCE, 
2071
 
                                "Force", xco+10+(width-20)/2, yco-24, (width-20)/4-10, 19, 
2072
 
                                &ia->flag, 0, 0, 0, 0, 
2073
 
                                "Apply Ipo as a global or local force depending on the local option (dynamic objects only)"); 
2074
 
                        uiButSetFunc(but, change_ipo_actuator, but, ia);
2075
 
 
2076
 
                        but = uiDefButBitS(block, TOG, ACT_IPOADD, ACT_IPOADD, 
2077
 
                                "Add", xco+3*(width-20)/4, yco-24, (width-20)/4-10, 19, 
2078
 
                                &ia->flag, 0, 0, 0, 0, 
2079
 
                                "Ipo is added to the current loc/rot/scale in global or local coordinate according to Local flag"); 
2080
 
                        uiButSetFunc(but, change_ipo_actuator, but, ia);
2081
 
                        
2082
 
                        /* Only show the do-force-local toggle if force is requested */
2083
 
                        if (ia->flag & (ACT_IPOFORCE|ACT_IPOADD)) {
2084
 
                                uiDefButBitS(block, TOG, ACT_IPOLOCAL, 0, 
2085
 
                                        "L", xco+width-30, yco-24, 20, 19, 
2086
 
                                        &ia->flag, 0, 0, 0, 0, 
2087
 
                                        "Let the ipo acts in local coordinates, used in Force and Add mode"); 
2088
 
                        }
2089
 
 
2090
 
                        if (ia->type==ACT_IPO_FROM_PROP) {
2091
 
                                uiDefBut(block, TEX, 0, 
2092
 
                                        "Prop: ",               xco+10, yco-44, width-80, 19, 
2093
 
                                        ia->name, 0.0, MAX_NAME, 0, 0,
2094
 
                                        "Use this property to define the Ipo position");
2095
 
                        }
2096
 
                        else {
2097
 
                                uiDefButF(block, NUM, 0, 
2098
 
                                        "Sta",          xco+10, yco-44, (width-80)/2, 19, 
2099
 
                                        &ia->sta, 1.0, MAXFRAMEF, 0, 0, 
2100
 
                                        "Start frame");
2101
 
                                uiDefButF(block, NUM, 0, 
2102
 
                                        "End",          xco+10+(width-80)/2, yco-44, (width-80)/2, 19, 
2103
 
                                        &ia->end, 1.0, MAXFRAMEF, 0, 0, 
2104
 
                                        "End frame");
2105
 
                        }
2106
 
                        uiDefButBitS(block, TOG, ACT_IPOCHILD,  B_REDR, 
2107
 
                                "Child",        xco+10+(width-80), yco-44, 60, 19, 
2108
 
                                &ia->flag, 0, 0, 0, 0, 
2109
 
                                "Update IPO on all children Objects as well");
2110
 
                        uiDefBut(block, TEX, 0, 
2111
 
                                "FrameProp: ",          xco+10, yco-64, width-20, 19, 
2112
 
                                ia->frameProp, 0.0, MAX_NAME, 0, 0,
2113
 
                                "Assign the action's current frame number to this property");
2114
 
 
2115
 
                        yco-= ysize;
2116
 
                        break;
2117
 
                }
2118
 
        case ACT_PROPERTY:
2119
 
                {
2120
 
                        ysize= 68;
2121
 
                        
2122
 
                        glRects(xco, yco-ysize, xco+width, yco);
2123
 
                        uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2124
 
                        
2125
 
                        pa= act->data;
2126
 
                        
2127
 
                        str= "Type%t|Assign%x0|Add %x1|Copy %x2|Toggle (bool/int/float/timer)%x3";
2128
 
                        uiDefButI(block, MENU, B_REDR, str,             xco+30,yco-24,width-60, 19, &pa->type, 0, 31, 0, 0, "Type");
2129
 
                        
2130
 
                        uiDefBut(block, TEX, 1, "Prop: ",               xco+30,yco-44,width-60, 19, pa->name, 0, MAX_NAME, 0, 0, "Property name");
2131
 
                        
2132
 
                        
2133
 
                        if (pa->type==ACT_PROP_TOGGLE) {
2134
 
                                /* no ui */
2135
 
                                ysize -= 22;
2136
 
                        }
2137
 
                        else if (pa->type==ACT_PROP_COPY) {
2138
 
                                uiDefIDPoinBut(block, test_obpoin_but, ID_OB, 1, "OB:", xco+10, yco-64, (width-20)/2, 19, &(pa->ob), "Copy from this Object");
2139
 
                                uiDefBut(block, TEX, 1, "Prop: ",               xco+10+(width-20)/2, yco-64, (width-20)/2, 19, pa->value, 0, MAX_NAME, 0, 0, "Copy this property");
2140
 
                        }
2141
 
                        else {
2142
 
                                uiDefBut(block, TEX, 1, "Value: ",              xco+30,yco-64,width-60, 19, pa->value, 0, MAX_NAME, 0, 0, "change with this value, use \"\" around strings");
2143
 
                        }
2144
 
                        yco-= ysize;
2145
 
                        
2146
 
                        break;
2147
 
                }
2148
 
        case ACT_SOUND:
2149
 
                {
2150
 
                        sa = act->data;
2151
 
                        sa->sndnr = 0;
2152
 
                        
2153
 
                        if (sa->flag & ACT_SND_3D_SOUND)
2154
 
                                ysize = 180;
2155
 
                        else
2156
 
                                ysize = 92;
2157
 
 
2158
 
                        wval = (width-20)/2;
2159
 
                        glRects(xco, yco-ysize, xco+width, yco);
2160
 
                        uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2161
 
                        
2162
 
                        if (bmain->sound.first) {
2163
 
                                IDnames_to_pupstring(&str, "Sound files", NULL, &(bmain->sound), (ID *)sa->sound, &(sa->sndnr));
2164
 
                                /* reset this value, it is for handling the event */
2165
 
                                sa->sndnr = 0;
2166
 
                                uiDefButS(block, MENU, B_SOUNDACT_BROWSE, str, xco+10,yco-22,20,19, &(sa->sndnr), 0, 0, 0, 0, "");      
2167
 
                                uiDefButO(block, BUT, "sound.open", 0, "Load Sound", xco+wval+10, yco-22, wval, 19,
2168
 
                                          "Load a sound file (remember to set caching on for small sounds that are played often)");
2169
 
 
2170
 
                                if (sa->sound) {
2171
 
                                        char dummy_str[] = "Sound mode %t|Play Stop %x0|Play End %x1|Loop Stop %x2|"
2172
 
                                                           "Loop End %x3|Loop Ping Pong Stop %x5|Loop Ping Pong %x4";
2173
 
                                        uiDefBut(block, TEX, B_IDNAME, "SO:",xco+30,yco-22,wval-20,19,
2174
 
                                                 ((ID *)sa->sound)->name+2, 0.0, MAX_ID_NAME-2, 0, 0, "");
2175
 
                                        uiDefButS(block, MENU, 1, dummy_str,xco+10,yco-44,width-20, 19,
2176
 
                                                  &sa->type, 0.0, 0.0, 0, 0, "");
2177
 
                                        uiDefButF(block, NUM, 0, "Volume:", xco+10,yco-66,wval, 19, &sa->volume,
2178
 
                                                  0.0, 1.0, 0, 0, "Sets the volume of this sound");
2179
 
                                        uiDefButF(block, NUM, 0, "Pitch:",xco+wval+10,yco-66,wval, 19, &sa->pitch,-12.0,
2180
 
                                                  12.0, 0, 0, "Sets the pitch of this sound");
2181
 
                                        uiDefButS(block, TOG | BIT, 0, "3D Sound", xco+10, yco-88, width-20, 19,
2182
 
                                                  &sa->flag, 0.0, 1.0, 0.0, 0.0, "Plays the sound positioned in 3D space");
2183
 
                                        if (sa->flag & ACT_SND_3D_SOUND) {
2184
 
                                                uiDefButF(block, NUM, 0, "Minimum Gain: ", xco+10, yco-110, wval, 19,
2185
 
                                                          &sa->sound3D.min_gain, 0.0, 1.0, 0.0, 0.0,
2186
 
                                                          "The minimum gain of the sound, no matter how far it is away");
2187
 
                                                uiDefButF(block, NUM, 0, "Maximum Gain: ", xco+10, yco-132, wval, 19,
2188
 
                                                          &sa->sound3D.max_gain, 0.0, 1.0, 0.0, 0.0,
2189
 
                                                          "The maximum gain of the sound, no matter how near it is");
2190
 
                                                uiDefButF(block, NUM, 0, "Reference Distance: ", xco+10, yco-154, wval, 19,
2191
 
                                                          &sa->sound3D.reference_distance, 0.0, FLT_MAX, 0.0, 0.0,
2192
 
                                                          "The reference distance is the distance where the sound has a gain of 1.0");
2193
 
                                                uiDefButF(block, NUM, 0, "Maximum Distance: ", xco+10, yco-176, wval, 19,
2194
 
                                                          &sa->sound3D.max_distance, 0.0, FLT_MAX, 0.0, 0.0,
2195
 
                                                          "The maximum distance at which you can hear the sound");
2196
 
                                                uiDefButF(block, NUM, 0, "Rolloff: ", xco+wval+10, yco-110, wval, 19,
2197
 
                                                          &sa->sound3D.rolloff_factor, 0.0, 5.0, 0.0, 0.0,
2198
 
                                                          "The rolloff factor defines the influence factor on volume depending on distance");
2199
 
                                                uiDefButF(block, NUM, 0, "Cone Outer Gain: ", xco+wval+10, yco-132, wval, 19,
2200
 
                                                          &sa->sound3D.cone_outer_gain, 0.0, 1.0, 0.0, 0.0,
2201
 
                                                          "The gain outside the outer cone. The gain in the outer cone will be "
2202
 
                                                          "interpolated between this value and the normal gain in the inner cone");
2203
 
                                                uiDefButF(block, NUM, 0, "Cone Outer Angle: ", xco+wval+10, yco-154, wval,
2204
 
                                                          19, &sa->sound3D.cone_outer_angle, 0.0, 360.0, 0.0, 0.0,
2205
 
                                                          "The angle of the outer cone");
2206
 
                                                uiDefButF(block, NUM, 0, "Cone Inner Angle: ", xco+wval+10, yco-176, wval,
2207
 
                                                          19, &sa->sound3D.cone_inner_angle, 0.0, 360.0, 0.0, 0.0,
2208
 
                                                          "The angle of the inner cone");
2209
 
                                        }
2210
 
                                }
2211
 
                                MEM_freeN((void *)str);
2212
 
                        } 
2213
 
                        else {
2214
 
                                uiDefButO(block, BUT, "sound.open", 0, "Load Sound", xco+10, yco-22, width-20, 19, "Load a sound file");
2215
 
                        }
2216
 
                                        
2217
 
                        yco-= ysize;
2218
 
                        
2219
 
                        break;
2220
 
                }
2221
 
        case ACT_CAMERA:
2222
 
 
2223
 
                ysize= 48;
2224
 
 
2225
 
                glRects(xco, yco-ysize, xco+width, yco);
2226
 
                uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2227
 
                
2228
 
                ca= act->data;
2229
 
 
2230
 
                uiDefIDPoinBut(block, test_obpoin_but, ID_OB, 1, "OB:",         xco+10, yco-24, (width-20)/2, 19, &(ca->ob), "Look at this Object");
2231
 
                uiDefButF(block, NUM, 0, "Height:",     xco+10+(width-20)/2, yco-24, (width-20)/2, 19, &ca->height, 0.0, 20.0, 0, 0, "");
2232
 
                
2233
 
                uiDefButF(block, NUM, 0, "Min:",        xco+10, yco-44, (width-60)/2, 19, &ca->min, 0.0, 20.0, 0, 0, "");
2234
 
                
2235
 
                if (ca->axis==0) ca->axis= 'x';
2236
 
                uiDefButS(block, ROW, 0, "X",   xco+10+(width-60)/2, yco-44, 20, 19, &ca->axis, 4.0, (float)'x', 0, 0, "Camera tries to get behind the X axis");
2237
 
                uiDefButS(block, ROW, 0, "Y",   xco+30+(width-60)/2, yco-44, 20, 19, &ca->axis, 4.0, (float)'y', 0, 0, "Camera tries to get behind the Y axis");
2238
 
                
2239
 
                uiDefButF(block, NUM, 0, "Max:",        xco+20+(width)/2, yco-44, (width-60)/2, 19, &ca->max, 0.0, 20.0, 0, 0, "");
2240
 
 
2241
 
                yco-= ysize;
2242
 
 
2243
 
                break;
2244
 
 
2245
 
        case ACT_EDIT_OBJECT:
2246
 
                
2247
 
                eoa= act->data;
2248
 
 
2249
 
                if (eoa->type==ACT_EDOB_ADD_OBJECT) {
2250
 
                        ysize = 92;
2251
 
                        glRects(xco, yco-ysize, xco+width, yco);
2252
 
                        uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2253
 
 
2254
 
                        uiDefIDPoinBut(block, test_obpoin_but, ID_OB, 1, "OB:",         xco+10, yco-44, (width-20)/2, 19, &(eoa->ob), "Add this Object and all its children (cant be on an visible layer)");
2255
 
                        uiDefButI(block, NUM, 0, "Time:",       xco+10+(width-20)/2, yco-44, (width-20)/2, 19, &eoa->time, 0.0, 2000.0, 0, 0, "Duration the new Object lives");
2256
 
 
2257
 
                        wval= (width-60)/3;
2258
 
                        uiDefBut(block, LABEL, 0, "linV",       xco,           yco-68,   45, 19,
2259
 
                                         NULL, 0, 0, 0, 0,
2260
 
                                         "Velocity upon creation");
2261
 
                        uiDefButF(block, NUM, 0, "",            xco+45,        yco-68, wval, 19,
2262
 
                                         eoa->linVelocity, -100.0, 100.0, 10, 0,
2263
 
                                         "Velocity upon creation, x component");
2264
 
                        uiDefButF(block, NUM, 0, "",            xco+45+wval,   yco-68, wval, 19,
2265
 
                                         eoa->linVelocity+1, -100.0, 100.0, 10, 0,
2266
 
                                         "Velocity upon creation, y component");
2267
 
                        uiDefButF(block, NUM, 0, "",            xco+45+2*wval, yco-68, wval, 19,
2268
 
                                         eoa->linVelocity+2, -100.0, 100.0, 10, 0,
2269
 
                                         "Velocity upon creation, z component");
2270
 
                        uiDefButBitS(block, TOG, ACT_EDOB_LOCAL_LINV, 0, "L", xco+45+3*wval, yco-68, 15, 19,
2271
 
                                         &eoa->localflag, 0.0, 0.0, 0, 0,
2272
 
                                         "Apply the transformation locally");
2273
 
                        
2274
 
                        
2275
 
                        uiDefBut(block, LABEL, 0, "AngV",       xco,           yco-90,   45, 19,
2276
 
                                         NULL, 0, 0, 0, 0,
2277
 
                                         "Angular velocity upon creation");
2278
 
                        uiDefButF(block, NUM, 0, "",            xco+45,        yco-90, wval, 19,
2279
 
                                         eoa->angVelocity, -10000.0, 10000.0, 10, 0,
2280
 
                                         "Angular velocity upon creation, x component");
2281
 
                        uiDefButF(block, NUM, 0, "",            xco+45+wval,   yco-90, wval, 19,
2282
 
                                         eoa->angVelocity+1, -10000.0, 10000.0, 10, 0,
2283
 
                                         "Angular velocity upon creation, y component");
2284
 
                        uiDefButF(block, NUM, 0, "",            xco+45+2*wval, yco-90, wval, 19,
2285
 
                                         eoa->angVelocity+2, -10000.0, 10000.0, 10, 0,
2286
 
                                         "Angular velocity upon creation, z component");
2287
 
                        uiDefButBitS(block, TOG, ACT_EDOB_LOCAL_ANGV, 0, "L", xco+45+3*wval, yco-90, 15, 19,
2288
 
                                         &eoa->localflag, 0.0, 0.0, 0, 0,
2289
 
                                         "Apply the rotation locally");
2290
 
                                         
2291
 
 
2292
 
                }
2293
 
                else if (eoa->type==ACT_EDOB_END_OBJECT) {
2294
 
                        ysize= 28;
2295
 
                        glRects(xco, yco-ysize, xco+width, yco);
2296
 
                        uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2297
 
                }
2298
 
                else if (eoa->type==ACT_EDOB_REPLACE_MESH) {
2299
 
                        ysize= 48;
2300
 
                        glRects(xco, yco-ysize, xco+width, yco);
2301
 
                        uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2302
 
         
2303
 
                        uiDefIDPoinBut(block, test_meshpoin_but, ID_ME, 1, "ME:",               xco+40, yco-44, (width-80)/2, 19, &(eoa->me), "replace the existing, when left blank 'Phys' will remake the existing physics mesh");
2304
 
                        
2305
 
                        uiDefButBitS(block, TOGN, ACT_EDOB_REPLACE_MESH_NOGFX, 0, "Gfx",        xco+40 + (width-80)/2, yco-44, (width-80)/4, 19, &eoa->flag, 0, 0, 0, 0, "Replace the display mesh");
2306
 
                        uiDefButBitS(block, TOG, ACT_EDOB_REPLACE_MESH_PHYS, 0, "Phys", xco+40 + (width-80)/2 +(width-80)/4, yco-44, (width-80)/4, 19, &eoa->flag, 0, 0, 0, 0, "Replace the physics mesh (triangle bounds only. compound shapes not supported)");
2307
 
                }
2308
 
                else if (eoa->type==ACT_EDOB_TRACK_TO) {
2309
 
                        ysize= 48;
2310
 
                        glRects(xco, yco-ysize, xco+width, yco);
2311
 
                        uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2312
 
         
2313
 
                        uiDefIDPoinBut(block, test_obpoin_but, ID_OB, 1, "OB:",         xco+10, yco-44, (width-20)/2, 19, &(eoa->ob), "Track to this Object");
2314
 
                        uiDefButI(block, NUM, 0, "Time:",       xco+10+(width-20)/2, yco-44, (width-20)/2-40, 19, &eoa->time, 0.0, 2000.0, 0, 0, "Duration the tracking takes");
2315
 
                        uiDefButS(block, TOG, 0, "3D",  xco+width-50, yco-44, 40, 19, &eoa->flag, 0.0, 0.0, 0, 0, "Enable 3D tracking");
2316
 
                }
2317
 
                else if (eoa->type==ACT_EDOB_DYNAMICS) {
2318
 
                        ysize= 69;
2319
 
                        glRects(xco, yco-ysize, xco+width, yco);
2320
 
                        uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2321
 
                        
2322
 
                        str= "Dynamic Operation %t|Restore Dynamics %x0|Suspend Dynamics %x1|Enable Rigid Body %x2|Disable Rigid Body %x3|Set Mass %x4";
2323
 
                        uiDefButS(block, MENU, B_REDR, str,             xco+40, yco-44, (width-80), 19,  &(eoa->dyn_operation), 0.0, 0.0, 0, 0, "");
2324
 
                        if (eoa->dyn_operation==4) {
2325
 
                                uiDefButF(block, NUM, 0, "",            xco+40, yco-63, width-80, 19,
2326
 
                                         &eoa->mass, 0.0, 10000.0, 10, 0,
2327
 
                                         "Mass for object");
2328
 
                        }
2329
 
                }
2330
 
                str= "Edit Object %t|Add Object %x0|End Object %x1|Replace Mesh %x2|Track to %x3|Dynamics %x4";
2331
 
                uiDefButS(block, MENU, B_REDR, str,             xco+40, yco-24, (width-80), 19, &eoa->type, 0.0, 0.0, 0, 0, "");
2332
 
 
2333
 
                yco-= ysize;
2334
 
 
2335
 
                break;
2336
 
 
2337
 
        case ACT_CONSTRAINT:
2338
 
                coa= act->data;
2339
 
        
2340
 
                if (coa->type == ACT_CONST_TYPE_LOC) {
2341
 
                        ysize= 69;
2342
 
 
2343
 
                        glRects(xco, yco-ysize, xco+width, yco);
2344
 
                        uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2345
 
                        
2346
 
        /*              str= "Limit %t|None %x0|Loc X %x1|Loc Y %x2|Loc Z %x4|Rot X %x8|Rot Y %x16|Rot Z %x32"; */
2347
 
        /*                      coa->flag &= ~(63); */
2348
 
                        str= "Limit %t|None %x0|Loc X %x1|Loc Y %x2|Loc Z %x4";
2349
 
                        coa->flag &= 7;
2350
 
                        coa->time = 0;
2351
 
                        uiDefButS(block, MENU, 1, str,          xco+10, yco-65, 70, 19, &coa->flag, 0.0, 0.0, 0, 0, "");
2352
 
                
2353
 
                        uiDefButS(block, NUM,           0, "damp",      xco+10, yco-45, 70, 19, &coa->damp, 0.0, 100.0, 0, 0, "Damping factor: time constant (in frame) of low pass filter");
2354
 
                        uiDefBut(block, LABEL,                  0, "Min",       xco+80, yco-45, (width-90)/2, 19, NULL, 0.0, 0.0, 0, 0, "");
2355
 
                        uiDefBut(block, LABEL,                  0, "Max",       xco+80+(width-90)/2, yco-45, (width-90)/2, 19, NULL, 0.0, 0.0, 0, 0, "");
2356
 
 
2357
 
                        if (coa->flag & ACT_CONST_LOCX) fp= coa->minloc;
2358
 
                        else if (coa->flag & ACT_CONST_LOCY) fp= coa->minloc+1;
2359
 
                        else if (coa->flag & ACT_CONST_LOCZ) fp= coa->minloc+2;
2360
 
                        else if (coa->flag & ACT_CONST_ROTX) fp= coa->minrot;
2361
 
                        else if (coa->flag & ACT_CONST_ROTY) fp= coa->minrot+1;
2362
 
                        else fp= coa->minrot+2;
2363
 
                        
2364
 
                        uiDefButF(block, NUM, 0, "",            xco+80, yco-65, (width-90)/2, 19, fp, -2000.0, 2000.0, 10, 0, "");
2365
 
                        uiDefButF(block, NUM, 0, "",            xco+80+(width-90)/2, yco-65, (width-90)/2, 19, fp+3, -2000.0, 2000.0, 10, 0, "");
2366
 
                }
2367
 
                else if (coa->type == ACT_CONST_TYPE_DIST) {
2368
 
                        ysize= 106;
2369
 
 
2370
 
                        glRects(xco, yco-ysize, xco+width, yco);
2371
 
                        uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2372
 
                        
2373
 
                        str= "Direction %t|None %x0|X axis %x1|Y axis %x2|Z axis %x4|-X axis %x8|-Y axis %x16|-Z axis %x32";
2374
 
                        uiDefButS(block, MENU, B_REDR, str,             xco+10, yco-65, 70, 19, &coa->mode, 0.0, 0.0, 0, 0, "Set the direction of the ray");
2375
 
                
2376
 
                        uiDefButS(block, NUM,           0, "damp",      xco+10, yco-45, 70, 19, &coa->damp, 0.0, 100.0, 0, 0, "Damping factor: time constant (in frame) of low pass filter");
2377
 
                        uiDefBut(block, LABEL,                  0, "Range",     xco+80, yco-45, (width-115)/2, 19, NULL, 0.0, 0.0, 0, 0, "Set the maximum length of ray");
2378
 
                        uiDefButBitS(block, TOG, ACT_CONST_DISTANCE, B_REDR, "Dist",    xco+80+(width-115)/2, yco-45, (width-115)/2, 19, &coa->flag, 0.0, 0.0, 0, 0, "Force distance of object to point of impact of ray");
2379
 
                        uiDefButBitS(block, TOG, ACT_CONST_LOCAL, 0, "L", xco+80+(width-115), yco-45, 25, 19,
2380
 
                                         &coa->flag, 0.0, 0.0, 0, 0, "Set ray along object's axis or global axis");
2381
 
 
2382
 
                        if (coa->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= coa->minloc;
2383
 
                        else if (coa->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= coa->minloc+1;
2384
 
                        else fp= coa->minloc+2;
2385
 
 
2386
 
                        uiDefButF(block, NUM, 0, "",            xco+80, yco-65, (width-115)/2, 19, fp+3, 0.0, 2000.0, 10, 0, "Maximum length of ray");
2387
 
                        if (coa->flag & ACT_CONST_DISTANCE)
2388
 
                                uiDefButF(block, NUM, 0, "",            xco+80+(width-115)/2, yco-65, (width-115)/2, 19, fp, -2000.0, 2000.0, 10, 0, "Keep this distance to target");
2389
 
                        uiDefButBitS(block, TOG, ACT_CONST_NORMAL, 0, "N", xco+80+(width-115), yco-65, 25, 19,
2390
 
                                         &coa->flag, 0.0, 0.0, 0, 0, "Set object axis along (local axis) or parallel (global axis) to the normal at hit position");
2391
 
                        uiDefButBitS(block, TOG, ACT_CONST_MATERIAL, B_REDR, "M/P", xco+10, yco-84, 40, 19,
2392
 
                                         &coa->flag, 0.0, 0.0, 0, 0, "Detect material instead of property");
2393
 
                        if (coa->flag & ACT_CONST_MATERIAL) {
2394
 
                                uiDefBut(block, TEX, 1, "Material:", xco + 50, yco-84, (width-60), 19,
2395
 
                                        coa->matprop, 0, MAX_NAME, 0, 0,
2396
 
                                        "Ray detects only Objects with this material");
2397
 
                        }
2398
 
                        else {
2399
 
                                uiDefBut(block, TEX, 1, "Property:", xco + 50, yco-84, (width-60), 19,
2400
 
                                        coa->matprop, 0, MAX_NAME, 0, 0,
2401
 
                                        "Ray detect only Objects with this property");
2402
 
                        }
2403
 
                        uiDefButBitS(block, TOG, ACT_CONST_PERMANENT, 0, "PER", xco+10, yco-103, 40, 19,
2404
 
                                &coa->flag, 0.0, 0.0, 0, 0, "Persistent actuator: stays active even if ray does not reach target");
2405
 
                        uiDefButS(block, NUM, 0, "time", xco+50, yco-103, (width-60)/2, 19, &(coa->time), 0.0, 1000.0, 0, 0, "Maximum activation time in frame, 0 for unlimited");
2406
 
                        uiDefButS(block, NUM, 0, "rotDamp", xco+50+(width-60)/2, yco-103, (width-60)/2, 19, &(coa->rotdamp), 0.0, 100.0, 0, 0, "Use a different damping for orientation");
2407
 
                }
2408
 
                else if (coa->type == ACT_CONST_TYPE_ORI) {
2409
 
                        ysize= 87;
2410
 
 
2411
 
                        glRects(xco, yco-ysize, xco+width, yco);
2412
 
                        uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2413
 
                        
2414
 
                        str= "Direction %t|None %x0|X axis %x1|Y axis %x2|Z axis %x4";
2415
 
                        uiDefButS(block, MENU, B_REDR, str,             xco+10, yco-65, 70, 19, &coa->mode, 0.0, 0.0, 0, 0, "Select the axis to be aligned along the reference direction");
2416
 
                
2417
 
                        uiDefButS(block, NUM,           0, "damp",      xco+10, yco-45, 70, 19, &coa->damp, 0.0, 100.0, 0, 0, "Damping factor: time constant (in frame) of low pass filter");
2418
 
                        uiDefBut(block, LABEL,                  0, "X", xco+80, yco-45, (width-115)/3, 19, NULL, 0.0, 0.0, 0, 0, "");
2419
 
                        uiDefBut(block, LABEL,                  0, "Y", xco+80+(width-115)/3, yco-45, (width-115)/3, 19, NULL, 0.0, 0.0, 0, 0, "");
2420
 
                        uiDefBut(block, LABEL,                  0, "Z", xco+80+2*(width-115)/3, yco-45, (width-115)/3, 19, NULL, 0.0, 0.0, 0, 0, "");
2421
 
 
2422
 
                        uiDefButF(block, NUM, 0, "",            xco+80, yco-65, (width-115)/3, 19, &coa->maxrot[0], -2000.0, 2000.0, 10, 0, "X component of reference direction");
2423
 
                        uiDefButF(block, NUM, 0, "",            xco+80+(width-115)/3, yco-65, (width-115)/3, 19, &coa->maxrot[1], -2000.0, 2000.0, 10, 0, "Y component of reference direction");
2424
 
                        uiDefButF(block, NUM, 0, "",            xco+80+2*(width-115)/3, yco-65, (width-115)/3, 19, &coa->maxrot[2], -2000.0, 2000.0, 10, 0, "Z component of reference direction");
2425
 
 
2426
 
                        uiDefButS(block, NUM, 0, "time", xco+10, yco-84, 70, 19, &(coa->time), 0.0, 1000.0, 0, 0, "Maximum activation time in frame, 0 for unlimited");
2427
 
                        uiDefButF(block, NUM, 0, "min", xco+80, yco-84, (width-115)/2, 19, &(coa->minloc[0]), 0.0, 180.0, 10, 1, "Minimum angle (in degree) to maintain with target direction. No correction is done if angle with target direction is between min and max");
2428
 
                        uiDefButF(block, NUM, 0, "max", xco+80+(width-115)/2, yco-84, (width-115)/2, 19, &(coa->maxloc[0]), 0.0, 180.0, 10, 1, "Maximum angle (in degree) allowed with target direction. No correction is done if angle with target direction is between min and max");
2429
 
                }
2430
 
                else if (coa->type == ACT_CONST_TYPE_FH) {
2431
 
                        ysize= 106;
2432
 
 
2433
 
                        glRects(xco, yco-ysize, xco+width, yco);
2434
 
                        uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2435
 
                        
2436
 
                        str= "Direction %t|None %x0|X axis %x1|Y axis %x2|Z axis %x4|-X axis %x8|-Y axis %x16|-Z axis %x32";
2437
 
                        uiDefButS(block, MENU, B_REDR, str,             xco+10, yco-65, 70, 19, &coa->mode, 0.0, 0.0, 0, 0, "Set the direction of the ray (in world coordinate)");
2438
 
 
2439
 
                        if (coa->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= coa->minloc;
2440
 
                        else if (coa->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= coa->minloc+1;
2441
 
                        else fp= coa->minloc+2;
2442
 
 
2443
 
                        uiDefButF(block, NUM,           0, "damp",      xco+10, yco-45, (width-70)/2, 19, &coa->maxrot[0], 0.0, 1.0, 1, 0, "Damping factor of the Fh spring force");
2444
 
                        uiDefButF(block, NUM,           0, "dist",      xco+10+(width-70)/2, yco-45, (width-70)/2, 19, fp, 0.010, 2000.0, 10, 0, "Height of the Fh area");
2445
 
                        uiDefButBitS(block, TOG, ACT_CONST_DOROTFH, 0, "Rot Fh",        xco+10+(width-70), yco-45, 50, 19, &coa->flag, 0.0, 0.0, 0, 0, "Keep object axis parallel to normal");
2446
 
 
2447
 
                        uiDefButF(block, NUMSLI, 0, "Fh ",              xco+80, yco-65, (width-115), 19, fp+3, 0.0, 1.0, 0, 0, "Spring force within the Fh area");
2448
 
                        uiDefButBitS(block, TOG, ACT_CONST_NORMAL, 0, "N", xco+80+(width-115), yco-65, 25, 19,
2449
 
                                         &coa->flag, 0.0, 0.0, 0, 0, "Add a horizontal spring force on slopes");
2450
 
                        uiDefButBitS(block, TOG, ACT_CONST_MATERIAL, B_REDR, "M/P", xco+10, yco-84, 40, 19,
2451
 
                                         &coa->flag, 0.0, 0.0, 0, 0, "Detect material instead of property");
2452
 
                        if (coa->flag & ACT_CONST_MATERIAL) {
2453
 
                                uiDefBut(block, TEX, 1, "Material:", xco + 50, yco-84, (width-60), 19,
2454
 
                                        coa->matprop, 0, MAX_NAME, 0, 0,
2455
 
                                        "Ray detects only Objects with this material");
2456
 
                        }
2457
 
                        else {
2458
 
                                uiDefBut(block, TEX, 1, "Property:", xco + 50, yco-84, (width-60), 19,
2459
 
                                        coa->matprop, 0, MAX_NAME, 0, 0,
2460
 
                                        "Ray detect only Objects with this property");
2461
 
                        }
2462
 
                        uiDefButBitS(block, TOG, ACT_CONST_PERMANENT, 0, "PER", xco+10, yco-103, 40, 19,
2463
 
                                &coa->flag, 0.0, 0.0, 0, 0, "Persistent actuator: stays active even if ray does not reach target");
2464
 
                        uiDefButS(block, NUM, 0, "time", xco+50, yco-103, 90, 19, &(coa->time), 0.0, 1000.0, 0, 0, "Maximum activation time in frame, 0 for unlimited");
2465
 
                        uiDefButF(block, NUM, 0, "rotDamp", xco+140, yco-103, (width-150), 19, &coa->maxrot[1], 0.0, 1.0, 1, 0, "Use a different damping for rotation");
2466
 
                }
2467
 
                str= "Constraint Type %t|Location %x0|Distance %x1|Orientation %x2|Force field %x3";
2468
 
                but = uiDefButS(block, MENU, B_REDR, str,               xco+40, yco-23, (width-80), 19, &coa->type, 0.0, 0.0, 0, 0, "");
2469
 
                yco-= ysize;
2470
 
                break;
2471
 
 
2472
 
        case ACT_SCENE:
2473
 
                sca= act->data;
2474
 
                
2475
 
                if (sca->type==ACT_SCENE_RESTART) {
2476
 
                        ysize= 28;
2477
 
                        glRects(xco, yco-ysize, xco+width, yco);
2478
 
                        uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2479
 
                }
2480
 
                else if (sca->type==ACT_SCENE_CAMERA) {
2481
 
 
2482
 
                        ysize= 48;
2483
 
                        glRects(xco, yco-ysize, xco+width, yco);
2484
 
                        uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2485
 
 
2486
 
                        uiDefIDPoinBut(block, test_obpoin_but, ID_OB, 1, "OB:",         xco+40, yco-44, (width-80), 19, &(sca->camera), "Set this Camera. Leave empty to refer to self object");
2487
 
                }
2488
 
                else if (sca->type==ACT_SCENE_SET) {
2489
 
                        
2490
 
                        ysize= 48;
2491
 
                        glRects(xco, yco-ysize, xco+width, yco);
2492
 
                        uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2493
 
 
2494
 
                        uiDefIDPoinBut(block, test_scenepoin_but, ID_SCE, 1, "SCE:",            xco+40, yco-44, (width-80), 19, &(sca->scene), "Set this Scene");
2495
 
                }
2496
 
                else if (sca->type==ACT_SCENE_ADD_FRONT) {
2497
 
                        
2498
 
                        ysize= 48;
2499
 
                        glRects(xco, yco-ysize, xco+width, yco);
2500
 
                        uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2501
 
 
2502
 
                        uiDefIDPoinBut(block, test_scenepoin_but, ID_SCE, 1, "SCE:",            xco+40, yco-44, (width-80), 19, &(sca->scene), "Add an Overlay Scene");
2503
 
                }
2504
 
                else if (sca->type==ACT_SCENE_ADD_BACK) {
2505
 
                        
2506
 
                        ysize= 48;
2507
 
                        glRects(xco, yco-ysize, xco+width, yco);
2508
 
                        uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2509
 
 
2510
 
                        uiDefIDPoinBut(block, test_scenepoin_but, ID_SCE, 1, "SCE:",            xco+40, yco-44, (width-80), 19, &(sca->scene), "Add a Background Scene");
2511
 
                }
2512
 
                else if (sca->type==ACT_SCENE_REMOVE) {
2513
 
                        
2514
 
                        ysize= 48;
2515
 
                        glRects(xco, yco-ysize, xco+width, yco);
2516
 
                        uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2517
 
 
2518
 
                        uiDefIDPoinBut(block, test_scenepoin_but, ID_SCE, 1, "SCE:",            xco+40, yco-44, (width-80), 19, &(sca->scene), "Remove a Scene");
2519
 
                }
2520
 
                else if (sca->type==ACT_SCENE_SUSPEND) {
2521
 
                        
2522
 
                        ysize= 48;
2523
 
                        glRects(xco, yco-ysize, xco+width, yco);
2524
 
                        uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2525
 
 
2526
 
                        uiDefIDPoinBut(block, test_scenepoin_but, ID_SCE, 1, "SCE:",            xco+40, yco-44, (width-80), 19, &(sca->scene), "Pause a Scene");
2527
 
                }
2528
 
                else if (sca->type==ACT_SCENE_RESUME) {
2529
 
                        
2530
 
                        ysize= 48;
2531
 
                        glRects(xco, yco-ysize, xco+width, yco);
2532
 
                        uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2533
 
 
2534
 
                        uiDefIDPoinBut(block, test_scenepoin_but, ID_SCE, 1, "SCE:",            xco+40, yco-44, (width-80), 19, &(sca->scene), "Unpause a Scene");
2535
 
                }
2536
 
 
2537
 
                str= "Scene %t|Restart %x0|Set Scene %x1|Set Camera %x2|Add OverlayScene %x3|Add BackgroundScene %x4|Remove Scene %x5|Suspend Scene %x6|Resume Scene %x7";
2538
 
                uiDefButS(block, MENU, B_REDR, str,             xco+40, yco-24, (width-80), 19, &sca->type, 0.0, 0.0, 0, 0, ""); 
2539
 
 
2540
 
                  yco-= ysize; 
2541
 
                  break; 
2542
 
        case ACT_GAME:
2543
 
                {
2544
 
                        gma = act->data;
2545
 
                        if (gma->type == ACT_GAME_LOAD) {
2546
 
                                //ysize = 68;
2547
 
                                ysize = 48;
2548
 
                                glRects(xco, yco-ysize, xco+width, yco); 
2549
 
                                uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1); 
2550
 
                                   uiDefBut(block, TEX, 1, "File: ", xco+10, yco-44,width-20,19, &(gma->filename), 0, sizeof(gma->filename), 0, 0, "Load this blend file, use the \"//\" prefix for a path relative to the current blend file");
2551
 
//                              uiDefBut(block, TEX, 1, "Anim: ", xco+10, yco-64,width-20,19, &(gma->loadaniname), 0, sizeof(gma->loadaniname), 0, 0, "Use this loadinganimation");
2552
 
                        }
2553
 
#if 0
2554
 
                        else if (gma->type == ACT_GAME_START) {
2555
 
                                ysize = 68; 
2556
 
                                glRects(xco, yco-ysize, xco+width, yco); 
2557
 
                                uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2558
 
 
2559
 
                                   uiDefBut(block, TEX, 1, "File: ", xco+10, yco-44,width-20,19, &(gma->filename), 0, sizeof(gma->filename), 0, 0, "Load this file");
2560
 
                                uiDefBut(block, TEX, 1, "Anim: ", xco+10, yco-64,width-20,19, &(gma->loadaniname), 0, sizeof(gma->loadaniname), 0, 0, "Use this loadinganimation");
2561
 
                        }
2562
 
#endif
2563
 
                        else if (ELEM4(gma->type, ACT_GAME_RESTART, ACT_GAME_QUIT, ACT_GAME_SAVECFG, ACT_GAME_LOADCFG)) {
2564
 
                                ysize = 28; 
2565
 
                                glRects(xco, yco-ysize, xco+width, yco); 
2566
 
                                uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1); 
2567
 
                        }
2568
 
 
2569
 
                        //str = "Scene %t|Load game%x0|Start loaded game%x1|Restart this game%x2|Quit this game %x3";
2570
 
                        str = "Scene %t|Start new game%x0|Restart this game%x2|Quit this game %x3|Save bge.logic.globalDict %x4|Load bge.logic.globalDict %x5";
2571
 
                        uiDefButS(block, MENU, B_REDR, str, xco+40, yco-24, (width-80), 19, &gma->type, 0.0, 0.0, 0, 0, ""); 
2572
 
                        
2573
 
                        yco -= ysize; 
2574
 
                        break; 
2575
 
                }
2576
 
        case ACT_GROUP:
2577
 
                ga= act->data;
2578
 
 
2579
 
                ysize= 52;
2580
 
 
2581
 
                glRects(xco, yco-ysize, xco+width, yco);
2582
 
                uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2583
 
                
2584
 
                str= "GroupKey types   %t|Set Key %x6|Play %x0|Ping Pong %x1|Flipper %x2|Loop Stop %x3|Loop End %x4|Property %x5";
2585
 
 
2586
 
                uiDefButS(block, MENU, 1, str,                  xco+20, yco-24, width-40, 19, &ga->type, 0, 0, 0, 0, "");
2587
 
                if (ga->type==ACT_GROUP_SET) {
2588
 
                        uiDefBut(block, TEX, 0, "Key: ",                xco+20, yco-44, (width-10)/2, 19, ga->name, 0.0, MAX_NAME, 0, 0, "This name defines groupkey to be set");
2589
 
                        uiDefButI(block, NUM, 0, "Frame:",      xco+20+(width-10)/2, yco-44, (width-70)/2, 19, &ga->sta, 0.0, 2500.0, 0, 0, "Set this frame");
2590
 
                }
2591
 
                else if (ga->type==ACT_GROUP_FROM_PROP) {
2592
 
                        uiDefBut(block, TEX, 0, "Prop: ",               xco+20, yco-44, width-40, 19, ga->name, 0.0, MAX_NAME, 0, 0, "Use this property to define the Group position");
2593
 
                }
2594
 
                else {
2595
 
                        uiDefButI(block, NUM, 0, "State",               xco+20, yco-44, (width-40)/2, 19, &ga->sta, 0.0, 2500.0, 0, 0, "Start frame");
2596
 
                        uiDefButI(block, NUM, 0, "End",         xco+20+(width-40)/2, yco-44, (width-40)/2, 19, &ga->end, 0.0, 2500.0, 0, 0, "End frame");
2597
 
                }
2598
 
                yco-= ysize;
2599
 
                break;
2600
 
 
2601
 
        case ACT_VISIBILITY:
2602
 
                ysize = 24;
2603
 
 
2604
 
                glRects(xco, yco-ysize, xco+width, yco);
2605
 
                uiEmboss((float)xco,
2606
 
                         (float)yco-ysize, (float)xco+width, (float)yco, 1);
2607
 
                
2608
 
                visAct = act->data;
2609
 
 
2610
 
                uiBlockBeginAlign(block);
2611
 
                uiDefButBitI(block, TOGN, ACT_VISIBILITY_INVISIBLE, B_REDR,
2612
 
                          "Visible",
2613
 
                          xco + 10, yco - 20, (width - 20)/3, 19, &visAct->flag,
2614
 
                          0.0, 0.0, 0, 0,
2615
 
                          "Set the objects visible. Initialized from the objects render restriction toggle (access in the outliner)");
2616
 
                uiDefButBitI(block, TOG, ACT_VISIBILITY_OCCLUSION, B_REDR,
2617
 
                          "Occlusion",
2618
 
                          xco + 10 + ((width - 20)/3), yco - 20, (width - 20)/3, 19, &visAct->flag,
2619
 
                          0.0, 0.0, 0, 0,
2620
 
                          "Set the object to occlude objects behind it. Initialized from the object type in physics button");
2621
 
                uiBlockEndAlign(block);
2622
 
                
2623
 
                uiDefButBitI(block, TOG, ACT_VISIBILITY_RECURSIVE, 0,
2624
 
                          "Children",
2625
 
                          xco + 10 + (((width - 20)/3)*2)+10, yco - 20, ((width - 20)/3)-10, 19, &visAct->flag,
2626
 
                          0.0, 0.0, 0, 0,
2627
 
                          "Sets all the children of this object to the same visibility/occlusion recursively");
2628
 
 
2629
 
                yco-= ysize;
2630
 
 
2631
 
                break;
2632
 
                
2633
 
        case ACT_STATE:
2634
 
                ysize = 34;
2635
 
 
2636
 
                glRects(xco, yco-ysize, xco+width, yco);
2637
 
                uiEmboss((float)xco,
2638
 
                         (float)yco-ysize, (float)xco+width, (float)yco, 1);
2639
 
                
2640
 
                staAct = act->data;
2641
 
 
2642
 
                str= "Operation %t|Cpy %x0|Add %x1|Sub %x2|Inv %x3";
2643
 
 
2644
 
                uiDefButI(block, MENU, B_REDR, str,
2645
 
                          xco + 10, yco - 24, 65, 19, &staAct->type,
2646
 
                          0.0, 0.0, 0, 0,
2647
 
                          "Select the bit operation on object state mask");
2648
 
 
2649
 
                for (wval=0; wval<15; wval+=5) {
2650
 
                        uiBlockBeginAlign(block);
2651
 
                        for (stbit=0; stbit<5; stbit++) {
2652
 
                                but = uiDefButBitI(block,  TOG, 1<<(stbit+wval), stbit+wval, "",        (short)(xco+85+12*stbit+13*wval), yco-17, 12, 12, (int *)&(staAct->mask), 0, 0, 0, 0, get_state_name(ob, (short)(stbit+wval)));
2653
 
                                uiButSetFunc(but, check_state_mask, but, &(staAct->mask));
2654
 
                        }
2655
 
                        for (stbit=0; stbit<5; stbit++) {
2656
 
                                but = uiDefButBitI(block, TOG, 1<<(stbit+wval+15), stbit+wval+15, "",   (short)(xco+85+12*stbit+13*wval), yco-29, 12, 12, (int *)&(staAct->mask), 0, 0, 0, 0, get_state_name(ob, (short)(stbit+wval+15)));
2657
 
                                uiButSetFunc(but, check_state_mask, but, &(staAct->mask));
2658
 
                        }
2659
 
                }
2660
 
                uiBlockEndAlign(block);
2661
 
 
2662
 
                yco-= ysize;
2663
 
 
2664
 
                break;
2665
 
 
2666
 
        case ACT_RANDOM:
2667
 
                ysize  = 69;
2668
 
 
2669
 
                glRects(xco, yco-ysize, xco+width, yco);
2670
 
                uiEmboss((float)xco,
2671
 
                                  (float)yco-ysize, (float)xco+width, (float)yco, 1);
2672
 
                
2673
 
                randAct = act->data;
2674
 
 
2675
 
                /* 1. seed */
2676
 
                uiDefButI(block, NUM, 1, "Seed: ",              (xco+10),yco-24, 0.4 *(width-20), 19,
2677
 
                                 &randAct->seed, 0, 1000, 0, 0,
2678
 
                                 "Initial seed of the random generator. Use Python for more freedom. "
2679
 
                                 " (Choose 0 for not random)");
2680
 
 
2681
 
                /* 2. distribution type */
2682
 
                /* One pick per distribution. These numbers MUST match the #defines  */
2683
 
                /* in game.h !!!                                                     */
2684
 
                str= "Distribution %t|Bool Constant %x0|Bool Uniform %x1"
2685
 
                        "|Bool Bernoulli %x2|Int Constant %x3|Int Uniform %x4"
2686
 
                        "|Int Poisson %x5|Float Constant %x6|Float Uniform %x7"
2687
 
                        "|Float Normal %x8|Float Neg. Exp. %x9";
2688
 
                uiDefButI(block, MENU, B_REDR, str, (xco+10) + 0.4 * (width-20), yco-24, 0.6 * (width-20), 19,
2689
 
                                 &randAct->distribution, 0.0, 0.0, 0, 0,
2690
 
                                 "Choose the type of distribution");
2691
 
 
2692
 
                /* 3. property */
2693
 
                uiDefBut(block, TEX, 1, "Property:", (xco+10), yco-44, (width-20), 19,
2694
 
                                 &randAct->propname, 0, MAX_NAME, 0, 0,
2695
 
                                 "Assign the random value to this property"); 
2696
 
 
2697
 
                /*4. and 5. arguments for the distribution*/
2698
 
                switch (randAct->distribution) {
2699
 
                case ACT_RANDOM_BOOL_CONST:
2700
 
                        uiDefButBitI(block, TOG, 1, 1, "Always true", (xco+10), yco-64, (width-20), 19,
2701
 
                                         &randAct->int_arg_1, 2.0, 1, 0, 0,
2702
 
                                         "Always false or always true");                        
2703
 
                        break;
2704
 
                case ACT_RANDOM_BOOL_UNIFORM:
2705
 
                        uiDefBut(block, LABEL, 0, "     Do a 50-50 pick",       (xco+10), yco-64, (width-20), 19,
2706
 
                                         NULL, 0, 0, 0, 0,
2707
 
                                         "Choose between true and false, 50% chance each");
2708
 
                        break;
2709
 
                case ACT_RANDOM_BOOL_BERNOUILLI:
2710
 
                        uiDefButF(block, NUM, 1, "Chance", (xco+10), yco-64, (width-20), 19,
2711
 
                                         &randAct->float_arg_1, 0.0, 1.0, 0, 0,
2712
 
                                         "Pick a number between 0 and 1. Success if you stay "
2713
 
                                         "below this value");                   
2714
 
                        break;
2715
 
                case ACT_RANDOM_INT_CONST:
2716
 
                        uiDefButI(block, NUM, 1, "Value: ",             (xco+10), yco-64, (width-20), 19,
2717
 
                                         &randAct->int_arg_1, -1000, 1000, 0, 0,
2718
 
                                         "Always return this number");
2719
 
                        break;
2720
 
                case ACT_RANDOM_INT_UNIFORM:
2721
 
                        uiDefButI(block, NUM, 1, "Min: ",               (xco+10), yco-64, (width-20)/2, 19,
2722
 
                                         &randAct->int_arg_1, -1000, 1000, 0, 0,
2723
 
                                         "Choose a number from a range. "
2724
 
                                         "Lower boundary of the range");
2725
 
                        uiDefButI(block, NUM, 1, "Max: ",               (xco+10) + (width-20)/2, yco-64, (width-20)/2, 19,
2726
 
                                         &randAct->int_arg_2, -1000, 1000, 0, 0,
2727
 
                                         "Choose a number from a range. "
2728
 
                                         "Upper boundary of the range");
2729
 
                        break;
2730
 
                case ACT_RANDOM_INT_POISSON:
2731
 
                        uiDefButF(block, NUM, 1, "Mean: ", (xco+10), yco-64, (width-20), 19,
2732
 
                                         &randAct->float_arg_1, 0.01, 100.0, 0, 0,
2733
 
                                         "Expected mean value of the distribution");                                            
2734
 
                        break;
2735
 
                case ACT_RANDOM_FLOAT_CONST:
2736
 
                        uiDefButF(block, NUM, 1, "Value: ", (xco+10), yco-64, (width-20), 19,
2737
 
                                         &randAct->float_arg_1, 0.0, 1.0, 0, 0,
2738
 
                                         "Always return this number");
2739
 
                        break;
2740
 
                case ACT_RANDOM_FLOAT_UNIFORM:
2741
 
                        uiDefButF(block, NUM, 1, "Min: ",               (xco+10), yco-64, (width-20)/2, 19,
2742
 
                                         &randAct->float_arg_1, -10000.0, 10000.0, 0, 0,
2743
 
                                         "Choose a number from a range"
2744
 
                                         "Lower boundary of the range");
2745
 
                        uiDefButF(block, NUM, 1, "Max: ",               (xco+10) + (width-20)/2, yco-64, (width-20)/2, 19,
2746
 
                                         &randAct->float_arg_2, -10000.0, 10000.0, 0, 0,
2747
 
                                         "Choose a number from a range"
2748
 
                                         "Upper boundary of the range");
2749
 
                        break;
2750
 
                case ACT_RANDOM_FLOAT_NORMAL:
2751
 
                        uiDefButF(block, NUM, 1, "Mean: ",              (xco+10), yco-64, (width-20)/2, 19,
2752
 
                                         &randAct->float_arg_1, -10000.0, 10000.0, 0, 0,
2753
 
                                         "A normal distribution. Mean of the distribution");
2754
 
                        uiDefButF(block, NUM, 1, "SD: ",                (xco+10) + (width-20)/2, yco-64, (width-20)/2, 19,
2755
 
                                         &randAct->float_arg_2, 0.0, 10000.0, 0, 0,
2756
 
                                         "A normal distribution. Standard deviation of the "
2757
 
                                         "distribution");
2758
 
                        break;
2759
 
                case ACT_RANDOM_FLOAT_NEGATIVE_EXPONENTIAL:
2760
 
                        uiDefButF(block, NUM, 1, "Half-life time: ", (xco+10), yco-64, (width-20), 19,
2761
 
                                         &randAct->float_arg_1, 0.001, 10000.0, 0, 0,
2762
 
                                         "Negative exponential dropoff");
2763
 
                        break;
2764
 
                default:
2765
 
                        ; /* don't know what this distro is... can be useful for testing */
2766
 
                        /* though :)                                                     */
2767
 
                }
2768
 
 
2769
 
                yco-= ysize;
2770
 
                break;
2771
 
        case ACT_MESSAGE:
2772
 
                ma = act->data;
2773
 
 
2774
 
                ysize = 4 + (3 * 24); /* footer + number of lines * 24 pixels/line */
2775
 
        
2776
 
                glRects(xco, yco-ysize, xco+width, yco);
2777
 
                uiEmboss((float)xco,        (float)yco-ysize,
2778
 
                                 (float)xco+width,  (float)yco, 1);
2779
 
 
2780
 
                myline=1;
2781
 
 
2782
 
                /* line 1: To */
2783
 
                uiDefBut(block, TEX, 1, "To: ",
2784
 
                        (xco+10), (yco-(myline++*24)), (width-20), 19,
2785
 
                        &ma->toPropName, 0, MAX_NAME, 0, 0,
2786
 
                        "Optional send message to objects with this name only, or empty to broadcast");
2787
 
 
2788
 
                /* line 2: Message Subject */
2789
 
                uiDefBut(block, TEX, 1, "Subject: ",
2790
 
                (xco+10), (yco-(myline++*24)), (width-20), 19,
2791
 
                &ma->subject, 0, MAX_NAME, 0, 0,
2792
 
                "Optional message subject. This is what can be filtered on");
2793
 
 
2794
 
                /* line 3: Text/Property */
2795
 
                uiDefButBitS(block, TOG, 1, B_REDR, "T/P",
2796
 
                        (xco+10),(yco-(myline*24)), (0.20 * (width-20)), 19,
2797
 
                        &ma->bodyType, 0.0, 0.0, 0, 0,
2798
 
                        "Toggle message type: either Text or a PropertyName");
2799
 
 
2800
 
                if (ma->bodyType == ACT_MESG_MESG) {
2801
 
                        /* line 3: Message Body */
2802
 
                        uiDefBut(block, TEX, 1, "Body: ",
2803
 
                        (xco+10+(0.20*(width-20))),(yco-(myline++*24)),(0.8*(width-20)),19,
2804
 
                        &ma->body, 0, MAX_NAME, 0, 0,
2805
 
                        "Optional message body Text");
2806
 
                }
2807
 
                else {
2808
 
                        /* line 3: Property body (set by property) */
2809
 
                        uiDefBut(block, TEX, 1, "Propname: ",
2810
 
                        (xco+10+(0.20*(width-20))),(yco-(myline++*24)),(0.8*(width-20)),19,
2811
 
                        &ma->body, 0, MAX_NAME, 0, 0,
2812
 
                        "The message body will be set by the Property Value");
2813
 
                }
2814
 
                
2815
 
                yco -= ysize;
2816
 
                break;
2817
 
        case ACT_2DFILTER:
2818
 
                tdfa = act->data;
2819
 
 
2820
 
                ysize = 50;
2821
 
                if (tdfa->type == ACT_2DFILTER_CUSTOMFILTER) {
2822
 
                        ysize +=20;
2823
 
                }
2824
 
                glRects( xco, yco-ysize, xco+width, yco ); 
2825
 
                uiEmboss( (float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1 );
2826
 
 
2827
 
                switch(tdfa->type)
2828
 
                {
2829
 
                        case ACT_2DFILTER_MOTIONBLUR:
2830
 
                                if (!tdfa->flag) {
2831
 
                                        uiDefButS(block, TOG, B_REDR, "D",      xco+30,yco-44,19, 19, &tdfa->flag, 0.0, 0.0, 0.0, 0.0, "Disable Motion Blur");
2832
 
                                        uiDefButF(block, NUM, B_REDR, "Value:", xco+52,yco-44,width-82,19,&tdfa->float_arg,0.0,1.0,0.0,0.0,"Set motion blur value");
2833
 
                                }
2834
 
                                else {
2835
 
                                        uiDefButS(block, TOG, B_REDR, "Disabled",       xco+30,yco-44,width-60, 19, &tdfa->flag, 0.0, 0.0, 0.0, 0.0, "Enable Motion Blur");
2836
 
                                }
2837
 
                                break;
2838
 
                        case ACT_2DFILTER_BLUR:
2839
 
                        case ACT_2DFILTER_SHARPEN:
2840
 
                        case ACT_2DFILTER_DILATION:
2841
 
                        case ACT_2DFILTER_EROSION:
2842
 
                        case ACT_2DFILTER_LAPLACIAN:
2843
 
                        case ACT_2DFILTER_SOBEL:
2844
 
                        case ACT_2DFILTER_PREWITT:
2845
 
                        case ACT_2DFILTER_GRAYSCALE:
2846
 
                        case ACT_2DFILTER_SEPIA:
2847
 
                        case ACT_2DFILTER_INVERT:
2848
 
                        case ACT_2DFILTER_NOFILTER:
2849
 
                        case ACT_2DFILTER_DISABLED:
2850
 
                        case ACT_2DFILTER_ENABLED:
2851
 
                                uiDefButI(block, NUM, B_REDR, "Pass Number:", xco+30,yco-44,width-60,19,&tdfa->int_arg,0.0,MAX_RENDER_PASS-1,0.0,0.0,"Set filter order");
2852
 
                                break;
2853
 
                        case ACT_2DFILTER_CUSTOMFILTER:
2854
 
                                uiDefButI(block, NUM, B_REDR, "Pass Number:", xco+30,yco-44,width-60,19,&tdfa->int_arg,0.0,MAX_RENDER_PASS-1,0.0,0.0,"Set filter order");
2855
 
                                uiDefIDPoinBut(block, test_scriptpoin_but, ID_SCRIPT, 1, "Script: ", xco+30,yco-64,width-60, 19, &tdfa->text, "");
2856
 
                                break;
2857
 
                }
2858
 
                
2859
 
                str= "2D Filter   %t|Motion Blur   %x1|Blur %x2|Sharpen %x3|Dilation %x4|Erosion %x5|"
2860
 
                                "Laplacian %x6|Sobel %x7|Prewitt %x8|Gray Scale %x9|Sepia %x10|Invert %x11|Custom Filter %x12|"
2861
 
                                "Enable Filter %x-2|Disable Filter %x-1|Remove Filter %x0|";
2862
 
                uiDefButS(block, MENU, B_REDR, str,     xco+30,yco-24,width-60, 19, &tdfa->type, 0.0, 0.0, 0.0, 0.0, "2D filter type");
2863
 
                
2864
 
                yco -= ysize;
2865
 
                break;
2866
 
        case ACT_PARENT:
2867
 
                parAct = act->data;
2868
 
 
2869
 
                if (parAct->type==ACT_PARENT_SET) {
2870
 
                        
2871
 
                        ysize= 48;
2872
 
                        glRects(xco, yco-ysize, xco+width, yco);
2873
 
                        uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2874
 
                        uiDefIDPoinBut(block, test_obpoin_but, ID_OB, 1, "OB:",         xco+95, yco-24, (width-100), 19, &(parAct->ob), "Set this object as parent");
2875
 
                        uiBlockBeginAlign(block);
2876
 
                        uiDefButBitS(block, TOGN, ACT_PARENT_COMPOUND, B_REDR,
2877
 
                        "Compound",
2878
 
                        xco + 5, yco - 44, (width - 10)/2, 19, &parAct->flag,
2879
 
                        0.0, 0.0, 0, 0,
2880
 
                        "Add this object shape to the parent shape (only if the parent shape is already compound)");
2881
 
                        uiDefButBitS(block, TOGN, ACT_PARENT_GHOST, B_REDR,
2882
 
                        "Ghost",
2883
 
                        xco + 5 + ((width - 10)/2), yco - 44, (width - 10)/2, 19, &parAct->flag,
2884
 
                        0.0, 0.0, 0, 0,
2885
 
                        "Make this object ghost while parented (only if not compound)");
2886
 
                        uiBlockEndAlign(block);
2887
 
                }
2888
 
                else if (parAct->type==ACT_PARENT_REMOVE) {
2889
 
 
2890
 
                        ysize= 28;
2891
 
                        glRects(xco, yco-ysize, xco+width, yco);
2892
 
                        uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2893
 
                }
2894
 
 
2895
 
                str= "Parent %t|Set Parent %x0|Remove Parent %x1";
2896
 
                uiDefButI(block, MENU, B_REDR, str,             xco+5, yco-24, parAct->type==1?(width-80):90, 19, &parAct->type, 0.0, 0.0, 0, 0, ""); 
2897
 
 
2898
 
                yco-= ysize;
2899
 
                break;
2900
 
        case ACT_ARMATURE:
2901
 
                armAct = act->data;
2902
 
 
2903
 
                if (ob->type == OB_ARMATURE) {
2904
 
                        str= "Constraint %t|Run armature %x0|Enable %x1|Disable %x2|Set target %x3|Set weight %x4";
2905
 
                        uiDefButI(block, MENU, B_REDR, str,             xco+5, yco-24, (width-10)*0.35, 19, &armAct->type, 0.0, 0.0, 0, 0, ""); 
2906
 
 
2907
 
                        switch (armAct->type) {
2908
 
                        case ACT_ARM_RUN:
2909
 
                                ysize = 28;
2910
 
                                break;
2911
 
                        default:
2912
 
                                uiBlockBeginAlign(block);
2913
 
                                but = uiDefBut(block, TEX, 1, "Bone: ",
2914
 
                                                (xco+5), (yco-44), (width-10)/2, 19,
2915
 
                                                armAct->posechannel, 0, MAX_NAME, 0, 0,
2916
 
                                                "Bone on which the constraint is defined");
2917
 
                                uiButSetFunc(but, check_armature_actuator, but, armAct);
2918
 
                                but = uiDefBut(block, TEX, 1, "Cons: ",
2919
 
                                                (xco+5)+(width-10)/2, (yco-44), (width-10)/2, 19,
2920
 
                                                armAct->constraint, 0, MAX_NAME, 0, 0,
2921
 
                                                "Name of the constraint you want to control");
2922
 
                                uiButSetFunc(but, check_armature_actuator, but, armAct);
2923
 
                                uiBlockEndAlign(block);
2924
 
                                ysize = 48;
2925
 
                                switch (armAct->type) {
2926
 
                                case ACT_ARM_SETTARGET:
2927
 
                                        uiDefIDPoinBut(block, test_obpoin_but, ID_OB, 1, "Target: ",            xco+5, yco-64, (width-10), 19, &(armAct->target), "Set this object as the target of the constraint"); 
2928
 
                                        uiDefIDPoinBut(block, test_obpoin_but, ID_OB, 1, "Secondary Target: ",          xco+5, yco-84, (width-10), 19, &(armAct->subtarget), "Set this object as the secondary target of the constraint (only IK polar target at the moment)"); 
2929
 
                                        ysize += 40;
2930
 
                                        break;
2931
 
                                case ACT_ARM_SETWEIGHT:
2932
 
                                        uiDefButF(block, NUM, B_REDR, "Weight:", xco+5+(width-10)*0.35,yco-24,(width-10)*0.65,19,&armAct->weight,0.0,1.0,0.0,0.0,"Set weight of this constraint");
2933
 
                                        break;
2934
 
                                }
2935
 
                        }
2936
 
                  }
2937
 
                glRects(xco, yco-ysize, xco+width, yco); 
2938
 
                uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1); 
2939
 
                yco-= ysize;
2940
 
                break;
2941
 
 
2942
 
         default:
2943
 
                ysize= 4;
2944
 
 
2945
 
                glRects(xco, yco-ysize, xco+width, yco);
2946
 
                uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2947
 
                
2948
 
                yco-= ysize;
2949
 
                break;
2950
 
        }
2951
 
 
2952
 
        uiBlockSetEmboss(block, UI_EMBOSS);
2953
 
 
2954
 
        return yco-4;
2955
 
}
2956
737
 
2957
738
static void do_sensor_menu(bContext *C, void *UNUSED(arg), int event)
2958
739
{       
2991
772
        block= uiBeginBlock(C, ar, __func__, UI_EMBOSSP);
2992
773
        uiBlockSetButmFunc(block, do_sensor_menu, NULL);
2993
774
        
2994
 
        uiDefBut(block, BUTM, 1, "Show Objects",        0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 0, "");
2995
 
        uiDefBut(block, BUTM, 1, "Hide Objects",        0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 1, "");
 
775
        uiDefBut(block, BUTM, 1, IFACE_("Show Objects"),        0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 0, "");
 
776
        uiDefBut(block, BUTM, 1, IFACE_("Hide Objects"),        0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 1, "");
2996
777
        uiDefBut(block, SEPR, 0, "",    0, (short)(yco-=6), 160, 6, NULL, 0.0, 0.0, 0, 0, "");
2997
 
        uiDefBut(block, BUTM, 1, "Show Sensors",        0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 2, "");
2998
 
        uiDefBut(block, BUTM, 1, "Hide Sensors",        0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 3, "");
 
778
        uiDefBut(block, BUTM, 1, IFACE_("Show Sensors"),        0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 2, "");
 
779
        uiDefBut(block, BUTM, 1, IFACE_("Hide Sensors"),        0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 3, "");
2999
780
 
3000
781
        uiBlockSetDirection(block, UI_TOP);
3001
782
        uiEndBlock(C, block);
3040
821
        block= uiBeginBlock(C, ar, __func__, UI_EMBOSSP);
3041
822
        uiBlockSetButmFunc(block, do_controller_menu, NULL);
3042
823
        
3043
 
        uiDefBut(block, BUTM, 1, "Show Objects",        0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 0, "");
3044
 
        uiDefBut(block, BUTM, 1, "Hide Objects",        0,(short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 1, "");
 
824
        uiDefBut(block, BUTM, 1, IFACE_("Show Objects"),        0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 0, "");
 
825
        uiDefBut(block, BUTM, 1, IFACE_("Hide Objects"),        0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 1, "");
3045
826
        uiDefBut(block, SEPR, 0, "",                                    0, (short)(yco-=6), 160, 6, NULL, 0.0, 0.0, 0, 0, "");
3046
 
        uiDefBut(block, BUTM, 1, "Show Controllers",    0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 2, 2, "");
3047
 
        uiDefBut(block, BUTM, 1, "Hide Controllers",    0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 3, 3, "");
 
827
        uiDefBut(block, BUTM, 1, IFACE_("Show Controllers"),    0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 2, 2, "");
 
828
        uiDefBut(block, BUTM, 1, IFACE_("Hide Controllers"),    0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 3, 3, "");
3048
829
 
3049
830
        uiBlockSetDirection(block, UI_TOP);
3050
831
        uiEndBlock(C, block);
3089
870
        block= uiBeginBlock(C, ar, __func__, UI_EMBOSSP);
3090
871
        uiBlockSetButmFunc(block, do_actuator_menu, NULL);
3091
872
        
3092
 
        uiDefBut(block, BUTM, 1, "Show Objects",        0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 0, "");
3093
 
        uiDefBut(block, BUTM, 1, "Hide Objects",        0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 1, "");
 
873
        uiDefBut(block, BUTM, 1, IFACE_("Show Objects"),        0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 0, "");
 
874
        uiDefBut(block, BUTM, 1, IFACE_("Hide Objects"),        0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 1, "");
3094
875
        uiDefBut(block, SEPR, 0, "",    0, (short)(xco-=6), 160, 6, NULL, 0.0, 0.0, 0, 0, "");
3095
 
        uiDefBut(block, BUTM, 1, "Show Actuators",      0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 2, "");
3096
 
        uiDefBut(block, BUTM, 1, "Hide Actuators",      0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 3, "");
 
876
        uiDefBut(block, BUTM, 1, IFACE_("Show Actuators"),      0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 2, "");
 
877
        uiDefBut(block, BUTM, 1, IFACE_("Hide Actuators"),      0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 3, "");
3097
878
 
3098
879
        uiBlockSetDirection(block, UI_TOP);
3099
880
        uiEndBlock(C, block);
3101
882
        return block;
3102
883
}
3103
884
 
3104
 
 
3105
 
 
3106
885
static void check_controller_state_mask(bContext *UNUSED(C), void *arg1_but, void *arg2_mask)
3107
886
{
3108
887
        unsigned int *cont_mask = arg2_mask;
3113
892
        but->retval = B_REDR;
3114
893
}
3115
894
 
3116
 
static int first_bit(unsigned int mask)
3117
 
{
3118
 
        int bit;
3119
 
 
3120
 
        for (bit=0; bit<32; bit++) {
3121
 
                if (mask & (1<<bit))
3122
 
                        return bit;
3123
 
        }
3124
 
        return -1;
3125
 
}
3126
 
 
3127
895
static uiBlock *controller_state_mask_menu(bContext *C, ARegion *ar, void *arg_cont)
3128
896
{
3129
897
        uiBlock *block;
3137
905
        /* use this for a fake extra empy space around the buttons */
3138
906
        uiDefBut(block, LABEL, 0, "",                   -5, -5, 200, 34, NULL, 0, 0, 0, 0, "");
3139
907
        
3140
 
        for (offset=0; offset<15; offset+=5) {
 
908
        for (offset=0; offset<15; offset += 5) {
3141
909
                uiBlockBeginAlign(block);
3142
910
                for (stbit=0; stbit<5; stbit++) {
3143
911
                        but = uiDefButBitI(block, TOG, (1<<(stbit+offset)), (stbit+offset), "", (short)(xco+12*stbit+13*offset), yco, 12, 12, (int *)&(cont->state_mask), 0, 0, 0, 0, "");
3156
924
        return block;
3157
925
}
3158
926
 
3159
 
static void do_object_state_menu(bContext *UNUSED(C), void *arg, int event)
3160
 
{       
3161
 
        Object *ob = arg;
3162
 
 
3163
 
        switch (event) {
3164
 
        case 0:
3165
 
                ob->state = 0x3FFFFFFF;
3166
 
                break;
3167
 
        case 1:
3168
 
                ob->state = ob->init_state;
3169
 
                if (!ob->state)
3170
 
                        ob->state = 1;
3171
 
                break;
3172
 
        case 2:
3173
 
                ob->init_state = ob->state;
3174
 
                break;
3175
 
        }
3176
 
}
3177
 
 
3178
 
static uiBlock *object_state_mask_menu(bContext *C, ARegion *ar, void *arg_obj)
3179
 
{
3180
 
        uiBlock *block;
3181
 
        short xco = 0;
3182
 
 
3183
 
        block= uiBeginBlock(C, ar, __func__, UI_EMBOSSP);
3184
 
        uiBlockSetButmFunc(block, do_object_state_menu, arg_obj);
3185
 
        
3186
 
        uiDefBut(block, BUTM, 1, "Set all bits",                0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 0, "");
3187
 
        uiDefBut(block, BUTM, 1, "Recall init state",   0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 1, "");
3188
 
        uiDefBut(block, SEPR, 0, "",                                    0, (short)(xco-=6),      160, 6,  NULL, 0.0, 0.0, 0, 0, "");
3189
 
        uiDefBut(block, BUTM, 1, "Store init state",    0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 2, "");
3190
 
 
3191
 
        uiBlockSetDirection(block, UI_TOP);
3192
 
        uiEndBlock(C, block);
3193
 
        
3194
 
        return block;
3195
 
}
3196
 
 
3197
927
static int is_sensor_linked(uiBlock *block, bSensor *sens)
3198
928
{
3199
929
        bController *cont;
3214
944
        uiLayout *box, *row, *sub;
3215
945
        bSensor *sens= (bSensor *)ptr->data;
3216
946
        
3217
 
        box= uiLayoutBox(layout);
3218
 
        row= uiLayoutRow(box, 0);
 
947
        box = uiLayoutBox(layout);
 
948
        row = uiLayoutRow(box, FALSE);
3219
949
        
3220
950
        uiItemR(row, ptr, "show_expanded", UI_ITEM_R_NO_BG, "", ICON_NONE);
3221
951
        if (RNA_boolean_get(ptr, "show_expanded")) {
3227
957
                uiItemL(row, sens->name, ICON_NONE);
3228
958
        }
3229
959
 
3230
 
        sub= uiLayoutRow(row, 0);
 
960
        sub = uiLayoutRow(row, FALSE);
3231
961
        uiLayoutSetActive(sub, ((RNA_boolean_get(logic_ptr, "show_sensors_active_states") &&
3232
962
                                 RNA_boolean_get(ptr, "show_expanded")) || RNA_boolean_get(ptr, "pin")));
3233
963
        uiItemR(sub, ptr, "pin", UI_ITEM_R_NO_BG, "", ICON_NONE);
3234
964
 
3235
965
        if (RNA_boolean_get(ptr, "show_expanded")==0) {
3236
 
                sub= uiLayoutRow(row, 1);
 
966
                sub = uiLayoutRow(row, TRUE);
3237
967
                uiItemEnumO(sub, "LOGIC_OT_sensor_move", "", ICON_TRIA_UP, "direction", 1); // up
3238
968
                uiItemEnumO(sub, "LOGIC_OT_sensor_move", "", ICON_TRIA_DOWN, "direction", 2); // down
3239
969
        }
3245
975
{
3246
976
        uiLayout *box, *split, *sub, *row;
3247
977
 
3248
 
        box= uiLayoutBox(layout);
3249
 
        split = uiLayoutSplit(box, 0.45, 0);
 
978
        box = uiLayoutBox(layout);
 
979
        split = uiLayoutSplit(box, 0.45f, FALSE);
3250
980
        
3251
 
        row= uiLayoutRow(split, 1);
 
981
        row = uiLayoutRow(split, TRUE);
3252
982
        uiItemR(row, ptr, "use_pulse_true_level", 0, "", ICON_DOTSUP);
3253
983
        uiItemR(row, ptr, "use_pulse_false_level", 0, "", ICON_DOTSDOWN);
3254
984
 
3255
 
        sub=uiLayoutRow(row, 0);
 
985
        sub = uiLayoutRow(row, FALSE);
3256
986
        uiLayoutSetActive(sub, (RNA_boolean_get(ptr, "use_pulse_true_level") ||
3257
987
                                RNA_boolean_get(ptr, "use_pulse_false_level")));
3258
 
        uiItemR(sub, ptr, "frequency", 0, "Freq", ICON_NONE);
 
988
        uiItemR(sub, ptr, "frequency", 0, IFACE_("Freq"), ICON_NONE);
3259
989
        
3260
 
        row= uiLayoutRow(split, 1);
 
990
        row = uiLayoutRow(split, TRUE);
3261
991
        uiItemR(row, ptr, "use_level", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
3262
992
        uiItemR(row, ptr, "use_tap", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
3263
993
        
3264
 
        uiItemR(split, ptr, "invert", UI_ITEM_R_TOGGLE, "Invert", ICON_NONE);
 
994
        uiItemR(split, ptr, "invert", UI_ITEM_R_TOGGLE, IFACE_("Invert"), ICON_NONE);
3265
995
}
3266
996
/* sensors in alphabetical order */
3267
997
 
3276
1006
 
3277
1007
static void draw_sensor_armature(uiLayout *layout, PointerRNA *ptr)
3278
1008
{
3279
 
        bSensor *sens = (bSensor*)ptr->data;
 
1009
        bSensor *sens = (bSensor *)ptr->data;
3280
1010
        bArmatureSensor *as = (bArmatureSensor *) sens->data;
3281
1011
        Object *ob = (Object *)ptr->id.data;
3282
1012
        PointerRNA pose_ptr, pchan_ptr;
3284
1014
        uiLayout *row;
3285
1015
 
3286
1016
        if (ob->type != OB_ARMATURE) {
3287
 
                uiItemL(layout, "Sensor only available for armatures", ICON_NONE);
 
1017
                uiItemL(layout, IFACE_("Sensor only available for armatures"), ICON_NONE);
3288
1018
                return;
3289
1019
        }
3290
1020
 
3299
1029
                if (RNA_property_collection_lookup_string(&pose_ptr, bones_prop, as->posechannel, &pchan_ptr))
3300
1030
                        uiItemPointerR(layout, ptr, "constraint", &pchan_ptr, "constraints", NULL, ICON_CONSTRAINT_BONE);
3301
1031
        }
3302
 
        row = uiLayoutRow(layout, 1);
 
1032
        row = uiLayoutRow(layout, TRUE);
3303
1033
        uiItemR(row, ptr, "test_type", 0, NULL, ICON_NONE);
3304
1034
        if (RNA_enum_get(ptr, "test_type") != SENS_ARM_STATE_CHANGED)
3305
1035
                uiItemR(row, ptr, "value", 0, NULL, ICON_NONE);
3312
1042
 
3313
1043
        RNA_main_pointer_create(CTX_data_main(C), &main_ptr);
3314
1044
 
3315
 
        split = uiLayoutSplit(layout, 0.3, 0);
3316
 
        row = uiLayoutRow(split, 1);
 
1045
        split = uiLayoutSplit(layout, 0.3f, FALSE);
 
1046
        row = uiLayoutRow(split, TRUE);
3317
1047
        uiItemR(row, ptr, "use_pulse", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
3318
1048
        uiItemR(row, ptr, "use_material", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
3319
1049
 
3331
1061
{
3332
1062
        uiLayout *row;
3333
1063
        
3334
 
        row= uiLayoutRow(layout, 0);
 
1064
        row = uiLayoutRow(layout, FALSE);
3335
1065
 
3336
1066
        uiItemR(row, ptr, "delay", 0, NULL, ICON_NONE);
3337
1067
        uiItemR(row, ptr, "duration", 0, NULL, ICON_NONE);
3349
1079
                case SENS_JOY_BUTTON:
3350
1080
                        uiItemR(layout, ptr, "use_all_events", 0, NULL, ICON_NONE);
3351
1081
 
3352
 
                        col = uiLayoutColumn(layout, 0);
3353
 
                        uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_all_events")==0);
 
1082
                        col = uiLayoutColumn(layout, FALSE);
 
1083
                        uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_all_events") == FALSE);
3354
1084
                        uiItemR(col, ptr, "button_number", 0, NULL, ICON_NONE);
3355
1085
                        break;
3356
1086
                case SENS_JOY_AXIS:
3357
 
                        row = uiLayoutRow(layout, 0);
 
1087
                        row = uiLayoutRow(layout, FALSE);
3358
1088
                        uiItemR(row, ptr, "axis_number", 0, NULL, ICON_NONE);
3359
1089
                        uiItemR(row, ptr, "axis_threshold", 0, NULL, ICON_NONE);
3360
1090
 
3361
1091
                        uiItemR(layout, ptr, "use_all_events", 0, NULL, ICON_NONE);
3362
 
                        col = uiLayoutColumn(layout, 0);
3363
 
                        uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_all_events")==0);
 
1092
                        col = uiLayoutColumn(layout, FALSE);
 
1093
                        uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_all_events") == FALSE);
3364
1094
                        uiItemR(col, ptr, "axis_direction", 0, NULL, ICON_NONE);
3365
1095
                        break;
3366
1096
                case SENS_JOY_HAT:
3367
1097
                        uiItemR(layout, ptr, "hat_number", 0, NULL, ICON_NONE);
3368
1098
                        uiItemR(layout, ptr, "use_all_events", 0, NULL, ICON_NONE);
3369
1099
 
3370
 
                        col = uiLayoutColumn(layout, 0);
3371
 
                        uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_all_events")==0);
 
1100
                        col = uiLayoutColumn(layout, FALSE);
 
1101
                        uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_all_events") == FALSE);
3372
1102
                        uiItemR(col, ptr, "hat_direction", 0, NULL, ICON_NONE);
3373
1103
                        break;
3374
1104
                case SENS_JOY_AXIS_SINGLE:
3375
 
                        row = uiLayoutRow(layout, 0);
 
1105
                        row = uiLayoutRow(layout, FALSE);
3376
1106
                        uiItemR(row, ptr, "single_axis_number", 0, NULL, ICON_NONE);
3377
1107
                        uiItemR(row, ptr, "axis_threshold", 0, NULL, ICON_NONE);
3378
1108
                        break;
3385
1115
        PointerRNA settings_ptr;
3386
1116
        uiLayout *row, *col;
3387
1117
 
3388
 
        row = uiLayoutRow(layout, 0);
3389
 
        uiItemL(row, "Key:", ICON_NONE);
3390
 
        col = uiLayoutColumn(row, 0);
3391
 
        uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_all_keys")==0);
 
1118
        row = uiLayoutRow(layout, FALSE);
 
1119
        uiItemL(row, IFACE_("Key:"), ICON_NONE);
 
1120
        col = uiLayoutColumn(row, FALSE);
 
1121
        uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_all_keys") == FALSE);
3392
1122
        uiItemR(col, ptr, "key", UI_ITEM_R_EVENT, "", ICON_NONE);
3393
 
        col = uiLayoutColumn(row, 0);
 
1123
        col = uiLayoutColumn(row, FALSE);
3394
1124
        uiItemR(col, ptr, "use_all_keys", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
3395
1125
        
3396
 
        col = uiLayoutColumn(layout, 0);
3397
 
        uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_all_keys")==0);
3398
 
        row = uiLayoutRow(col, 0);
3399
 
        uiItemL(row, "First Modifier:", ICON_NONE);
 
1126
        col = uiLayoutColumn(layout, FALSE);
 
1127
        uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_all_keys") == FALSE);
 
1128
        row = uiLayoutRow(col, FALSE);
 
1129
        uiItemL(row, IFACE_("First Modifier:"), ICON_NONE);
3400
1130
        uiItemR(row, ptr, "modifier_key_1", UI_ITEM_R_EVENT, "", ICON_NONE);
3401
1131
        
3402
 
        row = uiLayoutRow(col, 0);
3403
 
        uiItemL(row, "Second Modifier:", ICON_NONE);
 
1132
        row = uiLayoutRow(col, FALSE);
 
1133
        uiItemL(row, IFACE_("Second Modifier:"), ICON_NONE);
3404
1134
        uiItemR(row, ptr, "modifier_key_2", UI_ITEM_R_EVENT, "", ICON_NONE);
3405
1135
 
3406
1136
        RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr);
3415
1145
 
3416
1146
static void draw_sensor_mouse(uiLayout *layout, PointerRNA *ptr)
3417
1147
{
3418
 
        uiItemR(layout, ptr, "mouse_event", 0, NULL, ICON_NONE);
 
1148
        uiLayout *split;
 
1149
 
 
1150
        split = uiLayoutSplit(layout, 0.8f, FALSE);
 
1151
        uiItemR(split, ptr, "mouse_event", 0, NULL, ICON_NONE);
 
1152
 
 
1153
        if (RNA_enum_get(ptr, "mouse_event") == BL_SENS_MOUSE_MOUSEOVER_ANY)
 
1154
                uiItemR(split, ptr, "use_pulse", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
3419
1155
}
3420
1156
 
3421
1157
static void draw_sensor_near(uiLayout *layout, PointerRNA *ptr)
3424
1160
 
3425
1161
        uiItemR(layout, ptr, "property", 0, NULL, ICON_NONE);
3426
1162
 
3427
 
        row= uiLayoutRow(layout, 1);
 
1163
        row = uiLayoutRow(layout, TRUE);
3428
1164
        uiItemR(row, ptr, "distance", 0, NULL, ICON_NONE);
3429
1165
        uiItemR(row, ptr, "reset_distance", 0, NULL, ICON_NONE);
3430
1166
}
3442
1178
 
3443
1179
        switch (RNA_enum_get(ptr, "evaluation_type")) {
3444
1180
                case SENS_PROP_INTERVAL:
3445
 
                        row = uiLayoutRow(layout, 0);
 
1181
                        row = uiLayoutRow(layout, FALSE);
3446
1182
                        uiItemR(row, ptr, "value_min", 0, NULL, ICON_NONE);
3447
1183
                        uiItemR(row, ptr, "value_max", 0, NULL, ICON_NONE);
3448
1184
                        break;
3464
1200
        uiItemR(layout, ptr, "property", 0, NULL, ICON_NONE);
3465
1201
        uiItemR(layout, ptr, "axis", 0, NULL, ICON_NONE);
3466
1202
 
3467
 
        row= uiLayoutRow(layout, 0);
 
1203
        row = uiLayoutRow(layout, FALSE);
3468
1204
        uiItemR(row, ptr, "angle", 0, NULL, ICON_NONE);
3469
1205
        uiItemR(row, ptr, "distance", 0, NULL, ICON_NONE);
3470
1206
}
3480
1216
        PointerRNA main_ptr;
3481
1217
 
3482
1218
        RNA_main_pointer_create(CTX_data_main(C), &main_ptr);
3483
 
        split= uiLayoutSplit(layout, 0.3, 0);
 
1219
        split = uiLayoutSplit(layout, 0.3f, FALSE);
3484
1220
        uiItemR(split, ptr, "ray_type", 0, "", ICON_NONE);
3485
1221
        switch (RNA_enum_get(ptr, "ray_type")) {
3486
1222
                case SENS_RAY_PROPERTY:
3491
1227
                        break;
3492
1228
        }
3493
1229
 
3494
 
        split= uiLayoutSplit(layout, 0.3, 0);
 
1230
        split = uiLayoutSplit(layout, 0.3, FALSE);
3495
1231
        uiItemR(split, ptr, "axis", 0, "", ICON_NONE);
3496
 
        row= uiLayoutRow(split, 0);     
 
1232
        row = uiLayoutRow(split, FALSE);
3497
1233
        uiItemR(row, ptr, "range", 0, NULL, ICON_NONE);
3498
1234
        uiItemR(row, ptr, "use_x_ray", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
3499
1235
}
3572
1308
        char state[3];
3573
1309
        BLI_snprintf(state, sizeof(state), "%d", RNA_int_get(ptr, "states"));
3574
1310
        
3575
 
        box= uiLayoutBox(layout);
3576
 
        row= uiLayoutRow(box, 0);
 
1311
        box = uiLayoutBox(layout);
 
1312
        row = uiLayoutRow(box, FALSE);
3577
1313
        
3578
1314
        uiItemR(row, ptr, "show_expanded", UI_ITEM_R_NO_BG, "", ICON_NONE);
3579
1315
        if (RNA_boolean_get(ptr, "show_expanded")) {
3580
1316
                uiItemR(row, ptr, "type", 0, "", ICON_NONE);
3581
1317
                uiItemR(row, ptr, "name", 0, "", ICON_NONE);
3582
1318
                /* XXX provisory for Blender 2.50Beta */
3583
 
                uiDefBlockBut(uiLayoutGetBlock(layout), controller_state_mask_menu, cont, state, (short)(xco+width-44), yco, 22+22, UI_UNIT_Y, "Set controller state index (from 1 to 30)");
 
1319
                uiDefBlockBut(uiLayoutGetBlock(layout), controller_state_mask_menu, cont, state, (short)(xco+width-44), yco, 22+22, UI_UNIT_Y, IFACE_("Set controller state index (from 1 to 30)"));
3584
1320
        }
3585
1321
        else {
3586
1322
                uiItemL(row, controller_name(cont->type), ICON_NONE);
3591
1327
        uiItemR(row, ptr, "use_priority", 0, "", ICON_NONE);
3592
1328
 
3593
1329
        if (RNA_boolean_get(ptr, "show_expanded")==0) {
3594
 
                sub= uiLayoutRow(row, 1);
 
1330
                sub = uiLayoutRow(row, TRUE);
3595
1331
                uiItemEnumO(sub, "LOGIC_OT_controller_move", "", ICON_TRIA_UP, "direction", 1); // up
3596
1332
                uiItemEnumO(sub, "LOGIC_OT_controller_move", "", ICON_TRIA_DOWN, "direction", 2); // down
3597
1333
        }
3607
1343
{
3608
1344
        uiLayout *split, *sub;
3609
1345
 
3610
 
        split = uiLayoutSplit(layout, 0.3, 1);
 
1346
        split = uiLayoutSplit(layout, 0.3, TRUE);
3611
1347
        uiItemR(split, ptr, "mode", 0, "", ICON_NONE);
3612
1348
        if (RNA_enum_get(ptr, "mode") == CONT_PY_SCRIPT) {
3613
1349
                uiItemR(split, ptr, "text", 0, "", ICON_NONE);
3614
1350
        }
3615
1351
        else {
3616
 
                sub = uiLayoutSplit(split, 0.8, 0);
 
1352
                sub = uiLayoutSplit(split, 0.8f, FALSE);
3617
1353
                uiItemR(sub, ptr, "module", 0, "", ICON_NONE);
3618
1354
                uiItemR(sub, ptr, "use_debug", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
3619
1355
        }
3663
1399
        uiLayout *box, *row, *sub;
3664
1400
        bActuator *act= (bActuator *)ptr->data;
3665
1401
        
3666
 
        box= uiLayoutBox(layout);
3667
 
        row= uiLayoutRow(box, 0);
 
1402
        box = uiLayoutBox(layout);
 
1403
        row = uiLayoutRow(box, FALSE);
3668
1404
        
3669
1405
        uiItemR(row, ptr, "show_expanded", UI_ITEM_R_NO_BG, "", ICON_NONE);
3670
1406
        if (RNA_boolean_get(ptr, "show_expanded")) {
3676
1412
                uiItemL(row, act->name, ICON_NONE);
3677
1413
        }
3678
1414
 
3679
 
        sub= uiLayoutRow(row, 0);
 
1415
        sub = uiLayoutRow(row, FALSE);
3680
1416
        uiLayoutSetActive(sub, ((RNA_boolean_get(logic_ptr, "show_actuators_active_states") &&
3681
1417
                                 RNA_boolean_get(ptr, "show_expanded")) || RNA_boolean_get(ptr, "pin")));
3682
1418
        uiItemR(sub, ptr, "pin", UI_ITEM_R_NO_BG, "", ICON_NONE);
3683
1419
 
3684
1420
        if (RNA_boolean_get(ptr, "show_expanded")==0) {
3685
 
                sub= uiLayoutRow(row, 1);
 
1421
                sub = uiLayoutRow(row, TRUE);
3686
1422
                uiItemEnumO(sub, "LOGIC_OT_actuator_move", "", ICON_TRIA_UP, "direction", 1); // up
3687
1423
                uiItemEnumO(sub, "LOGIC_OT_actuator_move", "", ICON_TRIA_DOWN, "direction", 2); // down
3688
1424
        }
3697
1433
 
3698
1434
        RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr);
3699
1435
 
3700
 
        row= uiLayoutRow(layout, 0);
 
1436
        row = uiLayoutRow(layout, FALSE);
3701
1437
        uiItemR(row, ptr, "play_mode", 0, "", ICON_NONE);
3702
1438
 
3703
 
        sub= uiLayoutRow(row, 1);
 
1439
        sub = uiLayoutRow(row, TRUE);
3704
1440
        uiItemR(sub, ptr, "use_force", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
3705
1441
        uiItemR(sub, ptr, "use_additive", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
3706
1442
 
3707
 
        row = uiLayoutColumn(sub, 0);
 
1443
        row = uiLayoutColumn(sub, FALSE);
3708
1444
        uiLayoutSetActive(row, (RNA_boolean_get(ptr, "use_additive") || RNA_boolean_get(ptr, "use_force")));
3709
1445
        uiItemR(row, ptr, "use_local", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
3710
1446
 
3711
 
        row= uiLayoutRow(layout, 0);
 
1447
        row = uiLayoutRow(layout, FALSE);
3712
1448
        uiItemR(row, ptr, "action", 0, "", ICON_NONE);
3713
1449
        uiItemR(row, ptr, "use_continue_last_frame", 0, NULL, ICON_NONE);
3714
1450
 
3715
 
        row= uiLayoutRow(layout, 0);
 
1451
        row = uiLayoutRow(layout, FALSE);
3716
1452
        if ((RNA_enum_get(ptr, "play_mode") == ACT_ACTION_FROM_PROP))
3717
1453
                uiItemPointerR(row, ptr, "property", &settings_ptr, "properties", NULL, ICON_NONE);
3718
1454
 
3723
1459
 
3724
1460
        uiItemR(row, ptr, "apply_to_children", 0, NULL, ICON_NONE);
3725
1461
 
3726
 
        row= uiLayoutRow(layout, 0);
 
1462
        row = uiLayoutRow(layout, FALSE);
3727
1463
        uiItemR(row, ptr, "frame_blend_in", 0, NULL, ICON_NONE);
3728
1464
        uiItemR(row, ptr, "priority", 0, NULL, ICON_NONE);
3729
1465
 
3730
 
        row= uiLayoutRow(layout, 0);
 
1466
        row = uiLayoutRow(layout, FALSE);
3731
1467
        uiItemR(row, ptr, "layer", 0, NULL, ICON_NONE);
3732
1468
        uiItemR(row, ptr, "layer_weight", 0, NULL, ICON_NONE);
3733
1469
 
3740
1476
 
3741
1477
static void draw_actuator_armature(uiLayout *layout, PointerRNA *ptr)
3742
1478
{
3743
 
        bActuator *act = (bActuator*)ptr->data;
 
1479
        bActuator *act = (bActuator *)ptr->data;
3744
1480
        bArmatureActuator *aa = (bArmatureActuator *) act->data;
3745
1481
        Object *ob = (Object *)ptr->id.data;
3746
1482
        bConstraint *constraint = NULL;
3748
1484
        PropertyRNA *bones_prop = NULL;
3749
1485
 
3750
1486
        if (ob->type != OB_ARMATURE) {
3751
 
                uiItemL(layout, "Actuator only available for armatures", ICON_NONE);
 
1487
                uiItemL(layout, IFACE_("Actuator only available for armatures"), ICON_NONE);
3752
1488
                return;
3753
1489
        }
3754
1490
        
3759
1495
        
3760
1496
        uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE);
3761
1497
        
3762
 
        switch (RNA_enum_get(ptr, "mode"))
3763
 
        {
 
1498
        switch (RNA_enum_get(ptr, "mode")) {
3764
1499
                case ACT_ARM_RUN:
3765
1500
                        break;
3766
1501
                case ACT_ARM_ENABLE:
3816
1551
        uiLayout *row;
3817
1552
        uiItemR(layout, ptr, "object", 0, NULL, ICON_NONE);
3818
1553
 
3819
 
        row = uiLayoutRow(layout, 0);
 
1554
        row = uiLayoutRow(layout, FALSE);
3820
1555
        uiItemR(row, ptr, "height", 0, NULL, ICON_NONE);
3821
1556
        uiItemR(row, ptr, "axis", 0, NULL, ICON_NONE);
3822
1557
 
3823
 
        row = uiLayoutRow(layout, 1);
 
1558
        row = uiLayoutRow(layout, TRUE);
3824
1559
        uiItemR(row, ptr, "min", 0, NULL, ICON_NONE);
3825
1560
        uiItemR(row, ptr, "max", 0, NULL, ICON_NONE);
3826
1561
 
3835
1570
        RNA_main_pointer_create(CTX_data_main(C), &main_ptr);
3836
1571
 
3837
1572
        uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE);
3838
 
        switch (RNA_enum_get(ptr, "mode"))
3839
 
        {
 
1573
        switch (RNA_enum_get(ptr, "mode")) {
3840
1574
                case ACT_CONST_TYPE_LOC:
3841
1575
                        uiItemR(layout, ptr, "limit", 0, NULL, ICON_NONE);
3842
1576
 
3843
 
                        row = uiLayoutRow(layout, 1);
 
1577
                        row = uiLayoutRow(layout, TRUE);
3844
1578
                        uiItemR(row, ptr, "limit_min", 0, NULL, ICON_NONE);
3845
1579
                        uiItemR(row, ptr, "limit_max", 0, NULL, ICON_NONE);
3846
1580
 
3848
1582
                        break;
3849
1583
 
3850
1584
                case ACT_CONST_TYPE_DIST:
3851
 
                        split = uiLayoutSplit(layout, 0.8, 0);
 
1585
                        split = uiLayoutSplit(layout, 0.8, FALSE);
3852
1586
                        uiItemR(split, ptr, "direction", 0, NULL, ICON_NONE);
3853
 
                        row = uiLayoutRow(split, 1);
 
1587
                        row = uiLayoutRow(split, TRUE);
3854
1588
                        uiItemR(row, ptr, "use_local", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
3855
1589
                        uiItemR(row, ptr, "use_normal", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
3856
1590
 
3857
 
                        row = uiLayoutRow(layout, 0);
3858
 
                        col = uiLayoutColumn(row, 1);
3859
 
                        uiItemL(col, "Range:", ICON_NONE);
 
1591
                        row = uiLayoutRow(layout, FALSE);
 
1592
                        col = uiLayoutColumn(row, TRUE);
 
1593
                        uiItemL(col, IFACE_("Range:"), ICON_NONE);
3860
1594
                        uiItemR(col, ptr, "range", 0, "", ICON_NONE);
3861
1595
 
3862
 
                        col = uiLayoutColumn(row, 1);
 
1596
                        col = uiLayoutColumn(row, TRUE);
3863
1597
                        uiItemR(col, ptr, "use_force_distance", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
3864
 
                        sub = uiLayoutColumn(col, 0);
3865
 
                        uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_force_distance")==1);
 
1598
                        sub = uiLayoutColumn(col, FALSE);
 
1599
                        uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_force_distance") == TRUE);
3866
1600
                        uiItemR(sub, ptr, "distance", 0, "", ICON_NONE);
3867
1601
 
3868
 
                        uiItemR(layout, ptr, "damping", UI_ITEM_R_SLIDER , NULL, ICON_NONE);
 
1602
                        uiItemR(layout, ptr, "damping", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
3869
1603
 
3870
 
                        split = uiLayoutSplit(layout, 0.15, 0);
 
1604
                        split = uiLayoutSplit(layout, 0.15f, FALSE);
3871
1605
                        uiItemR(split, ptr, "use_material_detect", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
3872
1606
                        if (RNA_boolean_get(ptr, "use_material_detect"))
3873
1607
                                uiItemPointerR(split, ptr, "material", &main_ptr, "materials", NULL, ICON_MATERIAL_DATA);
3874
1608
                        else
3875
1609
                                uiItemR(split, ptr, "property", 0, NULL, ICON_NONE);
3876
1610
 
3877
 
                        split = uiLayoutSplit(layout, 0.15, 0);
 
1611
                        split = uiLayoutSplit(layout, 0.15, FALSE);
3878
1612
                        uiItemR(split, ptr, "use_persistent", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
3879
1613
 
3880
 
                        row = uiLayoutRow(split, 1);
 
1614
                        row = uiLayoutRow(split, TRUE);
3881
1615
                        uiItemR(row, ptr, "time", 0, NULL, ICON_NONE);
3882
1616
                        uiItemR(row, ptr, "damping_rotation", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
3883
1617
                        break;
3885
1619
                case ACT_CONST_TYPE_ORI:
3886
1620
                        uiItemR(layout, ptr, "direction_axis_pos", 0, NULL, ICON_NONE);
3887
1621
 
3888
 
                        row=uiLayoutRow(layout, 1);
3889
 
                        uiItemR(row, ptr, "damping", UI_ITEM_R_SLIDER , NULL, ICON_NONE);
 
1622
                        row=uiLayoutRow(layout, TRUE);
 
1623
                        uiItemR(row, ptr, "damping", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
3890
1624
                        uiItemR(row, ptr, "time", 0, NULL, ICON_NONE);
3891
1625
 
3892
 
                        row=uiLayoutRow(layout, 0);
 
1626
                        row=uiLayoutRow(layout, FALSE);
3893
1627
                        uiItemR(row, ptr, "rotation_max", 0, NULL, ICON_NONE);
3894
1628
 
3895
 
                        row=uiLayoutRow(layout, 1);
 
1629
                        row=uiLayoutRow(layout, TRUE);
3896
1630
                        uiItemR(row, ptr, "angle_min", 0, NULL, ICON_NONE);
3897
1631
                        uiItemR(row, ptr, "angle_max", 0, NULL, ICON_NONE);
3898
1632
                        break;
3899
1633
 
3900
1634
                case ACT_CONST_TYPE_FH:
3901
 
                        split=uiLayoutSplit(layout, 0.75, 0);
3902
 
                        row= uiLayoutRow(split, 0);
3903
 
                        uiItemR(row, ptr, "fh_damping", UI_ITEM_R_SLIDER , NULL, ICON_NONE);
 
1635
                        split = uiLayoutSplit(layout, 0.75, FALSE);
 
1636
                        row = uiLayoutRow(split, FALSE);
 
1637
                        uiItemR(row, ptr, "fh_damping", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
3904
1638
 
3905
1639
                        uiItemR(row, ptr, "fh_height", 0, NULL, ICON_NONE);
3906
 
                        uiItemR(split, ptr, "use_fh_paralel_axis", UI_ITEM_R_TOGGLE , NULL, ICON_NONE);
 
1640
                        uiItemR(split, ptr, "use_fh_paralel_axis", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
3907
1641
 
3908
 
                        row = uiLayoutRow(layout, 0);
 
1642
                        row = uiLayoutRow(layout, FALSE);
3909
1643
                        uiItemR(row, ptr, "direction_axis", 0, NULL, ICON_NONE);
3910
 
                        split = uiLayoutSplit(row, 0.9, 0);
 
1644
                        split = uiLayoutSplit(row, 0.9f, FALSE);
3911
1645
                        uiItemR(split, ptr, "fh_force", 0, NULL, ICON_NONE);
3912
 
                        uiItemR(split, ptr, "use_fh_normal", UI_ITEM_R_TOGGLE , NULL, ICON_NONE);
 
1646
                        uiItemR(split, ptr, "use_fh_normal", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
3913
1647
 
3914
 
                        split = uiLayoutSplit(layout, 0.15, 0);
 
1648
                        split = uiLayoutSplit(layout, 0.15, FALSE);
3915
1649
                        uiItemR(split, ptr, "use_material_detect", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
3916
1650
                        if (RNA_boolean_get(ptr, "use_material_detect"))
3917
1651
                                uiItemPointerR(split, ptr, "material", &main_ptr, "materials", NULL, ICON_MATERIAL_DATA);
3918
1652
                        else
3919
1653
                                uiItemR(split, ptr, "property", 0, NULL, ICON_NONE);
3920
1654
 
3921
 
                        split = uiLayoutSplit(layout, 0.15, 0);
 
1655
                        split = uiLayoutSplit(layout, 0.15, FALSE);
3922
1656
                        uiItemR(split, ptr, "use_persistent", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
3923
1657
 
3924
 
                        row = uiLayoutRow(split, 0);
 
1658
                        row = uiLayoutRow(split, FALSE);
3925
1659
                        uiItemR(row, ptr, "time", 0, NULL, ICON_NONE);
3926
1660
                        uiItemR(row, ptr, "damping_rotation", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
3927
1661
                        break;
3934
1668
        uiLayout *row, *split, *sub;
3935
1669
        uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE);
3936
1670
 
3937
 
        switch (RNA_enum_get(ptr, "mode"))
3938
 
        {
 
1671
        switch (RNA_enum_get(ptr, "mode")) {
3939
1672
                case ACT_EDOB_ADD_OBJECT:
3940
 
                        row = uiLayoutRow(layout, 0);
 
1673
                        row = uiLayoutRow(layout, FALSE);
3941
1674
                        uiItemR(row, ptr, "object", 0, NULL, ICON_NONE);
3942
1675
                        uiItemR(row, ptr, "time", 0, NULL, ICON_NONE);
3943
1676
 
3944
 
                        split = uiLayoutSplit(layout, 0.9, 0);
3945
 
                        row = uiLayoutRow(split, 0);
 
1677
                        split = uiLayoutSplit(layout, 0.9, FALSE);
 
1678
                        row = uiLayoutRow(split, FALSE);
3946
1679
                        uiItemR(row, ptr, "linear_velocity", 0, NULL, ICON_NONE);
3947
1680
                        uiItemR(split, ptr, "use_local_linear_velocity", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
3948
1681
 
3949
 
                        split = uiLayoutSplit(layout, 0.9, 0);
3950
 
                        row = uiLayoutRow(split, 0);
 
1682
                        split = uiLayoutSplit(layout, 0.9, FALSE);
 
1683
                        row = uiLayoutRow(split, FALSE);
3951
1684
                        uiItemR(row, ptr, "angular_velocity", 0, NULL, ICON_NONE);
3952
1685
                        uiItemR(split, ptr, "use_local_angular_velocity", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
3953
1686
                        break;
3955
1688
                        break;
3956
1689
                case ACT_EDOB_REPLACE_MESH:
3957
1690
                        if (ob->type != OB_MESH) {
3958
 
                                uiItemL(layout, "Mode only available for mesh objects", ICON_NONE);
 
1691
                                uiItemL(layout, IFACE_("Mode only available for mesh objects"), ICON_NONE);
3959
1692
                                break;
3960
1693
                        }
3961
 
                        split = uiLayoutSplit(layout, 0.6, 0);
 
1694
                        split = uiLayoutSplit(layout, 0.6, FALSE);
3962
1695
                        uiItemR(split, ptr, "mesh", 0, NULL, ICON_NONE);
3963
 
                        row = uiLayoutRow(split, 0);
 
1696
                        row = uiLayoutRow(split, FALSE);
3964
1697
                        uiItemR(row, ptr, "use_replace_display_mesh", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
3965
1698
                        uiItemR(row, ptr, "use_replace_physics_mesh", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
3966
1699
                        break;
3967
1700
                case ACT_EDOB_TRACK_TO:
3968
 
                        split = uiLayoutSplit(layout, 0.5, 0);
 
1701
                        split = uiLayoutSplit(layout, 0.5, FALSE);
3969
1702
                        uiItemR(split, ptr, "track_object", 0, NULL, ICON_NONE);
3970
 
                        sub = uiLayoutSplit(split, 0.7, 0);
 
1703
                        sub = uiLayoutSplit(split, 0.7f, FALSE);
3971
1704
                        uiItemR(sub, ptr, "time", 0, NULL, ICON_NONE);
3972
1705
                        uiItemR(sub, ptr, "use_3d_tracking", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
3973
1706
                        break;
3974
1707
                case ACT_EDOB_DYNAMICS:
3975
1708
                        if (ob->type != OB_MESH) {
3976
 
                                uiItemL(layout, "Mode only available for mesh objects", ICON_NONE);
 
1709
                                uiItemL(layout, IFACE_("Mode only available for mesh objects"), ICON_NONE);
3977
1710
                                break;
3978
1711
                        }
3979
1712
                        uiItemR(layout, ptr, "dynamic_operation", 0, NULL, ICON_NONE);
3988
1721
        uiLayout *row, *split;
3989
1722
 
3990
1723
        uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE);
3991
 
        switch (RNA_enum_get(ptr, "mode"))
3992
 
        {
 
1724
        switch (RNA_enum_get(ptr, "mode")) {
3993
1725
                case ACT_2DFILTER_CUSTOMFILTER:
3994
1726
                        uiItemR(layout, ptr, "filter_pass", 0, NULL, ICON_NONE);
3995
1727
                        uiItemR(layout, ptr, "glsl_shader", 0, NULL, ICON_NONE);
3996
1728
                        break;
3997
1729
                case ACT_2DFILTER_MOTIONBLUR:
3998
 
                        split=uiLayoutSplit(layout, 0.75, 1);
3999
 
                        row= uiLayoutRow(split, 0);
4000
 
                        uiLayoutSetActive(row, RNA_boolean_get(ptr, "use_motion_blur")==1);
 
1730
                        split=uiLayoutSplit(layout, 0.75f, TRUE);
 
1731
                        row = uiLayoutRow(split, FALSE);
 
1732
                        uiLayoutSetActive(row, RNA_boolean_get(ptr, "use_motion_blur") == TRUE);
4001
1733
                        uiItemR(row, ptr, "motion_blur_factor", 0, NULL, ICON_NONE);
4002
1734
                        uiItemR(split, ptr, "use_motion_blur", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
4003
1735
                        break;
4028
1760
        uiItemPointerR(layout, ptr, "to_property", &main_ptr, "objects", NULL, ICON_OBJECT_DATA);
4029
1761
        uiItemR(layout, ptr, "subject", 0, NULL, ICON_NONE);
4030
1762
 
4031
 
        row= uiLayoutRow(layout, 1);
 
1763
        row = uiLayoutRow(layout, TRUE);
4032
1764
        uiItemR(row, ptr, "body_type", 0, NULL, ICON_NONE);
4033
1765
 
4034
1766
        if (RNA_enum_get(ptr, "body_type") == ACT_MESG_MESG)
4044
1776
        uiLayout *split, *row, *col, *sub;
4045
1777
        int physics_type;
4046
1778
 
4047
 
        ob = (Object *)ptr->id.data;    
 
1779
        ob = (Object *)ptr->id.data;
4048
1780
        RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr);
4049
1781
        physics_type = RNA_enum_get(&settings_ptr, "physics_type");
4050
1782
        
4052
1784
        
4053
1785
        switch (RNA_enum_get(ptr, "mode")) {
4054
1786
                case ACT_OBJECT_NORMAL:
4055
 
                        split = uiLayoutSplit(layout, 0.9, 0);
4056
 
                        row = uiLayoutRow(split, 0);
 
1787
                        split = uiLayoutSplit(layout, 0.9, FALSE);
 
1788
                        row = uiLayoutRow(split, FALSE);
4057
1789
                        uiItemR(row, ptr, "offset_location", 0, NULL, ICON_NONE);
4058
1790
                        uiItemR(split, ptr, "use_local_location", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
4059
1791
 
4060
 
                        split = uiLayoutSplit(layout, 0.9, 0);
4061
 
                        row = uiLayoutRow(split, 0);
 
1792
                        split = uiLayoutSplit(layout, 0.9, FALSE);
 
1793
                        row = uiLayoutRow(split, FALSE);
4062
1794
                        uiItemR(row, ptr, "offset_rotation", 0, NULL, ICON_NONE);
4063
1795
                        uiItemR(split, ptr, "use_local_rotation", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
4064
1796
                        
4065
 
                        if (ELEM3(physics_type, OB_BODY_TYPE_DYNAMIC, OB_BODY_TYPE_RIGID, OB_BODY_TYPE_SOFT)) {                 
4066
 
                                uiItemL(layout, "Dynamic Object Settings:", ICON_NONE);
4067
 
                                split = uiLayoutSplit(layout, 0.9, 0);
4068
 
                                row = uiLayoutRow(split, 0);
 
1797
                        if (ELEM3(physics_type, OB_BODY_TYPE_DYNAMIC, OB_BODY_TYPE_RIGID, OB_BODY_TYPE_SOFT)) {
 
1798
                                uiItemL(layout, IFACE_("Dynamic Object Settings:"), ICON_NONE);
 
1799
                                split = uiLayoutSplit(layout, 0.9, FALSE);
 
1800
                                row = uiLayoutRow(split, FALSE);
4069
1801
                                uiItemR(row, ptr, "force", 0, NULL, ICON_NONE);
4070
1802
                                uiItemR(split, ptr, "use_local_force", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
4071
1803
 
4072
 
                                split = uiLayoutSplit(layout, 0.9, 0);
4073
 
                                row = uiLayoutRow(split, 0);
 
1804
                                split = uiLayoutSplit(layout, 0.9, FALSE);
 
1805
                                row = uiLayoutRow(split, FALSE);
4074
1806
                                uiItemR(row, ptr, "torque", 0, NULL, ICON_NONE);
4075
1807
                                uiItemR(split, ptr, "use_local_torque", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
4076
1808
 
4077
 
                                split = uiLayoutSplit(layout, 0.9, 0);
4078
 
                                row = uiLayoutRow(split, 0);
 
1809
                                split = uiLayoutSplit(layout, 0.9, FALSE);
 
1810
                                row = uiLayoutRow(split, FALSE);
4079
1811
                                uiItemR(row, ptr, "linear_velocity", 0, NULL, ICON_NONE);
4080
 
                                row = uiLayoutRow(split, 1);
 
1812
                                row = uiLayoutRow(split, TRUE);
4081
1813
                                uiItemR(row, ptr, "use_local_linear_velocity", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
4082
1814
                                uiItemR(row, ptr, "use_add_linear_velocity", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
4083
1815
 
4084
 
                                split = uiLayoutSplit(layout, 0.9, 0);
4085
 
                                row = uiLayoutRow(split, 0);
 
1816
                                split = uiLayoutSplit(layout, 0.9, FALSE);
 
1817
                                row = uiLayoutRow(split, FALSE);
4086
1818
                                uiItemR(row, ptr, "angular_velocity", 0, NULL, ICON_NONE);
4087
1819
                                uiItemR(split, ptr, "use_local_angular_velocity", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
4088
1820
 
4092
1824
                case ACT_OBJECT_SERVO:
4093
1825
                        uiItemR(layout, ptr, "reference_object", 0, NULL, ICON_NONE);
4094
1826
 
4095
 
                        split = uiLayoutSplit(layout, 0.9, 0);
4096
 
                        row = uiLayoutRow(split, 0);
 
1827
                        split = uiLayoutSplit(layout, 0.9, FALSE);
 
1828
                        row = uiLayoutRow(split, FALSE);
4097
1829
                        uiItemR(row, ptr, "linear_velocity", 0, NULL, ICON_NONE);
4098
1830
                        uiItemR(split, ptr, "use_local_linear_velocity", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
4099
1831
 
4100
 
                        row = uiLayoutRow(layout, 0);
4101
 
                        col = uiLayoutColumn(row, 0);
 
1832
                        row = uiLayoutRow(layout, FALSE);
 
1833
                        col = uiLayoutColumn(row, FALSE);
4102
1834
                        uiItemR(col, ptr, "use_servo_limit_x", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
4103
 
                        sub = uiLayoutColumn(col, 1);
4104
 
                        uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_servo_limit_x")==1);
 
1835
                        sub = uiLayoutColumn(col, TRUE);
 
1836
                        uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_servo_limit_x") == TRUE);
4105
1837
                        uiItemR(sub, ptr, "force_max_x", 0, NULL, ICON_NONE);
4106
1838
                        uiItemR(sub, ptr, "force_min_x", 0, NULL, ICON_NONE);
4107
1839
 
4108
 
                        col = uiLayoutColumn(row, 0);
 
1840
                        col = uiLayoutColumn(row, FALSE);
4109
1841
                        uiItemR(col, ptr, "use_servo_limit_y", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
4110
 
                        sub = uiLayoutColumn(col, 1);
4111
 
                        uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_servo_limit_y")==1);
 
1842
                        sub = uiLayoutColumn(col, TRUE);
 
1843
                        uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_servo_limit_y") == TRUE);
4112
1844
                        uiItemR(sub, ptr, "force_max_y", 0, NULL, ICON_NONE);
4113
1845
                        uiItemR(sub, ptr, "force_min_y", 0, NULL, ICON_NONE);
4114
1846
 
4115
 
                        col = uiLayoutColumn(row, 0);
 
1847
                        col = uiLayoutColumn(row, FALSE);
4116
1848
                        uiItemR(col, ptr, "use_servo_limit_z", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
4117
 
                        sub = uiLayoutColumn(col, 1);
4118
 
                        uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_servo_limit_z")==1);
 
1849
                        sub = uiLayoutColumn(col, TRUE);
 
1850
                        uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_servo_limit_z") == TRUE);
4119
1851
                        uiItemR(sub, ptr, "force_max_z", 0, NULL, ICON_NONE);
4120
1852
                        uiItemR(sub, ptr, "force_min_z", 0, NULL, ICON_NONE);
4121
1853
 
4123
1855
                        //Layout designers willing to help on that, please compare with 2.49 ui
4124
1856
                        // (since the old code is going to be deleted ... soon)
4125
1857
 
4126
 
                        col = uiLayoutColumn(layout, 1);
 
1858
                        col = uiLayoutColumn(layout, TRUE);
4127
1859
                        uiItemR(col, ptr, "proportional_coefficient", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
4128
1860
                        uiItemR(col, ptr, "integral_coefficient", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
4129
1861
                        uiItemR(col, ptr, "derivate_coefficient", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
4130
1862
                        break;
 
1863
                case ACT_OBJECT_CHARACTER:
 
1864
                        split = uiLayoutSplit(layout, 0.9, FALSE);
 
1865
                        row = uiLayoutRow(split, FALSE);
 
1866
                        uiItemR(row, ptr, "offset_location", 0, NULL, ICON_NONE);
 
1867
                        row = uiLayoutRow(split, TRUE);
 
1868
                        uiItemR(row, ptr, "use_local_location", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
 
1869
                        uiItemR(row, ptr, "use_add_character_location", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
 
1870
 
 
1871
                        split = uiLayoutSplit(layout, 0.9, FALSE);
 
1872
                        row = uiLayoutRow(split, FALSE);
 
1873
                        uiItemR(row, ptr, "offset_rotation", 0, NULL, ICON_NONE);
 
1874
                        uiItemR(split, ptr, "use_local_rotation", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
 
1875
 
 
1876
                        split = uiLayoutSplit(layout, 0.9, FALSE);
 
1877
                        row = uiLayoutRow(split, FALSE);
 
1878
                        split = uiLayoutSplit(row, 0.7, FALSE);
 
1879
                        uiItemL(split, "", ICON_NONE); /*Just use this for some spacing */
 
1880
                        uiItemR(split, ptr, "use_character_jump", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
 
1881
                        break;
4131
1882
        }
4132
1883
}
4133
1884
 
4140
1891
        if (RNA_enum_get(ptr, "mode") == ACT_PARENT_SET) {
4141
1892
                uiItemR(layout, ptr, "object", 0, NULL, ICON_NONE);
4142
1893
 
4143
 
                row = uiLayoutRow(layout, 0);
 
1894
                row = uiLayoutRow(layout, FALSE);
4144
1895
                uiItemR(row, ptr, "use_compound", 0, NULL, ICON_NONE);
4145
 
                sub= uiLayoutRow(row, 0);
4146
 
                uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_compound")==1);
 
1896
                sub = uiLayoutRow(row, FALSE);
 
1897
                uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_compound") == TRUE);
4147
1898
                uiItemR(sub, ptr, "use_ghost", 0, NULL, ICON_NONE);
4148
1899
        }
4149
1900
}
4163
1914
        uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE);
4164
1915
        uiItemPointerR(layout, ptr, "property", &settings_ptr, "properties", NULL, ICON_NONE);
4165
1916
 
4166
 
        switch(RNA_enum_get(ptr, "mode"))
4167
 
        {
 
1917
        switch (RNA_enum_get(ptr, "mode")) {
4168
1918
                case ACT_PROP_TOGGLE:
4169
1919
                        break;
4170
1920
                case ACT_PROP_ADD:
4174
1924
                        uiItemR(layout, ptr, "value", 0, NULL, ICON_NONE);
4175
1925
                        break;
4176
1926
                case ACT_PROP_COPY:
4177
 
                        row = uiLayoutRow(layout, 0);
 
1927
                        row = uiLayoutRow(layout, FALSE);
4178
1928
                        uiItemR(row, ptr, "object", 0, NULL, ICON_NONE);
4179
1929
                        if (ob_from) {
4180
1930
                                RNA_pointer_create((ID *)ob_from, &RNA_GameObjectSettings, ob_from, &obj_settings_ptr);
4181
1931
                                uiItemPointerR(row, ptr, "object_property", &obj_settings_ptr, "properties", NULL, ICON_NONE);
4182
1932
                        }
4183
1933
                        else {
4184
 
                                sub= uiLayoutRow(row, 0);
4185
 
                                uiLayoutSetActive(sub, 0);
 
1934
                                sub = uiLayoutRow(row, FALSE);
 
1935
                                uiLayoutSetActive(sub, FALSE);
4186
1936
                                uiItemR(sub, ptr, "object_property", 0, NULL, ICON_NONE);
4187
1937
                        }
4188
1938
                        break;
4198
1948
        ob = (Object *)ptr->id.data;
4199
1949
        RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr);
4200
1950
 
4201
 
        row = uiLayoutRow(layout, 0);
 
1951
        row = uiLayoutRow(layout, FALSE);
4202
1952
 
4203
1953
        uiItemR(row, ptr, "seed", 0, NULL, ICON_NONE);
4204
1954
        uiItemR(row, ptr, "distribution", 0, NULL, ICON_NONE);
4205
1955
 
4206
 
        row = uiLayoutRow(layout, 0);
 
1956
        row = uiLayoutRow(layout, FALSE);
4207
1957
        uiItemPointerR(row, ptr, "property", &settings_ptr, "properties", NULL, ICON_NONE);
4208
1958
 
4209
 
        row = uiLayoutRow(layout, 0);
 
1959
        row = uiLayoutRow(layout, FALSE);
4210
1960
 
4211
1961
        switch (RNA_enum_get(ptr, "distribution")) {
4212
1962
                case ACT_RANDOM_BOOL_CONST:
4214
1964
                        break;
4215
1965
 
4216
1966
                case ACT_RANDOM_BOOL_UNIFORM:
4217
 
                        uiItemL(row, "Choose between true and false, 50% chance each", ICON_NONE);
 
1967
                        uiItemL(row, IFACE_("Choose between true and false, 50% chance each"), ICON_NONE);
4218
1968
                        break;
4219
1969
 
4220
1970
                case ACT_RANDOM_BOOL_BERNOUILLI:
4277
2027
        uiLayout *row;
4278
2028
 
4279
2029
        if (ob->type != OB_MESH) {
4280
 
                uiItemL(layout, "Actuator only available for mesh objects", ICON_NONE);
 
2030
                uiItemL(layout, IFACE_("Actuator only available for mesh objects"), ICON_NONE);
4281
2031
                return;
4282
2032
        }
4283
2033
 
4284
2034
        RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr);
4285
2035
 
4286
 
        row= uiLayoutRow(layout, 0);
 
2036
        row = uiLayoutRow(layout, FALSE);
4287
2037
        uiItemR(row, ptr, "mode", 0, "", ICON_NONE);
4288
2038
        uiItemR(row, ptr, "action", 0, "", ICON_NONE);
4289
2039
        uiItemR(row, ptr, "use_continue_last_frame", 0, NULL, ICON_NONE);
4290
2040
 
4291
 
        row= uiLayoutRow(layout, 0);
 
2041
        row = uiLayoutRow(layout, FALSE);
4292
2042
        if ((RNA_enum_get(ptr, "mode") == ACT_ACTION_FROM_PROP))
4293
2043
                uiItemPointerR(row, ptr, "property", &settings_ptr, "properties", NULL, ICON_NONE);
4294
2044
 
4297
2047
                uiItemR(row, ptr, "frame_end", 0, NULL, ICON_NONE);
4298
2048
        }
4299
2049
 
4300
 
        row= uiLayoutRow(layout, 0);
 
2050
        row = uiLayoutRow(layout, FALSE);
4301
2051
        uiItemR(row, ptr, "frame_blend_in", 0, NULL, ICON_NONE);
4302
2052
        uiItemR(row, ptr, "priority", 0, NULL, ICON_NONE);
4303
2053
 
4304
 
        row= uiLayoutRow(layout, 0);
 
2054
        row = uiLayoutRow(layout, FALSE);
4305
2055
        uiItemPointerR(row, ptr, "frame_property", &settings_ptr, "properties", NULL, ICON_NONE);
4306
2056
 
4307
2057
#ifdef __NLA_ACTION_BY_MOTION_ACTUATOR
4315
2065
 
4316
2066
        uiTemplateID(layout, C, ptr, "sound", NULL, "SOUND_OT_open", NULL);
4317
2067
        if (!RNA_pointer_get(ptr, "sound").data) {
4318
 
                uiItemL(layout, "Select a sound from the list or load a new one", ICON_NONE);
 
2068
                uiItemL(layout, IFACE_("Select a sound from the list or load a new one"), ICON_NONE);
4319
2069
                return;
4320
2070
        }
4321
2071
        uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE);
4322
2072
 
4323
 
        row = uiLayoutRow(layout, 0);
 
2073
        row = uiLayoutRow(layout, FALSE);
4324
2074
        uiItemR(row, ptr, "volume", 0, NULL, ICON_NONE);
4325
2075
        uiItemR(row, ptr, "pitch", 0, NULL, ICON_NONE);
4326
2076
 
4327
2077
        uiItemR(layout, ptr, "use_sound_3d", 0, NULL, ICON_NONE);
4328
2078
        
4329
 
        col = uiLayoutColumn(layout, 0);
4330
 
        uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_sound_3d")==1);
 
2079
        col = uiLayoutColumn(layout, FALSE);
 
2080
        uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_sound_3d") == TRUE);
4331
2081
 
4332
 
        row = uiLayoutRow(col, 0);
 
2082
        row = uiLayoutRow(col, FALSE);
4333
2083
        uiItemR(row, ptr, "gain_3d_min", 0, NULL, ICON_NONE);
4334
2084
        uiItemR(row, ptr, "gain_3d_max", 0, NULL, ICON_NONE);
4335
2085
 
4336
 
        row = uiLayoutRow(col, 0);
 
2086
        row = uiLayoutRow(col, FALSE);
4337
2087
        uiItemR(row, ptr, "distance_3d_reference", 0, NULL, ICON_NONE);
4338
2088
        uiItemR(row, ptr, "distance_3d_max", 0, NULL, ICON_NONE);
4339
2089
 
4340
 
        row = uiLayoutRow(col, 0);
 
2090
        row = uiLayoutRow(col, FALSE);
4341
2091
        uiItemR(row, ptr, "rolloff_factor_3d", 0, NULL, ICON_NONE);
4342
2092
        uiItemR(row, ptr, "cone_outer_gain_3d", 0, NULL, ICON_NONE);
4343
2093
 
4344
 
        row = uiLayoutRow(col, 0);
 
2094
        row = uiLayoutRow(col, FALSE);
4345
2095
        uiItemR(row, ptr, "cone_outer_angle_3d", 0, NULL, ICON_NONE);
4346
2096
        uiItemR(row, ptr, "cone_inner_angle_3d", 0, NULL, ICON_NONE);
4347
2097
}
4353
2103
        PointerRNA settings_ptr;
4354
2104
        RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr);
4355
2105
 
4356
 
        split = uiLayoutSplit(layout, 0.35, 0);
 
2106
        split = uiLayoutSplit(layout, 0.35, FALSE);
4357
2107
        uiItemR(split, ptr, "operation", 0, NULL, ICON_NONE);
4358
2108
 
4359
2109
        uiTemplateLayers(split, ptr, "states", &settings_ptr, "used_states", 0);
4362
2112
static void draw_actuator_visibility(uiLayout *layout, PointerRNA *ptr)
4363
2113
{
4364
2114
        uiLayout *row;
4365
 
        row = uiLayoutRow(layout, 0);
 
2115
        row = uiLayoutRow(layout, FALSE);
4366
2116
 
4367
2117
        uiItemR(row, ptr, "use_visible", 0, NULL, ICON_NONE);
4368
2118
        uiItemR(row, ptr, "use_occlusion", 0, NULL, ICON_NONE);
4374
2124
        uiLayout *row;
4375
2125
        uiLayout *col;
4376
2126
 
4377
 
        uiItemR(layout, ptr, "mode", 0, NULL, 0);
4378
 
        uiItemR(layout, ptr, "target", 0, NULL, 0);
4379
 
        uiItemR(layout, ptr, "navmesh", 0, NULL, 0);    
4380
 
 
4381
 
        row = uiLayoutRow(layout, 0);
4382
 
        uiItemR(row, ptr, "distance", 0, NULL, 0);
4383
 
        uiItemR(row, ptr, "velocity", 0, NULL, 0);
4384
 
        row = uiLayoutRow(layout, 0);
4385
 
        uiItemR(row, ptr, "acceleration", 0, NULL, 0);
4386
 
        uiItemR(row, ptr, "turn_speed", 0, NULL, 0);
4387
 
 
4388
 
        row = uiLayoutRow(layout, 0);
4389
 
        col = uiLayoutColumn(row, 0);
4390
 
        uiItemR(col, ptr, "facing", 0, NULL, 0);
4391
 
        col = uiLayoutColumn(row, 0);
4392
 
        uiItemR(col, ptr, "facing_axis", 0, NULL, 0);
 
2127
        uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE);
 
2128
        uiItemR(layout, ptr, "target", 0, NULL, ICON_NONE);
 
2129
        uiItemR(layout, ptr, "navmesh", 0, NULL, ICON_NONE);
 
2130
 
 
2131
        row = uiLayoutRow(layout, FALSE);
 
2132
        uiItemR(row, ptr, "distance", 0, NULL, ICON_NONE);
 
2133
        uiItemR(row, ptr, "velocity", 0, NULL, ICON_NONE);
 
2134
        row = uiLayoutRow(layout, FALSE);
 
2135
        uiItemR(row, ptr, "acceleration", 0, NULL, ICON_NONE);
 
2136
        uiItemR(row, ptr, "turn_speed", 0, NULL, ICON_NONE);
 
2137
 
 
2138
        row = uiLayoutRow(layout, FALSE);
 
2139
        col = uiLayoutColumn(row, FALSE);
 
2140
        uiItemR(col, ptr, "facing", 0, NULL, ICON_NONE);
 
2141
        col = uiLayoutColumn(row, FALSE);
 
2142
        uiItemR(col, ptr, "facing_axis", 0, NULL, ICON_NONE);
4393
2143
        if (!RNA_boolean_get(ptr, "facing")) {
4394
 
                uiLayoutSetActive(col, 0);
 
2144
                uiLayoutSetActive(col, FALSE);
4395
2145
        }
4396
 
        col = uiLayoutColumn(row, 0);
4397
 
        uiItemR(col, ptr, "normal_up", 0, NULL, 0);
 
2146
        col = uiLayoutColumn(row, FALSE);
 
2147
        uiItemR(col, ptr, "normal_up", 0, NULL, ICON_NONE);
4398
2148
        if (!RNA_pointer_get(ptr, "navmesh").data) {
4399
 
                uiLayoutSetActive(col, 0);
 
2149
                uiLayoutSetActive(col, FALSE);
4400
2150
        }
4401
2151
 
4402
 
        row = uiLayoutRow(layout, 0);
4403
 
        uiItemR(row, ptr, "self_terminated", 0, NULL, 0);
 
2152
        row = uiLayoutRow(layout, FALSE);
 
2153
        uiItemR(row, ptr, "self_terminated", 0, NULL, ICON_NONE);
4404
2154
        if (RNA_enum_get(ptr, "mode")==ACT_STEERING_PATHFOLLOWING) {
4405
 
                uiItemR(row, ptr, "update_period", 0, NULL, 0); 
4406
 
                row = uiLayoutRow(layout, 0);
 
2155
                uiItemR(row, ptr, "update_period", 0, NULL, ICON_NONE);
 
2156
                row = uiLayoutRow(layout, FALSE);
4407
2157
        }
4408
 
        uiItemR(row, ptr, "show_visualization", 0, NULL, 0);    
 
2158
        uiItemR(row, ptr, "show_visualization", 0, NULL, ICON_NONE);
4409
2159
}
4410
2160
 
4411
2161
static void draw_brick_actuator(uiLayout *layout, PointerRNA *ptr, bContext *C)
4474
2224
        }
4475
2225
}
4476
2226
 
4477
 
static void logic_buttons_new(bContext *C, ARegion *ar)
 
2227
void logic_buttons(bContext *C, ARegion *ar)
4478
2228
{
4479
2229
        SpaceLogic *slogic= CTX_wm_space_logic(C);
4480
2230
        Object *ob= CTX_data_active_object(C);
4481
 
        Object *act_ob= ob;
4482
2231
        ID **idar;
4483
 
        
4484
 
        PointerRNA logic_ptr, settings_ptr;
4485
 
        
 
2232
        PointerRNA logic_ptr, settings_ptr, object_ptr;
4486
2233
        uiLayout *layout, *row, *box;
4487
2234
        uiBlock *block;
4488
2235
        uiBut *but;
4489
2236
        char uiblockstr[32];
4490
2237
        short a, count;
4491
 
        int xco, yco, width;
 
2238
        int xco, yco, width, height;
4492
2239
        
4493
2240
        if (ob==NULL) return;
4494
2241
        
4498
2245
        BLI_snprintf(uiblockstr, sizeof(uiblockstr), "buttonswin %p", (void *)ar);
4499
2246
        block= uiBeginBlock(C, ar, uiblockstr, UI_EMBOSS);
4500
2247
        uiBlockSetHandleFunc(block, do_logic_buts, NULL);
 
2248
        uiBoundsBlock(block, U.widget_unit/2);
4501
2249
        
4502
2250
        /* loop over all objects and set visible/linked flags for the logic bricks */
4503
2251
        for (a=0; a<count; a++) {
4542
2290
        
4543
2291
        /* ****************** Controllers ****************** */
4544
2292
        
4545
 
        xco= 420; yco= 170; width= 300;
 
2293
        xco= 21 * U.widget_unit; yco= - U.widget_unit / 2; width= 15 * U.widget_unit;
4546
2294
        layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, xco, yco, width, 20, UI_GetStyle());
4547
 
        row = uiLayoutRow(layout, 1);
4548
 
        
4549
 
        uiDefBlockBut(block, controller_menu, NULL, "Controllers", xco-10, yco, 300, UI_UNIT_Y, "");            /* replace this with uiLayout stuff later */
4550
 
        
4551
 
        uiItemR(row, &logic_ptr, "show_controllers_selected_objects", 0, "Sel", ICON_NONE);
4552
 
        uiItemR(row, &logic_ptr, "show_controllers_active_object", 0, "Act", ICON_NONE);
4553
 
        uiItemR(row, &logic_ptr, "show_controllers_linked_controller", 0, "Link", ICON_NONE);
 
2295
        row = uiLayoutRow(layout, TRUE);
 
2296
        
 
2297
        uiDefBlockBut(block, controller_menu, NULL, IFACE_("Controllers"), xco - U.widget_unit / 2, yco, width, UI_UNIT_Y, "");         /* replace this with uiLayout stuff later */
 
2298
        
 
2299
        uiItemR(row, &logic_ptr, "show_controllers_selected_objects", 0, IFACE_("Sel"), ICON_NONE);
 
2300
        uiItemR(row, &logic_ptr, "show_controllers_active_object", 0, IFACE_("Act"), ICON_NONE);
 
2301
        uiItemR(row, &logic_ptr, "show_controllers_linked_controller", 0, IFACE_("Link"), ICON_NONE);
4554
2302
 
4555
2303
        for (a=0; a<count; a++) {
4556
2304
                bController *cont;
4561
2309
                ob= (Object *)idar[a];
4562
2310
 
4563
2311
                /* only draw the controller common header if "use_visible" */
4564
 
                if ( (ob->scavisflag & OB_VIS_CONT) == 0) continue;
 
2312
                if ( (ob->scavisflag & OB_VIS_CONT) == 0) {
 
2313
                        continue;
 
2314
                }
4565
2315
        
4566
2316
                /* Drawing the Controller Header common to all Selected Objects */
4567
2317
 
4568
2318
                RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr);
4569
2319
 
4570
 
                split= uiLayoutSplit(layout, 0.05, 0);
 
2320
                split = uiLayoutSplit(layout, 0.05f, FALSE);
4571
2321
                uiItemR(split, &settings_ptr, "show_state_panel", UI_ITEM_R_NO_BG, "", ICON_DISCLOSURE_TRI_RIGHT);
4572
2322
 
4573
 
                row = uiLayoutRow(split, 1);
4574
 
                uiDefButBitS(block, TOG, OB_SHOWCONT, B_REDR, ob->id.name+2,(short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide controllers");
4575
 
                if (ob == act_ob)
4576
 
                        uiItemMenuEnumO(row, "LOGIC_OT_controller_add", "type", "Add Controller", ICON_NONE);
 
2323
                row = uiLayoutRow(split, TRUE);
 
2324
                uiDefButBitS(block, TOG, OB_SHOWCONT, B_REDR, ob->id.name+2, (short)(xco - U.widget_unit / 2), yco, (short)(width - 1.5f * U.widget_unit), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, TIP_("Object name, click to show/hide controllers"));
 
2325
 
 
2326
                RNA_pointer_create((ID *)ob, &RNA_Object, ob, &object_ptr);
 
2327
                uiLayoutSetContextPointer(row, "object", &object_ptr);
 
2328
                uiItemMenuEnumO(row, "LOGIC_OT_controller_add", "type", IFACE_("Add Controller"), ICON_NONE);
4577
2329
 
4578
2330
                if (RNA_boolean_get(&settings_ptr, "show_state_panel")) {
4579
2331
 
4580
 
                        box= uiLayoutBox(layout);
4581
 
                        split= uiLayoutSplit(box, 0.2, 0);
4582
 
 
4583
 
                        col= uiLayoutColumn(split, 0);
4584
 
                        uiItemL(col, "Visible", ICON_NONE);
4585
 
                        uiItemL(col, "Initial", ICON_NONE);
4586
 
 
4587
 
                        subsplit= uiLayoutSplit(split, 0.85, 0);
4588
 
                        col= uiLayoutColumn(subsplit, 0);
4589
 
                        row= uiLayoutRow(col, 0);
4590
 
                        uiLayoutSetActive(row, RNA_boolean_get(&settings_ptr, "use_all_states")==0);
4591
 
                        uiTemplateLayers(row, &settings_ptr, "states_visible", &settings_ptr, "used_states", 0);
4592
 
                        row= uiLayoutRow(col, 0);
4593
 
                        uiTemplateLayers(row, &settings_ptr, "states_initial", &settings_ptr, "used_states", 0);
4594
 
 
4595
 
                        col= uiLayoutColumn(subsplit, 0);
 
2332
                        box = uiLayoutBox(layout);
 
2333
                        split = uiLayoutSplit(box, 0.2f, FALSE);
 
2334
 
 
2335
                        col = uiLayoutColumn(split, FALSE);
 
2336
                        uiItemL(col, IFACE_("Visible"), ICON_NONE);
 
2337
                        uiItemL(col, IFACE_("Initial"), ICON_NONE);
 
2338
 
 
2339
                        subsplit = uiLayoutSplit(split, 0.85f, FALSE);
 
2340
                        col = uiLayoutColumn(subsplit, FALSE);
 
2341
                        row = uiLayoutRow(col, FALSE);
 
2342
                        uiLayoutSetActive(row, RNA_boolean_get(&settings_ptr, "use_all_states") == FALSE);
 
2343
                        uiTemplateGameStates(row, &settings_ptr, "states_visible", &settings_ptr, "used_states", 0);
 
2344
                        row = uiLayoutRow(col, FALSE);
 
2345
                        uiTemplateGameStates(row, &settings_ptr, "states_initial", &settings_ptr, "used_states", 0);
 
2346
 
 
2347
                        col = uiLayoutColumn(subsplit, FALSE);
4596
2348
                        uiItemR(col, &settings_ptr, "use_all_states", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
4597
2349
                        uiItemR(col, &settings_ptr, "show_debug_state", 0, "", ICON_NONE);
4598
2350
                }
4611
2363
                                continue;
4612
2364
                        
4613
2365
                        /* use two nested splits to align inlinks/links properly */
4614
 
                        split = uiLayoutSplit(layout, 0.05, 0);
 
2366
                        split = uiLayoutSplit(layout, 0.05f, FALSE);
4615
2367
                        
4616
2368
                        /* put inlink button to the left */
4617
 
                        col = uiLayoutColumn(split, 0);
 
2369
                        col = uiLayoutColumn(split, FALSE);
4618
2370
                        uiLayoutSetAlignment(col, UI_LAYOUT_ALIGN_LEFT);
4619
2371
                        uiDefIconBut(block, INLINK, 0, ICON_INLINK, 0, 0, UI_UNIT_X, UI_UNIT_Y, cont, LINK_CONTROLLER, 0, 0, 0, "");
4620
2372
                        
4621
 
                        //col = uiLayoutColumn(split, 1);
 
2373
                        //col = uiLayoutColumn(split, TRUE);
4622
2374
                        /* nested split for middle and right columns */
4623
 
                        subsplit = uiLayoutSplit(split, 0.95, 0);
 
2375
                        subsplit = uiLayoutSplit(split, 0.95f, FALSE);
4624
2376
                        
4625
 
                        col = uiLayoutColumn(subsplit, 1);
 
2377
                        col = uiLayoutColumn(subsplit, TRUE);
4626
2378
                        uiLayoutSetContextPointer(col, "controller", &ptr);
4627
2379
                        
4628
2380
                        /* should make UI template for controller header.. function will do for now */
4634
2386
                        
4635
2387
                        
4636
2388
                        /* put link button to the right */
4637
 
                        col = uiLayoutColumn(subsplit, 0);
 
2389
                        col = uiLayoutColumn(subsplit, FALSE);
4638
2390
                        uiLayoutSetAlignment(col, UI_LAYOUT_ALIGN_LEFT);
4639
2391
                        but = uiDefIconBut(block, LINK, 0, ICON_LINK, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
4640
2392
                        uiSetButLink(but, NULL, (void ***)&(cont->links), &cont->totlinks, LINK_CONTROLLER, LINK_ACTUATOR);
4641
2393
                }
4642
2394
        }
4643
2395
        uiBlockLayoutResolve(block, NULL, &yco);        /* stores final height in yco */
4644
 
        
 
2396
        height = yco;
4645
2397
        
4646
2398
        /* ****************** Sensors ****************** */
4647
2399
        
4648
 
        xco= 10; yco= 170; width= 340;
 
2400
        xco= U.widget_unit / 2; yco= -U.widget_unit / 2; width= 17 * U.widget_unit;
4649
2401
        layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, xco, yco, width, 20, UI_GetStyle());
4650
 
        row = uiLayoutRow(layout, 1);
4651
 
        
4652
 
        uiDefBlockBut(block, sensor_menu, NULL, "Sensors", xco-10, yco, 300, UI_UNIT_Y, "");            /* replace this with uiLayout stuff later */
4653
 
        
4654
 
        uiItemR(row, &logic_ptr, "show_sensors_selected_objects", 0, "Sel", ICON_NONE);
4655
 
        uiItemR(row, &logic_ptr, "show_sensors_active_object", 0, "Act", ICON_NONE);
4656
 
        uiItemR(row, &logic_ptr, "show_sensors_linked_controller", 0, "Link", ICON_NONE);
4657
 
        uiItemR(row, &logic_ptr, "show_sensors_active_states", 0, "State", ICON_NONE);
 
2402
        row = uiLayoutRow(layout, TRUE);
 
2403
        
 
2404
        uiDefBlockBut(block, sensor_menu, NULL, IFACE_("Sensors"), xco - U.widget_unit / 2, yco, 15 * U.widget_unit, UI_UNIT_Y, "");            /* replace this with uiLayout stuff later */
 
2405
        
 
2406
        uiItemR(row, &logic_ptr, "show_sensors_selected_objects", 0, IFACE_("Sel"), ICON_NONE);
 
2407
        uiItemR(row, &logic_ptr, "show_sensors_active_object", 0, IFACE_("Act"), ICON_NONE);
 
2408
        uiItemR(row, &logic_ptr, "show_sensors_linked_controller", 0, IFACE_("Link"), ICON_NONE);
 
2409
        uiItemR(row, &logic_ptr, "show_sensors_active_states", 0, IFACE_("State"), ICON_NONE);
4658
2410
        
4659
2411
        for (a=0; a<count; a++) {
4660
2412
                bSensor *sens;
4665
2417
                /* only draw the sensor common header if "use_visible" */
4666
2418
                if ((ob->scavisflag & OB_VIS_SENS) == 0) continue;
4667
2419
 
4668
 
                row = uiLayoutRow(layout, 1);
4669
 
                uiDefButBitS(block, TOG, OB_SHOWSENS, B_REDR, ob->id.name+2,(short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide sensors");
4670
 
                if (ob == act_ob)
4671
 
                        uiItemMenuEnumO(row, "LOGIC_OT_sensor_add", "type", "Add Sensor", ICON_NONE);
 
2420
                row = uiLayoutRow(layout, TRUE);
 
2421
                uiDefButBitS(block, TOG, OB_SHOWSENS, B_REDR, ob->id.name+2, (short)(xco - U.widget_unit / 2), yco, (short)(width - 1.5f * U.widget_unit), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, TIP_("Object name, click to show/hide sensors"));
 
2422
 
 
2423
                RNA_pointer_create((ID *)ob, &RNA_Object, ob, &object_ptr);
 
2424
                uiLayoutSetContextPointer(row, "object", &object_ptr);
 
2425
                uiItemMenuEnumO(row, "LOGIC_OT_sensor_add", "type", IFACE_("Add Sensor"), ICON_NONE);
4672
2426
                
4673
2427
                if ((ob->scaflag & OB_SHOWSENS) == 0) continue;
4674
2428
                
4689
2443
                                /* make as visible, for move operator */
4690
2444
                                sens->flag |= SENS_VISIBLE;
4691
2445
 
4692
 
                                split = uiLayoutSplit(layout, 0.95, 0);
4693
 
                                col = uiLayoutColumn(split, 1);
 
2446
                                split = uiLayoutSplit(layout, 0.95f, FALSE);
 
2447
                                col = uiLayoutColumn(split, TRUE);
4694
2448
                                uiLayoutSetContextPointer(col, "sensor", &ptr);
4695
2449
                                
4696
2450
                                /* should make UI template for sensor header.. function will do for now */
4700
2454
                                draw_brick_sensor(col, &ptr, C);
4701
2455
                                
4702
2456
                                /* put link button to the right */
4703
 
                                col = uiLayoutColumn(split, 0);
 
2457
                                col = uiLayoutColumn(split, FALSE);
4704
2458
                                /* use old-school uiButtons for links for now */
4705
2459
                                but = uiDefIconBut(block, LINK, 0, ICON_LINK, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
4706
2460
                                uiSetButLink(but, NULL, (void ***)&(sens->links), &sens->totlinks, LINK_SENSOR, LINK_CONTROLLER);
4708
2462
                }
4709
2463
        }
4710
2464
        uiBlockLayoutResolve(block, NULL, &yco);        /* stores final height in yco */
 
2465
        height = MIN2(height, yco);
4711
2466
        
4712
2467
        /* ****************** Actuators ****************** */
4713
2468
        
4714
 
        xco= 800; yco= 170; width= 340;
 
2469
        xco= 40 * U.widget_unit; yco= -U.widget_unit / 2; width= 17 * U.widget_unit;
4715
2470
        layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, xco, yco, width, 20, UI_GetStyle());
4716
 
        row = uiLayoutRow(layout, 1);
4717
 
        
4718
 
        uiDefBlockBut(block, actuator_menu, NULL, "Actuators", xco-10, yco, 300, UI_UNIT_Y, "");                /* replace this with uiLayout stuff later */
4719
 
        
4720
 
        uiItemR(row, &logic_ptr, "show_actuators_selected_objects", 0, "Sel", ICON_NONE);
4721
 
        uiItemR(row, &logic_ptr, "show_actuators_active_object", 0, "Act", ICON_NONE);
4722
 
        uiItemR(row, &logic_ptr, "show_actuators_linked_controller", 0, "Link", ICON_NONE);
4723
 
        uiItemR(row, &logic_ptr, "show_actuators_active_states", 0, "State", ICON_NONE);
 
2471
        row = uiLayoutRow(layout, TRUE);
 
2472
        
 
2473
        uiDefBlockBut(block, actuator_menu, NULL, IFACE_("Actuators"), xco - U.widget_unit / 2, yco, 15 * U.widget_unit, UI_UNIT_Y, "");                /* replace this with uiLayout stuff later */
 
2474
        
 
2475
        uiItemR(row, &logic_ptr, "show_actuators_selected_objects", 0, IFACE_("Sel"), ICON_NONE);
 
2476
        uiItemR(row, &logic_ptr, "show_actuators_active_object", 0, IFACE_("Act"), ICON_NONE);
 
2477
        uiItemR(row, &logic_ptr, "show_actuators_linked_controller", 0, IFACE_("Link"), ICON_NONE);
 
2478
        uiItemR(row, &logic_ptr, "show_actuators_active_states", 0, IFACE_("State"), ICON_NONE);
4724
2479
        
4725
2480
        for (a=0; a<count; a++) {
4726
2481
                bActuator *act;
4729
2484
                ob= (Object *)idar[a];
4730
2485
 
4731
2486
                /* only draw the actuator common header if "use_visible" */
4732
 
                if ( (ob->scavisflag & OB_VIS_ACT) == 0) continue;
4733
 
 
4734
 
                row = uiLayoutRow(layout, 1);
4735
 
                uiDefButBitS(block, TOG, OB_SHOWACT, B_REDR, ob->id.name+2,(short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide actuators");
4736
 
                if (ob == act_ob)
4737
 
                        uiItemMenuEnumO(row, "LOGIC_OT_actuator_add", "type", "Add Actuator", ICON_NONE);
 
2487
                if ((ob->scavisflag & OB_VIS_ACT) == 0) {
 
2488
                        continue;
 
2489
                }
 
2490
 
 
2491
                row = uiLayoutRow(layout, TRUE);
 
2492
                uiDefButBitS(block, TOG, OB_SHOWACT, B_REDR, ob->id.name+2, (short)(xco - U.widget_unit / 2), yco, (short)(width - 1.5f * U.widget_unit), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, TIP_("Object name, click to show/hide actuators"));
 
2493
 
 
2494
                RNA_pointer_create((ID *)ob, &RNA_Object, ob, &object_ptr);
 
2495
                uiLayoutSetContextPointer(row, "object", &object_ptr);
 
2496
                uiItemMenuEnumO(row, "LOGIC_OT_actuator_add", "type", IFACE_("Add Actuator"), ICON_NONE);
4738
2497
 
4739
2498
                if ((ob->scaflag & OB_SHOWACT) == 0) continue;
4740
2499
                
4756
2515
                                /* make as visible, for move operator */
4757
2516
                                act->flag |= ACT_VISIBLE;
4758
2517
 
4759
 
                                split = uiLayoutSplit(layout, 0.05, 0);
 
2518
                                split = uiLayoutSplit(layout, 0.05f, FALSE);
4760
2519
                                
4761
2520
                                /* put inlink button to the left */
4762
 
                                col = uiLayoutColumn(split, 0);
 
2521
                                col = uiLayoutColumn(split, FALSE);
4763
2522
                                uiDefIconBut(block, INLINK, 0, ICON_INLINK, 0, 0, UI_UNIT_X, UI_UNIT_Y, act, LINK_ACTUATOR, 0, 0, 0, "");
4764
2523
 
4765
 
                                col = uiLayoutColumn(split, 1);
 
2524
                                col = uiLayoutColumn(split, TRUE);
4766
2525
                                uiLayoutSetContextPointer(col, "actuator", &ptr);
4767
2526
                                
4768
2527
                                /* should make UI template for actuator header.. function will do for now */
4775
2534
                }
4776
2535
        }
4777
2536
        uiBlockLayoutResolve(block, NULL, &yco);        /* stores final height in yco */
4778
 
        
4779
 
        
4780
 
        uiComposeLinks(block);
4781
 
        
4782
 
        uiEndBlock(C, block);
4783
 
        uiDrawBlock(C, block);
4784
 
        
4785
 
        if (idar) MEM_freeN(idar);
4786
 
}
4787
 
 
4788
 
void logic_buttons(bContext *C, ARegion *ar)
4789
 
{
4790
 
        Main *bmain= CTX_data_main(C);
4791
 
        SpaceLogic *slogic= CTX_wm_space_logic(C);
4792
 
        Object *ob= CTX_data_active_object(C);
4793
 
        ID **idar;
4794
 
        bSensor *sens;
4795
 
        bController *cont;
4796
 
        bActuator *act;
4797
 
        uiBlock *block;
4798
 
        uiBut *but;
4799
 
        PointerRNA logic_ptr;
4800
 
        int a, iact, stbit, offset;
4801
 
        int xco, yco, width, ycoo;
4802
 
        short count;
4803
 
        char numstr[32];
4804
 
        /* pin is a bool used for actuator and sensor drawing with states
4805
 
         * pin so changing states dosnt hide the logic brick */
4806
 
        char pin;
4807
 
 
4808
 
        if (G.rt == 0) {
4809
 
                logic_buttons_new(C, ar);
4810
 
                return;
4811
 
        }
4812
 
        
4813
 
        if (ob==NULL) return;
4814
 
//      uiSetButLock(object_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
4815
 
 
4816
 
        BLI_snprintf(numstr, sizeof(numstr), "buttonswin %p", (void *)ar);
4817
 
        block= uiBeginBlock(C, ar, numstr, UI_EMBOSS);
4818
 
        uiBlockSetHandleFunc(block, do_logic_buts, NULL);
4819
 
 
4820
 
        RNA_pointer_create(NULL, &RNA_SpaceLogicEditor, slogic, &logic_ptr);
4821
 
        
4822
 
        idar= get_selected_and_linked_obs(C, &count, slogic->scaflag);
4823
 
 
4824
 
        /* clean ACT_LINKED and ACT_VISIBLE of all potentially visible actuators so that 
4825
 
         * we can determine which is actually linked/visible */
4826
 
        for (a=0; a<count; a++) {
4827
 
                ob= (Object *)idar[a];
4828
 
                act= ob->actuators.first;
4829
 
                while (act) {
4830
 
                        act->flag &= ~(ACT_LINKED|ACT_VISIBLE);
4831
 
                        act = act->next;
4832
 
                }
4833
 
                /* same for sensors */
4834
 
                sens= ob->sensors.first;
4835
 
                while (sens) {
4836
 
                        sens->flag &= ~(SENS_VISIBLE);
4837
 
                        sens = sens->next;
4838
 
                }
4839
 
        }
4840
 
                
4841
 
        /* start with the controller because we need to know which one is visible */
4842
 
        /* ******************************* */
4843
 
        xco= 400; yco= 170; width= 300;
4844
 
 
4845
 
        uiDefBlockBut(block, controller_menu, NULL, "Controllers", xco-10, yco+35, 100, UI_UNIT_Y, "");
4846
 
        
4847
 
        uiBlockBeginAlign(block);
4848
 
        uiDefButBitS(block, TOG, BUTS_CONT_SEL,  B_REDR, "Sel", xco+110, yco+35, (width-100)/3, UI_UNIT_Y, &slogic->scaflag, 0, 0, 0, 0, "Show all selected Objects");
4849
 
        uiDefButBitS(block, TOG, BUTS_CONT_ACT, B_REDR, "Act", xco+110+(width-100)/3, yco+35, (width-100)/3, UI_UNIT_Y, &slogic->scaflag, 0, 0, 0, 0, "Show active Object");
4850
 
        uiDefButBitS(block, TOG, BUTS_CONT_LINK, B_REDR, "Link", xco+110+2*(width-100)/3, yco+35, (width-100)/3, UI_UNIT_Y, &slogic->scaflag, 0, 0, 0, 0, "Show linked Objects to Sensor/Actuator");
4851
 
        uiBlockEndAlign(block);
4852
 
        
4853
 
        for (a=0; a<count; a++) {
4854
 
                unsigned int controller_state_mask = 0; /* store a bitmask for states that are used */
4855
 
                
4856
 
                ob= (Object *)idar[a];
4857
 
//              uiClearButLock();
4858
 
//              uiSetButLock(object_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
4859
 
                if ( (ob->scavisflag & OB_VIS_CONT) == 0) continue;
4860
 
 
4861
 
                /* presume it is only objects for now */
4862
 
                uiBlockBeginAlign(block);
4863
 
//              if (ob->controllers.first) uiSetCurFont(block, UI_HELVB);
4864
 
                uiDefButBitS(block, TOG, OB_SHOWCONT, B_REDR, ob->id.name+2,(short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Active Object name");
4865
 
//              if (ob->controllers.first) uiSetCurFont(block, UI_HELV);
4866
 
                uiDefButBitS(block, TOG, OB_ADDCONT, B_ADD_CONT, "Add",(short)(xco+width-40), yco, 50, UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Add a new Controller");
4867
 
                uiBlockEndAlign(block);
4868
 
                yco-=20;
4869
 
                
4870
 
                /* mark all actuators linked to these controllers */
4871
 
                /* note that some of these actuators could be from objects that are not in the display list.
4872
 
                 * It's ok because those actuators will not be displayed here */
4873
 
                cont= ob->controllers.first;
4874
 
                while (cont) {
4875
 
                        for (iact=0; iact<cont->totlinks; iact++) {
4876
 
                                act = cont->links[iact];
4877
 
                                if (act)
4878
 
                                        act->flag |= ACT_LINKED;
4879
 
                        }
4880
 
                        controller_state_mask |= cont->state_mask;
4881
 
                        cont = cont->next;
4882
 
                }
4883
 
 
4884
 
                if (ob->scaflag & OB_SHOWCONT) {
4885
 
 
4886
 
                        /* first show the state */
4887
 
                        uiDefBlockBut(block, object_state_mask_menu, ob, "State", (short)(xco-10), (short)(yco-10), 36, UI_UNIT_Y, "Object state menu: store and retrieve initial state");
4888
 
 
4889
 
                        if (!ob->state)
4890
 
                                ob->state = 1;
4891
 
                        for (offset=0; offset<15; offset+=5) {
4892
 
                                uiBlockBeginAlign(block);
4893
 
                                for (stbit=0; stbit<5; stbit++) {
4894
 
                                        but = uiDefButBitI(block, controller_state_mask&(1<<(stbit+offset)) ? BUT_TOGDUAL:TOG, 1<<(stbit+offset), stbit+offset, "",     (short)(xco+31+12*stbit+13*offset), yco, 12, 12, (int *)&(ob->state), 0, 0, 0, 0, get_state_name(ob, (short)(stbit+offset)));
4895
 
                                        uiButSetFunc(but, check_state_mask, but, &(ob->state));
4896
 
                                }
4897
 
                                for (stbit=0; stbit<5; stbit++) {
4898
 
                                        but = uiDefButBitI(block, controller_state_mask&(1<<(stbit+offset+15)) ? BUT_TOGDUAL:TOG, 1<<(stbit+offset+15), stbit+offset+15, "",    (short)(xco+31+12*stbit+13*offset), yco-12, 12, 12, (int *)&(ob->state), 0, 0, 0, 0, get_state_name(ob, (short)(stbit+offset+15)));
4899
 
                                        uiButSetFunc(but, check_state_mask, but, &(ob->state));
4900
 
                                }
4901
 
                        }
4902
 
                        uiBlockBeginAlign(block);
4903
 
                        uiDefButBitS(block, TOG, OB_ALLSTATE, B_SET_STATE_BIT, "All",(short)(xco+226), yco-10, 22, UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Set all state bits");
4904
 
                        uiDefButBitS(block, TOG, OB_INITSTBIT, B_INIT_STATE_BIT, "Ini",(short)(xco+248), yco-10, 22, UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Set the initial state");
4905
 
                        uiDefButBitS(block, TOG, OB_DEBUGSTATE, 0, "D",(short)(xco+270), yco-10, 15, UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Print state debug info");
4906
 
                        uiBlockEndAlign(block);
4907
 
 
4908
 
                        yco-=35;
4909
 
                
4910
 
                        /* display only the controllers that match the current state */
4911
 
                        offset = 0;
4912
 
                        for (stbit=0; stbit<32; stbit++) {
4913
 
                                if (!(ob->state & (1<<stbit)))
4914
 
                                        continue;
4915
 
                                /* add a separation between controllers of different states */
4916
 
                                if (offset) {
4917
 
                                        offset = 0;
4918
 
                                        yco -= 6;
4919
 
                                }
4920
 
                                cont= ob->controllers.first;
4921
 
                                while (cont) {
4922
 
                                        if (cont->state_mask & (1<<stbit)) {
4923
 
                                                /* this controller is visible, mark all its actuator */
4924
 
                                                for (iact=0; iact<cont->totlinks; iact++) {
4925
 
                                                        act = cont->links[iact];
4926
 
                                                        if (act)
4927
 
                                                                act->flag |= ACT_VISIBLE;
4928
 
                                                }
4929
 
                                                uiDefIconButBitS(block, TOG, CONT_DEL, B_DEL_CONT, ICON_X,      xco, yco, 22, UI_UNIT_Y, &cont->flag, 0, 0, 0, 0, "Delete Controller");
4930
 
                                                uiDefIconButBitS(block, ICONTOG, CONT_SHOW, B_REDR, ICON_RIGHTARROW, (short)(xco+width-22), yco, 22, UI_UNIT_Y, &cont->flag, 0, 0, 0, 0, "Controller settings");
4931
 
                                                uiDefIconButBitS(block, TOG, CONT_PRIO, B_REDR, ICON_BOOKMARKS, (short)(xco+width-66), yco, 22, UI_UNIT_Y, &cont->flag, 0, 0, 0, 0, "Mark controller for execution before all non-marked controllers (good for startup scripts)");
4932
 
 
4933
 
                                                sprintf(numstr, "%d", first_bit(cont->state_mask)+1);
4934
 
                                                uiDefBlockBut(block, controller_state_mask_menu, cont, numstr, (short)(xco+width-44), yco, 22, UI_UNIT_Y, "Set controller state index (from 1 to 30)");
4935
 
                                
4936
 
                                                if (cont->flag & CONT_SHOW) {
4937
 
                                                        cont->otype= cont->type;
4938
 
                                                        uiDefButS(block, MENU, B_CHANGE_CONT, controller_pup(),(short)(xco+22), yco, 70, UI_UNIT_Y, &cont->type, 0, 0, 0, 0, "Controller type");
4939
 
                                                        but = uiDefBut(block, TEX, 1, "", (short)(xco+92), yco, (short)(width-158), UI_UNIT_Y, cont->name, 0, MAX_NAME, 0, 0, "Controller name");
4940
 
                                                        uiButSetFunc(but, make_unique_prop_names_cb, cont->name, (void*) 0);
4941
 
                                
4942
 
                                                        ycoo= yco;
4943
 
                                                        yco= draw_controllerbuttons(cont, block, xco, yco, width);
4944
 
                                                        if (yco-6 < ycoo) ycoo= (yco+ycoo-20)/2;
4945
 
                                                }
4946
 
                                                else {
4947
 
                                                        cpack(0x999999);
4948
 
                                                        glRecti(xco+22, yco, xco+width-22,yco+19);
4949
 
                                                        but = uiDefBut(block, LABEL, 0, controller_name(cont->type), (short)(xco+22), yco, 70, UI_UNIT_Y, cont, 0, 0, 0, 0, "Controller type");
4950
 
                                                        //uiButSetFunc(but, old_sca_move_controller, cont, NULL);
4951
 
                                                        but = uiDefBut(block, LABEL, 0, cont->name,(short)(xco+92), yco,(short)(width-158), UI_UNIT_Y, cont, 0, 0, 0, 0, "Controller name");
4952
 
                                                        //uiButSetFunc(but, old_sca_move_controller, cont, NULL);
4953
 
 
4954
 
                                                        uiBlockBeginAlign(block);
4955
 
                                                        but = uiDefIconBut(block, BUT, B_REDR, ICON_TRIA_UP, (short)(xco+width-(110+5)), yco, 22, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Move this logic brick up");
4956
 
                                                        uiButSetFunc(but, old_sca_move_controller, cont, (void *)TRUE);
4957
 
                                                        but = uiDefIconBut(block, BUT, B_REDR, ICON_TRIA_DOWN, (short)(xco+width-(88+5)), yco, 22, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Move this logic brick down");
4958
 
                                                        uiButSetFunc(but, old_sca_move_controller, cont, (void *)FALSE);
4959
 
                                                        uiBlockEndAlign(block);
4960
 
 
4961
 
                                                        ycoo= yco;
4962
 
                                                }
4963
 
                                
4964
 
                                                but = uiDefIconBut(block, LINK, 0, ICON_LINK,   (short)(xco+width), ycoo, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
4965
 
                                                uiSetButLink(but, NULL, (void ***)&(cont->links), &cont->totlinks, LINK_CONTROLLER, LINK_ACTUATOR);
4966
 
                                
4967
 
                                                uiDefIconBut(block, INLINK, 0, ICON_INLINK,(short)(xco-19), ycoo, UI_UNIT_X, UI_UNIT_Y, cont, LINK_CONTROLLER, 0, 0, 0, "");
4968
 
                                                /* offset is >0 if at least one controller was displayed */
4969
 
                                                offset++;
4970
 
                                                yco-=20;
4971
 
                                        }
4972
 
                                        cont= cont->next;
4973
 
                                }
4974
 
 
4975
 
                        }
4976
 
                        yco-= 6;
4977
 
                }
4978
 
        }
4979
 
 
4980
 
        /* ******************************* */
4981
 
        xco= 10; yco= 170; width= 300;
4982
 
 
4983
 
        uiDefBlockBut(block, sensor_menu, NULL, "Sensors", xco-10, yco+35, 70, UI_UNIT_Y, "");
4984
 
        
4985
 
        uiBlockBeginAlign(block);
4986
 
        uiDefButBitS(block, TOG, BUTS_SENS_SEL, B_REDR, "Sel", xco+80, yco+35, (width-70)/4, UI_UNIT_Y, &slogic->scaflag, 0, 0, 0, 0, "Show all selected Objects");
4987
 
        uiDefButBitS(block, TOG, BUTS_SENS_ACT, B_REDR, "Act", xco+80+(width-70)/4, yco+35, (width-70)/4, UI_UNIT_Y, &slogic->scaflag, 0, 0, 0, 0, "Show active Object");
4988
 
        uiDefButBitS(block, TOG, BUTS_SENS_LINK, B_REDR, "Link", xco+80+2*(width-70)/4, yco+35, (width-70)/4, UI_UNIT_Y, &slogic->scaflag, 0, 0, 0, 0, "Show linked Objects to Controller");
4989
 
        uiDefButBitS(block, TOG, BUTS_SENS_STATE, B_REDR, "State", xco+80+3*(width-70)/4, yco+35, (width-70)/4, UI_UNIT_Y, &slogic->scaflag, 0, 0, 0, 0, "Show only sensors connected to active states");
4990
 
        uiBlockEndAlign(block);
4991
 
        
4992
 
        for (a=0; a<count; a++) {
4993
 
                ob= (Object *)idar[a];
4994
 
//              uiClearButLock();
4995
 
//              uiSetButLock(object_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
4996
 
                
4997
 
                if ( (ob->scavisflag & OB_VIS_SENS) == 0) continue;
4998
 
                
4999
 
                /* presume it is only objects for now */
5000
 
                uiBlockBeginAlign(block);
5001
 
//              if (ob->sensors.first) uiSetCurFont(block, UI_HELVB);
5002
 
                uiDefButBitS(block, TOG, OB_SHOWSENS, B_REDR, ob->id.name+2,(short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide sensors");
5003
 
//              if (ob->sensors.first) uiSetCurFont(block, UI_HELV);
5004
 
                uiDefButBitS(block, TOG, OB_ADDSENS, B_ADD_SENS, "Add",(short)(xco+width-40), yco, 50, UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Add a new Sensor");
5005
 
                uiBlockEndAlign(block);
5006
 
                yco-=20;
5007
 
                
5008
 
                if (ob->scaflag & OB_SHOWSENS) {
5009
 
                        
5010
 
                        sens= ob->sensors.first;
5011
 
                        while (sens) {
5012
 
                                if (!(slogic->scaflag & BUTS_SENS_STATE) ||
5013
 
                                         (sens->totlinks == 0) ||               /* always display sensor without links so that is can be edited */
5014
 
                                         (sens->flag & SENS_PIN && slogic->scaflag & BUTS_SENS_STATE) || /* states can hide some sensors, pinned sensors ignore the visible state */
5015
 
                                         (is_sensor_linked(block, sens))
5016
 
                                ) {
5017
 
                                        /* should we draw the pin? - for now always draw when there is a state */
5018
 
                                        pin = (slogic->scaflag & BUTS_SENS_STATE && (sens->flag & SENS_SHOW || sens->flag & SENS_PIN)) ? 1 : 0;
5019
 
                                        
5020
 
                                        sens->flag |= SENS_VISIBLE;
5021
 
                                        uiDefIconButBitS(block, TOG, SENS_DEL, B_DEL_SENS, ICON_X,      xco, yco, 22, UI_UNIT_Y, &sens->flag, 0, 0, 0, 0, "Delete Sensor");
5022
 
                                        if (pin)
5023
 
                                                uiDefIconButBitS(block, ICONTOG, SENS_PIN, B_REDR, ICON_PINNED, (short)(xco+width-44), yco, 22, UI_UNIT_Y, &sens->flag, 0, 0, 0, 0, "Display when not linked to a visible states controller");
5024
 
                                        
5025
 
                                        uiDefIconButBitS(block, ICONTOG, SENS_SHOW, B_REDR, ICON_RIGHTARROW, (short)(xco+width-22), yco, 22, UI_UNIT_Y, &sens->flag, 0, 0, 0, 0, "Sensor settings");
5026
 
 
5027
 
                                        ycoo= yco;
5028
 
                                        if (sens->flag & SENS_SHOW) {
5029
 
                                                uiDefButS(block, MENU, B_CHANGE_SENS, sensor_pup(),     (short)(xco+22), yco, 80, UI_UNIT_Y, &sens->type, 0, 0, 0, 0, "Sensor type");
5030
 
                                                but = uiDefBut(block, TEX, 1, "", (short)(xco+102), yco, (short)(width-(pin?146:124)), UI_UNIT_Y, sens->name, 0, MAX_NAME, 0, 0, "Sensor name");
5031
 
                                                uiButSetFunc(but, make_unique_prop_names_cb, sens->name, (void*) 0);
5032
 
 
5033
 
                                                sens->otype= sens->type;
5034
 
                                                yco= draw_sensorbuttons(ob, sens, block, xco, yco, width);
5035
 
                                                if (yco-6 < ycoo) ycoo= (yco+ycoo-20)/2;
5036
 
                                        }
5037
 
                                        else {
5038
 
                                                set_col_sensor(sens->type, 1);
5039
 
                                                glRecti(xco+22, yco, xco+width-22,yco+19);
5040
 
                                                but = uiDefBut(block, LABEL, 0, sensor_name(sens->type),        (short)(xco+22), yco, 80, UI_UNIT_Y, sens, 0, 0, 0, 0, "");
5041
 
                                                //uiButSetFunc(but, old_sca_move_sensor, sens, NULL);
5042
 
                                                but = uiDefBut(block, LABEL, 0, sens->name, (short)(xco+102), yco, (short)(width-(pin?146:124)), UI_UNIT_Y, sens, 0, MAX_NAME, 0, 0, "");
5043
 
                                                //uiButSetFunc(but, old_sca_move_sensor, sens, NULL);
5044
 
 
5045
 
                                                uiBlockBeginAlign(block);
5046
 
                                                but = uiDefIconBut(block, BUT, B_REDR, ICON_TRIA_UP, (short)(xco+width-(66+5)), yco, 22, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Move this logic brick up");
5047
 
                                                uiButSetFunc(but, old_sca_move_sensor, sens, (void *)TRUE);
5048
 
                                                but = uiDefIconBut(block, BUT, B_REDR, ICON_TRIA_DOWN, (short)(xco+width-(44+5)), yco, 22, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Move this logic brick down");
5049
 
                                                uiButSetFunc(but, old_sca_move_sensor, sens, (void *)FALSE);
5050
 
                                                uiBlockEndAlign(block);
5051
 
                                        }
5052
 
 
5053
 
                                        but = uiDefIconBut(block, LINK, 0, ICON_LINK,   (short)(xco+width), ycoo, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
5054
 
                                        uiSetButLink(but, NULL, (void ***)&(sens->links), &sens->totlinks, LINK_SENSOR, LINK_CONTROLLER);
5055
 
 
5056
 
                                        yco-=20;
5057
 
                                }
5058
 
                                sens= sens->next;
5059
 
                        }
5060
 
                        yco-= 6;
5061
 
                }
5062
 
        }
5063
 
        /* ******************************* */
5064
 
        xco= 800; yco= 170; width= 300;
5065
 
        uiDefBlockBut(block, actuator_menu, NULL, "Actuators", xco-10, yco+35, 90, UI_UNIT_Y, "");
5066
 
 
5067
 
        uiBlockBeginAlign(block);
5068
 
        uiDefButBitS(block, TOG, BUTS_ACT_SEL, B_REDR, "Sel", xco+110, yco+35, (width-100)/4, UI_UNIT_Y, &slogic->scaflag, 0, 0, 0, 0, "Show all selected Objects");
5069
 
        uiDefButBitS(block, TOG, BUTS_ACT_ACT, B_REDR, "Act", xco+110+(width-100)/4, yco+35, (width-100)/4, UI_UNIT_Y, &slogic->scaflag, 0, 0, 0, 0, "Show active Object");
5070
 
        uiDefButBitS(block, TOG, BUTS_ACT_LINK, B_REDR, "Link", xco+110+2*(width-100)/4, yco+35, (width-100)/4, UI_UNIT_Y, &slogic->scaflag, 0, 0, 0, 0, "Show linked Objects to Controller");
5071
 
        uiDefButBitS(block, TOG, BUTS_ACT_STATE, B_REDR, "State", xco+110+3*(width-100)/4, yco+35, (width-100)/4, UI_UNIT_Y, &slogic->scaflag, 0, 0, 0, 0, "Show only actuators connected to active states");
5072
 
        uiBlockEndAlign(block);
5073
 
        for (a=0; a<count; a++) {
5074
 
                ob= (Object *)idar[a];
5075
 
//              uiClearButLock();
5076
 
//              uiSetButLock(object_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
5077
 
                if ( (ob->scavisflag & OB_VIS_ACT) == 0) continue;
5078
 
 
5079
 
                /* presume it is only objects for now */
5080
 
                uiBlockBeginAlign(block);
5081
 
//              if (ob->actuators.first) uiSetCurFont(block, UI_HELVB);
5082
 
                uiDefButBitS(block, TOG, OB_SHOWACT, B_REDR, ob->id.name+2,(short)(xco-10), yco,(short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide actuators");
5083
 
//              if (ob->actuators.first) uiSetCurFont(block, UI_HELV);
5084
 
                uiDefButBitS(block, TOG, OB_ADDACT, B_ADD_ACT, "Add",(short)(xco+width-40), yco, 50, UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Add a new Actuator");
5085
 
                uiBlockEndAlign(block);
5086
 
                yco-=20;
5087
 
                
5088
 
                if (ob->scaflag & OB_SHOWACT) {
5089
 
                        
5090
 
                        act= ob->actuators.first;
5091
 
                        while (act) {
5092
 
                                if (!(slogic->scaflag & BUTS_ACT_STATE) ||
5093
 
                                        !(act->flag & ACT_LINKED) ||            /* always display actuators without links so that is can be edited */
5094
 
                                         (act->flag & ACT_VISIBLE) ||           /* this actuator has visible connection, display it */
5095
 
                                         (act->flag & ACT_PIN && slogic->scaflag & BUTS_ACT_STATE)) {
5096
 
                                        
5097
 
                                        pin = (slogic->scaflag & BUTS_ACT_STATE && (act->flag & SENS_SHOW || act->flag & SENS_PIN)) ? 1 : 0;
5098
 
                                        
5099
 
                                        act->flag |= ACT_VISIBLE;       /* mark the actuator as visible to help implementing the up/down action */
5100
 
                                        uiDefIconButBitS(block, TOG, ACT_DEL, B_DEL_ACT, ICON_X,        xco, yco, 22, UI_UNIT_Y, &act->flag, 0, 0, 0, 0, "Delete Actuator");
5101
 
                                        if (pin)
5102
 
                                                uiDefIconButBitS(block, ICONTOG, ACT_PIN, B_REDR, ICON_PINNED, (short)(xco+width-44), yco, 22, UI_UNIT_Y, &act->flag, 0, 0, 0, 0, "Display when not linked to a visible states controller");
5103
 
                                        uiDefIconButBitS(block, ICONTOG, ACT_SHOW, B_REDR, ICON_RIGHTARROW, (short)(xco+width-22), yco, 22, UI_UNIT_Y, &act->flag, 0, 0, 0, 0, "Display the actuator");
5104
 
                                        
5105
 
                                        if (act->flag & ACT_SHOW) {
5106
 
                                                act->otype= act->type;
5107
 
                                                uiDefButS(block, MENU, B_CHANGE_ACT, actuator_pup(ob),  (short)(xco+22), yco, 90, UI_UNIT_Y, &act->type, 0, 0, 0, 0, "Actuator type");
5108
 
                                                but = uiDefBut(block, TEX, 1, "", (short)(xco+112), yco, (short)(width-(pin?156:134)), UI_UNIT_Y, act->name, 0, MAX_NAME, 0, 0, "Actuator name");
5109
 
                                                uiButSetFunc(but, make_unique_prop_names_cb, act->name, (void*) 0);
5110
 
 
5111
 
                                                ycoo= yco;
5112
 
                                                yco= draw_actuatorbuttons(bmain, ob, act, block, xco, yco, width);
5113
 
                                                if (yco-6 < ycoo) ycoo= (yco+ycoo-20)/2;
5114
 
                                        }
5115
 
                                        else {
5116
 
                                                set_col_actuator(act->type, 1);
5117
 
                                                glRecti((short)(xco+22), yco, (short)(xco+width-22),(short)(yco+19));
5118
 
                                                /* but= */ uiDefBut(block, LABEL, 0, actuator_name(act->type), (short)(xco+22), yco, 90, UI_UNIT_Y, act, 0, 0, 0, 0, "Actuator type");
5119
 
                                                // uiButSetFunc(but, old_sca_move_actuator, act, NULL);
5120
 
                                                /* but= */ uiDefBut(block, LABEL, 0, act->name, (short)(xco+112), yco, (short)(width-(pin?156:134)), UI_UNIT_Y, act, 0, 0, 0, 0, "Actuator name");
5121
 
                                                // uiButSetFunc(but, old_sca_move_actuator, act, NULL);
5122
 
 
5123
 
                                                uiBlockBeginAlign(block);
5124
 
                                                but = uiDefIconBut(block, BUT, B_REDR, ICON_TRIA_UP, (short)(xco+width-(66+5)), yco, 22, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Move this logic brick up");
5125
 
                                                uiButSetFunc(but, old_sca_move_actuator, act, (void *)TRUE);
5126
 
                                                but = uiDefIconBut(block, BUT, B_REDR, ICON_TRIA_DOWN, (short)(xco+width-(44+5)), yco, 22, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Move this logic brick down");
5127
 
                                                uiButSetFunc(but, old_sca_move_actuator, act, (void *)FALSE);
5128
 
                                                uiBlockEndAlign(block);
5129
 
 
5130
 
                                                ycoo= yco;
5131
 
                                        }
5132
 
 
5133
 
                                        uiDefIconBut(block, INLINK, 0, ICON_INLINK,(short)(xco-19), ycoo, UI_UNIT_X, UI_UNIT_Y, act, LINK_ACTUATOR, 0, 0, 0, "");
5134
 
 
5135
 
                                        yco-=20;
5136
 
                                }
5137
 
                                act= act->next;
5138
 
                        }
5139
 
                        yco-= 6;
5140
 
                }
5141
 
        }
5142
 
 
5143
 
        uiComposeLinks(block);
5144
 
        
5145
 
        uiEndBlock(C, block);
5146
 
        uiDrawBlock(C, block);
5147
 
 
5148
 
        if (idar) MEM_freeN(idar);
5149
 
}
5150
 
 
5151
 
 
5152
 
 
5153
 
 
5154
 
 
 
2537
        height = MIN2(height, yco);
 
2538
 
 
2539
        UI_view2d_totRect_set(&ar->v2d, 57.5f * U.widget_unit, height - U.widget_unit);
 
2540
        
 
2541
        /* set the view */
 
2542
        UI_view2d_view_ortho(&ar->v2d);
 
2543
 
 
2544
        uiComposeLinks(block);
 
2545
        
 
2546
        uiEndBlock(C, block);
 
2547
        uiDrawBlock(C, block);
 
2548
        
 
2549
        /* restore view matrix */
 
2550
        UI_view2d_view_restore(C);
 
2551
        
 
2552
        if (idar) MEM_freeN(idar);
 
2553
}
5155
2554