4 * ***** BEGIN GPL LICENSE BLOCK *****
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 * The Original Code is Copyright (C) 2009 Blender Foundation.
21 * All rights reserved.
24 * Contributor(s): Blender Foundation
26 * ***** END GPL LICENSE BLOCK *****
34 #include "DNA_actuator_types.h"
35 #include "DNA_controller_types.h"
36 #include "DNA_property_types.h"
37 #include "DNA_space_types.h"
38 #include "DNA_scene_types.h"
39 #include "DNA_screen_types.h"
40 #include "DNA_sensor_types.h"
41 #include "DNA_constraint_types.h"
42 #include "DNA_windowmanager_types.h"
43 #include "DNA_object_types.h"
45 #include "MEM_guardedalloc.h"
47 #include "BLI_blenlib.h"
48 #include "BLI_utildefines.h"
50 #include "BKE_action.h"
51 #include "BKE_context.h"
52 #include "BKE_global.h"
53 #include "BKE_library.h"
63 #include "UI_interface.h"
65 #include "RNA_access.h"
68 #include "../interface/interface_intern.h"
70 #include "logic_intern.h"
73 #define MAX_RENDER_PASS 100
77 #define B_ADD_SENS 2703
78 #define B_CHANGE_SENS 2704
79 #define B_DEL_SENS 2705
81 #define B_ADD_CONT 2706
82 #define B_CHANGE_CONT 2707
83 #define B_DEL_CONT 2708
85 #define B_ADD_ACT 2709
86 #define B_CHANGE_ACT 2710
87 #define B_DEL_ACT 2711
89 #define B_SOUNDACT_BROWSE 2712
91 #define B_SETSECTOR 2713
92 #define B_SETPROP 2714
93 #define B_SETACTOR 2715
94 #define B_SETMAINACTOR 2716
95 #define B_SETDYNA 2717
96 #define B_SET_STATE_BIT 2718
97 #define B_INIT_STATE_BIT 2719
100 static ID **get_selected_and_linked_obs(bContext *C, short *count, short scavisflag);
102 static int vergname(const void *v1, const void *v2)
109 return strcmp(*x1, *x2);
112 void make_unique_prop_names(bContext *C, char *str)
120 short a, obcount, propcount=0, nr;
123 /* this function is called by a Button, and gives the current
124 * stringpointer as an argument, this is the one that can change
127 idar= get_selected_and_linked_obs(C, &obcount, BUTS_SENS_SEL|BUTS_SENS_ACT|BUTS_ACT_SEL|BUTS_ACT_ACT|BUTS_CONT_SEL|BUTS_CONT_ACT);
129 /* for each object, make properties and sca names unique */
131 /* count total names */
132 for(a=0; a<obcount; a++) {
133 ob= (Object *)idar[a];
134 propcount+= BLI_countlist(&ob->prop);
135 propcount+= BLI_countlist(&ob->sensors);
136 propcount+= BLI_countlist(&ob->controllers);
137 propcount+= BLI_countlist(&ob->actuators);
140 if(idar) MEM_freeN(idar);
144 /* make names array for sorting */
145 names= MEM_callocN(propcount*sizeof(void *), "names");
147 /* count total names */
149 for(a=0; a<obcount; a++) {
150 ob= (Object *)idar[a];
151 prop= ob->prop.first;
153 names[nr++]= prop->name;
156 sens= ob->sensors.first;
158 names[nr++]= sens->name;
161 cont= ob->controllers.first;
163 names[nr++]= cont->name;
166 act= ob->actuators.first;
168 names[nr++]= act->name;
173 qsort(names, propcount, sizeof(void *), vergname);
175 /* now we check for double names, and change them */
177 for(nr=0; nr<propcount; nr++) {
178 if(names[nr]!=str && strcmp( names[nr], str )==0 ) {
179 BLI_newname(str, +1);
187 static void make_unique_prop_names_cb(bContext *C, void *strv, void *UNUSED(redraw_view3d_flagv))
190 // int redraw_view3d_flag= GET_INT_FROM_POINTER(redraw_view3d_flagv);
192 make_unique_prop_names(C, str);
196 static void old_sca_move_sensor(bContext *C, void *datav, void *move_up)
198 /* deprecated, no longer using it (moved to sca.c) */
199 Scene *scene= CTX_data_scene(C);
200 bSensor *sens_to_delete= datav;
205 // val= pupmenu("Move up%x1|Move down %x2");
209 /* now find out which object has this ... */
213 sens= base->object->sensors.first;
215 if(sens == sens_to_delete) break;
220 if( val==1 && sens->prev) {
221 for (tmp=sens->prev; tmp; tmp=tmp->prev) {
222 if (tmp->flag & SENS_VISIBLE)
226 BLI_remlink(&base->object->sensors, sens);
227 BLI_insertlinkbefore(&base->object->sensors, tmp, sens);
230 else if( val==2 && sens->next) {
231 for (tmp=sens->next; tmp; tmp=tmp->next) {
232 if (tmp->flag & SENS_VISIBLE)
236 BLI_remlink(&base->object->sensors, sens);
237 BLI_insertlink(&base->object->sensors, tmp, sens);
240 ED_undo_push(C, "Move sensor");
249 static void old_sca_move_controller(bContext *C, void *datav, void *move_up)
251 /* deprecated, no longer using it (moved to sca.c) */
252 Scene *scene= CTX_data_scene(C);
253 bController *controller_to_del= datav;
256 bController *cont, *tmp;
258 //val= pupmenu("Move up%x1|Move down %x2");
262 /* now find out which object has this ... */
266 cont= base->object->controllers.first;
268 if(cont == controller_to_del) break;
273 if( val==1 && cont->prev) {
274 /* locate the controller that has the same state mask but is earlier in the list */
277 if(tmp->state_mask & cont->state_mask)
282 BLI_remlink(&base->object->controllers, cont);
283 BLI_insertlinkbefore(&base->object->controllers, tmp, cont);
286 else if( val==2 && cont->next) {
289 if(tmp->state_mask & cont->state_mask)
293 BLI_remlink(&base->object->controllers, cont);
294 BLI_insertlink(&base->object->controllers, tmp, cont);
296 ED_undo_push(C, "Move controller");
305 static void old_sca_move_actuator(bContext *C, void *datav, void *move_up)
307 /* deprecated, no longer using it (moved to sca.c) */
308 Scene *scene= CTX_data_scene(C);
309 bActuator *actuator_to_move= datav;
312 bActuator *act, *tmp;
314 //val= pupmenu("Move up%x1|Move down %x2");
318 /* now find out which object has this ... */
322 act= base->object->actuators.first;
324 if(act == actuator_to_move) break;
329 if( val==1 && act->prev) {
330 /* locate the first visible actuators before this one */
331 for (tmp = act->prev; tmp; tmp=tmp->prev) {
332 if (tmp->flag & ACT_VISIBLE)
336 BLI_remlink(&base->object->actuators, act);
337 BLI_insertlinkbefore(&base->object->actuators, tmp, act);
340 else if( val==2 && act->next) {
341 for (tmp=act->next; tmp; tmp=tmp->next) {
342 if (tmp->flag & ACT_VISIBLE)
346 BLI_remlink(&base->object->actuators, act);
347 BLI_insertlink(&base->object->actuators, tmp, act);
350 ED_undo_push(C, "Move actuator");
359 void do_logic_buts(bContext *C, void *UNUSED(arg), int event)
361 Main *bmain= CTX_data_main(C);
368 ob= CTX_data_active_object(C);
374 /* check for inconsistent types */
375 ob->gameflag &= ~(OB_SECTOR|OB_MAINACTOR|OB_DYNAMIC|OB_ACTOR);
381 ob->gameflag &= ~(OB_SECTOR|OB_PROP);
385 for(ob=bmain->object.first; ob; ob=ob->id.next) {
386 if(ob->scaflag & OB_ADDSENS) {
387 ob->scaflag &= ~OB_ADDSENS;
388 sens= new_sensor(SENS_ALWAYS);
389 BLI_addtail(&(ob->sensors), sens);
390 make_unique_prop_names(C, sens->name);
391 ob->scaflag |= OB_SHOWSENS;
395 ED_undo_push(C, "Add sensor");
399 for(ob=bmain->object.first; ob; ob=ob->id.next) {
400 sens= ob->sensors.first;
402 if(sens->type != sens->otype) {
404 sens->otype= sens->type;
413 for(ob=bmain->object.first; ob; ob=ob->id.next) {
414 sens= ob->sensors.first;
416 if(sens->flag & SENS_DEL) {
417 BLI_remlink(&(ob->sensors), sens);
424 ED_undo_push(C, "Delete sensor");
428 for(ob=bmain->object.first; ob; ob=ob->id.next) {
429 if(ob->scaflag & OB_ADDCONT) {
430 ob->scaflag &= ~OB_ADDCONT;
431 cont= new_controller(CONT_LOGIC_AND);
432 make_unique_prop_names(C, cont->name);
433 ob->scaflag |= OB_SHOWCONT;
434 BLI_addtail(&(ob->controllers), cont);
435 /* set the controller state mask from the current object state.
436 A controller is always in a single state, so select the lowest bit set
437 from the object state */
438 for (bit=0; bit<32; bit++) {
439 if (ob->state & (1<<bit))
442 cont->state_mask = (1<<bit);
443 if (cont->state_mask == 0) {
444 /* shouldn't happen, object state is never 0 */
445 cont->state_mask = 1;
449 ED_undo_push(C, "Add controller");
452 case B_SET_STATE_BIT:
453 for(ob=bmain->object.first; ob; ob=ob->id.next) {
454 if(ob->scaflag & OB_ALLSTATE) {
455 ob->scaflag &= ~OB_ALLSTATE;
456 ob->state = 0x3FFFFFFF;
461 case B_INIT_STATE_BIT:
462 for(ob=bmain->object.first; ob; ob=ob->id.next) {
463 if(ob->scaflag & OB_INITSTBIT) {
464 ob->scaflag &= ~OB_INITSTBIT;
465 ob->state = ob->init_state;
473 for(ob=bmain->object.first; ob; ob=ob->id.next) {
474 cont= ob->controllers.first;
476 if(cont->type != cont->otype) {
477 init_controller(cont);
478 cont->otype= cont->type;
488 for(ob=bmain->object.first; ob; ob=ob->id.next) {
489 cont= ob->controllers.first;
491 if(cont->flag & CONT_DEL) {
492 BLI_remlink(&(ob->controllers), cont);
493 unlink_controller(cont);
494 free_controller(cont);
500 ED_undo_push(C, "Delete controller");
504 for(ob=bmain->object.first; ob; ob=ob->id.next) {
505 if(ob->scaflag & OB_ADDACT) {
506 ob->scaflag &= ~OB_ADDACT;
507 act= new_actuator(ACT_OBJECT);
508 make_unique_prop_names(C, act->name);
509 BLI_addtail(&(ob->actuators), act);
510 ob->scaflag |= OB_SHOWACT;
513 ED_undo_push(C, "Add actuator");
517 for(ob=bmain->object.first; ob; ob=ob->id.next) {
518 act= ob->actuators.first;
520 if(act->type != act->otype) {
522 act->otype= act->type;
531 for(ob=bmain->object.first; ob; ob=ob->id.next) {
532 act= ob->actuators.first;
534 if(act->flag & ACT_DEL) {
535 BLI_remlink(&(ob->actuators), act);
536 unlink_actuator(act);
543 ED_undo_push(C, "Delete actuator");
546 case B_SOUNDACT_BROWSE:
547 /* since we don't know which... */
549 for(ob=bmain->object.first; ob; ob=ob->id.next) {
550 act= ob->actuators.first;
553 if(act->type==ACT_SOUND)
555 bSoundActuator *sa= act->data;
558 ID *sound= bmain->sound.first;
561 if(sa->sndnr == -2) {
562 // XXX activate_databrowse((ID *)bmain->sound.first, ID_SO, 0, B_SOUNDACT_BROWSE,
563 // &sa->sndnr, do_logic_buts);
576 ((ID *)sa->sound)->us--;
578 sa->sound= (struct bSound *)sound;
598 static const char *sensor_name(int type)
635 static const char *sensor_pup(void)
637 /* the number needs to match defines in DNA_sensor_types.h */
638 return "Sensors %t|Always %x0|Delay %x13|Keyboard %x3|Mouse %x5|"
639 "Touch %x1|Collision %x6|Near %x2|Radar %x7|"
640 "Property %x4|Random %x8|Ray %x9|Message %x10|Joystick %x11|Actuator %x12|Armature %x14";
643 static const char *controller_name(int type)
650 case CONT_LOGIC_NAND:
656 case CONT_LOGIC_XNOR:
658 case CONT_EXPRESSION:
666 static const char *controller_pup(void)
668 return "Controllers %t|AND %x0|OR %x1|XOR %x6|NAND %x4|NOR %x5|XNOR %x7|Expression %x2|Python %x3";
671 static const char *actuator_name(int type)
674 case ACT_SHAPEACTION:
675 return "Shape Action";
692 case ACT_EDIT_OBJECT:
693 return "Edit Object";
723 static const char *actuator_pup(Object *owner)
728 return "Actuators %t|Action %x15|Armature %x23|Motion %x0|Constraint %x9|Ipo %x1"
729 "|Camera %x3|Sound %x5|Property %x6|Edit Object %x10"
730 "|Scene %x11|Random %x13|Message %x14|Game %x17"
731 "|Visibility %x18|2D Filter %x19|Parent %x20|State %x22";
735 return "Actuators %t|Shape Action %x21|Motion %x0|Constraint %x9|Ipo %x1"
736 "|Camera %x3|Sound %x5|Property %x6|Edit Object %x10"
737 "|Scene %x11|Random %x13|Message %x14|Game %x17"
738 "|Visibility %x18|2D Filter %x19|Parent %x20|State %x22";
742 return "Actuators %t|Motion %x0|Constraint %x9|Ipo %x1"
743 "|Camera %x3|Sound %x5|Property %x6|Edit Object %x10"
744 "|Scene %x11|Random %x13|Message %x14|Game %x17"
745 "|Visibility %x18|2D Filter %x19|Parent %x20|State %x22";
751 static void set_sca_ob(Object *ob)
756 cont= ob->controllers.first;
758 cont->mynew= (bController *)ob;
761 act= ob->actuators.first;
763 act->mynew= (bActuator *)ob;
768 static ID **get_selected_and_linked_obs(bContext *C, short *count, short scavisflag)
771 Main *bmain= CTX_data_main(C);
772 Scene *scene= CTX_data_scene(C);
773 Object *ob, *obt, *obact= CTX_data_active_object(C);
780 /* we need a sorted object list */
781 /* set scavisflags flags in Objects to indicate these should be evaluated */
782 /* also hide ob pointers in ->new entries of controllerss/actuators */
786 if(scene==NULL) return NULL;
788 ob= bmain->object.first;
795 /* XXX here it checked 3d lay */
800 if(base->lay & lay) {
801 if(base->flag & SELECT) {
802 if(scavisflag & BUTS_SENS_SEL) base->object->scavisflag |= OB_VIS_SENS;
803 if(scavisflag & BUTS_CONT_SEL) base->object->scavisflag |= OB_VIS_CONT;
804 if(scavisflag & BUTS_ACT_SEL) base->object->scavisflag |= OB_VIS_ACT;
811 if(scavisflag & BUTS_SENS_ACT) obact->scavisflag |= OB_VIS_SENS;
812 if(scavisflag & BUTS_CONT_ACT) obact->scavisflag |= OB_VIS_CONT;
813 if(scavisflag & BUTS_ACT_ACT) obact->scavisflag |= OB_VIS_ACT;
816 /* BUTS_XXX_STATE are similar to BUTS_XXX_LINK for selecting the object */
817 if(scavisflag & (BUTS_SENS_LINK|BUTS_CONT_LINK|BUTS_ACT_LINK|BUTS_SENS_STATE|BUTS_ACT_STATE)) {
822 ob= bmain->object.first;
825 /* 1st case: select sensor when controller selected */
826 if((scavisflag & (BUTS_SENS_LINK|BUTS_SENS_STATE)) && (ob->scavisflag & OB_VIS_SENS)==0) {
827 sens= ob->sensors.first;
829 for(a=0; a<sens->totlinks; a++) {
831 obt= (Object *)sens->links[a]->mynew;
832 if(obt && (obt->scavisflag & OB_VIS_CONT)) {
834 ob->scavisflag |= OB_VIS_SENS;
844 /* 2nd case: select cont when act selected */
845 if((scavisflag & BUTS_CONT_LINK) && (ob->scavisflag & OB_VIS_CONT)==0) {
846 cont= ob->controllers.first;
848 for(a=0; a<cont->totlinks; a++) {
850 obt= (Object *)cont->links[a]->mynew;
851 if(obt && (obt->scavisflag & OB_VIS_ACT)) {
853 ob->scavisflag |= OB_VIS_CONT;
863 /* 3rd case: select controller when sensor selected */
864 if((scavisflag & BUTS_CONT_LINK) && (ob->scavisflag & OB_VIS_SENS)) {
865 sens= ob->sensors.first;
867 for(a=0; a<sens->totlinks; a++) {
869 obt= (Object *)sens->links[a]->mynew;
870 if(obt && (obt->scavisflag & OB_VIS_CONT)==0) {
872 obt->scavisflag |= OB_VIS_CONT;
880 /* 4th case: select actuator when controller selected */
881 if( (scavisflag & (BUTS_ACT_LINK|BUTS_ACT_STATE)) && (ob->scavisflag & OB_VIS_CONT)) {
882 cont= ob->controllers.first;
884 for(a=0; a<cont->totlinks; a++) {
886 obt= (Object *)cont->links[a]->mynew;
887 if(obt && (obt->scavisflag & OB_VIS_ACT)==0) {
889 obt->scavisflag |= OB_VIS_ACT;
903 ob= bmain->object.first;
905 if( ob->scavisflag ) (*count)++;
909 if(*count==0) return NULL;
910 if(*count>24) *count= 24; /* temporal */
912 idar= MEM_callocN( (*count)*sizeof(void *), "idar");
914 ob= bmain->object.first;
917 /* make the active object always the first one of the list */
919 idar[0]= (ID *)obact;
924 if( (ob->scavisflag) && (ob != obact)) {
932 /* just to be sure... these were set in set_sca_done_ob() */
933 clear_sca_new_poins();
939 static int get_col_sensor(int type)
941 /* XXX themecolors not here */
944 case SENS_ALWAYS: return TH_PANEL;
945 case SENS_DELAY: return TH_PANEL;
946 case SENS_TOUCH: return TH_PANEL;
947 case SENS_COLLISION: return TH_PANEL;
948 case SENS_NEAR: return TH_PANEL;
949 case SENS_KEYBOARD: return TH_PANEL;
950 case SENS_PROPERTY: return TH_PANEL;
951 case SENS_ARMATURE: return TH_PANEL;
952 case SENS_ACTUATOR: return TH_PANEL;
953 case SENS_MOUSE: return TH_PANEL;
954 case SENS_RADAR: return TH_PANEL;
955 case SENS_RANDOM: return TH_PANEL;
956 case SENS_RAY: return TH_PANEL;
957 case SENS_MESSAGE: return TH_PANEL;
958 case SENS_JOYSTICK: return TH_PANEL;
959 default: return TH_PANEL;
962 static void set_col_sensor(int type, int medium)
964 int col= get_col_sensor(type);
965 UI_ThemeColorShade(col, medium?30:0);
969 static void verify_logicbutton_func(bContext *UNUSED(C), void *data1, void *data2)
971 bSensor *sens= (bSensor*)data1;
973 if(sens->level && sens->tap) {
974 if(data2 == &(sens->level))
981 static void test_scriptpoin_but(struct bContext *C, const char *name, ID **idpp)
983 *idpp= BLI_findstring(&CTX_data_main(C)->text, name, offsetof(ID, name) + 2);
986 static void test_actionpoin_but(struct bContext *C, const char *name, ID **idpp)
988 *idpp= BLI_findstring(&CTX_data_main(C)->action, name, offsetof(ID, name) + 2);
994 static void test_obpoin_but(struct bContext *C, const char *name, ID **idpp)
996 *idpp= BLI_findstring(&CTX_data_main(C)->object, name, offsetof(ID, name) + 2);
998 id_lib_extern(*idpp); /* checks lib data, sets correct flag for saving then */
1001 static void test_meshpoin_but(struct bContext *C, const char *name, ID **idpp)
1003 *idpp= BLI_findstring(&CTX_data_main(C)->mesh, name, offsetof(ID, name) + 2);
1008 static void test_matpoin_but(struct bContext *C, const char *name, ID **idpp)
1010 *idpp= BLI_findstring(&CTX_data_main(C)->mat, name, offsetof(ID, name) + 2);
1015 static void test_scenepoin_but(struct bContext *C, const char *name, ID **idpp)
1017 *idpp= BLI_findstring(&CTX_data_main(C)->scene, name, offsetof(ID, name) + 2);
1022 static void test_keyboard_event(struct bContext *UNUSED(C), void *arg_ks, void *UNUSED(arg))
1024 bKeyboardSensor *ks= (bKeyboardSensor*)arg_ks;
1026 if(!ISKEYBOARD(ks->key))
1028 if(!ISKEYBOARD(ks->qual))
1030 if(!ISKEYBOARD(ks->qual2))
1035 * Draws a toggle for pulse mode, a frequency field and a toggle to invert
1036 * the value of this sensor. Operates on the shared data block of sensors.
1038 static void draw_default_sensor_header(bSensor *sens,
1046 /* Pulsing and frequency */
1047 uiBlockBeginAlign(block);
1048 uiDefIconButBitS(block, TOG, SENS_PULSE_REPEAT, 1, ICON_DOTSUP,
1049 (short)(x + 10 + 0. * (w-20)), (short)(y - 21), (short)(0.1 * (w-20)), 19,
1050 &sens->pulse, 0.0, 0.0, 0, 0,
1051 "Activate TRUE level triggering (pulse mode)");
1053 uiDefIconButBitS(block, TOG, SENS_NEG_PULSE_MODE, 1, ICON_DOTSDOWN,
1054 (short)(x + 10 + 0.1 * (w-20)), (short)(y - 21), (short)(0.1 * (w-20)), 19,
1055 &sens->pulse, 0.0, 0.0, 0, 0,
1056 "Activate FALSE level triggering (pulse mode)");
1057 uiDefButS(block, NUM, 1, "f:",
1058 (short)(x + 10 + 0.2 * (w-20)), (short)(y - 21), (short)(0.275 * (w-20)), 19,
1059 &sens->freq, 0.0, 10000.0, 0, 0,
1060 "Delay between repeated pulses (in logic tics, 0 = no delay)");
1061 uiBlockEndAlign(block);
1063 /* value or shift? */
1064 uiBlockBeginAlign(block);
1065 but= uiDefButS(block, TOG, 1, "Level",
1066 (short)(x + 10 + 0.5 * (w-20)), (short)(y - 21), (short)(0.20 * (w-20)), 19,
1067 &sens->level, 0.0, 0.0, 0, 0,
1068 "Level detector, trigger controllers of new states (only applicable upon logic state transition)");
1069 uiButSetFunc(but, verify_logicbutton_func, sens, &(sens->level));
1070 but= uiDefButS(block, TOG, 1, "Tap",
1071 (short)(x + 10 + 0.702 * (w-20)), (short)(y - 21), (short)(0.12 * (w-20)), 19,
1072 &sens->tap, 0.0, 0.0, 0, 0,
1073 "Trigger controllers only for an instant, even while the sensor remains true");
1074 uiButSetFunc(but, verify_logicbutton_func, sens, &(sens->tap));
1075 uiBlockEndAlign(block);
1077 uiDefButS(block, TOG, 1, "Inv",
1078 (short)(x + 10 + 0.85 * (w-20)), (short)(y - 21), (short)(0.15 * (w-20)), 19,
1079 &sens->invert, 0.0, 0.0, 0, 0,
1080 "Invert the level (output) of this sensor");
1083 static void get_armature_bone_constraint(Object *ob, const char *posechannel, const char *constraint_name, bConstraint **constraint)
1085 /* check that bone exist in the active object */
1086 if (ob->type == OB_ARMATURE && ob->pose) {
1087 bPoseChannel *pchan= get_pose_channel(ob->pose, posechannel);
1089 bConstraint *con= BLI_findstring(&pchan->constraints, constraint_name, offsetof(bConstraint, name));
1095 /* didn't find any */
1097 static void check_armature_bone_constraint(Object *ob, char *posechannel, char *constraint)
1099 /* check that bone exist in the active object */
1100 if (ob->type == OB_ARMATURE && ob->pose) {
1101 bPoseChannel *pchan;
1102 bPose *pose = ob->pose;
1103 for (pchan=pose->chanbase.first; pchan; pchan=pchan->next) {
1104 if (!strcmp(pchan->name, posechannel)) {
1105 /* found it, now look for constraint channel */
1107 for (con=pchan->constraints.first; con; con=con->next) {
1108 if (!strcmp(con->name, constraint)) {
1109 /* found it, all ok */
1113 /* didn't find constraint, make empty */
1119 /* didn't find any */
1124 static void check_armature_sensor(bContext *C, void *arg1_but, void *arg2_sens)
1126 bArmatureSensor *sens = arg2_sens;
1127 uiBut *but = arg1_but;
1128 Object *ob= CTX_data_active_object(C);
1130 /* check that bone exist in the active object */
1131 but->retval = B_REDR;
1132 check_armature_bone_constraint(ob, sens->posechannel, sens->constraint);
1135 static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short xco, short yco, short width)
1137 bNearSensor *ns = NULL;
1138 bTouchSensor *ts = NULL;
1139 bKeyboardSensor *ks = NULL;
1140 bPropertySensor *ps = NULL;
1141 bArmatureSensor *arm = NULL;
1142 bMouseSensor *ms = NULL;
1143 bCollisionSensor *cs = NULL;
1144 bRadarSensor *rs = NULL;
1145 bRandomSensor *randomSensor = NULL;
1146 bRaySensor *raySens = NULL;
1147 bMessageSensor *mes = NULL;
1148 bJoystickSensor *joy = NULL;
1149 bActuatorSensor *as = NULL;
1150 bDelaySensor *ds = NULL;
1155 /* yco is at the top of the rect, draw downwards */
1157 set_col_sensor(sens->type, 0);
1165 glRects(xco, yco-ysize, xco+width, yco);
1166 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1168 draw_default_sensor_header(sens, block, xco, yco, width);
1178 glRects(xco, yco-ysize, xco+width, yco);
1179 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1181 draw_default_sensor_header(sens, block, xco, yco, width);
1185 /* uiDefBut(block, TEX, 1, "Property:", xco,yco-22,width, 19, &ts->name, 0, 31, 0, 0, "Only look for Objects with this property"); */
1186 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");
1187 ///* 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");
1191 case SENS_COLLISION:
1195 glRects(xco, yco-ysize, xco+width, yco);
1196 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1198 draw_default_sensor_header(sens, block, xco, yco, width);
1201 /* The collision sensor will become a generic collision (i.e. it */
1202 /* absorb the old touch sensor). */
1204 uiDefButBitS(block, TOG, SENS_COLLISION_PULSE, B_REDR, "Pulse",(short)(xco + 10),(short)(yco - 44),
1205 (short)(0.20 * (width-20)), 19, &cs->mode, 0.0, 0.0, 0, 0,
1206 "Changes to the set of colliding objects generated pulses");
1208 uiDefButBitS(block, TOG, SENS_COLLISION_MATERIAL, B_REDR, "M/P",(short)(xco + 10 + (0.20 * (width-20))),(short)(yco - 44),
1209 (short)(0.20 * (width-20)), 19, &cs->mode, 0.0, 0.0, 0, 0,
1210 "Toggle collision on material or property");
1212 if (cs->mode & SENS_COLLISION_MATERIAL) {
1213 uiDefBut(block, TEX, 1, "Material:", (short)(xco + 10 + 0.40 * (width-20)),
1214 (short)(yco-44), (short)(0.6*(width-20)), 19, &cs->materialName, 0, 31, 0, 0,
1215 "Only look for Objects with this material");
1217 uiDefBut(block, TEX, 1, "Property:", (short)(xco + 10 + 0.40 * (width-20)), (short)(yco-44),
1218 (short)(0.6*(width-20)), 19, &cs->name, 0, 31, 0, 0,
1219 "Only look for Objects with this property");
1222 /* 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"); */
1231 glRects(xco, yco-ysize, xco+width, yco);
1232 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1234 draw_default_sensor_header(sens, block, xco, yco, width);
1237 uiDefBut(block, TEX, 1, "Property:",(short)(10+xco),(short)(yco-44), (short)(width-20), 19,
1238 &ns->name, 0, 31, 0, 0, "Only look for Objects with this property");
1239 uiDefButF(block, NUM, 1, "Dist",(short)(10+xco),(short)(yco-68),(short)((width-22)/2), 19,
1240 &ns->dist, 0.0, 1000.0, 1000, 0, "Trigger distance");
1241 uiDefButF(block, NUM, 1, "Reset",(short)(10+xco+(width-22)/2), (short)(yco-68), (short)((width-22)/2), 19,
1242 &ns->resetdist, 0.0, 1000.0, 1000, 0, "Reset distance");
1250 glRects(xco, yco-ysize, xco+width, yco);
1251 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1253 draw_default_sensor_header(sens, block, xco, yco, width);
1257 uiDefBut(block, TEX, 1, "Prop:",
1258 (short)(10+xco),(short)(yco-44), (short)(0.7 * (width-20)), 19,
1259 &rs->name, 0, 31, 0, 0,
1260 "Only look for Objects with this property");
1262 str = "Type %t|+X axis %x0|+Y axis %x1|+Z axis %x2|-X axis %x3|-Y axis %x4|-Z axis %x5";
1263 uiDefButS(block, MENU, B_REDR, str,
1264 (short)(10+xco+0.7 * (width-20)), (short)(yco-44), (short)(0.3 * (width-22)), 19,
1265 &rs->axis, 2.0, 31, 0, 0,
1266 "Specify along which axis the radar cone is cast");
1268 uiDefButF(block, NUM, 1, "Ang:",
1269 (short)(10+xco), (short)(yco-68), (short)((width-20)/2), 19,
1270 &rs->angle, 0.0, 179.9, 10, 0,
1271 "Opening angle of the radar cone");
1272 uiDefButF(block, NUM, 1, "Dist:",
1273 (short)(xco+10 + (width-20)/2), (short)(yco-68), (short)((width-20)/2), 19,
1274 &rs->range, 0.01, 10000.0, 100, 0,
1275 "Depth of the radar cone");
1283 /* 5 lines: 120 height */
1284 ysize= (ks->type&1) ? 96:120;
1286 glRects(xco, yco-ysize, xco+width, yco);
1287 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1290 draw_default_sensor_header(sens, block, xco, yco, width);
1292 /* part of line 1 */
1293 uiDefBut(block, LABEL, 0, "Key", xco, yco-44, 40, 19, NULL, 0, 0, 0, 0, "");
1294 uiDefButBitS(block, TOG, 1, B_REDR, "All keys", xco+40+(width/2), yco-44, (width/2)-50, 19,
1295 &ks->type, 0, 0, 0, 0, "");
1298 if ((ks->type&1)==0) { /* is All Keys option off? */
1299 /* line 2: hotkey and allkeys toggle */
1300 but= uiDefKeyevtButS(block, 0, "", xco+40, yco-44, (width)/2, 19, &ks->key, "Key code");
1301 uiButSetFunc(but, test_keyboard_event, ks, NULL);
1303 /* line 3: two key modifyers (qual1, qual2) */
1304 uiDefBut(block, LABEL, 0, "Hold", xco, yco-68, 40, 19, NULL, 0, 0, 0, 0, "");
1305 but= uiDefKeyevtButS(block, 0, "", xco+40, yco-68, (width-50)/2, 19, &ks->qual, "Modifier key code");
1306 uiButSetFunc(but, test_keyboard_event, ks, NULL);
1307 but= uiDefKeyevtButS(block, 0, "", xco+40+(width-50)/2, yco-68, (width-50)/2, 19, &ks->qual2, "Second Modifier key code");
1308 uiButSetFunc(but, test_keyboard_event, ks, NULL);
1311 /* line 4: toggle property for string logging mode */
1312 uiDefBut(block, TEX, 1, "LogToggle: ",
1313 xco+10, yco-((ks->type&1) ? 68:92), (width-20), 19,
1314 ks->toggleName, 0, 31, 0, 0,
1315 "Property that indicates whether to log "
1316 "keystrokes as a string");
1318 /* line 5: target property for string logging mode */
1319 uiDefBut(block, TEX, 1, "Target: ",
1320 xco+10, yco-((ks->type&1) ? 92:116), (width-20), 19,
1321 ks->targetName, 0, 31, 0, 0,
1322 "Property that receives the keystrokes in case "
1323 "a string is logged");
1332 glRects(xco, yco-ysize, xco+width, yco);
1333 uiEmboss((float)xco, (float)yco-ysize,
1334 (float)xco+width, (float)yco, 1);
1336 draw_default_sensor_header(sens, block, xco, yco, width);
1339 str= "Type %t|Equal %x0|Not Equal %x1|Interval %x2|Changed %x3";
1340 /* str= "Type %t|Equal %x0|Not Equal %x1"; */
1341 uiDefButI(block, MENU, B_REDR, str, xco+30,yco-44,width-60, 19,
1342 &ps->type, 0, 31, 0, 0, "Type");
1344 if (ps->type != SENS_PROP_EXPRESSION)
1346 uiDefBut(block, TEX, 1, "Prop: ", xco+30,yco-68,width-60, 19,
1347 ps->name, 0, 31, 0, 0, "Property name");
1350 if(ps->type == SENS_PROP_INTERVAL)
1352 uiDefBut(block, TEX, 1, "Min: ", xco,yco-92,width/2, 19,
1353 ps->value, 0, 31, 0, 0, "check for min value");
1354 uiDefBut(block, TEX, 1, "Max: ", xco+width/2,yco-92,width/2, 19,
1355 ps->maxvalue, 0, 31, 0, 0, "check for max value");
1357 else if(ps->type == SENS_PROP_CHANGED);
1360 uiDefBut(block, TEX, 1, "Value: ", xco+30,yco-92,width-60, 19,
1361 ps->value, 0, 31, 0, 0, "check for value");
1371 glRects(xco, yco-ysize, xco+width, yco);
1372 uiEmboss((float)xco, (float)yco-ysize,
1373 (float)xco+width, (float)yco, 1);
1375 draw_default_sensor_header(sens, block, xco, yco, width);
1378 if (ob->type == OB_ARMATURE) {
1379 uiBlockBeginAlign(block);
1380 but = uiDefBut(block, TEX, 1, "Bone: ",
1381 (xco+10), (yco-44), (width-20)/2, 19,
1382 arm->posechannel, 0, 31, 0, 0,
1383 "Bone on which you want to check a constraint");
1384 uiButSetFunc(but, check_armature_sensor, but, arm);
1385 but = uiDefBut(block, TEX, 1, "Cons: ",
1386 (xco+10)+(width-20)/2, (yco-44), (width-20)/2, 19,
1387 arm->constraint, 0, 31, 0, 0,
1388 "Name of the constraint you want to control");
1389 uiButSetFunc(but, check_armature_sensor, but, arm);
1390 uiBlockEndAlign(block);
1392 str= "Type %t|State changed %x0|Lin error below %x1|Lin error above %x2|Rot error below %x3|Rot error above %x4";
1394 uiDefButI(block, MENU, B_REDR, str, xco+10,yco-66,0.4*(width-20), 19,
1395 &arm->type, 0, 31, 0, 0, "Type");
1397 if (arm->type != SENS_ARM_STATE_CHANGED)
1399 uiDefButF(block, NUM, 1, "Value: ", xco+10+0.4*(width-20),yco-66,0.6*(width-20), 19,
1400 &arm->value, -10000.0, 10000.0, 100, 0, "Test the error against this value");
1410 glRects(xco, yco-ysize, xco+width, yco);
1411 uiEmboss((float)xco, (float)yco-ysize,
1412 (float)xco+width, (float)yco, 1);
1414 draw_default_sensor_header(sens, block, xco, yco, width);
1417 uiDefBut(block, TEX, 1, "Act: ", xco+30,yco-44,width-60, 19,
1418 as->name, 0, 31, 0, 0, "Actuator name, actuator active state modifications will be detected");
1426 glRects(xco, yco-ysize, xco+width, yco);
1427 uiEmboss((float)xco, (float)yco-ysize,
1428 (float)xco+width, (float)yco, 1);
1430 draw_default_sensor_header(sens, block, xco, yco, width);
1433 uiDefButS(block, NUM, 0, "Delay",(short)(10+xco),(short)(yco-44),(short)((width-22)*0.4+10), 19,
1434 &ds->delay, 0.0, 5000.0, 0, 0, "Delay in number of logic tics before the positive trigger (default 60 per second)");
1435 uiDefButS(block, NUM, 0, "Dur",(short)(10+xco+(width-22)*0.4+10),(short)(yco-44),(short)((width-22)*0.4-10), 19,
1436 &ds->duration, 0.0, 5000.0, 0, 0, "If >0, delay in number of logic tics before the negative trigger following the positive trigger");
1437 uiDefButBitS(block, TOG, SENS_DELAY_REPEAT, 0, "REP",(short)(xco + 10 + (width-22)*0.8),(short)(yco - 44),
1438 (short)(0.20 * (width-22)), 19, &ds->flag, 0.0, 0.0, 0, 0,
1439 "Toggle repeat option. If selected, the sensor restarts after Delay+Dur logic tics");
1446 /* Two lines: 48 pixels high. */
1449 glRects(xco, yco-ysize, xco+width, yco);
1450 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1452 /* line 1: header */
1453 draw_default_sensor_header(sens, block, xco, yco, width);
1455 /* Line 2: type selection. The number are a bit mangled to get
1456 * proper compatibility with older .blend files. */
1457 /* Any sensor type default is 0 but the ms enum starts in 1.
1458 * Therefore the mosue sensor is initialized to 1 in sca.c */
1459 str= "Type %t|Left button %x1|Middle button %x2|"
1460 "Right button %x4|Wheel Up %x5|Wheel Down %x6|Movement %x8|Mouse over %x16|Mouse over any%x32";
1461 uiDefButS(block, MENU, B_REDR, str, xco+10, yco-44, (width*0.8f)-20, 19,
1462 &ms->type, 0, 31, 0, 0,
1463 "Specify the type of event this mouse sensor should trigger on");
1466 uiDefButBitS(block, TOG, SENS_MOUSE_FOCUS_PULSE, B_REDR, "Pulse",(short)(xco + 10) + (width*0.8f)-20,(short)(yco - 44),
1467 (short)(0.20 * (width-20)), 19, &ms->flag, 0.0, 0.0, 0, 0,
1468 "Moving the mouse over a different object generates a pulse");
1478 glRects(xco, yco-ysize, xco+width, yco);
1479 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1481 draw_default_sensor_header(sens, block, xco, yco, width);
1482 randomSensor = sens->data;
1483 /* some files were wrongly written, avoid crash now */
1486 uiDefButI(block, NUM, 1, "Seed: ", xco+10,yco-44,(width-20), 19,
1487 &randomSensor->seed, 0, 1000, 0, 0,
1488 "Initial seed of the generator. (Choose 0 for not random)");
1496 glRects(xco, yco-ysize, xco+width, yco);
1497 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1499 draw_default_sensor_header(sens, block, xco, yco, width);
1500 raySens = sens->data;
1502 /* 1. property or material */
1503 uiDefButBitS(block, TOG, SENS_COLLISION_MATERIAL, B_REDR, "M/P",
1504 xco + 10,yco - 44, 0.20 * (width-20), 19,
1505 &raySens->mode, 0.0, 0.0, 0, 0,
1506 "Toggle collision on material or property");
1508 if (raySens->mode & SENS_COLLISION_MATERIAL)
1510 uiDefBut(block, TEX, 1, "Material:", xco + 10 + 0.20 * (width-20), yco-44, 0.8*(width-20), 19,
1511 &raySens->matname, 0, 31, 0, 0,
1512 "Only look for Objects with this material");
1516 uiDefBut(block, TEX, 1, "Property:", xco + 10 + 0.20 * (width-20), yco-44, 0.8*(width-20), 19,
1517 &raySens->propname, 0, 31, 0, 0,
1518 "Only look for Objects with this property");
1522 uiDefButBitS(block, TOG, SENS_RAY_XRAY, 1, "X",
1523 xco + 10,yco - 68, 0.10 * (width-20), 19,
1524 &raySens->mode, 0.0, 0.0, 0, 0,
1525 "Toggle X-Ray option (see through objects that don't have the property)");
1526 /* 2. sensing range */
1527 uiDefButF(block, NUM, 1, "Range", xco+10 + 0.10 * (width-20), yco-68, 0.5 * (width-20), 19,
1528 &raySens->range, 0.01, 10000.0, 100, 0,
1529 "Sense objects no farther than this distance");
1531 /* 3. axis choice */
1532 str = "Type %t|+ X axis %x1|+ Y axis %x0|+ Z axis %x2|- X axis %x3|- Y axis %x4|- Z axis %x5";
1533 uiDefButI(block, MENU, B_REDR, str, xco+10 + 0.6 * (width-20), yco-68, 0.4 * (width-20), 19,
1534 &raySens->axisflag, 2.0, 31, 0, 0,
1535 "Specify along which axis the ray is cast");
1543 ysize = 2 * 24; /* total number of lines * 24 pixels/line */
1545 glRects(xco, yco-ysize, xco+width, yco);
1546 uiEmboss((float)xco, (float)yco-ysize,
1547 (float)xco+width, (float)yco, 1);
1549 /* line 1: header line */
1550 draw_default_sensor_header(sens, block, xco, yco, width);
1552 /* line 2: Subject filter */
1553 uiDefBut(block, TEX, 1, "Subject: ",
1554 (xco+10), (yco-44), (width-20), 19,
1555 mes->subject, 0, 31, 0, 0,
1556 "Optional subject filter: only accept messages with this subject"
1557 ", or empty for all");
1567 glRects(xco, yco-ysize, xco+width, yco);
1568 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1570 /* line 1: header */
1571 draw_default_sensor_header(sens, block, xco, yco, width);
1575 uiDefButC(block, NUM, 1, "Index:", xco+10, yco-44, 0.33 * (width-20), 19,
1576 &joy->joyindex, 0, SENS_JOY_MAXINDEX-1, 100, 0,
1577 "Specify which joystick to use");
1579 str= "Type %t|Button %x0|Axis %x1|Single Axis %x3|Hat%x2";
1580 uiDefButC(block, MENU, B_REDR, str, xco+87, yco-44, 0.26 * (width-20), 19,
1581 &joy->type, 0, 31, 0, 0,
1582 "The type of event this joystick sensor is triggered on");
1584 if (joy->type != SENS_JOY_AXIS_SINGLE) {
1585 if (joy->flag & SENS_JOY_ANY_EVENT) {
1586 switch (joy->type) {
1588 str = "All Axis Events";
1590 case SENS_JOY_BUTTON:
1591 str = "All Button Events";
1594 str = "All Hat Events";
1601 uiDefButBitS(block, TOG, SENS_JOY_ANY_EVENT, B_REDR, str,
1602 xco+10 + 0.475 * (width-20), yco-68, ((joy->flag & SENS_JOY_ANY_EVENT) ? 0.525 : 0.12) * (width-20), 19,
1603 &joy->flag, 0, 0, 0, 0,
1604 "Triggered by all events on this joysticks current type (axis/button/hat)");
1606 if(joy->type == SENS_JOY_BUTTON)
1608 if ((joy->flag & SENS_JOY_ANY_EVENT)==0) {
1609 uiDefButI(block, NUM, 1, "Number:", xco+10 + 0.6 * (width-20), yco-68, 0.4 * (width-20), 19,
1610 &joy->button, 0, 18, 100, 0,
1611 "Specify which button to use");
1614 else if(joy->type == SENS_JOY_AXIS)
1616 uiDefButS(block, NUM, 1, "Number:", xco+10, yco-68, 0.46 * (width-20), 19,
1617 &joy->axis, 1, 8.0, 100, 0,
1618 "Specify which axis pair to use, 1 is useually the main direction input");
1620 uiDefButI(block, NUM, 1, "Threshold:", xco+10 + 0.6 * (width-20),yco-44, 0.4 * (width-20), 19,
1621 &joy->precision, 0, 32768.0, 100, 0,
1622 "Specify the precision of the axis");
1624 if ((joy->flag & SENS_JOY_ANY_EVENT)==0) {
1625 str = "Type %t|Up Axis %x1 |Down Axis %x3|Left Axis %x2|Right Axis %x0";
1626 uiDefButI(block, MENU, B_REDR, str, xco+10 + 0.6 * (width-20), yco-68, 0.4 * (width-20), 19,
1627 &joy->axisf, 2.0, 31, 0, 0,
1628 "The direction of the axis, use 'All Events' to receive events on any direction");
1631 else if (joy->type == SENS_JOY_HAT)
1633 uiDefButI(block, NUM, 1, "Number:", xco+10, yco-68, 0.46 * (width-20), 19,
1634 &joy->hat, 1, 4.0, 100, 0,
1635 "Specify which hat to use");
1637 if ((joy->flag & SENS_JOY_ANY_EVENT)==0) {
1638 str = "Direction%t|Up%x1|Down%x4|Left%x8|Right%x2|%l|Up/Right%x3|Down/Left%x12|Up/Left%x9|Down/Right%x6";
1639 uiDefButI(block, MENU, 0, str, xco+10 + 0.6 * (width-20), yco-68, 0.4 * (width-20), 19,
1640 &joy->hatf, 2.0, 31, 0, 0,
1641 "The direction of the hat, use 'All Events' to receive events on any direction");
1644 else { /* (joy->type == SENS_JOY_AXIS_SINGLE)*/
1645 uiDefButS(block, NUM, 1, "Number:", xco+10, yco-68, 0.46 * (width-20), 19,
1646 &joy->axis_single, 1, 16.0, 100, 0,
1647 "Specify a single axis (verticle/horizontal/other) to detect");
1649 uiDefButI(block, NUM, 1, "Threshold:", xco+10 + 0.6 * (width-20),yco-44, 0.4 * (width-20), 19,
1650 &joy->precision, 0, 32768.0, 100, 0,
1651 "Specify the precision of the axis");
1663 static short draw_controllerbuttons(bController *cont, uiBlock *block, short xco, short yco, short width)
1665 bExpressionCont *ec;
1669 switch (cont->type) {
1670 case CONT_EXPRESSION:
1673 UI_ThemeColor(TH_PANEL);
1674 glRects(xco, yco-ysize, xco+width, yco);
1675 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1677 /* uiDefBut(block, LABEL, 1, "Not yet...", xco,yco-24,80, 19, NULL, 0, 0, 0, 0, ""); */
1679 /* uiDefBut(block, BUT, 1, "Variables", xco,yco-24,80, 19, NULL, 0, 0, 0, 0, "Available variables for expression"); */
1680 uiDefBut(block, TEX, 1, "Exp:", xco + 10 , yco-21, width-20, 19,
1681 ec->str, 0, 127, 0, 0,
1689 if(cont->data==NULL) init_controller(cont);
1692 UI_ThemeColor(TH_PANEL);
1693 glRects(xco, yco-ysize, xco+width, yco);
1694 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1697 uiBlockBeginAlign(block);
1698 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)");
1700 uiDefIDPoinBut(block, test_scriptpoin_but, ID_TXT, 1, "", xco+70,yco-23,width-74, 19, &pc->text, "Blender textblock to run as a script");
1702 uiDefBut(block, TEX, 1, "", xco+70,yco-23,(width-70)-25, 19, pc->module, 0, 63, 0, 0, "Module name and function to run e.g. \"someModule.main\". Internal texts and external python files can be used");
1703 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");
1705 uiBlockEndAlign(block);
1713 UI_ThemeColor(TH_PANEL);
1714 glRects(xco, yco-ysize, xco+width, yco);
1715 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1723 static int get_col_actuator(int type)
1726 case ACT_ACTION: return TH_PANEL;
1727 case ACT_SHAPEACTION: return TH_PANEL;
1728 case ACT_OBJECT: return TH_PANEL;
1729 case ACT_IPO: return TH_PANEL;
1730 case ACT_PROPERTY: return TH_PANEL;
1731 case ACT_SOUND: return TH_PANEL;
1732 case ACT_CAMERA: return TH_PANEL;
1733 case ACT_EDIT_OBJECT: return TH_PANEL;
1734 case ACT_GROUP: return TH_PANEL;
1735 case ACT_RANDOM: return TH_PANEL;
1736 case ACT_SCENE: return TH_PANEL;
1737 case ACT_MESSAGE: return TH_PANEL;
1738 case ACT_GAME: return TH_PANEL;
1739 case ACT_VISIBILITY: return TH_PANEL;
1740 case ACT_CONSTRAINT: return TH_PANEL;
1741 case ACT_STATE: return TH_PANEL;
1742 case ACT_ARMATURE: return TH_PANEL;
1743 default: return TH_PANEL;
1746 static void set_col_actuator(int item, int medium)
1748 int col= get_col_actuator(item);
1749 UI_ThemeColorShade(col, medium?30:10);
1753 static void change_object_actuator(bContext *UNUSED(C), void *act, void *UNUSED(arg))
1755 bObjectActuator *oa = act;
1757 if (oa->type != oa->otype) {
1759 case ACT_OBJECT_NORMAL:
1760 memset(oa, 0, sizeof(bObjectActuator));
1761 oa->flag = ACT_FORCE_LOCAL|ACT_TORQUE_LOCAL|ACT_DLOC_LOCAL|ACT_DROT_LOCAL;
1762 oa->type = ACT_OBJECT_NORMAL;
1765 case ACT_OBJECT_SERVO:
1766 memset(oa, 0, sizeof(bObjectActuator));
1767 oa->flag = ACT_LIN_VEL_LOCAL;
1768 oa->type = ACT_OBJECT_SERVO;
1769 oa->forcerot[0] = 30.0f;
1770 oa->forcerot[1] = 0.5f;
1771 oa->forcerot[2] = 0.0f;
1777 static void change_ipo_actuator(bContext *UNUSED(C), void *arg1_but, void *arg2_ia)
1779 bIpoActuator *ia = arg2_ia;
1780 uiBut *but = arg1_but;
1782 if (but->retval & ACT_IPOFORCE)
1783 ia->flag &= ~ACT_IPOADD;
1784 else if (but->retval & ACT_IPOADD)
1785 ia->flag &= ~ACT_IPOFORCE;
1786 but->retval = B_REDR;
1789 void update_object_actuator_PID(bContext *UNUSED(C), void *act, void *UNUSED(arg))
1791 bObjectActuator *oa = act;
1792 oa->forcerot[0] = 60.0f*oa->forcerot[1];
1795 char *get_state_name(Object *ob, short bit)
1801 cont = ob->controllers.first;
1803 if (cont->state_mask & mask) {
1811 static void check_state_mask(bContext *C, void *arg1_but, void *arg2_mask)
1813 wmWindow *win= CTX_wm_window(C);
1814 int shift= win->eventstate->shift;
1815 unsigned int *cont_mask = arg2_mask;
1816 uiBut *but = arg1_but;
1818 if (*cont_mask == 0 || !(shift))
1819 *cont_mask = (1<<but->retval);
1820 but->retval = B_REDR;
1823 static void check_armature_actuator(bContext *C, void *arg1_but, void *arg2_act)
1825 bArmatureActuator *act = arg2_act;
1826 uiBut *but = arg1_but;
1827 Object *ob= CTX_data_active_object(C);
1829 /* check that bone exist in the active object */
1830 but->retval = B_REDR;
1831 check_armature_bone_constraint(ob, act->posechannel, act->constraint);
1835 static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlock *block, short xco, short yco, short width)
1837 bSoundActuator *sa = NULL;
1838 bObjectActuator *oa = NULL;
1839 bIpoActuator *ia = NULL;
1840 bPropertyActuator *pa = NULL;
1841 bCameraActuator *ca = NULL;
1842 bEditObjectActuator *eoa = NULL;
1843 bConstraintActuator *coa = NULL;
1844 bSceneActuator *sca = NULL;
1845 bGroupActuator *ga = NULL;
1846 bRandomActuator *randAct = NULL;
1847 bMessageActuator *ma = NULL;
1848 bActionActuator *aa = NULL;
1849 bGameActuator *gma = NULL;
1850 bVisibilityActuator *visAct = NULL;
1851 bTwoDFilterActuator *tdfa = NULL;
1852 bParentActuator *parAct = NULL;
1853 bStateActuator *staAct = NULL;
1854 bArmatureActuator *armAct = NULL;
1857 short ysize = 0, wval;
1863 /* yco is at the top of the rect, draw downwards */
1864 set_col_actuator(act->type, 0);
1871 wval = (width-100)/3;
1872 if (oa->type == ACT_OBJECT_NORMAL)
1874 if ( ob->gameflag & OB_DYNAMIC )
1883 glRects(xco, yco-ysize, xco+width, yco);
1884 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1886 uiBlockBeginAlign(block);
1887 uiDefBut(block, LABEL, 0, "Loc", xco, yco-45, 45, 19, NULL, 0, 0, 0, 0, "Sets the location");
1888 uiDefButF(block, NUM, 0, "", xco+45, yco-45, wval, 19, oa->dloc, -10000.0, 10000.0, 10, 0, "");
1889 uiDefButF(block, NUM, 0, "", xco+45+wval, yco-45, wval, 19, oa->dloc+1, -10000.0, 10000.0, 10, 0, "");
1890 uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-45, wval, 19, oa->dloc+2, -10000.0, 10000.0, 10, 0, "");
1891 uiBlockEndAlign(block);
1893 uiDefBut(block, LABEL, 0, "Rot", xco, yco-64, 45, 19, NULL, 0, 0, 0, 0, "Sets the rotation");
1894 uiBlockBeginAlign(block);
1895 uiDefButF(block, NUM, 0, "", xco+45, yco-64, wval, 19, oa->drot, -10000.0, 10000.0, 10, 0, "");
1896 uiDefButF(block, NUM, 0, "", xco+45+wval, yco-64, wval, 19, oa->drot+1, -10000.0, 10000.0, 10, 0, "");
1897 uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-64, wval, 19, oa->drot+2, -10000.0, 10000.0, 10, 0, "");
1898 uiBlockEndAlign(block);
1900 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");
1901 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");
1903 if ( ob->gameflag & OB_DYNAMIC )
1905 uiDefBut(block, LABEL, 0, "Force", xco, yco-87, 55, 19, NULL, 0, 0, 0, 0, "Sets the force");
1906 uiBlockBeginAlign(block);
1907 uiDefButF(block, NUM, 0, "", xco+45, yco-87, wval, 19, oa->forceloc, -10000.0, 10000.0, 10, 0, "");
1908 uiDefButF(block, NUM, 0, "", xco+45+wval, yco-87, wval, 19, oa->forceloc+1, -10000.0, 10000.0, 10, 0, "");
1909 uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-87, wval, 19, oa->forceloc+2, -10000.0, 10000.0, 10, 0, "");
1910 uiBlockEndAlign(block);
1912 uiDefBut(block, LABEL, 0, "Torque", xco, yco-106, 55, 19, NULL, 0, 0, 0, 0, "Sets the torque");
1913 uiBlockBeginAlign(block);
1914 uiDefButF(block, NUM, 0, "", xco+45, yco-106, wval, 19, oa->forcerot, -10000.0, 10000.0, 10, 0, "");
1915 uiDefButF(block, NUM, 0, "", xco+45+wval, yco-106, wval, 19, oa->forcerot+1, -10000.0, 10000.0, 10, 0, "");
1916 uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-106, wval, 19, oa->forcerot+2, -10000.0, 10000.0, 10, 0, "");
1917 uiBlockEndAlign(block);
1920 if ( ob->gameflag & OB_DYNAMIC )
1922 uiDefBut(block, LABEL, 0, "LinV", xco, yco-129, 45, 19, NULL, 0, 0, 0, 0, "Sets the linear velocity");
1923 uiBlockBeginAlign(block);
1924 uiDefButF(block, NUM, 0, "", xco+45, yco-129, wval, 19, oa->linearvelocity, -10000.0, 10000.0, 10, 0, "");
1925 uiDefButF(block, NUM, 0, "", xco+45+wval, yco-129, wval, 19, oa->linearvelocity+1, -10000.0, 10000.0, 10, 0, "");
1926 uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-129, wval, 19, oa->linearvelocity+2, -10000.0, 10000.0, 10, 0, "");
1927 uiBlockEndAlign(block);
1929 uiDefBut(block, LABEL, 0, "AngV", xco, yco-148, 45, 19, NULL, 0, 0, 0, 0, "Sets the angular velocity");
1930 uiBlockBeginAlign(block);
1931 uiDefButF(block, NUM, 0, "", xco+45, yco-148, wval, 19, oa->angularvelocity, -10000.0, 10000.0, 10, 0, "");
1932 uiDefButF(block, NUM, 0, "", xco+45+wval, yco-148, wval, 19, oa->angularvelocity+1, -10000.0, 10000.0, 10, 0, "");
1933 uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-148, wval, 19, oa->angularvelocity+2, -10000.0, 10000.0, 10, 0, "");
1934 uiBlockEndAlign(block);
1936 uiDefBut(block, LABEL, 0, "Damp", xco, yco-171, 45, 19, NULL, 0, 0, 0, 0, "Number of frames to reach the target velocity");
1937 uiDefButS(block, NUM, 0, "", xco+45, yco-171, wval, 19, &oa->damping, 0.0, 1000.0, 100, 0, "");
1939 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");
1940 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");
1941 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");
1942 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");
1944 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");
1946 } else if (oa->type == ACT_OBJECT_SERVO)
1950 glRects(xco, yco-ysize, xco+width, yco);
1951 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1953 uiDefBut(block, LABEL, 0, "Ref", xco, yco-45, 45, 19, NULL, 0, 0, 0, 0, "");
1954 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");
1955 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");
1956 uiBlockBeginAlign(block);
1957 uiDefButF(block, NUM, 0, "", xco+45, yco-68, wval, 19, oa->linearvelocity, -10000.0, 10000.0, 10, 0, "");
1958 uiDefButF(block, NUM, 0, "", xco+45+wval, yco-68, wval, 19, oa->linearvelocity+1, -10000.0, 10000.0, 10, 0, "");
1959 uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-68, wval, 19, oa->linearvelocity+2, -10000.0, 10000.0, 10, 0, "");
1960 uiBlockEndAlign(block);
1961 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");
1963 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)");
1964 uiBlockBeginAlign(block);
1965 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");
1966 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");
1967 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");
1968 uiBlockEndAlign(block);
1969 uiDefBut(block, LABEL, 0, "Max", xco, yco-110, 45, 19, NULL, 0, 0, 0, 0, "Set the upper limit for force");
1970 uiDefBut(block, LABEL, 0, "Min", xco, yco-129, 45, 19, NULL, 0, 0, 0, 0, "Set the lower limit for force");
1971 if (oa->flag & ACT_SERVO_LIMIT_X) {
1972 uiDefButF(block, NUM, 0, "", xco+45, yco-110, wval, 19, oa->dloc, -10000.0, 10000.0, 10, 0, "");
1973 uiDefButF(block, NUM, 0, "", xco+45, yco-129, wval, 19, oa->drot, -10000.0, 10000.0, 10, 0, "");
1975 if (oa->flag & ACT_SERVO_LIMIT_Y) {
1976 uiDefButF(block, NUM, 0, "", xco+45+wval, yco-110, wval, 19, oa->dloc+1, -10000.0, 10000.0, 10, 0, "");
1977 uiDefButF(block, NUM, 0, "", xco+45+wval, yco-129, wval, 19, oa->drot+1, -10000.0, 10000.0, 10, 0, "");
1979 if (oa->flag & ACT_SERVO_LIMIT_Z) {
1980 uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-110, wval, 19, oa->dloc+2, -10000.0, 10000.0, 10, 0, "");
1981 uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-129, wval, 19, oa->drot+2, -10000.0, 10000.0, 10, 0, "");
1983 uiDefBut(block, LABEL, 0, "Servo", xco, yco-152, 45, 19, NULL, 0, 0, 0, 0, "Coefficients of the PID servo controller");
1984 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");
1985 uiDefBut(block, LABEL, 0, "Slow", xco, yco-171, 45, 19, NULL, 0, 0, 0, 0, "Low value of I coefficient correspond to slow response");
1986 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");
1987 uiButSetFunc(but, update_object_actuator_PID, oa, NULL);
1988 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");
1989 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");
1991 str= "Motion Type %t|Simple motion %x0|Servo Control %x1";
1992 but = uiDefButS(block, MENU, B_REDR, str, xco+40, yco-23, (width-80), 19, &oa->type, 0.0, 0.0, 0, 0, "");
1993 oa->otype = oa->type;
1994 uiButSetFunc(but, change_object_actuator, oa, NULL);
1999 case ACT_SHAPEACTION:
2002 #ifdef __NLA_ACTION_BY_MOTION_ACTUATOR
2008 glRects(xco, yco-ysize, xco+width, yco);
2009 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2012 wval = (width-60)/3;
2014 // str= "Action types %t|Play %x0|Ping Pong %x1|Flipper %x2|Loop Stop %x3|Loop End %x4|Property %x6";
2015 #ifdef __NLA_ACTION_BY_MOTION_ACTUATOR
2016 str= "Action types %t|Play %x0|Flipper %x2|Loop Stop %x3|Loop End %x4|Property %x6|Displacement %x7";
2018 str= "Action types %t|Play %x0|Flipper %x2|Loop Stop %x3|Loop End %x4|Property %x6";
2020 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");
2021 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");
2023 uiDefButBitS(block, TOGN, 1, 0, "Continue", xco+((width/3)*2)+20, yco-24, 60, 19,
2024 &aa->end_reset, 0.0, 0.0, 0, 0, "Restore last frame when switching on/off, otherwise play from the start each time");
2027 if(aa->type == ACT_ACTION_FROM_PROP)
2029 uiDefBut(block, TEX, 0, "Prop: ",xco+10, yco-44, width-20, 19, aa->name, 0.0, 31.0, 0, 0, "Use this property to define the Action position");
2033 uiDefButI(block, NUM, 0, "Sta: ",xco+10, yco-44, (width-20)/2, 19, &aa->sta, 1.0, MAXFRAMEF, 0, 0, "Start frame");
2034 uiDefButI(block, NUM, 0, "End: ",xco+10+(width-20)/2, yco-44, (width-20)/2, 19, &aa->end, 1.0, MAXFRAMEF, 0, 0, "End frame");
2037 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");
2038 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");
2040 uiDefBut(block, TEX, 0, "FrameProp: ",xco+10, yco-84, width-20, 19, aa->frameProp, 0.0, 31.0, 0, 0, "Assign the action's current frame number to this property");
2043 #ifdef __NLA_ACTION_BY_MOTION_ACTUATOR
2044 if(aa->type == ACT_ACTION_MOTION)
2046 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");
2061 glRects(xco, yco-ysize, xco+width, yco);
2062 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2064 str = "Ipo types %t|Play %x0|Ping Pong %x1|Flipper %x2|Loop Stop %x3|Loop End %x4|Property %x6";
2066 uiDefButS(block, MENU, B_REDR, str, xco+10, yco-24, (width-20)/2, 19, &ia->type, 0, 0, 0, 0, "");
2068 but = uiDefButBitS(block, TOG, ACT_IPOFORCE, ACT_IPOFORCE,
2069 "Force", xco+10+(width-20)/2, yco-24, (width-20)/4-10, 19,
2070 &ia->flag, 0, 0, 0, 0,
2071 "Apply Ipo as a global or local force depending on the local option (dynamic objects only)");
2072 uiButSetFunc(but, change_ipo_actuator, but, ia);
2074 but = uiDefButBitS(block, TOG, ACT_IPOADD, ACT_IPOADD,
2075 "Add", xco+3*(width-20)/4, yco-24, (width-20)/4-10, 19,
2076 &ia->flag, 0, 0, 0, 0,
2077 "Ipo is added to the current loc/rot/scale in global or local coordinate according to Local flag");
2078 uiButSetFunc(but, change_ipo_actuator, but, ia);
2080 /* Only show the do-force-local toggle if force is requested */
2081 if (ia->flag & (ACT_IPOFORCE|ACT_IPOADD)) {
2082 uiDefButBitS(block, TOG, ACT_IPOLOCAL, 0,
2083 "L", xco+width-30, yco-24, 20, 19,
2084 &ia->flag, 0, 0, 0, 0,
2085 "Let the ipo acts in local coordinates, used in Force and Add mode");
2088 if(ia->type==ACT_IPO_FROM_PROP) {
2089 uiDefBut(block, TEX, 0,
2090 "Prop: ", xco+10, yco-44, width-80, 19,
2091 ia->name, 0.0, 31.0, 0, 0,
2092 "Use this property to define the Ipo position");
2095 uiDefButI(block, NUM, 0,
2096 "Sta", xco+10, yco-44, (width-80)/2, 19,
2097 &ia->sta, 1.0, MAXFRAMEF, 0, 0,
2099 uiDefButI(block, NUM, 0,
2100 "End", xco+10+(width-80)/2, yco-44, (width-80)/2, 19,
2101 &ia->end, 1.0, MAXFRAMEF, 0, 0,
2104 uiDefButBitS(block, TOG, ACT_IPOCHILD, B_REDR,
2105 "Child", xco+10+(width-80), yco-44, 60, 19,
2106 &ia->flag, 0, 0, 0, 0,
2107 "Update IPO on all children Objects as well");
2108 uiDefBut(block, TEX, 0,
2109 "FrameProp: ", xco+10, yco-64, width-20, 19,
2110 ia->frameProp, 0.0, 31.0, 0, 0,
2111 "Assign the action's current frame number to this property");
2120 glRects(xco, yco-ysize, xco+width, yco);
2121 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2125 str= "Type%t|Assign%x0|Add %x1|Copy %x2|Toggle (bool/int/float/timer)%x3";
2126 uiDefButI(block, MENU, B_REDR, str, xco+30,yco-24,width-60, 19, &pa->type, 0, 31, 0, 0, "Type");
2128 uiDefBut(block, TEX, 1, "Prop: ", xco+30,yco-44,width-60, 19, pa->name, 0, 31, 0, 0, "Property name");
2131 if(pa->type==ACT_PROP_TOGGLE) {
2135 else if(pa->type==ACT_PROP_COPY) {
2136 uiDefIDPoinBut(block, test_obpoin_but, ID_OB, 1, "OB:", xco+10, yco-64, (width-20)/2, 19, &(pa->ob), "Copy from this Object");
2137 uiDefBut(block, TEX, 1, "Prop: ", xco+10+(width-20)/2, yco-64, (width-20)/2, 19, pa->value, 0, 31, 0, 0, "Copy this property");
2140 uiDefBut(block, TEX, 1, "Value: ", xco+30,yco-64,width-60, 19, pa->value, 0, 31, 0, 0, "change with this value, use \"\" around strings");
2151 if(sa->flag & ACT_SND_3D_SOUND)
2156 wval = (width-20)/2;
2157 glRects(xco, yco-ysize, xco+width, yco);
2158 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2160 if(bmain->sound.first) {
2161 IDnames_to_pupstring(&str, "Sound files", NULL, &(bmain->sound), (ID *)sa->sound, &(sa->sndnr));
2162 /* reset this value, it is for handling the event */
2164 uiDefButS(block, MENU, B_SOUNDACT_BROWSE, str, xco+10,yco-22,20,19, &(sa->sndnr), 0, 0, 0, 0, "");
2165 uiDefButO(block, BUT, "sound.open", 0, "Load Sound", xco+wval+10, yco-22, wval, 19, "Load a sound file. Remember to set caching on for small sounds that are played often.");
2168 char dummy_str[] = "Sound mode %t|Play Stop %x0|Play End %x1|Loop Stop %x2|Loop End %x3|Loop Ping Pong Stop %x5|Loop Ping Pong %x4";
2169 uiDefBut(block, TEX, B_IDNAME, "SO:",xco+30,yco-22,wval-20,19, ((ID *)sa->sound)->name+2, 0.0, 21.0, 0, 0, "");
2170 uiDefButS(block, MENU, 1, dummy_str,xco+10,yco-44,width-20, 19, &sa->type, 0.0, 0.0, 0, 0, "");
2171 uiDefButF(block, NUM, 0, "Volume:", xco+10,yco-66,wval, 19, &sa->volume, 0.0, 1.0, 0, 0, "Sets the volume of this sound");
2172 uiDefButF(block, NUM, 0, "Pitch:",xco+wval+10,yco-66,wval, 19, &sa->pitch,-12.0, 12.0, 0, 0, "Sets the pitch of this sound");
2173 uiDefButS(block, TOG | BIT, 0, "3D Sound", xco+10, yco-88, width-20, 19, &sa->flag, 0.0, 1.0, 0.0, 0.0, "Plays the sound positioned in 3D space.");
2174 if(sa->flag & ACT_SND_3D_SOUND)
2176 uiDefButF(block, NUM, 0, "Minimum Gain: ", xco+10, yco-110, wval, 19, &sa->sound3D.min_gain, 0.0, 1.0, 0.0, 0.0, "The minimum gain of the sound, no matter how far it is away.");
2177 uiDefButF(block, NUM, 0, "Maximum Gain: ", xco+10, yco-132, wval, 19, &sa->sound3D.max_gain, 0.0, 1.0, 0.0, 0.0, "The maximum gain of the sound, no matter how near it is.");
2178 uiDefButF(block, NUM, 0, "Reference Distance: ", xco+10, yco-154, wval, 19, &sa->sound3D.reference_distance, 0.0, FLT_MAX, 0.0, 0.0, "The reference distance is the distance where the sound has a gain of 1.0.");
2179 uiDefButF(block, NUM, 0, "Maximum Distance: ", xco+10, yco-176, wval, 19, &sa->sound3D.max_distance, 0.0, FLT_MAX, 0.0, 0.0, "The maximum distance at which you can hear the sound.");
2180 uiDefButF(block, NUM, 0, "Rolloff: ", xco+wval+10, yco-110, wval, 19, &sa->sound3D.rolloff_factor, 0.0, 5.0, 0.0, 0.0, "The rolloff factor defines the influence factor on volume depending on distance.");
2181 uiDefButF(block, NUM, 0, "Cone Outer Gain: ", xco+wval+10, yco-132, wval, 19, &sa->sound3D.cone_outer_gain, 0.0, 1.0, 0.0, 0.0, "The gain outside the outer cone. The gain in the outer cone will be interpolated between this value and the normal gain in the inner cone.");
2182 uiDefButF(block, NUM, 0, "Cone Outer Angle: ", xco+wval+10, yco-154, wval, 19, &sa->sound3D.cone_outer_angle, 0.0, 360.0, 0.0, 0.0, "The angle of the outer cone.");
2183 uiDefButF(block, NUM, 0, "Cone Inner Angle: ", xco+wval+10, yco-176, wval, 19, &sa->sound3D.cone_inner_angle, 0.0, 360.0, 0.0, 0.0, "The angle of the inner cone.");
2186 MEM_freeN((void *)str);
2189 uiDefButO(block, BUT, "sound.open", 0, "Load Sound", xco+10, yco-22, width-20, 19, "Load a sound file.");
2200 glRects(xco, yco-ysize, xco+width, yco);
2201 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2205 uiDefIDPoinBut(block, test_obpoin_but, ID_OB, 1, "OB:", xco+10, yco-24, (width-20)/2, 19, &(ca->ob), "Look at this Object");
2206 uiDefButF(block, NUM, 0, "Height:", xco+10+(width-20)/2, yco-24, (width-20)/2, 19, &ca->height, 0.0, 20.0, 0, 0, "");
2208 uiDefButF(block, NUM, 0, "Min:", xco+10, yco-44, (width-60)/2, 19, &ca->min, 0.0, 20.0, 0, 0, "");
2210 if(ca->axis==0) ca->axis= 'x';
2211 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");
2212 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");
2214 uiDefButF(block, NUM, 0, "Max:", xco+20+(width)/2, yco-44, (width-60)/2, 19, &ca->max, 0.0, 20.0, 0, 0, "");
2220 case ACT_EDIT_OBJECT:
2224 if(eoa->type==ACT_EDOB_ADD_OBJECT) {
2226 glRects(xco, yco-ysize, xco+width, yco);
2227 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2229 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)");
2230 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");
2233 uiDefBut(block, LABEL, 0, "linV", xco, yco-68, 45, 19,
2235 "Velocity upon creation");
2236 uiDefButF(block, NUM, 0, "", xco+45, yco-68, wval, 19,
2237 eoa->linVelocity, -100.0, 100.0, 10, 0,
2238 "Velocity upon creation, x component");
2239 uiDefButF(block, NUM, 0, "", xco+45+wval, yco-68, wval, 19,
2240 eoa->linVelocity+1, -100.0, 100.0, 10, 0,
2241 "Velocity upon creation, y component");
2242 uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-68, wval, 19,
2243 eoa->linVelocity+2, -100.0, 100.0, 10, 0,
2244 "Velocity upon creation, z component");
2245 uiDefButBitS(block, TOG, ACT_EDOB_LOCAL_LINV, 0, "L", xco+45+3*wval, yco-68, 15, 19,
2246 &eoa->localflag, 0.0, 0.0, 0, 0,
2247 "Apply the transformation locally");
2250 uiDefBut(block, LABEL, 0, "AngV", xco, yco-90, 45, 19,
2252 "Angular velocity upon creation");
2253 uiDefButF(block, NUM, 0, "", xco+45, yco-90, wval, 19,
2254 eoa->angVelocity, -10000.0, 10000.0, 10, 0,
2255 "Angular velocity upon creation, x component");
2256 uiDefButF(block, NUM, 0, "", xco+45+wval, yco-90, wval, 19,
2257 eoa->angVelocity+1, -10000.0, 10000.0, 10, 0,
2258 "Angular velocity upon creation, y component");
2259 uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-90, wval, 19,
2260 eoa->angVelocity+2, -10000.0, 10000.0, 10, 0,
2261 "Angular velocity upon creation, z component");
2262 uiDefButBitS(block, TOG, ACT_EDOB_LOCAL_ANGV, 0, "L", xco+45+3*wval, yco-90, 15, 19,
2263 &eoa->localflag, 0.0, 0.0, 0, 0,
2264 "Apply the rotation locally");
2268 else if(eoa->type==ACT_EDOB_END_OBJECT) {
2270 glRects(xco, yco-ysize, xco+width, yco);
2271 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2273 else if(eoa->type==ACT_EDOB_REPLACE_MESH) {
2275 glRects(xco, yco-ysize, xco+width, yco);
2276 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2278 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");
2280 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");
2281 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)");
2283 else if(eoa->type==ACT_EDOB_TRACK_TO) {
2285 glRects(xco, yco-ysize, xco+width, yco);
2286 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2288 uiDefIDPoinBut(block, test_obpoin_but, ID_OB, 1, "OB:", xco+10, yco-44, (width-20)/2, 19, &(eoa->ob), "Track to this Object");
2289 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");
2290 uiDefButS(block, TOG, 0, "3D", xco+width-50, yco-44, 40, 19, &eoa->flag, 0.0, 0.0, 0, 0, "Enable 3D tracking");
2292 else if(eoa->type==ACT_EDOB_DYNAMICS) {
2294 glRects(xco, yco-ysize, xco+width, yco);
2295 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2297 str= "Dynamic Operation %t|Restore Dynamics %x0|Suspend Dynamics %x1|Enable Rigid Body %x2|Disable Rigid Body %x3|Set Mass %x4";
2298 uiDefButS(block, MENU, B_REDR, str, xco+40, yco-44, (width-80), 19, &(eoa->dyn_operation), 0.0, 0.0, 0, 0, "");
2299 if(eoa->dyn_operation==4) {
2300 uiDefButF(block, NUM, 0, "", xco+40, yco-63, width-80, 19,
2301 &eoa->mass, 0.0, 10000.0, 10, 0,
2305 str= "Edit Object %t|Add Object %x0|End Object %x1|Replace Mesh %x2|Track to %x3|Dynamics %x4";
2306 uiDefButS(block, MENU, B_REDR, str, xco+40, yco-24, (width-80), 19, &eoa->type, 0.0, 0.0, 0, 0, "");
2312 case ACT_CONSTRAINT:
2315 if (coa->type == ACT_CONST_TYPE_LOC) {
2318 glRects(xco, yco-ysize, xco+width, yco);
2319 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2321 /* str= "Limit %t|None %x0|Loc X %x1|Loc Y %x2|Loc Z %x4|Rot X %x8|Rot Y %x16|Rot Z %x32"; */
2322 /* coa->flag &= ~(63); */
2323 str= "Limit %t|None %x0|Loc X %x1|Loc Y %x2|Loc Z %x4";
2326 uiDefButS(block, MENU, 1, str, xco+10, yco-65, 70, 19, &coa->flag, 0.0, 0.0, 0, 0, "");
2328 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");
2329 uiDefBut(block, LABEL, 0, "Min", xco+80, yco-45, (width-90)/2, 19, NULL, 0.0, 0.0, 0, 0, "");
2330 uiDefBut(block, LABEL, 0, "Max", xco+80+(width-90)/2, yco-45, (width-90)/2, 19, NULL, 0.0, 0.0, 0, 0, "");
2332 if(coa->flag & ACT_CONST_LOCX) fp= coa->minloc;
2333 else if(coa->flag & ACT_CONST_LOCY) fp= coa->minloc+1;
2334 else if(coa->flag & ACT_CONST_LOCZ) fp= coa->minloc+2;
2335 else if(coa->flag & ACT_CONST_ROTX) fp= coa->minrot;
2336 else if(coa->flag & ACT_CONST_ROTY) fp= coa->minrot+1;
2337 else fp= coa->minrot+2;
2339 uiDefButF(block, NUM, 0, "", xco+80, yco-65, (width-90)/2, 19, fp, -2000.0, 2000.0, 10, 0, "");
2340 uiDefButF(block, NUM, 0, "", xco+80+(width-90)/2, yco-65, (width-90)/2, 19, fp+3, -2000.0, 2000.0, 10, 0, "");
2341 } else if (coa->type == ACT_CONST_TYPE_DIST) {
2344 glRects(xco, yco-ysize, xco+width, yco);
2345 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2347 str= "Direction %t|None %x0|X axis %x1|Y axis %x2|Z axis %x4|-X axis %x8|-Y axis %x16|-Z axis %x32";
2348 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");
2350 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");
2351 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");
2352 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");
2353 uiDefButBitS(block, TOG, ACT_CONST_LOCAL, 0, "L", xco+80+(width-115), yco-45, 25, 19,
2354 &coa->flag, 0.0, 0.0, 0, 0, "Set ray along object's axis or global axis");
2356 if(coa->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= coa->minloc;
2357 else if(coa->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= coa->minloc+1;
2358 else fp= coa->minloc+2;
2360 uiDefButF(block, NUM, 0, "", xco+80, yco-65, (width-115)/2, 19, fp+3, 0.0, 2000.0, 10, 0, "Maximum length of ray");
2361 if (coa->flag & ACT_CONST_DISTANCE)
2362 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");
2363 uiDefButBitS(block, TOG, ACT_CONST_NORMAL, 0, "N", xco+80+(width-115), yco-65, 25, 19,
2364 &coa->flag, 0.0, 0.0, 0, 0, "Set object axis along (local axis) or parallel (global axis) to the normal at hit position");
2365 uiDefButBitS(block, TOG, ACT_CONST_MATERIAL, B_REDR, "M/P", xco+10, yco-84, 40, 19,
2366 &coa->flag, 0.0, 0.0, 0, 0, "Detect material instead of property");
2367 if (coa->flag & ACT_CONST_MATERIAL)
2369 uiDefBut(block, TEX, 1, "Material:", xco + 50, yco-84, (width-60), 19,
2370 coa->matprop, 0, 31, 0, 0,
2371 "Ray detects only Objects with this material");
2375 uiDefBut(block, TEX, 1, "Property:", xco + 50, yco-84, (width-60), 19,
2376 coa->matprop, 0, 31, 0, 0,
2377 "Ray detect only Objects with this property");
2379 uiDefButBitS(block, TOG, ACT_CONST_PERMANENT, 0, "PER", xco+10, yco-103, 40, 19,
2380 &coa->flag, 0.0, 0.0, 0, 0, "Persistent actuator: stays active even if ray does not reach target");
2381 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");
2382 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");
2383 } else if (coa->type == ACT_CONST_TYPE_ORI) {
2386 glRects(xco, yco-ysize, xco+width, yco);
2387 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2389 str= "Direction %t|None %x0|X axis %x1|Y axis %x2|Z axis %x4";
2390 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");
2392 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");
2393 uiDefBut(block, LABEL, 0, "X", xco+80, yco-45, (width-115)/3, 19, NULL, 0.0, 0.0, 0, 0, "");
2394 uiDefBut(block, LABEL, 0, "Y", xco+80+(width-115)/3, yco-45, (width-115)/3, 19, NULL, 0.0, 0.0, 0, 0, "");
2395 uiDefBut(block, LABEL, 0, "Z", xco+80+2*(width-115)/3, yco-45, (width-115)/3, 19, NULL, 0.0, 0.0, 0, 0, "");
2397 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");
2398 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");
2399 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");
2401 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");
2402 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");
2403 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");
2404 } else if (coa->type == ACT_CONST_TYPE_FH) {
2407 glRects(xco, yco-ysize, xco+width, yco);
2408 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2410 str= "Direction %t|None %x0|X axis %x1|Y axis %x2|Z axis %x4|-X axis %x8|-Y axis %x16|-Z axis %x32";
2411 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)");
2413 if(coa->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= coa->minloc;
2414 else if(coa->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= coa->minloc+1;
2415 else fp= coa->minloc+2;
2417 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");
2418 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");
2419 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");
2421 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");
2422 uiDefButBitS(block, TOG, ACT_CONST_NORMAL, 0, "N", xco+80+(width-115), yco-65, 25, 19,
2423 &coa->flag, 0.0, 0.0, 0, 0, "Add a horizontal spring force on slopes");
2424 uiDefButBitS(block, TOG, ACT_CONST_MATERIAL, B_REDR, "M/P", xco+10, yco-84, 40, 19,
2425 &coa->flag, 0.0, 0.0, 0, 0, "Detect material instead of property");
2426 if (coa->flag & ACT_CONST_MATERIAL)
2428 uiDefBut(block, TEX, 1, "Material:", xco + 50, yco-84, (width-60), 19,
2429 coa->matprop, 0, 31, 0, 0,
2430 "Ray detects only Objects with this material");
2434 uiDefBut(block, TEX, 1, "Property:", xco + 50, yco-84, (width-60), 19,
2435 coa->matprop, 0, 31, 0, 0,
2436 "Ray detect only Objects with this property");
2438 uiDefButBitS(block, TOG, ACT_CONST_PERMANENT, 0, "PER", xco+10, yco-103, 40, 19,
2439 &coa->flag, 0.0, 0.0, 0, 0, "Persistent actuator: stays active even if ray does not reach target");
2440 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");
2441 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");
2443 str= "Constraint Type %t|Location %x0|Distance %x1|Orientation %x2|Force field %x3";
2444 but = uiDefButS(block, MENU, B_REDR, str, xco+40, yco-23, (width-80), 19, &coa->type, 0.0, 0.0, 0, 0, "");
2451 if(sca->type==ACT_SCENE_RESTART) {
2453 glRects(xco, yco-ysize, xco+width, yco);
2454 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2456 else if(sca->type==ACT_SCENE_CAMERA) {
2459 glRects(xco, yco-ysize, xco+width, yco);
2460 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2462 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");
2464 else if(sca->type==ACT_SCENE_SET) {
2467 glRects(xco, yco-ysize, xco+width, yco);
2468 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2470 uiDefIDPoinBut(block, test_scenepoin_but, ID_SCE, 1, "SCE:", xco+40, yco-44, (width-80), 19, &(sca->scene), "Set this Scene");
2472 else if(sca->type==ACT_SCENE_ADD_FRONT) {
2475 glRects(xco, yco-ysize, xco+width, yco);
2476 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2478 uiDefIDPoinBut(block, test_scenepoin_but, ID_SCE, 1, "SCE:", xco+40, yco-44, (width-80), 19, &(sca->scene), "Add an Overlay Scene");
2480 else if(sca->type==ACT_SCENE_ADD_BACK) {
2483 glRects(xco, yco-ysize, xco+width, yco);
2484 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2486 uiDefIDPoinBut(block, test_scenepoin_but, ID_SCE, 1, "SCE:", xco+40, yco-44, (width-80), 19, &(sca->scene), "Add a Background Scene");
2488 else if(sca->type==ACT_SCENE_REMOVE) {
2491 glRects(xco, yco-ysize, xco+width, yco);
2492 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2494 uiDefIDPoinBut(block, test_scenepoin_but, ID_SCE, 1, "SCE:", xco+40, yco-44, (width-80), 19, &(sca->scene), "Remove a Scene");
2496 else if(sca->type==ACT_SCENE_SUSPEND) {
2499 glRects(xco, yco-ysize, xco+width, yco);
2500 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2502 uiDefIDPoinBut(block, test_scenepoin_but, ID_SCE, 1, "SCE:", xco+40, yco-44, (width-80), 19, &(sca->scene), "Pause a Scene");
2504 else if(sca->type==ACT_SCENE_RESUME) {
2507 glRects(xco, yco-ysize, xco+width, yco);
2508 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2510 uiDefIDPoinBut(block, test_scenepoin_but, ID_SCE, 1, "SCE:", xco+40, yco-44, (width-80), 19, &(sca->scene), "Unpause a Scene");
2513 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";
2514 uiDefButS(block, MENU, B_REDR, str, xco+40, yco-24, (width-80), 19, &sca->type, 0.0, 0.0, 0, 0, "");
2521 if (gma->type == ACT_GAME_LOAD)
2525 glRects(xco, yco-ysize, xco+width, yco);