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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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 *****
33 #include "DNA_actuator_types.h"
34 #include "DNA_controller_types.h"
35 #include "DNA_object_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_sound_types.h"
42 #include "DNA_armature_types.h"
43 #include "DNA_constraint_types.h"
44 #include "DNA_action_types.h"
45 #include "DNA_windowmanager_types.h"
47 #include "MEM_guardedalloc.h"
49 #include "BLI_blenlib.h"
51 #include "BKE_context.h"
52 #include "BKE_global.h"
53 #include "BKE_library.h"
55 #include "BKE_property.h"
56 #include "BKE_screen.h"
58 #include "BKE_utildefines.h"
60 #include "ED_screen.h"
68 #include "BIF_glutil.h"
70 #include "UI_interface.h"
71 #include "UI_resources.h"
72 #include "UI_view2d.h"
75 #include "../interface/interface_intern.h"
77 #include "logic_intern.h"
80 #define MAX_RENDER_PASS 100
84 #define B_ADD_SENS 2703
85 #define B_CHANGE_SENS 2704
86 #define B_DEL_SENS 2705
88 #define B_ADD_CONT 2706
89 #define B_CHANGE_CONT 2707
90 #define B_DEL_CONT 2708
92 #define B_ADD_ACT 2709
93 #define B_CHANGE_ACT 2710
94 #define B_DEL_ACT 2711
96 #define B_SOUNDACT_BROWSE 2712
98 #define B_SETSECTOR 2713
99 #define B_SETPROP 2714
100 #define B_SETACTOR 2715
101 #define B_SETMAINACTOR 2716
102 #define B_SETDYNA 2717
103 #define B_SET_STATE_BIT 2718
104 #define B_INIT_STATE_BIT 2719
107 static ID **get_selected_and_linked_obs(bContext *C, short *count, short scavisflag);
109 static int vergname(const void *v1, const void *v2)
116 return strcmp(*x1, *x2);
119 void make_unique_prop_names(bContext *C, char *str)
127 short a, obcount, propcount=0, nr;
130 /* this function is called by a Button, and gives the current
131 * stringpointer as an argument, this is the one that can change
134 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);
136 /* for each object, make properties and sca names unique */
138 /* count total names */
139 for(a=0; a<obcount; a++) {
140 ob= (Object *)idar[a];
141 propcount+= BLI_countlist(&ob->prop);
142 propcount+= BLI_countlist(&ob->sensors);
143 propcount+= BLI_countlist(&ob->controllers);
144 propcount+= BLI_countlist(&ob->actuators);
147 if(idar) MEM_freeN(idar);
151 /* make names array for sorting */
152 names= MEM_callocN(propcount*sizeof(void *), "names");
154 /* count total names */
156 for(a=0; a<obcount; a++) {
157 ob= (Object *)idar[a];
158 prop= ob->prop.first;
160 names[nr++]= prop->name;
163 sens= ob->sensors.first;
165 names[nr++]= sens->name;
168 cont= ob->controllers.first;
170 names[nr++]= cont->name;
173 act= ob->actuators.first;
175 names[nr++]= act->name;
180 qsort(names, propcount, sizeof(void *), vergname);
182 /* now we check for double names, and change them */
184 for(nr=0; nr<propcount; nr++) {
185 if(names[nr]!=str && strcmp( names[nr], str )==0 ) {
186 BLI_newname(str, +1);
194 static void make_unique_prop_names_cb(bContext *C, void *strv, void *redraw_view3d_flagv)
197 // int redraw_view3d_flag= GET_INT_FROM_POINTER(redraw_view3d_flagv);
199 make_unique_prop_names(C, str);
203 static void sca_move_sensor(bContext *C, void *datav, void *move_up)
205 Scene *scene= CTX_data_scene(C);
206 bSensor *sens_to_delete= datav;
211 // val= pupmenu("Move up%x1|Move down %x2");
215 /* now find out which object has this ... */
219 sens= base->object->sensors.first;
221 if(sens == sens_to_delete) break;
226 if( val==1 && sens->prev) {
227 for (tmp=sens->prev; tmp; tmp=tmp->prev) {
228 if (tmp->flag & SENS_VISIBLE)
232 BLI_remlink(&base->object->sensors, sens);
233 BLI_insertlinkbefore(&base->object->sensors, tmp, sens);
236 else if( val==2 && sens->next) {
237 for (tmp=sens->next; tmp; tmp=tmp->next) {
238 if (tmp->flag & SENS_VISIBLE)
242 BLI_remlink(&base->object->sensors, sens);
243 BLI_insertlink(&base->object->sensors, tmp, sens);
246 ED_undo_push(C, "Move sensor");
255 static void sca_move_controller(bContext *C, void *datav, void *move_up)
257 Scene *scene= CTX_data_scene(C);
258 bController *controller_to_del= datav;
261 bController *cont, *tmp;
263 //val= pupmenu("Move up%x1|Move down %x2");
267 /* now find out which object has this ... */
271 cont= base->object->controllers.first;
273 if(cont == controller_to_del) break;
278 if( val==1 && cont->prev) {
279 /* locate the controller that has the same state mask but is earlier in the list */
282 if(tmp->state_mask & cont->state_mask)
287 BLI_remlink(&base->object->controllers, cont);
288 BLI_insertlinkbefore(&base->object->controllers, tmp, cont);
291 else if( val==2 && cont->next) {
294 if(tmp->state_mask & cont->state_mask)
298 BLI_remlink(&base->object->controllers, cont);
299 BLI_insertlink(&base->object->controllers, tmp, cont);
301 ED_undo_push(C, "Move controller");
310 static void sca_move_actuator(bContext *C, void *datav, void *move_up)
312 Scene *scene= CTX_data_scene(C);
313 bActuator *actuator_to_move= datav;
316 bActuator *act, *tmp;
318 //val= pupmenu("Move up%x1|Move down %x2");
322 /* now find out which object has this ... */
326 act= base->object->actuators.first;
328 if(act == actuator_to_move) break;
333 if( val==1 && act->prev) {
334 /* locate the first visible actuators before this one */
335 for (tmp = act->prev; tmp; tmp=tmp->prev) {
336 if (tmp->flag & ACT_VISIBLE)
340 BLI_remlink(&base->object->actuators, act);
341 BLI_insertlinkbefore(&base->object->actuators, tmp, act);
344 else if( val==2 && act->next) {
345 for (tmp=act->next; tmp; tmp=tmp->next) {
346 if (tmp->flag & ACT_VISIBLE)
350 BLI_remlink(&base->object->actuators, act);
351 BLI_insertlink(&base->object->actuators, tmp, act);
354 ED_undo_push(C, "Move actuator");
363 void do_logic_buts(bContext *C, void *arg, int event)
371 ob= CTX_data_active_object(C);
377 /* check for inconsistant types */
378 ob->gameflag &= ~(OB_SECTOR|OB_MAINACTOR|OB_DYNAMIC|OB_ACTOR);
384 ob->gameflag &= ~(OB_SECTOR|OB_PROP);
388 for(ob=G.main->object.first; ob; ob=ob->id.next) {
389 if(ob->scaflag & OB_ADDSENS) {
390 ob->scaflag &= ~OB_ADDSENS;
391 sens= new_sensor(SENS_ALWAYS);
392 BLI_addtail(&(ob->sensors), sens);
393 make_unique_prop_names(C, sens->name);
394 ob->scaflag |= OB_SHOWSENS;
398 ED_undo_push(C, "Add sensor");
402 for(ob=G.main->object.first; ob; ob=ob->id.next) {
403 sens= ob->sensors.first;
405 if(sens->type != sens->otype) {
407 sens->otype= sens->type;
416 for(ob=G.main->object.first; ob; ob=ob->id.next) {
417 sens= ob->sensors.first;
419 if(sens->flag & SENS_DEL) {
420 BLI_remlink(&(ob->sensors), sens);
427 ED_undo_push(C, "Delete sensor");
431 for(ob=G.main->object.first; ob; ob=ob->id.next) {
432 if(ob->scaflag & OB_ADDCONT) {
433 ob->scaflag &= ~OB_ADDCONT;
434 cont= new_controller(CONT_LOGIC_AND);
435 make_unique_prop_names(C, cont->name);
436 ob->scaflag |= OB_SHOWCONT;
437 BLI_addtail(&(ob->controllers), cont);
438 /* set the controller state mask from the current object state.
439 A controller is always in a single state, so select the lowest bit set
440 from the object state */
441 for (bit=0; bit<32; bit++) {
442 if (ob->state & (1<<bit))
445 cont->state_mask = (1<<bit);
446 if (cont->state_mask == 0) {
447 /* shouldn't happen, object state is never 0 */
448 cont->state_mask = 1;
452 ED_undo_push(C, "Add controller");
455 case B_SET_STATE_BIT:
456 for(ob=G.main->object.first; ob; ob=ob->id.next) {
457 if(ob->scaflag & OB_SETSTBIT) {
458 ob->scaflag &= ~OB_SETSTBIT;
459 ob->state = 0x3FFFFFFF;
464 case B_INIT_STATE_BIT:
465 for(ob=G.main->object.first; ob; ob=ob->id.next) {
466 if(ob->scaflag & OB_INITSTBIT) {
467 ob->scaflag &= ~OB_INITSTBIT;
468 ob->state = ob->init_state;
476 for(ob=G.main->object.first; ob; ob=ob->id.next) {
477 cont= ob->controllers.first;
479 if(cont->type != cont->otype) {
480 init_controller(cont);
481 cont->otype= cont->type;
491 for(ob=G.main->object.first; ob; ob=ob->id.next) {
492 cont= ob->controllers.first;
494 if(cont->flag & CONT_DEL) {
495 BLI_remlink(&(ob->controllers), cont);
496 unlink_controller(cont);
497 free_controller(cont);
503 ED_undo_push(C, "Delete controller");
507 for(ob=G.main->object.first; ob; ob=ob->id.next) {
508 if(ob->scaflag & OB_ADDACT) {
509 ob->scaflag &= ~OB_ADDACT;
510 act= new_actuator(ACT_OBJECT);
511 make_unique_prop_names(C, act->name);
512 BLI_addtail(&(ob->actuators), act);
513 ob->scaflag |= OB_SHOWACT;
516 ED_undo_push(C, "Add actuator");
520 for(ob=G.main->object.first; ob; ob=ob->id.next) {
521 act= ob->actuators.first;
523 if(act->type != act->otype) {
525 act->otype= act->type;
534 for(ob=G.main->object.first; ob; ob=ob->id.next) {
535 act= ob->actuators.first;
537 if(act->flag & ACT_DEL) {
538 BLI_remlink(&(ob->actuators), act);
539 unlink_actuator(act);
546 ED_undo_push(C, "Delete actuator");
549 case B_SOUNDACT_BROWSE:
550 /* since we don't know which... */
552 for(ob=G.main->object.first; ob; ob=ob->id.next) {
553 act= ob->actuators.first;
556 if(act->type==ACT_SOUND)
558 bSoundActuator *sa= act->data;
561 bSound *sound= G.main->sound.first;
564 if(sa->sndnr == -2) {
565 // XXX activate_databrowse((ID *)G.main->sound.first, ID_SO, 0, B_SOUNDACT_BROWSE,
566 // &sa->sndnr, do_logic_buts);
575 sound= sound->id.next;
601 static char *sensor_name(int type)
638 static char *sensor_pup(void)
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";
646 static char *controller_name(int type)
653 case CONT_LOGIC_NAND:
659 case CONT_LOGIC_XNOR:
661 case CONT_EXPRESSION:
669 static char *controller_pup(void)
671 return "Controllers %t|AND %x0|OR %x1|XOR %x6|NAND %x4|NOR %x5|XNOR %x7|Expression %x2|Python %x3";
674 static char *actuator_name(int type)
677 case ACT_SHAPEACTION:
678 return "Shape Action";
695 case ACT_EDIT_OBJECT:
696 return "Edit Object";
726 static char *actuator_pup(Object *owner)
731 return "Actuators %t|Action %x15|Armature %x23|Motion %x0|Constraint %x9|Ipo %x1"
732 "|Camera %x3|Sound %x5|Property %x6|Edit Object %x10"
733 "|Scene %x11|Random %x13|Message %x14|Game %x17"
734 "|Visibility %x18|2D Filter %x19|Parent %x20|State %x22";
738 return "Actuators %t|Shape Action %x21|Motion %x0|Constraint %x9|Ipo %x1"
739 "|Camera %x3|Sound %x5|Property %x6|Edit Object %x10"
740 "|Scene %x11|Random %x13|Message %x14|Game %x17"
741 "|Visibility %x18|2D Filter %x19|Parent %x20|State %x22";
745 return "Actuators %t|Motion %x0|Constraint %x9|Ipo %x1"
746 "|Camera %x3|Sound %x5|Property %x6|Edit Object %x10"
747 "|Scene %x11|Random %x13|Message %x14|Game %x17"
748 "|Visibility %x18|2D Filter %x19|Parent %x20|State %x22";
754 static void set_sca_ob(Object *ob)
759 cont= ob->controllers.first;
761 cont->mynew= (bController *)ob;
764 act= ob->actuators.first;
766 act->mynew= (bActuator *)ob;
771 static ID **get_selected_and_linked_obs(bContext *C, short *count, short scavisflag)
774 Scene *scene= CTX_data_scene(C);
775 Object *ob, *obt, *obact= CTX_data_active_object(C);
782 /* we need a sorted object list */
783 /* set scavisflags flags in Objects to indicate these should be evaluated */
784 /* also hide ob pointers in ->new entries of controllerss/actuators */
788 if(scene==NULL) return NULL;
790 ob= G.main->object.first;
797 /* XXX here it checked 3d lay */
802 if(base->lay & lay) {
803 if(base->flag & SELECT) {
804 if(scavisflag & BUTS_SENS_SEL) base->object->scavisflag |= OB_VIS_SENS;
805 if(scavisflag & BUTS_CONT_SEL) base->object->scavisflag |= OB_VIS_CONT;
806 if(scavisflag & BUTS_ACT_SEL) base->object->scavisflag |= OB_VIS_ACT;
813 if(scavisflag & BUTS_SENS_ACT) obact->scavisflag |= OB_VIS_SENS;
814 if(scavisflag & BUTS_CONT_ACT) obact->scavisflag |= OB_VIS_CONT;
815 if(scavisflag & BUTS_ACT_ACT) obact->scavisflag |= OB_VIS_ACT;
818 /* BUTS_XXX_STATE are similar to BUTS_XXX_LINK for selecting the object */
819 if(scavisflag & (BUTS_SENS_LINK|BUTS_CONT_LINK|BUTS_ACT_LINK|BUTS_SENS_STATE|BUTS_ACT_STATE)) {
824 ob= G.main->object.first;
827 /* 1st case: select sensor when controller selected */
828 if((scavisflag & (BUTS_SENS_LINK|BUTS_SENS_STATE)) && (ob->scavisflag & OB_VIS_SENS)==0) {
829 sens= ob->sensors.first;
831 for(a=0; a<sens->totlinks; a++) {
833 obt= (Object *)sens->links[a]->mynew;
834 if(obt && (obt->scavisflag & OB_VIS_CONT)) {
836 ob->scavisflag |= OB_VIS_SENS;
846 /* 2nd case: select cont when act selected */
847 if((scavisflag & BUTS_CONT_LINK) && (ob->scavisflag & OB_VIS_CONT)==0) {
848 cont= ob->controllers.first;
850 for(a=0; a<cont->totlinks; a++) {
852 obt= (Object *)cont->links[a]->mynew;
853 if(obt && (obt->scavisflag & OB_VIS_ACT)) {
855 ob->scavisflag |= OB_VIS_CONT;
865 /* 3rd case: select controller when sensor selected */
866 if((scavisflag & BUTS_CONT_LINK) && (ob->scavisflag & OB_VIS_SENS)) {
867 sens= ob->sensors.first;
869 for(a=0; a<sens->totlinks; a++) {
871 obt= (Object *)sens->links[a]->mynew;
872 if(obt && (obt->scavisflag & OB_VIS_CONT)==0) {
874 obt->scavisflag |= OB_VIS_CONT;
882 /* 4th case: select actuator when controller selected */
883 if( (scavisflag & (BUTS_ACT_LINK|BUTS_ACT_STATE)) && (ob->scavisflag & OB_VIS_CONT)) {
884 cont= ob->controllers.first;
886 for(a=0; a<cont->totlinks; a++) {
888 obt= (Object *)cont->links[a]->mynew;
889 if(obt && (obt->scavisflag & OB_VIS_ACT)==0) {
891 obt->scavisflag |= OB_VIS_ACT;
905 ob= G.main->object.first;
907 if( ob->scavisflag ) (*count)++;
911 if(*count==0) return NULL;
912 if(*count>24) *count= 24; /* temporal */
914 idar= MEM_callocN( (*count)*sizeof(void *), "idar");
916 ob= G.main->object.first;
919 if( ob->scavisflag ) {
927 /* just to be sure... these were set in set_sca_done_ob() */
928 clear_sca_new_poins();
934 static int get_col_sensor(int type)
936 /* XXX themecolors not here */
939 case SENS_ALWAYS: return TH_PANEL;
940 case SENS_DELAY: return TH_PANEL;
941 case SENS_TOUCH: return TH_PANEL;
942 case SENS_COLLISION: return TH_PANEL;
943 case SENS_NEAR: return TH_PANEL;
944 case SENS_KEYBOARD: return TH_PANEL;
945 case SENS_PROPERTY: return TH_PANEL;
946 case SENS_ARMATURE: return TH_PANEL;
947 case SENS_ACTUATOR: return TH_PANEL;
948 case SENS_MOUSE: return TH_PANEL;
949 case SENS_RADAR: return TH_PANEL;
950 case SENS_RANDOM: return TH_PANEL;
951 case SENS_RAY: return TH_PANEL;
952 case SENS_MESSAGE: return TH_PANEL;
953 case SENS_JOYSTICK: return TH_PANEL;
954 default: return TH_PANEL;
957 static void set_col_sensor(int type, int medium)
959 int col= get_col_sensor(type);
960 UI_ThemeColorShade(col, medium?30:0);
964 static void verify_logicbutton_func(bContext *C, void *data1, void *data2)
966 bSensor *sens= (bSensor*)data1;
968 if(sens->level && sens->tap) {
969 if(data2 == &(sens->level))
976 static void test_scriptpoin_but(struct bContext *C, char *name, ID **idpp)
980 id= CTX_data_main(C)->text.first;
982 if( strcmp(name, id->name+2)==0 ) {
991 static void test_actionpoin_but(struct bContext *C, char *name, ID **idpp)
995 id= CTX_data_main(C)->action.first;
997 if( strcmp(name, id->name+2)==0 ) {
1008 static void test_obpoin_but(struct bContext *C, char *name, ID **idpp)
1012 id= CTX_data_main(C)->object.first;
1014 if( strcmp(name, id->name+2)==0 ) {
1016 id_lib_extern(id); /* checks lib data, sets correct flag for saving then */
1024 static void test_meshpoin_but(struct bContext *C, char *name, ID **idpp)
1028 if( *idpp ) (*idpp)->us--;
1030 id= CTX_data_main(C)->mesh.first;
1032 if( strcmp(name, id->name+2)==0 ) {
1042 static void test_matpoin_but(struct bContext *C, char *name, ID **idpp)
1046 if( *idpp ) (*idpp)->us--;
1048 id= CTX_data_main(C)->mat.first;
1050 if( strcmp(name, id->name+2)==0 ) {
1060 static void test_scenepoin_but(struct bContext *C, char *name, ID **idpp)
1064 if( *idpp ) (*idpp)->us--;
1066 id= CTX_data_main(C)->scene.first;
1068 if( strcmp(name, id->name+2)==0 ) {
1079 static void test_keyboard_event(struct bContext *C, void *arg_ks, void *arg_unused)
1081 bKeyboardSensor *ks= (bKeyboardSensor*)arg_ks;
1083 if(!ISKEYBOARD(ks->key))
1085 if(!ISKEYBOARD(ks->qual))
1087 if(!ISKEYBOARD(ks->qual2))
1092 * Draws a toggle for pulse mode, a frequency field and a toggle to invert
1093 * the value of this sensor. Operates on the shared data block of sensors.
1095 static void draw_default_sensor_header(bSensor *sens,
1103 /* Pulsing and frequency */
1104 uiBlockBeginAlign(block);
1105 uiDefIconButBitS(block, TOG, SENS_PULSE_REPEAT, 1, ICON_DOTSUP,
1106 (short)(x + 10 + 0. * (w-20)), (short)(y - 21), (short)(0.1 * (w-20)), 19,
1107 &sens->pulse, 0.0, 0.0, 0, 0,
1108 "Activate TRUE level triggering (pulse mode)");
1110 uiDefIconButBitS(block, TOG, SENS_NEG_PULSE_MODE, 1, ICON_DOTSDOWN,
1111 (short)(x + 10 + 0.1 * (w-20)), (short)(y - 21), (short)(0.1 * (w-20)), 19,
1112 &sens->pulse, 0.0, 0.0, 0, 0,
1113 "Activate FALSE level triggering (pulse mode)");
1114 uiDefButS(block, NUM, 1, "f:",
1115 (short)(x + 10 + 0.2 * (w-20)), (short)(y - 21), (short)(0.275 * (w-20)), 19,
1116 &sens->freq, 0.0, 10000.0, 0, 0,
1117 "Delay between repeated pulses (in logic tics, 0 = no delay)");
1118 uiBlockEndAlign(block);
1120 /* value or shift? */
1121 uiBlockBeginAlign(block);
1122 but= uiDefButS(block, TOG, 1, "Level",
1123 (short)(x + 10 + 0.5 * (w-20)), (short)(y - 21), (short)(0.20 * (w-20)), 19,
1124 &sens->level, 0.0, 0.0, 0, 0,
1125 "Level detector, trigger controllers of new states (only applicable upon logic state transition)");
1126 uiButSetFunc(but, verify_logicbutton_func, sens, &(sens->level));
1127 but= uiDefButS(block, TOG, 1, "Tap",
1128 (short)(x + 10 + 0.702 * (w-20)), (short)(y - 21), (short)(0.12 * (w-20)), 19,
1129 &sens->tap, 0.0, 0.0, 0, 0,
1130 "Trigger controllers only for an instant, even while the sensor remains true");
1131 uiButSetFunc(but, verify_logicbutton_func, sens, &(sens->tap));
1132 uiBlockEndAlign(block);
1134 uiDefButS(block, TOG, 1, "Inv",
1135 (short)(x + 10 + 0.85 * (w-20)), (short)(y - 21), (short)(0.15 * (w-20)), 19,
1136 &sens->invert, 0.0, 0.0, 0, 0,
1137 "Invert the level (output) of this sensor");
1140 static void check_armature_bone_constraint(Object *ob, char *posechannel, char *constraint)
1142 /* check that bone exist in the active object */
1143 if (ob->type == OB_ARMATURE && ob->pose) {
1144 bPoseChannel *pchan;
1145 bPose *pose = ob->pose;
1146 for (pchan=pose->chanbase.first; pchan; pchan=pchan->next) {
1147 if (!strcmp(pchan->name, posechannel)) {
1148 /* found it, now look for constraint channel */
1150 for (con=pchan->constraints.first; con; con=con->next) {
1151 if (!strcmp(con->name, constraint)) {
1152 /* found it, all ok */
1156 /* didn't find constraint, make empty */
1162 /* didn't find any */
1167 static void check_armature_sensor(bContext *C, void *arg1_but, void *arg2_sens)
1169 bArmatureSensor *sens = arg2_sens;
1170 uiBut *but = arg1_but;
1171 Object *ob= CTX_data_active_object(C);
1173 /* check that bone exist in the active object */
1174 but->retval = B_REDR;
1175 check_armature_bone_constraint(ob, sens->posechannel, sens->constraint);
1178 static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short xco, short yco, short width,char* objectname)
1180 bNearSensor *ns = NULL;
1181 bTouchSensor *ts = NULL;
1182 bKeyboardSensor *ks = NULL;
1183 bPropertySensor *ps = NULL;
1184 bArmatureSensor *arm = NULL;
1185 bMouseSensor *ms = NULL;
1186 bCollisionSensor *cs = NULL;
1187 bRadarSensor *rs = NULL;
1188 bRandomSensor *randomSensor = NULL;
1189 bRaySensor *raySens = NULL;
1190 bMessageSensor *mes = NULL;
1191 bJoystickSensor *joy = NULL;
1192 bActuatorSensor *as = NULL;
1193 bDelaySensor *ds = NULL;
1198 /* yco is at the top of the rect, draw downwards */
1200 set_col_sensor(sens->type, 0);
1208 glRects(xco, yco-ysize, xco+width, yco);
1209 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1211 draw_default_sensor_header(sens, block, xco, yco, width);
1221 glRects(xco, yco-ysize, xco+width, yco);
1222 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1224 draw_default_sensor_header(sens, block, xco, yco, width);
1228 /* uiDefBut(block, TEX, 1, "Property:", xco,yco-22,width, 19, &ts->name, 0, 31, 0, 0, "Only look for Objects with this property"); */
1229 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");
1230 ///* 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");
1234 case SENS_COLLISION:
1238 glRects(xco, yco-ysize, xco+width, yco);
1239 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1241 draw_default_sensor_header(sens, block, xco, yco, width);
1244 /* The collision sensor will become a generic collision (i.e. it */
1245 /* absorb the old touch sensor). */
1247 uiDefButBitS(block, TOG, SENS_COLLISION_PULSE, B_REDR, "Pulse",(short)(xco + 10),(short)(yco - 44),
1248 (short)(0.20 * (width-20)), 19, &cs->mode, 0.0, 0.0, 0, 0,
1249 "Changes to the set of colliding objects generated pulses");
1251 uiDefButBitS(block, TOG, SENS_COLLISION_MATERIAL, B_REDR, "M/P",(short)(xco + 10 + (0.20 * (width-20))),(short)(yco - 44),
1252 (short)(0.20 * (width-20)), 19, &cs->mode, 0.0, 0.0, 0, 0,
1253 "Toggle collision on material or property");
1255 if (cs->mode & SENS_COLLISION_MATERIAL) {
1256 uiDefBut(block, TEX, 1, "Material:", (short)(xco + 10 + 0.40 * (width-20)),
1257 (short)(yco-44), (short)(0.6*(width-20)), 19, &cs->materialName, 0, 31, 0, 0,
1258 "Only look for Objects with this material");
1260 uiDefBut(block, TEX, 1, "Property:", (short)(xco + 10 + 0.40 * (width-20)), (short)(yco-44),
1261 (short)(0.6*(width-20)), 19, &cs->name, 0, 31, 0, 0,
1262 "Only look for Objects with this property");
1265 /* 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"); */
1274 glRects(xco, yco-ysize, xco+width, yco);
1275 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1277 draw_default_sensor_header(sens, block, xco, yco, width);
1280 uiDefBut(block, TEX, 1, "Property:",(short)(10+xco),(short)(yco-44), (short)(width-20), 19,
1281 &ns->name, 0, 31, 0, 0, "Only look for Objects with this property");
1282 uiDefButF(block, NUM, 1, "Dist",(short)(10+xco),(short)(yco-68),(short)((width-22)/2), 19,
1283 &ns->dist, 0.0, 1000.0, 1000, 0, "Trigger distance");
1284 uiDefButF(block, NUM, 1, "Reset",(short)(10+xco+(width-22)/2), (short)(yco-68), (short)((width-22)/2), 19,
1285 &ns->resetdist, 0.0, 1000.0, 1000, 0, "Reset distance");
1293 glRects(xco, yco-ysize, xco+width, yco);
1294 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1296 draw_default_sensor_header(sens, block, xco, yco, width);
1300 uiDefBut(block, TEX, 1, "Prop:",
1301 (short)(10+xco),(short)(yco-44), (short)(0.7 * (width-20)), 19,
1302 &rs->name, 0, 31, 0, 0,
1303 "Only look for Objects with this property");
1305 str = "Type %t|+X axis %x0|+Y axis %x1|+Z axis %x2|-X axis %x3|-Y axis %x4|-Z axis %x5";
1306 uiDefButS(block, MENU, B_REDR, str,
1307 (short)(10+xco+0.7 * (width-20)), (short)(yco-44), (short)(0.3 * (width-22)), 19,
1308 &rs->axis, 2.0, 31, 0, 0,
1309 "Specify along which axis the radar cone is cast");
1311 uiDefButF(block, NUM, 1, "Ang:",
1312 (short)(10+xco), (short)(yco-68), (short)((width-20)/2), 19,
1313 &rs->angle, 0.0, 179.9, 10, 0,
1314 "Opening angle of the radar cone");
1315 uiDefButF(block, NUM, 1, "Dist:",
1316 (short)(xco+10 + (width-20)/2), (short)(yco-68), (short)((width-20)/2), 19,
1317 &rs->range, 0.01, 10000.0, 100, 0,
1318 "Depth of the radar cone");
1326 /* 5 lines: 120 height */
1327 ysize= (ks->type&1) ? 96:120;
1329 glRects(xco, yco-ysize, xco+width, yco);
1330 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1333 draw_default_sensor_header(sens, block, xco, yco, width);
1335 /* part of line 1 */
1336 uiDefBut(block, LABEL, 0, "Key", xco, yco-44, 40, 19, NULL, 0, 0, 0, 0, "");
1337 uiDefButBitS(block, TOG, 1, B_REDR, "All keys", xco+40+(width/2), yco-44, (width/2)-50, 19,
1338 &ks->type, 0, 0, 0, 0, "");
1341 if ((ks->type&1)==0) { /* is All Keys option off? */
1342 /* line 2: hotkey and allkeys toggle */
1343 but= uiDefKeyevtButS(block, 0, "", xco+40, yco-44, (width)/2, 19, &ks->key, "Key code");
1344 uiButSetFunc(but, test_keyboard_event, ks, NULL);
1346 /* line 3: two key modifyers (qual1, qual2) */
1347 uiDefBut(block, LABEL, 0, "Hold", xco, yco-68, 40, 19, NULL, 0, 0, 0, 0, "");
1348 but= uiDefKeyevtButS(block, 0, "", xco+40, yco-68, (width-50)/2, 19, &ks->qual, "Modifier key code");
1349 uiButSetFunc(but, test_keyboard_event, ks, NULL);
1350 but= uiDefKeyevtButS(block, 0, "", xco+40+(width-50)/2, yco-68, (width-50)/2, 19, &ks->qual2, "Second Modifier key code");
1351 uiButSetFunc(but, test_keyboard_event, ks, NULL);
1354 /* line 4: toggle property for string logging mode */
1355 uiDefBut(block, TEX, 1, "LogToggle: ",
1356 xco+10, yco-((ks->type&1) ? 68:92), (width-20), 19,
1357 ks->toggleName, 0, 31, 0, 0,
1358 "Property that indicates whether to log "
1359 "keystrokes as a string");
1361 /* line 5: target property for string logging mode */
1362 uiDefBut(block, TEX, 1, "Target: ",
1363 xco+10, yco-((ks->type&1) ? 92:116), (width-20), 19,
1364 ks->targetName, 0, 31, 0, 0,
1365 "Property that receives the keystrokes in case "
1366 "a string is logged");
1375 glRects(xco, yco-ysize, xco+width, yco);
1376 uiEmboss((float)xco, (float)yco-ysize,
1377 (float)xco+width, (float)yco, 1);
1379 draw_default_sensor_header(sens, block, xco, yco, width);
1382 str= "Type %t|Equal %x0|Not Equal %x1|Interval %x2|Changed %x3";
1383 /* str= "Type %t|Equal %x0|Not Equal %x1"; */
1384 uiDefButI(block, MENU, B_REDR, str, xco+30,yco-44,width-60, 19,
1385 &ps->type, 0, 31, 0, 0, "Type");
1387 if (ps->type != SENS_PROP_EXPRESSION)
1389 uiDefBut(block, TEX, 1, "Prop: ", xco+30,yco-68,width-60, 19,
1390 ps->name, 0, 31, 0, 0, "Property name");
1393 if(ps->type == SENS_PROP_INTERVAL)
1395 uiDefBut(block, TEX, 1, "Min: ", xco,yco-92,width/2, 19,
1396 ps->value, 0, 31, 0, 0, "check for min value");
1397 uiDefBut(block, TEX, 1, "Max: ", xco+width/2,yco-92,width/2, 19,
1398 ps->maxvalue, 0, 31, 0, 0, "check for max value");
1400 else if(ps->type == SENS_PROP_CHANGED);
1403 uiDefBut(block, TEX, 1, "Value: ", xco+30,yco-92,width-60, 19,
1404 ps->value, 0, 31, 0, 0, "check for value");
1414 glRects(xco, yco-ysize, xco+width, yco);
1415 uiEmboss((float)xco, (float)yco-ysize,
1416 (float)xco+width, (float)yco, 1);
1418 draw_default_sensor_header(sens, block, xco, yco, width);
1421 if (ob->type == OB_ARMATURE) {
1422 uiBlockBeginAlign(block);
1423 but = uiDefBut(block, TEX, 1, "Bone: ",
1424 (xco+10), (yco-44), (width-20)/2, 19,
1425 arm->posechannel, 0, 31, 0, 0,
1426 "Bone on which you want to check a constraint");
1427 uiButSetFunc(but, check_armature_sensor, but, arm);
1428 but = uiDefBut(block, TEX, 1, "Cons: ",
1429 (xco+10)+(width-20)/2, (yco-44), (width-20)/2, 19,
1430 arm->constraint, 0, 31, 0, 0,
1431 "Name of the constraint you want to control");
1432 uiButSetFunc(but, check_armature_sensor, but, arm);
1433 uiBlockEndAlign(block);
1435 str= "Type %t|State changed %x0|Lin error below %x1|Lin error above %x2|Rot error below %x3|Rot error above %x4";
1437 uiDefButI(block, MENU, B_REDR, str, xco+10,yco-66,0.4*(width-20), 19,
1438 &arm->type, 0, 31, 0, 0, "Type");
1440 if (arm->type != SENS_ARM_STATE_CHANGED)
1442 uiDefButF(block, NUM, 1, "Value: ", xco+10+0.4*(width-20),yco-66,0.6*(width-20), 19,
1443 &arm->value, -10000.0, 10000.0, 100, 0, "Test the error against this value");
1453 glRects(xco, yco-ysize, xco+width, yco);
1454 uiEmboss((float)xco, (float)yco-ysize,
1455 (float)xco+width, (float)yco, 1);
1457 draw_default_sensor_header(sens, block, xco, yco, width);
1460 uiDefBut(block, TEX, 1, "Act: ", xco+30,yco-44,width-60, 19,
1461 as->name, 0, 31, 0, 0, "Actuator name, actuator active state modifications will be detected");
1469 glRects(xco, yco-ysize, xco+width, yco);
1470 uiEmboss((float)xco, (float)yco-ysize,
1471 (float)xco+width, (float)yco, 1);
1473 draw_default_sensor_header(sens, block, xco, yco, width);
1476 uiDefButS(block, NUM, 0, "Delay",(short)(10+xco),(short)(yco-44),(short)((width-22)*0.4+10), 19,
1477 &ds->delay, 0.0, 5000.0, 0, 0, "Delay in number of logic tics before the positive trigger (default 60 per second)");
1478 uiDefButS(block, NUM, 0, "Dur",(short)(10+xco+(width-22)*0.4+10),(short)(yco-44),(short)((width-22)*0.4-10), 19,
1479 &ds->duration, 0.0, 5000.0, 0, 0, "If >0, delay in number of logic tics before the negative trigger following the positive trigger");
1480 uiDefButBitS(block, TOG, SENS_DELAY_REPEAT, 0, "REP",(short)(xco + 10 + (width-22)*0.8),(short)(yco - 44),
1481 (short)(0.20 * (width-22)), 19, &ds->flag, 0.0, 0.0, 0, 0,
1482 "Toggle repeat option. If selected, the sensor restarts after Delay+Dur logic tics");
1489 /* Two lines: 48 pixels high. */
1492 glRects(xco, yco-ysize, xco+width, yco);
1493 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1495 /* line 1: header */
1496 draw_default_sensor_header(sens, block, xco, yco, width);
1498 /* Line 2: type selection. The number are a bit mangled to get
1499 * proper compatibility with older .blend files. */
1500 str= "Type %t|Left button %x1|Middle button %x2|"
1501 "Right button %x4|Wheel Up %x5|Wheel Down %x6|Movement %x8|Mouse over %x16|Mouse over any%x32";
1502 uiDefButS(block, MENU, B_REDR, str, xco+10, yco-44, (width*0.8f)-20, 19,
1503 &ms->type, 0, 31, 0, 0,
1504 "Specify the type of event this mouse sensor should trigger on");
1507 uiDefButBitS(block, TOG, SENS_MOUSE_FOCUS_PULSE, B_REDR, "Pulse",(short)(xco + 10) + (width*0.8f)-20,(short)(yco - 44),
1508 (short)(0.20 * (width-20)), 19, &ms->flag, 0.0, 0.0, 0, 0,
1509 "Moving the mouse over a different object generates a pulse");
1519 glRects(xco, yco-ysize, xco+width, yco);
1520 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1522 draw_default_sensor_header(sens, block, xco, yco, width);
1523 randomSensor = sens->data;
1524 /* some files were wrongly written, avoid crash now */
1527 uiDefButI(block, NUM, 1, "Seed: ", xco+10,yco-44,(width-20), 19,
1528 &randomSensor->seed, 0, 1000, 0, 0,
1529 "Initial seed of the generator. (Choose 0 for not random)");
1537 glRects(xco, yco-ysize, xco+width, yco);
1538 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1540 draw_default_sensor_header(sens, block, xco, yco, width);
1541 raySens = sens->data;
1543 /* 1. property or material */
1544 uiDefButBitS(block, TOG, SENS_COLLISION_MATERIAL, B_REDR, "M/P",
1545 xco + 10,yco - 44, 0.20 * (width-20), 19,
1546 &raySens->mode, 0.0, 0.0, 0, 0,
1547 "Toggle collision on material or property");
1549 if (raySens->mode & SENS_COLLISION_MATERIAL)
1551 uiDefBut(block, TEX, 1, "Material:", xco + 10 + 0.20 * (width-20), yco-44, 0.8*(width-20), 19,
1552 &raySens->matname, 0, 31, 0, 0,
1553 "Only look for Objects with this material");
1557 uiDefBut(block, TEX, 1, "Property:", xco + 10 + 0.20 * (width-20), yco-44, 0.8*(width-20), 19,
1558 &raySens->propname, 0, 31, 0, 0,
1559 "Only look for Objects with this property");
1563 uiDefButBitS(block, TOG, SENS_RAY_XRAY, 1, "X",
1564 xco + 10,yco - 68, 0.10 * (width-20), 19,
1565 &raySens->mode, 0.0, 0.0, 0, 0,
1566 "Toggle X-Ray option (see through objects that don't have the property)");
1567 /* 2. sensing range */
1568 uiDefButF(block, NUM, 1, "Range", xco+10 + 0.10 * (width-20), yco-68, 0.5 * (width-20), 19,
1569 &raySens->range, 0.01, 10000.0, 100, 0,
1570 "Sense objects no farther than this distance");
1572 /* 3. axis choice */
1573 str = "Type %t|+ X axis %x1|+ Y axis %x0|+ Z axis %x2|- X axis %x3|- Y axis %x4|- Z axis %x5";
1574 uiDefButI(block, MENU, B_REDR, str, xco+10 + 0.6 * (width-20), yco-68, 0.4 * (width-20), 19,
1575 &raySens->axisflag, 2.0, 31, 0, 0,
1576 "Specify along which axis the ray is cast");
1584 ysize = 2 * 24; /* total number of lines * 24 pixels/line */
1586 glRects(xco, yco-ysize, xco+width, yco);
1587 uiEmboss((float)xco, (float)yco-ysize,
1588 (float)xco+width, (float)yco, 1);
1590 /* line 1: header line */
1591 draw_default_sensor_header(sens, block, xco, yco, width);
1593 /* line 2: Subject filter */
1594 uiDefBut(block, TEX, 1, "Subject: ",
1595 (xco+10), (yco-44), (width-20), 19,
1596 mes->subject, 0, 31, 0, 0,
1597 "Optional subject filter: only accept messages with this subject"
1598 ", or empty for all");
1608 glRects(xco, yco-ysize, xco+width, yco);
1609 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1611 /* line 1: header */
1612 draw_default_sensor_header(sens, block, xco, yco, width);
1616 uiDefButC(block, NUM, 1, "Index:", xco+10, yco-44, 0.33 * (width-20), 19,
1617 &joy->joyindex, 0, SENS_JOY_MAXINDEX-1, 100, 0,
1618 "Specify which joystick to use");
1620 str= "Type %t|Button %x0|Axis %x1|Single Axis %x3|Hat%x2";
1621 uiDefButC(block, MENU, B_REDR, str, xco+87, yco-44, 0.26 * (width-20), 19,
1622 &joy->type, 0, 31, 0, 0,
1623 "The type of event this joystick sensor is triggered on");
1625 if (joy->type != SENS_JOY_AXIS_SINGLE) {
1626 if (joy->flag & SENS_JOY_ANY_EVENT) {
1627 switch (joy->type) {
1629 str = "All Axis Events";
1631 case SENS_JOY_BUTTON:
1632 str = "All Button Events";
1635 str = "All Hat Events";
1642 uiDefButBitS(block, TOG, SENS_JOY_ANY_EVENT, B_REDR, str,
1643 xco+10 + 0.475 * (width-20), yco-68, ((joy->flag & SENS_JOY_ANY_EVENT) ? 0.525 : 0.12) * (width-20), 19,
1644 &joy->flag, 0, 0, 0, 0,
1645 "Triggered by all events on this joysticks current type (axis/button/hat)");
1647 if(joy->type == SENS_JOY_BUTTON)
1649 if ((joy->flag & SENS_JOY_ANY_EVENT)==0) {
1650 uiDefButI(block, NUM, 1, "Number:", xco+10 + 0.6 * (width-20), yco-68, 0.4 * (width-20), 19,
1651 &joy->button, 0, 18, 100, 0,
1652 "Specify which button to use");
1655 else if(joy->type == SENS_JOY_AXIS)
1657 uiDefButS(block, NUM, 1, "Number:", xco+10, yco-68, 0.46 * (width-20), 19,
1658 &joy->axis, 1, 8.0, 100, 0,
1659 "Specify which axis pair to use, 1 is useually the main direction input");
1661 uiDefButI(block, NUM, 1, "Threshold:", xco+10 + 0.6 * (width-20),yco-44, 0.4 * (width-20), 19,
1662 &joy->precision, 0, 32768.0, 100, 0,
1663 "Specify the precision of the axis");
1665 if ((joy->flag & SENS_JOY_ANY_EVENT)==0) {
1666 str = "Type %t|Up Axis %x1 |Down Axis %x3|Left Axis %x2|Right Axis %x0";
1667 uiDefButI(block, MENU, B_REDR, str, xco+10 + 0.6 * (width-20), yco-68, 0.4 * (width-20), 19,
1668 &joy->axisf, 2.0, 31, 0, 0,
1669 "The direction of the axis, use 'All Events' to recieve events on any direction");
1672 else if (joy->type == SENS_JOY_HAT)
1674 uiDefButI(block, NUM, 1, "Number:", xco+10, yco-68, 0.46 * (width-20), 19,
1675 &joy->hat, 1, 4.0, 100, 0,
1676 "Specify which hat to use");
1678 if ((joy->flag & SENS_JOY_ANY_EVENT)==0) {
1679 str = "Direction%t|Up%x1|Down%x4|Left%x8|Right%x2|%l|Up/Right%x3|Down/Left%x12|Up/Left%x9|Down/Right%x6";
1680 uiDefButI(block, MENU, 0, str, xco+10 + 0.6 * (width-20), yco-68, 0.4 * (width-20), 19,
1681 &joy->hatf, 2.0, 31, 0, 0,
1682 "The direction of the hat, use 'All Events' to recieve events on any direction");
1685 else { /* (joy->type == SENS_JOY_AXIS_SINGLE)*/
1686 uiDefButS(block, NUM, 1, "Number:", xco+10, yco-68, 0.46 * (width-20), 19,
1687 &joy->axis_single, 1, 16.0, 100, 0,
1688 "Specify a single axis (verticle/horizontal/other) to detect");
1690 uiDefButI(block, NUM, 1, "Threshold:", xco+10 + 0.6 * (width-20),yco-44, 0.4 * (width-20), 19,
1691 &joy->precision, 0, 32768.0, 100, 0,
1692 "Specify the precision of the axis");
1704 static short draw_controllerbuttons(bController *cont, uiBlock *block, short xco, short yco, short width)
1706 bExpressionCont *ec;
1710 switch (cont->type) {
1711 case CONT_EXPRESSION:
1714 UI_ThemeColor(TH_PANEL);
1715 glRects(xco, yco-ysize, xco+width, yco);
1716 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1718 /* uiDefBut(block, LABEL, 1, "Not yet...", xco,yco-24,80, 19, NULL, 0, 0, 0, 0, ""); */
1720 /* uiDefBut(block, BUT, 1, "Variables", xco,yco-24,80, 19, NULL, 0, 0, 0, 0, "Available variables for expression"); */
1721 uiDefBut(block, TEX, 1, "Exp:", xco + 10 , yco-21, width-20, 19,
1722 ec->str, 0, 127, 0, 0,
1730 if(cont->data==NULL) init_controller(cont);
1733 UI_ThemeColor(TH_PANEL);
1734 glRects(xco, yco-ysize, xco+width, yco);
1735 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1738 uiBlockBeginAlign(block);
1739 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)");
1741 uiDefIDPoinBut(block, test_scriptpoin_but, ID_TXT, 1, "", xco+70,yco-23,width-74, 19, &pc->text, "Blender textblock to run as a script");
1743 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");
1744 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");
1746 uiBlockEndAlign(block);
1754 UI_ThemeColor(TH_PANEL);
1755 glRects(xco, yco-ysize, xco+width, yco);
1756 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1764 static int get_col_actuator(int type)
1767 case ACT_ACTION: return TH_PANEL;
1768 case ACT_SHAPEACTION: return TH_PANEL;
1769 case ACT_OBJECT: return TH_PANEL;
1770 case ACT_IPO: return TH_PANEL;
1771 case ACT_PROPERTY: return TH_PANEL;
1772 case ACT_SOUND: return TH_PANEL;
1773 case ACT_CAMERA: return TH_PANEL;
1774 case ACT_EDIT_OBJECT: return TH_PANEL;
1775 case ACT_GROUP: return TH_PANEL;
1776 case ACT_RANDOM: return TH_PANEL;
1777 case ACT_SCENE: return TH_PANEL;
1778 case ACT_MESSAGE: return TH_PANEL;
1779 case ACT_GAME: return TH_PANEL;
1780 case ACT_VISIBILITY: return TH_PANEL;
1781 case ACT_CONSTRAINT: return TH_PANEL;
1782 case ACT_STATE: return TH_PANEL;
1783 case ACT_ARMATURE: return TH_PANEL;
1784 default: return TH_PANEL;
1787 static void set_col_actuator(int item, int medium)
1789 int col= get_col_actuator(item);
1790 UI_ThemeColorShade(col, medium?30:10);
1794 static void change_object_actuator(bContext *C, void *act, void *arg)
1796 bObjectActuator *oa = act;
1798 if (oa->type != oa->otype) {
1800 case ACT_OBJECT_NORMAL:
1801 memset(oa, 0, sizeof(bObjectActuator));
1802 oa->flag = ACT_FORCE_LOCAL|ACT_TORQUE_LOCAL|ACT_DLOC_LOCAL|ACT_DROT_LOCAL;
1803 oa->type = ACT_OBJECT_NORMAL;
1806 case ACT_OBJECT_SERVO:
1807 memset(oa, 0, sizeof(bObjectActuator));
1808 oa->flag = ACT_LIN_VEL_LOCAL;
1809 oa->type = ACT_OBJECT_SERVO;
1810 oa->forcerot[0] = 30.0f;
1811 oa->forcerot[1] = 0.5f;
1812 oa->forcerot[2] = 0.0f;
1818 static void change_ipo_actuator(bContext *C, void *arg1_but, void *arg2_ia)
1820 bIpoActuator *ia = arg2_ia;
1821 uiBut *but = arg1_but;
1823 if (but->retval & ACT_IPOFORCE)
1824 ia->flag &= ~ACT_IPOADD;
1825 else if (but->retval & ACT_IPOADD)
1826 ia->flag &= ~ACT_IPOFORCE;
1827 but->retval = B_REDR;
1830 void update_object_actuator_PID(bContext *C, void *act, void *arg)
1832 bObjectActuator *oa = act;
1833 oa->forcerot[0] = 60.0f*oa->forcerot[1];
1836 char *get_state_name(Object *ob, short bit)
1842 cont = ob->controllers.first;
1844 if (cont->state_mask & mask) {
1852 static void check_state_mask(bContext *C, void *arg1_but, void *arg2_mask)
1854 wmWindow *win= CTX_wm_window(C);
1855 int shift= win->eventstate->shift;
1856 unsigned int *cont_mask = arg2_mask;
1857 uiBut *but = arg1_but;
1859 if (*cont_mask == 0 || !(shift))
1860 *cont_mask = (1<<but->retval);
1861 but->retval = B_REDR;
1864 static void check_armature_actuator(bContext *C, void *arg1_but, void *arg2_act)
1866 bArmatureActuator *act = arg2_act;
1867 uiBut *but = arg1_but;
1868 Object *ob= CTX_data_active_object(C);
1870 /* check that bone exist in the active object */
1871 but->retval = B_REDR;
1872 check_armature_bone_constraint(ob, act->posechannel, act->constraint);
1876 static short draw_actuatorbuttons(Object *ob, bActuator *act, uiBlock *block, short xco, short yco, short width)
1878 bSoundActuator *sa = NULL;
1879 bObjectActuator *oa = NULL;
1880 bIpoActuator *ia = NULL;
1881 bPropertyActuator *pa = NULL;
1882 bCameraActuator *ca = NULL;
1883 bEditObjectActuator *eoa = NULL;
1884 bConstraintActuator *coa = NULL;
1885 bSceneActuator *sca = NULL;
1886 bGroupActuator *ga = NULL;
1887 bRandomActuator *randAct = NULL;
1888 bMessageActuator *ma = NULL;
1889 bActionActuator *aa = NULL;
1890 bGameActuator *gma = NULL;
1891 bVisibilityActuator *visAct = NULL;
1892 bTwoDFilterActuator *tdfa = NULL;
1893 bParentActuator *parAct = NULL;
1894 bStateActuator *staAct = NULL;
1895 bArmatureActuator *armAct = NULL;
1898 short ysize = 0, wval;
1904 /* yco is at the top of the rect, draw downwards */
1905 set_col_actuator(act->type, 0);
1912 wval = (width-100)/3;
1913 if (oa->type == ACT_OBJECT_NORMAL)
1915 if ( ob->gameflag & OB_DYNAMIC )
1924 glRects(xco, yco-ysize, xco+width, yco);
1925 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1927 uiBlockBeginAlign(block);
1928 uiDefBut(block, LABEL, 0, "Loc", xco, yco-45, 45, 19, NULL, 0, 0, 0, 0, "Sets the location");
1929 uiDefButF(block, NUM, 0, "", xco+45, yco-45, wval, 19, oa->dloc, -10000.0, 10000.0, 10, 0, "");
1930 uiDefButF(block, NUM, 0, "", xco+45+wval, yco-45, wval, 19, oa->dloc+1, -10000.0, 10000.0, 10, 0, "");
1931 uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-45, wval, 19, oa->dloc+2, -10000.0, 10000.0, 10, 0, "");
1932 uiBlockEndAlign(block);
1934 uiDefBut(block, LABEL, 0, "Rot", xco, yco-64, 45, 19, NULL, 0, 0, 0, 0, "Sets the rotation");
1935 uiBlockBeginAlign(block);
1936 uiDefButF(block, NUM, 0, "", xco+45, yco-64, wval, 19, oa->drot, -10000.0, 10000.0, 10, 0, "");
1937 uiDefButF(block, NUM, 0, "", xco+45+wval, yco-64, wval, 19, oa->drot+1, -10000.0, 10000.0, 10, 0, "");
1938 uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-64, wval, 19, oa->drot+2, -10000.0, 10000.0, 10, 0, "");
1939 uiBlockEndAlign(block);
1941 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");
1942 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");
1944 if ( ob->gameflag & OB_DYNAMIC )
1946 uiDefBut(block, LABEL, 0, "Force", xco, yco-87, 55, 19, NULL, 0, 0, 0, 0, "Sets the force");
1947 uiBlockBeginAlign(block);
1948 uiDefButF(block, NUM, 0, "", xco+45, yco-87, wval, 19, oa->forceloc, -10000.0, 10000.0, 10, 0, "");
1949 uiDefButF(block, NUM, 0, "", xco+45+wval, yco-87, wval, 19, oa->forceloc+1, -10000.0, 10000.0, 10, 0, "");
1950 uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-87, wval, 19, oa->forceloc+2, -10000.0, 10000.0, 10, 0, "");
1951 uiBlockEndAlign(block);
1953 uiDefBut(block, LABEL, 0, "Torque", xco, yco-106, 55, 19, NULL, 0, 0, 0, 0, "Sets the torque");
1954 uiBlockBeginAlign(block);
1955 uiDefButF(block, NUM, 0, "", xco+45, yco-106, wval, 19, oa->forcerot, -10000.0, 10000.0, 10, 0, "");
1956 uiDefButF(block, NUM, 0, "", xco+45+wval, yco-106, wval, 19, oa->forcerot+1, -10000.0, 10000.0, 10, 0, "");
1957 uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-106, wval, 19, oa->forcerot+2, -10000.0, 10000.0, 10, 0, "");
1958 uiBlockEndAlign(block);
1961 if ( ob->gameflag & OB_DYNAMIC )
1963 uiDefBut(block, LABEL, 0, "LinV", xco, yco-129, 45, 19, NULL, 0, 0, 0, 0, "Sets the linear velocity");
1964 uiBlockBeginAlign(block);
1965 uiDefButF(block, NUM, 0, "", xco+45, yco-129, wval, 19, oa->linearvelocity, -10000.0, 10000.0, 10, 0, "");
1966 uiDefButF(block, NUM, 0, "", xco+45+wval, yco-129, wval, 19, oa->linearvelocity+1, -10000.0, 10000.0, 10, 0, "");
1967 uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-129, wval, 19, oa->linearvelocity+2, -10000.0, 10000.0, 10, 0, "");
1968 uiBlockEndAlign(block);
1970 uiDefBut(block, LABEL, 0, "AngV", xco, yco-148, 45, 19, NULL, 0, 0, 0, 0, "Sets the angular velocity");
1971 uiBlockBeginAlign(block);
1972 uiDefButF(block, NUM, 0, "", xco+45, yco-148, wval, 19, oa->angularvelocity, -10000.0, 10000.0, 10, 0, "");
1973 uiDefButF(block, NUM, 0, "", xco+45+wval, yco-148, wval, 19, oa->angularvelocity+1, -10000.0, 10000.0, 10, 0, "");
1974 uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-148, wval, 19, oa->angularvelocity+2, -10000.0, 10000.0, 10, 0, "");
1975 uiBlockEndAlign(block);
1977 uiDefBut(block, LABEL, 0, "Damp", xco, yco-171, 45, 19, NULL, 0, 0, 0, 0, "Number of frames to reach the target velocity");
1978 uiDefButS(block, NUM, 0, "", xco+45, yco-171, wval, 19, &oa->damping, 0.0, 1000.0, 100, 0, "");
1980 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");
1981 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");
1982 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");
1983 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");
1985 uiDefButBitS(block, TOG, ACT_ADD_LIN_VEL, 0, "add",xco+45+3*wval+15, yco-129, 35, 19, &oa->flag, 0.0, 0.0, 0, 0, "Toggles between ADD and SET linV");
1987 } else if (oa->type == ACT_OBJECT_SERVO)
1991 glRects(xco, yco-ysize, xco+width, yco);
1992 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1994 uiDefBut(block, LABEL, 0, "Ref", xco, yco-45, 45, 19, NULL, 0, 0, 0, 0, "");
1995 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");
1996 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");
1997 uiBlockBeginAlign(block);
1998 uiDefButF(block, NUM, 0, "", xco+45, yco-68, wval, 19, oa->linearvelocity, -10000.0, 10000.0, 10, 0, "");
1999 uiDefButF(block, NUM, 0, "", xco+45+wval, yco-68, wval, 19, oa->linearvelocity+1, -10000.0, 10000.0, 10, 0, "");
2000 uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-68, wval, 19, oa->linearvelocity+2, -10000.0, 10000.0, 10, 0, "");
2001 uiBlockEndAlign(block);
2002 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");
2004 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)");
2005 uiBlockBeginAlign(block);
2006 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");
2007 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");
2008 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");
2009 uiBlockEndAlign(block);
2010 uiDefBut(block, LABEL, 0, "Max", xco, yco-110, 45, 19, NULL, 0, 0, 0, 0, "Set the upper limit for force");
2011 uiDefBut(block, LABEL, 0, "Min", xco, yco-129, 45, 19, NULL, 0, 0, 0, 0, "Set the lower limit for force");
2012 if (oa->flag & ACT_SERVO_LIMIT_X) {
2013 uiDefButF(block, NUM, 0, "", xco+45, yco-110, wval, 19, oa->dloc, -10000.0, 10000.0, 10, 0, "");
2014 uiDefButF(block, NUM, 0, "", xco+45, yco-129, wval, 19, oa->drot, -10000.0, 10000.0, 10, 0, "");
2016 if (oa->flag & ACT_SERVO_LIMIT_Y) {
2017 uiDefButF(block, NUM, 0, "", xco+45+wval, yco-110, wval, 19, oa->dloc+1, -10000.0, 10000.0, 10, 0, "");
2018 uiDefButF(block, NUM, 0, "", xco+45+wval, yco-129, wval, 19, oa->drot+1, -10000.0, 10000.0, 10, 0, "");
2020 if (oa->flag & ACT_SERVO_LIMIT_Z) {
2021 uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-110, wval, 19, oa->dloc+2, -10000.0, 10000.0, 10, 0, "");
2022 uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-129, wval, 19, oa->drot+2, -10000.0, 10000.0, 10, 0, "");
2024 uiDefBut(block, LABEL, 0, "Servo", xco, yco-152, 45, 19, NULL, 0, 0, 0, 0, "Coefficients of the PID servo controller");
2025 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");
2026 uiDefBut(block, LABEL, 0, "Slow", xco, yco-171, 45, 19, NULL, 0, 0, 0, 0, "Low value of I coefficient correspond to slow response");
2027 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");
2028 uiButSetFunc(but, update_object_actuator_PID, oa, NULL);
2029 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");
2030 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");
2032 str= "Motion Type %t|Simple motion %x0|Servo Control %x1";
2033 but = uiDefButS(block, MENU, B_REDR, str, xco+40, yco-23, (width-80), 19, &oa->type, 0.0, 0.0, 0, 0, "");
2034 oa->otype = oa->type;
2035 uiButSetFunc(but, change_object_actuator, oa, NULL);
2040 case ACT_SHAPEACTION:
2043 #ifdef __NLA_ACTION_BY_MOTION_ACTUATOR
2049 glRects(xco, yco-ysize, xco+width, yco);
2050 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2053 wval = (width-60)/3;
2055 // str= "Action types %t|Play %x0|Ping Pong %x1|Flipper %x2|Loop Stop %x3|Loop End %x4|Property %x6";
2056 #ifdef __NLA_ACTION_BY_MOTION_ACTUATOR
2057 str= "Action types %t|Play %x0|Flipper %x2|Loop Stop %x3|Loop End %x4|Property %x6|Displacement %x7";
2059 str= "Action types %t|Play %x0|Flipper %x2|Loop Stop %x3|Loop End %x4|Property %x6";
2061 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");
2062 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");
2064 uiDefButBitS(block, TOGN, 1, 0, "Continue", xco+((width/3)*2)+20, yco-24, 60, 19,
2065 &aa->end_reset, 0.0, 0.0, 0, 0, "Restore last frame when switching on/off, otherwise play from the start each time");
2068 if(aa->type == ACT_ACTION_FROM_PROP)
2070 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");
2074 uiDefButI(block, NUM, 0, "Sta: ",xco+10, yco-44, (width-20)/2, 19, &aa->sta, 1.0, MAXFRAMEF, 0, 0, "Start frame");
2075 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");
2078 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");
2079 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");
2081 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");
2084 #ifdef __NLA_ACTION_BY_MOTION_ACTUATOR
2085 if(aa->type == ACT_ACTION_MOTION)
2087 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");
2102 glRects(xco, yco-ysize, xco+width, yco);
2103 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2105 str = "Ipo types %t|Play %x0|Ping Pong %x1|Flipper %x2|Loop Stop %x3|Loop End %x4|Property %x6";
2107 uiDefButS(block, MENU, B_REDR, str, xco+10, yco-24, (width-20)/2, 19, &ia->type, 0, 0, 0, 0, "");
2109 but = uiDefButBitS(block, TOG, ACT_IPOFORCE, ACT_IPOFORCE,
2110 "Force", xco+10+(width-20)/2, yco-24, (width-20)/4-10, 19,
2111 &ia->flag, 0, 0, 0, 0,
2112 "Apply Ipo as a global or local force depending on the local option (dynamic objects only)");
2113 uiButSetFunc(but, change_ipo_actuator, but, ia);
2115 but = uiDefButBitS(block, TOG, ACT_IPOADD, ACT_IPOADD,
2116 "Add", xco+3*(width-20)/4, yco-24, (width-20)/4-10, 19,
2117 &ia->flag, 0, 0, 0, 0,
2118 "Ipo is added to the current loc/rot/scale in global or local coordinate according to Local flag");
2119 uiButSetFunc(but, change_ipo_actuator, but, ia);
2121 /* Only show the do-force-local toggle if force is requested */
2122 if (ia->flag & (ACT_IPOFORCE|ACT_IPOADD)) {
2123 uiDefButBitS(block, TOG, ACT_IPOLOCAL, 0,
2124 "L", xco+width-30, yco-24, 20, 19,
2125 &ia->flag, 0, 0, 0, 0,
2126 "Let the ipo acts in local coordinates, used in Force and Add mode");
2129 if(ia->type==ACT_IPO_FROM_PROP) {
2130 uiDefBut(block, TEX, 0,
2131 "Prop: ", xco+10, yco-44, width-80, 19,
2132 ia->name, 0.0, 31.0, 0, 0,
2133 "Use this property to define the Ipo position");
2136 uiDefButI(block, NUM, 0,
2137 "Sta", xco+10, yco-44, (width-80)/2, 19,
2138 &ia->sta, 1.0, MAXFRAMEF, 0, 0,
2140 uiDefButI(block, NUM, 0,
2141 "End", xco+10+(width-80)/2, yco-44, (width-80)/2, 19,
2142 &ia->end, 1.0, MAXFRAMEF, 0, 0,
2145 uiDefButBitS(block, TOG, ACT_IPOCHILD, B_REDR,
2146 "Child", xco+10+(width-80), yco-44, 60, 19,
2147 &ia->flag, 0, 0, 0, 0,
2148 "Update IPO on all children Objects as well");
2149 uiDefBut(block, TEX, 0,
2150 "FrameProp: ", xco+10, yco-64, width-20, 19,
2151 ia->frameProp, 0.0, 31.0, 0, 0,
2152 "Assign the action's current frame number to this property");
2161 glRects(xco, yco-ysize, xco+width, yco);
2162 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2166 str= "Type%t|Assign%x0|Add %x1|Copy %x2|Toggle (bool/int/float/timer)%x3";
2167 uiDefButI(block, MENU, B_REDR, str, xco+30,yco-24,width-60, 19, &pa->type, 0, 31, 0, 0, "Type");
2169 uiDefBut(block, TEX, 1, "Prop: ", xco+30,yco-44,width-60, 19, pa->name, 0, 31, 0, 0, "Property name");
2172 if(pa->type==ACT_PROP_TOGGLE) {
2176 else if(pa->type==ACT_PROP_COPY) {
2177 uiDefIDPoinBut(block, test_obpoin_but, ID_OB, 1, "OB:", xco+10, yco-64, (width-20)/2, 19, &(pa->ob), "Copy from this Object");
2178 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");
2181 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");
2192 if(sa->flag & ACT_SND_3D_SOUND)
2197 wval = (width-20)/2;
2198 glRects(xco, yco-ysize, xco+width, yco);
2199 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2201 if(G.main->sound.first) {
2202 IDnames_to_pupstring(&str, "Sound files", NULL, &(G.main->sound), (ID *)sa->sound, &(sa->sndnr));
2203 /* reset this value, it is for handling the event */
2205 uiDefButS(block, MENU, B_SOUNDACT_BROWSE, str, xco+10,yco-22,20,19, &(sa->sndnr), 0, 0, 0, 0, "");
2206 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.");
2209 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";
2210 uiDefBut(block, TEX, B_IDNAME, "SO:",xco+30,yco-22,wval-20,19, sa->sound->id.name+2, 0.0, 21.0, 0, 0, "");
2211 uiDefButS(block, MENU, 1, dummy_str,xco+10,yco-44,width-20, 19, &sa->type, 0.0, 0.0, 0, 0, "");
2212 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");
2213 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");
2214 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.");
2215 if(sa->flag & ACT_SND_3D_SOUND)
2217 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.");
2218 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..");
2219 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.");
2220 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.");
2221 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.");
2222 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 und the normal gain in the inner cone.");
2223 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.");
2224 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.");
2230 uiDefButO(block, BUT, "sound.open", 0, "Load Sound", xco+10, yco-22, width-20, 19, "Load a sound file.");
2241 glRects(xco, yco-ysize, xco+width, yco);
2242 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2246 uiDefIDPoinBut(block, test_obpoin_but, ID_OB, 1, "OB:", xco+10, yco-24, (width-20)/2, 19, &(ca->ob), "Look at this Object");
2247 uiDefButF(block, NUM, 0, "Height:", xco+10+(width-20)/2, yco-24, (width-20)/2, 19, &ca->height, 0.0, 20.0, 0, 0, "");
2249 uiDefButF(block, NUM, 0, "Min:", xco+10, yco-44, (width-60)/2, 19, &ca->min, 0.0, 20.0, 0, 0, "");
2251 if(ca->axis==0) ca->axis= 'x';
2252 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");
2253 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");
2255 uiDefButF(block, NUM, 0, "Max:", xco+20+(width)/2, yco-44, (width-60)/2, 19, &ca->max, 0.0, 20.0, 0, 0, "");
2261 case ACT_EDIT_OBJECT:
2265 if(eoa->type==ACT_EDOB_ADD_OBJECT) {
2266 int wval; /* just a temp width */
2268 glRects(xco, yco-ysize, xco+width, yco);
2269 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2271 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)");
2272 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");
2275 uiDefBut(block, LABEL, 0, "linV", xco, yco-68, 45, 19,
2277 "Velocity upon creation");
2278 uiDefButF(block, NUM, 0, "", xco+45, yco-68, wval, 19,
2279 eoa->linVelocity, -100.0, 100.0, 10, 0,
2280 "Velocity upon creation, x component");
2281 uiDefButF(block, NUM, 0, "", xco+45+wval, yco-68, wval, 19,
2282 eoa->linVelocity+1, -100.0, 100.0, 10, 0,
2283 "Velocity upon creation, y component");
2284 uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-68, wval, 19,
2285 eoa->linVelocity+2, -100.0, 100.0, 10, 0,
2286 "Velocity upon creation, z component");
2287 uiDefButBitS(block, TOG, ACT_EDOB_LOCAL_LINV, 0, "L", xco+45+3*wval, yco-68, 15, 19,
2288 &eoa->localflag, 0.0, 0.0, 0, 0,
2289 "Apply the transformation locally");
2292 uiDefBut(block, LABEL, 0, "AngV", xco, yco-90, 45, 19,
2294 "Angular velocity upon creation");
2295 uiDefButF(block, NUM, 0, "", xco+45, yco-90, wval, 19,
2296 eoa->angVelocity, -10000.0, 10000.0, 10, 0,
2297 "Angular velocity upon creation, x component");
2298 uiDefButF(block, NUM, 0, "", xco+45+wval, yco-90, wval, 19,
2299 eoa->angVelocity+1, -10000.0, 10000.0, 10, 0,
2300 "Angular velocity upon creation, y component");
2301 uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-90, wval, 19,
2302 eoa->angVelocity+2, -10000.0, 10000.0, 10, 0,
2303 "Angular velocity upon creation, z component");
2304 uiDefButBitS(block, TOG, ACT_EDOB_LOCAL_ANGV, 0, "L", xco+45+3*wval, yco-90, 15, 19,
2305 &eoa->localflag, 0.0, 0.0, 0, 0,
2306 "Apply the rotation locally");
2310 else if(eoa->type==ACT_EDOB_END_OBJECT) {
2312 glRects(xco, yco-ysize, xco+width, yco);
2313 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2315 else if(eoa->type==ACT_EDOB_REPLACE_MESH) {
2317 glRects(xco, yco-ysize, xco+width, yco);
2318 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2320 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");
2322 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");
2323 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)");
2325 else if(eoa->type==ACT_EDOB_TRACK_TO) {
2327 glRects(xco, yco-ysize, xco+width, yco);
2328 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2330 uiDefIDPoinBut(block, test_obpoin_but, ID_OB, 1, "OB:", xco+10, yco-44, (width-20)/2, 19, &(eoa->ob), "Track to this Object");
2331 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");
2332 uiDefButS(block, TOG, 0, "3D", xco+width-50, yco-44, 40, 19, &eoa->flag, 0.0, 0.0, 0, 0, "Enable 3D tracking");
2334 else if(eoa->type==ACT_EDOB_DYNAMICS) {
2336 glRects(xco, yco-ysize, xco+width, yco);
2337 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2339 str= "Dynamic Operation %t|Restore Dynamics %x0|Suspend Dynamics %x1|Enable Rigid Body %x2|Disable Rigid Body %x3|Set Mass %x4";
2340 uiDefButS(block, MENU, B_REDR, str, xco+40, yco-44, (width-80), 19, &(eoa->dyn_operation), 0.0, 0.0, 0, 0, "");
2341 if(eoa->dyn_operation==4) {
2342 uiDefButF(block, NUM, 0, "", xco+40, yco-63, width-80, 19,
2343 &eoa->mass, 0.0, 10000.0, 10, 0,
2347 str= "Edit Object %t|Add Object %x0|End Object %x1|Replace Mesh %x2|Track to %x3|Dynamics %x4";
2348 uiDefButS(block, MENU, B_REDR, str, xco+40, yco-24, (width-80), 19, &eoa->type, 0.0, 0.0, 0, 0, "");
2354 case ACT_CONSTRAINT:
2357 if (coa->type == ACT_CONST_TYPE_LOC) {
2360 glRects(xco, yco-ysize, xco+width, yco);
2361 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2363 /* str= "Limit %t|None %x0|Loc X %x1|Loc Y %x2|Loc Z %x4|Rot X %x8|Rot Y %x16|Rot Z %x32"; */
2364 /* coa->flag &= ~(63); */
2365 str= "Limit %t|None %x0|Loc X %x1|Loc Y %x2|Loc Z %x4";
2368 uiDefButS(block, MENU, 1, str, xco+10, yco-65, 70, 19, &coa->flag, 0.0, 0.0, 0, 0, "");
2370 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");
2371 uiDefBut(block, LABEL, 0, "Min", xco+80, yco-45, (width-90)/2, 19, NULL, 0.0, 0.0, 0, 0, "");
2372 uiDefBut(block, LABEL, 0, "Max", xco+80+(width-90)/2, yco-45, (width-90)/2, 19, NULL, 0.0, 0.0, 0, 0, "");
2374 if(coa->flag & ACT_CONST_LOCX) fp= coa->minloc;
2375 else if(coa->flag & ACT_CONST_LOCY) fp= coa->minloc+1;
2376 else if(coa->flag & ACT_CONST_LOCZ) fp= coa->minloc+2;
2377 else if(coa->flag & ACT_CONST_ROTX) fp= coa->minrot;
2378 else if(coa->flag & ACT_CONST_ROTY) fp= coa->minrot+1;
2379 else fp= coa->minrot+2;
2381 uiDefButF(block, NUM, 0, "", xco+80, yco-65, (width-90)/2, 19, fp, -2000.0, 2000.0, 10, 0, "");
2382 uiDefButF(block, NUM, 0, "", xco+80+(width-90)/2, yco-65, (width-90)/2, 19, fp+3, -2000.0, 2000.0, 10, 0, "");
2383 } else if (coa->type == ACT_CONST_TYPE_DIST) {
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|-X axis %x8|-Y axis %x16|-Z axis %x32";
2390 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");
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, "Range", xco+80, yco-45, (width-115)/2, 19, NULL, 0.0, 0.0, 0, 0, "Set the maximum length of ray");
2394 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");
2395 uiDefButBitS(block, TOG, ACT_CONST_LOCAL, 0, "L", xco+80+(width-115), yco-45, 25, 19,
2396 &coa->flag, 0.0, 0.0, 0, 0, "Set ray along object's axis or global axis");
2398 if(coa->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= coa->minloc;
2399 else if(coa->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= coa->minloc+1;
2400 else fp= coa->minloc+2;
2402 uiDefButF(block, NUM, 0, "", xco+80, yco-65, (width-115)/2, 19, fp+3, 0.0, 2000.0, 10, 0, "Maximum length of ray");
2403 if (coa->flag & ACT_CONST_DISTANCE)
2404 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");
2405 uiDefButBitS(block, TOG, ACT_CONST_NORMAL, 0, "N", xco+80+(width-115), yco-65, 25, 19,
2406 &coa->flag, 0.0, 0.0, 0, 0, "Set object axis along (local axis) or parallel (global axis) to the normal at hit position");
2407 uiDefButBitS(block, TOG, ACT_CONST_MATERIAL, B_REDR, "M/P", xco+10, yco-84, 40, 19,
2408 &coa->flag, 0.0, 0.0, 0, 0, "Detect material instead of property");
2409 if (coa->flag & ACT_CONST_MATERIAL)
2411 uiDefBut(block, TEX, 1, "Material:", xco + 50, yco-84, (width-60), 19,
2412 coa->matprop, 0, 31, 0, 0,
2413 "Ray detects only Objects with this material");
2417 uiDefBut(block, TEX, 1, "Property:", xco + 50, yco-84, (width-60), 19,
2418 coa->matprop, 0, 31, 0, 0,
2419 "Ray detect only Objects with this property");
2421 uiDefButBitS(block, TOG, ACT_CONST_PERMANENT, 0, "PER", xco+10, yco-103, 40, 19,
2422 &coa->flag, 0.0, 0.0, 0, 0, "Persistent actuator: stays active even if ray does not reach target");
2423 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");
2424 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");
2425 } else if (coa->type == ACT_CONST_TYPE_ORI) {
2428 glRects(xco, yco-ysize, xco+width, yco);
2429 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2431 str= "Direction %t|None %x0|X axis %x1|Y axis %x2|Z axis %x4";
2432 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");
2434 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");
2435 uiDefBut(block, LABEL, 0, "X", xco+80, yco-45, (width-115)/3, 19, NULL, 0.0, 0.0, 0, 0, "");
2436 uiDefBut(block, LABEL, 0, "Y", xco+80+(width-115)/3, yco-45, (width-115)/3, 19, NULL, 0.0, 0.0, 0, 0, "");
2437 uiDefBut(block, LABEL, 0, "Z", xco+80+2*(width-115)/3, yco-45, (width-115)/3, 19, NULL, 0.0, 0.0, 0, 0, "");
2439 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");
2440 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");
2441 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");
2443 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");
2444 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");
2445 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");
2446 } else if (coa->type == ACT_CONST_TYPE_FH) {
2449 glRects(xco, yco-ysize, xco+width, yco);
2450 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2452 str= "Direction %t|None %x0|X axis %x1|Y axis %x2|Z axis %x4|-X axis %x8|-Y axis %x16|-Z axis %x32";
2453 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)");
2455 if(coa->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= coa->minloc;
2456 else if(coa->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= coa->minloc+1;
2457 else fp= coa->minloc+2;
2459 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");
2460 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");
2461 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");
2463 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");
2464 uiDefButBitS(block, TOG, ACT_CONST_NORMAL, 0, "N", xco+80+(width-115), yco-65, 25, 19,
2465 &coa->flag, 0.0, 0.0, 0, 0, "Add a horizontal spring force on slopes");
2466 uiDefButBitS(block, TOG, ACT_CONST_MATERIAL, B_REDR, "M/P", xco+10, yco-84, 40, 19,
2467 &coa->flag, 0.0, 0.0, 0, 0, "Detect material instead of property");
2468 if (coa->flag & ACT_CONST_MATERIAL)
2470 uiDefBut(block, TEX, 1, "Material:", xco + 50, yco-84, (width-60), 19,
2471 coa->matprop, 0, 31, 0, 0,
2472 "Ray detects only Objects with this material");
2476 uiDefBut(block, TEX, 1, "Property:", xco + 50, yco-84, (width-60), 19,
2477 coa->matprop, 0, 31, 0, 0,
2478 "Ray detect only Objects with this property");
2480 uiDefButBitS(block, TOG, ACT_CONST_PERMANENT, 0, "PER", xco+10, yco-103, 40, 19,
2481 &coa->flag, 0.0, 0.0, 0, 0, "Persistent actuator: stays active even if ray does not reach target");
2482 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");
2483 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");
2485 str= "Constraint Type %t|Location %x0|Distance %x1|Orientation %x2|Force field %x3";
2486 but = uiDefButS(block, MENU, B_REDR, str, xco+40, yco-23, (width-80), 19, &coa->type, 0.0, 0.0, 0, 0, "");
2493 if(sca->type==ACT_SCENE_RESTART) {
2495 glRects(xco, yco-ysize, xco+width, yco);
2496 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2498 else if(sca->type==ACT_SCENE_CAMERA) {
2501 glRects(xco, yco-ysize, xco+width, yco);
2502 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2504 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");
2506 else if(sca->type==ACT_SCENE_SET) {
2509 glRects(xco, yco-ysize, xco+width, yco);
2510 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2512 uiDefIDPoinBut(block, test_scenepoin_but, ID_SCE, 1, "SCE:", xco+40, yco-44, (width-80), 19, &(sca->scene), "Set this Scene");
2514 else if(sca->type==ACT_SCENE_ADD_FRONT) {
2517 glRects(xco, yco-ysize, xco+width, yco);
2518 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2520 uiDefIDPoinBut(block, test_scenepoin_but, ID_SCE, 1, "SCE:", xco+40, yco-44, (width-80), 19, &(sca->scene), "Add an Overlay Scene");
2522 else if(sca->type==ACT_SCENE_ADD_BACK) {
2525 glRects(xco, yco-ysize, xco+width, yco);
2526 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2528 uiDefIDPoinBut(block, test_scenepoin_but, ID_SCE, 1, "SCE:", xco+40, yco-44, (width-80), 19, &(sca->scene), "Add a Background Scene");
2530 else if(sca->type==ACT_SCENE_REMOVE) {
2533 glRects(xco, yco-ysize, xco+width, yco);
2534 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2536 uiDefIDPoinBut(block, test_scenepoin_but, ID_SCE, 1, "SCE:", xco+40, yco-44, (width-80), 19, &(sca->scene), "Remove a Scene");
2538 else if(sca->type==ACT_SCENE_SUSPEND) {
2541 glRects(xco, yco-ysize, xco+width, yco);
2542 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2544 uiDefIDPoinBut(block, test_scenepoin_but, ID_SCE, 1, "SCE:", xco+40, yco-44, (width-80), 19, &(sca->scene), "Pause a Scene");
2546 else if(sca->type==ACT_SCENE_RESUME) {
2549 glRects(xco, yco-ysize, xco+width, yco);
2550 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2552 uiDefIDPoinBut(block, test_scenepoin_but, ID_SCE, 1, "SCE:", xco+40, yco-44, (width-80), 19, &(sca->scene), "Unpause a Scene");
2555 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";
2556 uiDefButS(block, MENU, B_REDR, str, xco+40, yco-24, (width-80), 19, &sca->type, 0.0, 0.0, 0, 0, "");
2563 if (gma->type == ACT_GAME_LOAD)
2567 glRects(xco, yco-ysize, xco+width, yco);
2568 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2569 uiDefBut(block, TEX, 1, "File: ", xco+10, yco-44,width-20,19, &(gma->filename), 0, 63, 0, 0, "Load this blend file, use the \"//\" prefix for a path relative to the current blend file");
2570 // uiDefBut(block, TEX, 1, "Anim: ", xco+10, yco-64,width-20,19, &(gma->loadaniname), 0, 63, 0, 0, "Use this loadinganimation");
2572 /* else if (gma->type == ACT_GAME_START)
2575 glRects(xco, yco-ysize, xco+width, yco);
2576 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2578 uiDefBut(block, TEX, 1, "File: ", xco+10, yco-44,width-20,19, &(gma->filename), 0, 63, 0, 0, "Load this file");
2579 uiDefBut(block, TEX, 1, "Anim: ", xco+10, yco-64,width-20,19, &(gma->loadaniname), 0, 63, 0, 0, "Use this loadinganimation");
2581 */ else if (ELEM4(gma->type, ACT_GAME_RESTART, ACT_GAME_QUIT, ACT_GAME_SAVECFG, ACT_GAME_LOADCFG))
2584 glRects(xco, yco-ysize, xco+width, yco);
2585 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2588 //str = "Scene %t|Load game%x0|Start loaded game%x1|Restart this game%x2|Quit this game %x3";