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) 2001-2002 by NaN Holding BV.
21 * All rights reserved.
23 * The Original Code is: all of this file.
25 * Contributor(s): none yet.
27 * ***** END GPL LICENSE BLOCK *****
40 #include "MEM_guardedalloc.h"
42 #include "BLI_blenlib.h"
43 #include "BLI_arithb.h"
45 #include "DNA_action_types.h"
46 #include "DNA_material_types.h"
47 #include "DNA_sensor_types.h"
48 #include "DNA_actuator_types.h"
49 #include "DNA_controller_types.h"
50 #include "DNA_property_types.h"
51 #include "DNA_object_types.h"
52 #include "DNA_screen_types.h"
53 #include "DNA_space_types.h"
54 #include "DNA_scene_types.h"
55 #include "DNA_sound_types.h"
56 #include "DNA_text_types.h"
57 #include "DNA_userdef_types.h"
58 #include "DNA_view3d_types.h"
59 #include "DNA_mesh_types.h"
60 #include "DNA_world_types.h"
62 #include "BKE_library.h"
63 #include "BKE_global.h"
66 #include "BKE_property.h"
67 #include "BKE_property.h"
68 #include "BKE_utildefines.h"
71 #include "BIF_resources.h"
72 #include "BIF_space.h"
73 #include "BIF_interface.h"
74 #include "BIF_butspace.h"
75 #include "BIF_screen.h"
76 #include "BIF_keyval.h"
77 #include "BIF_editsound.h"
79 #include "BIF_editsca.h"
82 #include "BDR_editcurve.h"
83 #include "BDR_editobject.h"
84 #include "BSE_headerbuttons.h"
85 #include "BSE_filesel.h"
89 #include "nla.h" /* For __NLA : Important, do not remove */
90 #include "butspace.h" // own module
91 #include "interface.h"
94 void buttons_enji(uiBlock *, Object *);
95 void buttons_ketsji(uiBlock *, Object *);
96 void buttons_bullet(uiBlock *, Object *);
100 static ID **get_selected_and_linked_obs(short *count, short scavisflag);
101 static char *actuator_pup(Object *owner);
106 static void del_property(void *selpropv, void *data2_unused)
108 bProperty *prop, *selprop= selpropv;
115 prop= ob->prop.first;
118 if (strcmp(prop->name,"Text") == 0) {
119 allqueue(REDRAWVIEW3D, 0);
121 BLI_remlink(&ob->prop, prop);
128 BIF_undo_push("Delete property");
129 allqueue(REDRAWBUTSLOGIC, 0);
133 static int vergname(const void *v1, const void *v2)
140 return strcmp(*x1, *x2);
143 void make_unique_prop_names(char *str)
151 short a, obcount, propcount=0, nr;
154 /* this function is called by a Button, and gives the current
155 * stringpointer as an argument, this is the one that can change
158 idar= get_selected_and_linked_obs(&obcount, BUTS_SENS_SEL|BUTS_SENS_ACT|BUTS_ACT_SEL|BUTS_ACT_ACT|BUTS_CONT_SEL|BUTS_CONT_ACT);
160 /* for each object, make properties and sca names unique */
162 /* count total names */
163 for(a=0; a<obcount; a++) {
164 ob= (Object *)idar[a];
165 propcount+= BLI_countlist(&ob->prop);
166 propcount+= BLI_countlist(&ob->sensors);
167 propcount+= BLI_countlist(&ob->controllers);
168 propcount+= BLI_countlist(&ob->actuators);
171 if(idar) MEM_freeN(idar);
175 /* make names array for sorting */
176 names= MEM_callocN(propcount*sizeof(void *), "names");
178 /* count total names */
180 for(a=0; a<obcount; a++) {
181 ob= (Object *)idar[a];
182 prop= ob->prop.first;
184 names[nr++]= prop->name;
187 sens= ob->sensors.first;
189 names[nr++]= sens->name;
192 cont= ob->controllers.first;
194 names[nr++]= cont->name;
197 act= ob->actuators.first;
199 names[nr++]= act->name;
204 qsort(names, propcount, sizeof(void *), vergname);
206 /* now we check for double names, and change them */
208 for(nr=0; nr<propcount; nr++) {
209 if(names[nr]!=str && strcmp( names[nr], str )==0 ) {
210 BLI_newname(str, +1);
218 static void make_unique_prop_names_cb(void *strv, void *redraw_view3d_flagv)
221 int redraw_view3d_flag= GET_INT_FROM_POINTER(redraw_view3d_flagv);
223 make_unique_prop_names(str);
224 if (redraw_view3d_flag) allqueue(REDRAWVIEW3D, 0);
227 static void sca_move_sensor(void *datav, void *data2_unused)
229 bSensor *sens_to_delete= datav;
234 val= pupmenu("Move up%x1|Move down %x2");
237 /* now find out which object has this ... */
241 sens= base->object->sensors.first;
243 if(sens == sens_to_delete) break;
248 if( val==1 && sens->prev) {
249 for (tmp=sens->prev; tmp; tmp=tmp->prev) {
250 if (tmp->flag & SENS_VISIBLE)
254 BLI_remlink(&base->object->sensors, sens);
255 BLI_insertlinkbefore(&base->object->sensors, tmp, sens);
258 else if( val==2 && sens->next) {
259 for (tmp=sens->next; tmp; tmp=tmp->next) {
260 if (tmp->flag & SENS_VISIBLE)
264 BLI_remlink(&base->object->sensors, sens);
265 BLI_insertlink(&base->object->sensors, tmp, sens);
268 BIF_undo_push("Move sensor");
269 allqueue(REDRAWBUTSLOGIC, 0);
278 static void sca_move_controller(void *datav, void *data2_unused)
280 bController *controller_to_del= datav;
283 bController *cont, *tmp;
285 val= pupmenu("Move up%x1|Move down %x2");
288 /* now find out which object has this ... */
292 cont= base->object->controllers.first;
294 if(cont == controller_to_del) break;
299 if( val==1 && cont->prev) {
300 /* locate the controller that has the same state mask but is earlier in the list */
303 if(tmp->state_mask & cont->state_mask)
308 BLI_remlink(&base->object->controllers, cont);
309 BLI_insertlinkbefore(&base->object->controllers, tmp, cont);
312 else if( val==2 && cont->next) {
315 if(tmp->state_mask & cont->state_mask)
319 BLI_remlink(&base->object->controllers, cont);
320 BLI_insertlink(&base->object->controllers, tmp, cont);
322 BIF_undo_push("Move controller");
323 allqueue(REDRAWBUTSLOGIC, 0);
332 static void sca_move_actuator(void *datav, void *data2_unused)
334 bActuator *actuator_to_move= datav;
337 bActuator *act, *tmp;
339 val= pupmenu("Move up%x1|Move down %x2");
342 /* now find out which object has this ... */
346 act= base->object->actuators.first;
348 if(act == actuator_to_move) break;
353 if( val==1 && act->prev) {
354 /* locate the first visible actuators before this one */
355 for (tmp = act->prev; tmp; tmp=tmp->prev) {
356 if (tmp->flag & ACT_VISIBLE)
360 BLI_remlink(&base->object->actuators, act);
361 BLI_insertlinkbefore(&base->object->actuators, tmp, act);
364 else if( val==2 && act->next) {
365 for (tmp=act->next; tmp; tmp=tmp->next) {
366 if (tmp->flag & ACT_VISIBLE)
370 BLI_remlink(&base->object->actuators, act);
371 BLI_insertlink(&base->object->actuators, tmp, act);
374 BIF_undo_push("Move actuator");
375 allqueue(REDRAWBUTSLOGIC, 0);
384 void do_logic_buts(unsigned short event)
399 /* check for inconsistant types */
400 ob->gameflag &= ~(OB_PROP|OB_MAINACTOR|OB_DYNAMIC|OB_ACTOR);
401 ob->dtx |= OB_BOUNDBOX;
402 allqueue(REDRAWBUTSGAME, 0);
403 allqueue(REDRAWVIEW3D, 0);
407 /* check for inconsistant types */
408 ob->gameflag &= ~(OB_SECTOR|OB_MAINACTOR|OB_DYNAMIC|OB_ACTOR);
409 allqueue(REDRAWBUTSGAME, 0);
410 allqueue(REDRAWVIEW3D, 0);
416 ob->gameflag &= ~(OB_SECTOR|OB_PROP);
417 allqueue(REDRAWBUTSGAME, 0);
418 allqueue(REDRAWVIEW3D, 0);
423 prop= new_property(PROP_FLOAT);
424 make_unique_prop_names(prop->name);
425 BLI_addtail(&ob->prop, prop);
426 BIF_undo_push("Add property");
427 allqueue(REDRAWBUTSLOGIC, 0);
431 prop= ob->prop.first;
433 if(prop->type!=prop->otype) {
435 if (strcmp(prop->name, "Text") == 0) {
436 allqueue(REDRAWVIEW3D, 0);
441 allqueue(REDRAWBUTSLOGIC, 0);
445 for(ob=G.main->object.first; ob; ob=ob->id.next) {
446 if(ob->scaflag & OB_ADDSENS) {
447 ob->scaflag &= ~OB_ADDSENS;
448 sens= new_sensor(SENS_ALWAYS);
449 BLI_addtail(&(ob->sensors), sens);
450 make_unique_prop_names(sens->name);
451 ob->scaflag |= OB_SHOWSENS;
455 BIF_undo_push("Add sensor");
456 allqueue(REDRAWBUTSLOGIC, 0);
460 for(ob=G.main->object.first; ob; ob=ob->id.next) {
461 sens= ob->sensors.first;
463 if(sens->type != sens->otype) {
465 sens->otype= sens->type;
471 allqueue(REDRAWBUTSLOGIC, 0);
475 for(ob=G.main->object.first; ob; ob=ob->id.next) {
476 sens= ob->sensors.first;
478 if(sens->flag & SENS_DEL) {
479 BLI_remlink(&(ob->sensors), sens);
486 BIF_undo_push("Delete sensor");
487 allqueue(REDRAWBUTSLOGIC, 0);
491 for(ob=G.main->object.first; ob; ob=ob->id.next) {
492 if(ob->scaflag & OB_ADDCONT) {
493 ob->scaflag &= ~OB_ADDCONT;
494 cont= new_controller(CONT_LOGIC_AND);
495 make_unique_prop_names(cont->name);
496 ob->scaflag |= OB_SHOWCONT;
497 BLI_addtail(&(ob->controllers), cont);
498 /* set the controller state mask from the current object state.
499 A controller is always in a single state, so select the lowest bit set
500 from the object state */
501 for (bit=0; bit<32; bit++) {
502 if (ob->state & (1<<bit))
505 cont->state_mask = (1<<bit);
506 if (cont->state_mask == 0) {
507 /* shouldn't happen, object state is never 0 */
508 cont->state_mask = 1;
512 BIF_undo_push("Add controller");
513 allqueue(REDRAWBUTSLOGIC, 0);
516 case B_SET_STATE_BIT:
517 for(ob=G.main->object.first; ob; ob=ob->id.next) {
518 if(ob->scaflag & OB_SETSTBIT) {
519 ob->scaflag &= ~OB_SETSTBIT;
520 ob->state = 0x3FFFFFFF;
523 allqueue(REDRAWBUTSLOGIC, 0);
526 case B_INIT_STATE_BIT:
527 for(ob=G.main->object.first; ob; ob=ob->id.next) {
528 if(ob->scaflag & OB_INITSTBIT) {
529 ob->scaflag &= ~OB_INITSTBIT;
530 ob->state = ob->init_state;
535 allqueue(REDRAWBUTSLOGIC, 0);
539 for(ob=G.main->object.first; ob; ob=ob->id.next) {
540 cont= ob->controllers.first;
542 if(cont->type != cont->otype) {
543 init_controller(cont);
544 cont->otype= cont->type;
550 allqueue(REDRAWBUTSLOGIC, 0);
555 for(ob=G.main->object.first; ob; ob=ob->id.next) {
556 cont= ob->controllers.first;
558 if(cont->flag & CONT_DEL) {
559 BLI_remlink(&(ob->controllers), cont);
560 unlink_controller(cont);
561 free_controller(cont);
567 BIF_undo_push("Delete controller");
568 allqueue(REDRAWBUTSLOGIC, 0);
572 for(ob=G.main->object.first; ob; ob=ob->id.next) {
573 if(ob->scaflag & OB_ADDACT) {
574 ob->scaflag &= ~OB_ADDACT;
575 act= new_actuator(ACT_OBJECT);
576 make_unique_prop_names(act->name);
577 BLI_addtail(&(ob->actuators), act);
578 ob->scaflag |= OB_SHOWACT;
581 BIF_undo_push("Add actuator");
582 allqueue(REDRAWBUTSLOGIC, 0);
586 for(ob=G.main->object.first; ob; ob=ob->id.next) {
587 act= ob->actuators.first;
589 if(act->type != act->otype) {
591 act->otype= act->type;
597 allqueue(REDRAWBUTSLOGIC, 0);
601 for(ob=G.main->object.first; ob; ob=ob->id.next) {
602 act= ob->actuators.first;
604 if(act->flag & ACT_DEL) {
605 BLI_remlink(&(ob->actuators), act);
606 unlink_actuator(act);
613 BIF_undo_push("Delete actuator");
614 allqueue(REDRAWBUTSLOGIC, 0);
617 case B_SOUNDACT_BROWSE:
618 /* since we don't know which... */
620 for(ob=G.main->object.first; ob; ob=ob->id.next) {
621 act= ob->actuators.first;
624 if(act->type==ACT_SOUND)
626 bSoundActuator *sa= act->data;
629 bSound *sound= G.main->sound.first;
632 if(sa->sndnr == -2) {
633 activate_databrowse((ID *)G.main->sound.first, ID_SO, 0, B_SOUNDACT_BROWSE,
634 &sa->sndnr, do_logic_buts);
643 sound= sound->id.next;
663 allqueue(REDRAWBUTSLOGIC, 0);
664 allqueue(REDRAWSOUND, 0);
671 static char *sensor_name(int type)
706 static char *sensor_pup(void)
708 /* the number needs to match defines in game.h */
709 return "Sensors %t|Always %x0|Delay %x13|Keyboard %x3|Mouse %x5|"
710 "Touch %x1|Collision %x6|Near %x2|Radar %x7|"
711 "Property %x4|Random %x8|Ray %x9|Message %x10|Joystick %x11|Actuator %x12";
714 static char *controller_name(int type)
721 case CONT_LOGIC_NAND:
727 case CONT_LOGIC_XNOR:
729 case CONT_EXPRESSION:
737 static char *controller_pup(void)
739 return "Controllers %t|AND %x0|OR %x1|XOR %x6|NAND %x4|NOR %x5|XNOR %x7|Expression %x2|Python %x3";
742 static char *actuator_name(int type)
745 case ACT_SHAPEACTION:
746 return "Shape Action";
765 case ACT_EDIT_OBJECT:
766 return "Edit Object";
794 static char *actuator_pup(Object *owner)
799 return "Actuators %t|Action %x15|Motion %x0|Constraint %x9|Ipo %x1"
800 "|Camera %x3|Sound %x5|Property %x6|Edit Object %x10"
801 "|Scene %x11|Random %x13|Message %x14|CD %x16|Game %x17"
802 "|Visibility %x18|2D Filter %x19|Parent %x20|State %x22";
806 return "Actuators %t|Shape Action %x21|Motion %x0|Constraint %x9|Ipo %x1"
807 "|Camera %x3|Sound %x5|Property %x6|Edit Object %x10"
808 "|Scene %x11|Random %x13|Message %x14|CD %x16|Game %x17"
809 "|Visibility %x18|2D Filter %x19|Parent %x20|State %x22";
813 return "Actuators %t|Motion %x0|Constraint %x9|Ipo %x1"
814 "|Camera %x3|Sound %x5|Property %x6|Edit Object %x10"
815 "|Scene %x11|Random %x13|Message %x14|CD %x16|Game %x17"
816 "|Visibility %x18|2D Filter %x19|Parent %x20|State %x22";
822 static void set_sca_ob(Object *ob)
827 cont= ob->controllers.first;
829 cont->mynew= (bController *)ob;
832 act= ob->actuators.first;
834 act->mynew= (bActuator *)ob;
839 static ID **get_selected_and_linked_obs(short *count, short scavisflag)
849 /* we need a sorted object list */
850 /* set scavisflags flags in Objects to indicate these should be evaluated */
851 /* also hide ob pointers in ->new entries of controllerss/actuators */
855 if(G.scene==NULL) return NULL;
857 ob= G.main->object.first;
864 if(G.vd) lay= G.vd->lay;
865 else lay= G.scene->lay;
869 if(base->lay & lay) {
870 if(base->flag & SELECT) {
871 if(scavisflag & BUTS_SENS_SEL) base->object->scavisflag |= OB_VIS_SENS;
872 if(scavisflag & BUTS_CONT_SEL) base->object->scavisflag |= OB_VIS_CONT;
873 if(scavisflag & BUTS_ACT_SEL) base->object->scavisflag |= OB_VIS_ACT;
880 if(scavisflag & BUTS_SENS_ACT) OBACT->scavisflag |= OB_VIS_SENS;
881 if(scavisflag & BUTS_CONT_ACT) OBACT->scavisflag |= OB_VIS_CONT;
882 if(scavisflag & BUTS_ACT_ACT) OBACT->scavisflag |= OB_VIS_ACT;
885 /* BUTS_XXX_STATE are similar to BUTS_XXX_LINK for selecting the object */
886 if(scavisflag & (BUTS_SENS_LINK|BUTS_CONT_LINK|BUTS_ACT_LINK|BUTS_SENS_STATE|BUTS_ACT_STATE)) {
891 ob= G.main->object.first;
894 /* 1st case: select sensor when controller selected */
895 if((scavisflag & (BUTS_SENS_LINK|BUTS_SENS_STATE)) && (ob->scavisflag & OB_VIS_SENS)==0) {
896 sens= ob->sensors.first;
898 for(a=0; a<sens->totlinks; a++) {
900 obt= (Object *)sens->links[a]->mynew;
901 if(obt && (obt->scavisflag & OB_VIS_CONT)) {
903 ob->scavisflag |= OB_VIS_SENS;
913 /* 2nd case: select cont when act selected */
914 if((scavisflag & BUTS_CONT_LINK) && (ob->scavisflag & OB_VIS_CONT)==0) {
915 cont= ob->controllers.first;
917 for(a=0; a<cont->totlinks; a++) {
919 obt= (Object *)cont->links[a]->mynew;
920 if(obt && (obt->scavisflag & OB_VIS_ACT)) {
922 ob->scavisflag |= OB_VIS_CONT;
932 /* 3rd case: select controller when sensor selected */
933 if((scavisflag & BUTS_CONT_LINK) && (ob->scavisflag & OB_VIS_SENS)) {
934 sens= ob->sensors.first;
936 for(a=0; a<sens->totlinks; a++) {
938 obt= (Object *)sens->links[a]->mynew;
939 if(obt && (obt->scavisflag & OB_VIS_CONT)==0) {
941 obt->scavisflag |= OB_VIS_CONT;
949 /* 4th case: select actuator when controller selected */
950 if( (scavisflag & (BUTS_ACT_LINK|BUTS_ACT_STATE)) && (ob->scavisflag & OB_VIS_CONT)) {
951 cont= ob->controllers.first;
953 for(a=0; a<cont->totlinks; a++) {
955 obt= (Object *)cont->links[a]->mynew;
956 if(obt && (obt->scavisflag & OB_VIS_ACT)==0) {
958 obt->scavisflag |= OB_VIS_ACT;
972 ob= G.main->object.first;
974 if( ob->scavisflag ) (*count)++;
978 if(*count==0) return NULL;
979 if(*count>24) *count= 24; /* temporal */
981 idar= MEM_callocN( (*count)*sizeof(void *), "idar");
983 ob= G.main->object.first;
986 if( ob->scavisflag ) {
994 /* just to be sure... these were set in set_sca_done_ob() */
995 clear_sca_new_poins();
1001 static int get_col_sensor(int type)
1004 case SENS_ALWAYS: return TH_BUT_ACTION;
1005 case SENS_DELAY: return TH_BUT_ACTION;
1006 case SENS_TOUCH: return TH_BUT_NEUTRAL;
1007 case SENS_COLLISION: return TH_BUT_SETTING;
1008 case SENS_NEAR: return TH_BUT_SETTING1;
1009 case SENS_KEYBOARD: return TH_BUT_SETTING2;
1010 case SENS_PROPERTY: return TH_BUT_NUM;
1011 case SENS_ACTUATOR: return TH_BUT_NUM;
1012 case SENS_MOUSE: return TH_BUT_TEXTFIELD;
1013 case SENS_RADAR: return TH_BUT_POPUP;
1014 case SENS_RANDOM: return TH_BUT_NEUTRAL;
1015 case SENS_RAY: return TH_BUT_SETTING1;
1016 case SENS_MESSAGE: return TH_BUT_SETTING2;
1017 case SENS_JOYSTICK: return TH_BUT_NEUTRAL;
1018 default: return TH_BUT_NEUTRAL;
1021 static void set_col_sensor(int type, int medium)
1023 int col= get_col_sensor(type);
1024 BIF_ThemeColorShade(col, medium?30:0);
1028 * Draws a toggle for pulse mode, a frequency field and a toggle to invert
1029 * the value of this sensor. Operates on the shared data block of sensors.
1031 static void draw_default_sensor_header(bSensor *sens,
1037 /* Pulsing and frequency */
1038 uiDefIconButBitS(block, TOG, SENS_PULSE_REPEAT, 1, ICON_DOTSUP,
1039 (short)(x + 10 + 0. * (w-20)), (short)(y - 19), (short)(0.15 * (w-20)), 19,
1040 &sens->pulse, 0.0, 0.0, 0, 0,
1041 "Activate TRUE level triggering (pulse mode)");
1043 uiDefIconButBitS(block, TOG, SENS_NEG_PULSE_MODE, 1, ICON_DOTSDOWN,
1044 (short)(x + 10 + 0.15 * (w-20)), (short)(y - 19), (short)(0.15 * (w-20)), 19,
1045 &sens->pulse, 0.0, 0.0, 0, 0,
1046 "Activate FALSE level triggering (pulse mode)");
1047 uiDefButS(block, NUM, 1, "f:",
1048 (short)(x + 10 + 0.3 * (w-20)), (short)(y - 19), (short)(0.275 * (w-20)), 19,
1049 &sens->freq, 0.0, 10000.0, 0, 0,
1050 "Delay between repeated pulses (in logic tics, 0 = no delay)");
1052 /* value or shift? */
1053 uiDefButS(block, TOG, 1, "Inv",
1054 (short)(x + 10 + 0.85 * (w-20)), (short)(y - 19), (short)(0.15 * (w-20)), 19,
1055 &sens->invert, 0.0, 0.0, 0, 0,
1056 "Invert the level (output) of this sensor");
1057 uiDefButS(block, TOG, 1, "Lvl",
1058 (short)(x + 10 + 0.70 * (w-20)), (short)(y - 19), (short)(0.15 * (w-20)), 19,
1059 &sens->level, 0.0, 0.0, 0, 0,
1060 "Level detector versus edge detector (only applicable in case of logic state transition)");
1063 static short draw_sensorbuttons(bSensor *sens, uiBlock *block, short xco, short yco, short width,char* objectname)
1065 bNearSensor *ns = NULL;
1066 bTouchSensor *ts = NULL;
1067 bKeyboardSensor *ks = NULL;
1068 bPropertySensor *ps = NULL;
1069 bMouseSensor *ms = NULL;
1070 bCollisionSensor *cs = NULL;
1071 bRadarSensor *rs = NULL;
1072 bRandomSensor *randomSensor = NULL;
1073 bRaySensor *raySens = NULL;
1074 bMessageSensor *mes = NULL;
1075 bJoystickSensor *joy = NULL;
1076 bActuatorSensor *as = NULL;
1077 bDelaySensor *ds = NULL;
1081 /* yco is at the top of the rect, draw downwards */
1083 uiBlockSetEmboss(block, UI_EMBOSSM);
1085 set_col_sensor(sens->type, 0);
1093 glRects(xco, yco-ysize, xco+width, yco);
1094 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1096 draw_default_sensor_header(sens, block, xco, yco, width);
1106 glRects(xco, yco-ysize, xco+width, yco);
1107 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1109 draw_default_sensor_header(sens, block, xco, yco, width);
1113 /* uiDefBut(block, TEX, 1, "Property:", xco,yco-22,width, 19, &ts->name, 0, 31, 0, 0, "Only look for Objects with this property"); */
1114 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");
1115 ///* 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");
1119 case SENS_COLLISION:
1123 glRects(xco, yco-ysize, xco+width, yco);
1124 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1126 draw_default_sensor_header(sens, block, xco, yco, width);
1129 /* The collision sensor will become a generic collision (i.e. it */
1130 /* absorb the old touch sensor). */
1132 uiDefButBitS(block, TOG, SENS_COLLISION_MATERIAL, B_REDR, "M/P",(short)(xco + 10),(short)(yco - 44),
1133 (short)(0.20 * (width-20)), 19, &cs->mode, 0.0, 0.0, 0, 0,
1134 "Toggle collision on material or property.");
1136 if (cs->mode & SENS_COLLISION_MATERIAL) {
1137 uiDefBut(block, TEX, 1, "Material:", (short)(xco + 10 + 0.20 * (width-20)),
1138 (short)(yco-44), (short)(0.8*(width-20)), 19, &cs->materialName, 0, 31, 0, 0,
1139 "Only look for Objects with this material");
1141 uiDefBut(block, TEX, 1, "Property:", (short)(xco + 10 + 0.20 * (width-20)), (short)(yco-44),
1142 (short)(0.8*(width-20)), 19, &cs->name, 0, 31, 0, 0,
1143 "Only look for Objects with this property");
1146 /* 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"); */
1155 glRects(xco, yco-ysize, xco+width, yco);
1156 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1158 draw_default_sensor_header(sens, block, xco, yco, width);
1161 uiDefBut(block, TEX, 1, "Property:",(short)(10+xco),(short)(yco-44), (short)(width-20), 19,
1162 &ns->name, 0, 31, 0, 0, "Only look for Objects with this property");
1163 uiDefButF(block, NUM, 1, "Dist",(short)(10+xco),(short)(yco-68),(short)((width-22)/2), 19,
1164 &ns->dist, 0.0, 1000.0, 1000, 0, "Trigger distance");
1165 uiDefButF(block, NUM, 1, "Reset",(short)(10+xco+(width-22)/2), (short)(yco-68), (short)((width-22)/2), 19,
1166 &ns->resetdist, 0.0, 1000.0, 1000, 0, "Reset distance");
1174 glRects(xco, yco-ysize, xco+width, yco);
1175 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1177 draw_default_sensor_header(sens, block, xco, yco, width);
1181 uiDefBut(block, TEX, 1, "Prop:",
1182 (short)(10+xco),(short)(yco-44), (short)(0.7 * (width-20)), 19,
1183 &rs->name, 0, 31, 0, 0,
1184 "Only look for Objects with this property");
1186 str = "Type %t|+X axis %x0|+Y axis %x1|+Z axis %x2|-X axis %x3|-Y axis %x4|-Z axis %x5";
1187 uiDefButS(block, MENU, B_REDR, str,
1188 (short)(10+xco+0.7 * (width-20)), (short)(yco-44), (short)(0.3 * (width-22)), 19,
1189 &rs->axis, 2.0, 31, 0, 0,
1190 "Specify along which axis the radar cone is cast.");
1192 uiDefButF(block, NUM, 1, "Ang:",
1193 (short)(10+xco), (short)(yco-68), (short)((width-20)/2), 19,
1194 &rs->angle, 0.0, 179.9, 10, 0,
1195 "Opening angle of the radar cone.");
1196 uiDefButF(block, NUM, 1, "Dist:",
1197 (short)(xco+10 + (width-20)/2), (short)(yco-68), (short)((width-20)/2), 19,
1198 &rs->range, 0.01, 10000.0, 100, 0,
1199 "Depth of the radar cone");
1205 /* 5 lines: 120 height */
1208 glRects(xco, yco-ysize, xco+width, yco);
1209 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1212 draw_default_sensor_header(sens, block, xco, yco, width);
1215 /* line 2: hotkey and allkeys toggle */
1216 uiDefKeyevtButS(block, B_DIFF, "", xco+40, yco-44, (width)/2, 19, &ks->key, "Key code");
1218 /* line 3: two key modifyers (qual1, qual2) */
1219 uiDefKeyevtButS(block, B_DIFF, "", xco+40, yco-68, (width-50)/2, 19, &ks->qual, "Modifier key code");
1220 uiDefKeyevtButS(block, B_DIFF, "", xco+40+(width-50)/2, yco-68, (width-50)/2, 19, &ks->qual2, "Second Modifier key code");
1222 /* labels for line 1 and 2 */
1223 uiDefBut(block, LABEL, 0, "Key", xco, yco-44, 40, 19, NULL, 0, 0, 0, 0, "");
1224 uiDefBut(block, LABEL, 0, "Hold", xco, yco-68, 40, 19, NULL, 0, 0, 0, 0, "");
1226 /* part of line 1 */
1227 uiBlockSetCol(block, TH_BUT_SETTING2);
1228 uiDefButBitS(block, TOG, 1, 0, "All keys", xco+40+(width/2), yco-44, (width/2)-50, 19,
1229 &ks->type, 0, 0, 0, 0, "");
1231 /* line 4: toggle property for string logging mode */
1232 uiDefBut(block, TEX, 1, "LogToggle: ",
1233 xco+10, yco-92, (width-20), 19,
1234 ks->toggleName, 0, 31, 0, 0,
1235 "Property that indicates whether to log "
1236 "keystrokes as a string.");
1238 /* line 5: target property for string logging mode */
1239 uiDefBut(block, TEX, 1, "Target: ",
1240 xco+10, yco-116, (width-20), 19,
1241 ks->targetName, 0, 31, 0, 0,
1242 "Property that receives the keystrokes in case "
1243 "a string is logged.");
1252 glRects(xco, yco-ysize, xco+width, yco);
1253 uiEmboss((float)xco, (float)yco-ysize,
1254 (float)xco+width, (float)yco, 1);
1256 draw_default_sensor_header(sens, block, xco, yco, width);
1259 str= "Type %t|Equal %x0|Not Equal %x1|Interval %x2|Changed %x3";
1260 /* str= "Type %t|Equal %x0|Not Equal %x1"; */
1261 uiDefButI(block, MENU, B_REDR, str, xco+30,yco-44,width-60, 19,
1262 &ps->type, 0, 31, 0, 0, "Type");
1264 if (ps->type != SENS_PROP_EXPRESSION)
1266 uiDefBut(block, TEX, 1, "Prop: ", xco+30,yco-68,width-60, 19,
1267 ps->name, 0, 31, 0, 0, "Property name");
1270 if(ps->type == SENS_PROP_INTERVAL)
1272 uiDefBut(block, TEX, 1, "Min: ", xco,yco-92,width/2, 19,
1273 ps->value, 0, 31, 0, 0, "test for min value");
1274 uiDefBut(block, TEX, 1, "Max: ", xco+width/2,yco-92,width/2, 19,
1275 ps->maxvalue, 0, 31, 0, 0, "test for max value");
1277 else if(ps->type == SENS_PROP_CHANGED);
1280 uiDefBut(block, TEX, 1, "Value: ", xco+30,yco-92,width-60, 19,
1281 ps->value, 0, 31, 0, 0, "test for value");
1291 glRects(xco, yco-ysize, xco+width, yco);
1292 uiEmboss((float)xco, (float)yco-ysize,
1293 (float)xco+width, (float)yco, 1);
1295 draw_default_sensor_header(sens, block, xco, yco, width);
1298 uiDefBut(block, TEX, 1, "Act: ", xco+30,yco-44,width-60, 19,
1299 as->name, 0, 31, 0, 0, "Actuator name, actuator active state modifications will be detected");
1307 glRects(xco, yco-ysize, xco+width, yco);
1308 uiEmboss((float)xco, (float)yco-ysize,
1309 (float)xco+width, (float)yco, 1);
1311 draw_default_sensor_header(sens, block, xco, yco, width);
1314 uiDefButS(block, NUM, 0, "Delay",(short)(10+xco),(short)(yco-44),(short)((width-22)*0.4+10), 19,
1315 &ds->delay, 0.0, 5000.0, 0, 0, "Delay in number of frames before the positive trigger");
1316 uiDefButS(block, NUM, 0, "Dur",(short)(10+xco+(width-22)*0.4+10),(short)(yco-44),(short)((width-22)*0.4-10), 19,
1317 &ds->duration, 0.0, 5000.0, 0, 0, "If >0, delay in number of frames before the negative trigger following the positive trigger");
1318 uiDefButBitS(block, TOG, SENS_DELAY_REPEAT, 0, "REP",(short)(xco + 10 + (width-22)*0.8),(short)(yco - 44),
1319 (short)(0.20 * (width-22)), 19, &ds->flag, 0.0, 0.0, 0, 0,
1320 "Toggle repeat option. If selected, the sensor restarts after Delay+Dur frames");
1327 /* Two lines: 48 pixels high. */
1330 glRects(xco, yco-ysize, xco+width, yco);
1331 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1333 /* line 1: header */
1334 draw_default_sensor_header(sens, block, xco, yco, width);
1336 /* Line 2: type selection. The number are a bit mangled to get
1337 * proper compatibility with older .blend files. */
1338 str= "Type %t|Left button %x1|Middle button %x2|"
1339 "Right button %x4|Wheel Up %x5|Wheel Down %x6|Movement %x8|Mouse over %x16|Mouse over any%x32";
1340 uiDefButS(block, MENU, B_REDR, str, xco+10, yco-44, width-20, 19,
1341 &ms->type, 0, 31, 0, 0,
1342 "Specify the type of event this mouse sensor should trigger on.");
1351 glRects(xco, yco-ysize, xco+width, yco);
1352 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1354 draw_default_sensor_header(sens, block, xco, yco, width);
1355 randomSensor = sens->data;
1356 /* some files were wrongly written, avoid crash now */
1359 uiDefButI(block, NUM, 1, "Seed: ", xco+10,yco-44,(width-20), 19,
1360 &randomSensor->seed, 0, 1000, 0, 0,
1361 "Initial seed of the generator. (Choose 0 for not random)");
1369 glRects(xco, yco-ysize, xco+width, yco);
1370 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1372 draw_default_sensor_header(sens, block, xco, yco, width);
1373 raySens = sens->data;
1375 /* 1. property or material */
1376 uiDefButBitS(block, TOG, SENS_COLLISION_MATERIAL, B_REDR, "M/P",
1377 xco + 10,yco - 44, 0.20 * (width-20), 19,
1378 &raySens->mode, 0.0, 0.0, 0, 0,
1379 "Toggle collision on material or property.");
1381 if (raySens->mode & SENS_COLLISION_MATERIAL)
1383 uiDefBut(block, TEX, 1, "Material:", xco + 10 + 0.20 * (width-20), yco-44, 0.8*(width-20), 19,
1384 &raySens->matname, 0, 31, 0, 0,
1385 "Only look for Objects with this material");
1389 uiDefBut(block, TEX, 1, "Property:", xco + 10 + 0.20 * (width-20), yco-44, 0.8*(width-20), 19,
1390 &raySens->propname, 0, 31, 0, 0,
1391 "Only look for Objects with this property");
1395 uiDefButBitS(block, TOG, SENS_RAY_XRAY, 1, "X",
1396 xco + 10,yco - 68, 0.10 * (width-20), 19,
1397 &raySens->mode, 0.0, 0.0, 0, 0,
1398 "Toggle X-Ray option (see through objects that don't have the property)");
1399 /* 2. sensing range */
1400 uiDefButF(block, NUM, 1, "Range", xco+10 + 0.10 * (width-20), yco-68, 0.5 * (width-20), 19,
1401 &raySens->range, 0.01, 10000.0, 100, 0,
1402 "Sense objects no farther than this distance");
1404 /* 3. axis choice */
1405 str = "Type %t|+ X axis %x1|+ Y axis %x0|+ Z axis %x2|- X axis %x3|- Y axis %x4|- Z axis %x5";
1406 uiDefButI(block, MENU, B_REDR, str, xco+10 + 0.6 * (width-20), yco-68, 0.4 * (width-20), 19,
1407 &raySens->axisflag, 2.0, 31, 0, 0,
1408 "Specify along which axis the ray is cast.");
1416 ysize = 2 * 24; /* total number of lines * 24 pixels/line */
1418 glRects(xco, yco-ysize, xco+width, yco);
1419 uiEmboss((float)xco, (float)yco-ysize,
1420 (float)xco+width, (float)yco, 1);
1422 /* line 1: header line */
1423 draw_default_sensor_header(sens, block, xco, yco, width);
1425 /* line 2: Subject filter */
1426 uiDefBut(block, TEX, 1, "Subject: ",
1427 (xco+10), (yco-44), (width-20), 19,
1428 mes->subject, 0, 31, 0, 0,
1429 "Optional subject filter: only accept messages with this subject"
1430 ", or empty for all");
1440 glRects(xco, yco-ysize, xco+width, yco);
1441 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1443 /* line 1: header */
1444 draw_default_sensor_header(sens, block, xco, yco, width);
1448 uiDefButS(block, NUM, 1, "Index:", xco+10, yco-44, 0.6 * (width-120), 19,
1449 &joy->joyindex, 0, SENS_JOY_MAXINDEX-1, 100, 0,
1450 "Spesify which joystick to use");
1452 str= "Type %t|Button %x0|Axis %x1|Hat%x2";
1453 uiDefButS(block, MENU, B_REDR, str, xco+87, yco-44, 0.6 * (width-150), 19,
1454 &joy->type, 0, 31, 0, 0,
1455 "The type of event this joystick sensor is triggered on.");
1457 if(joy->type == SENS_JOY_BUTTON)
1459 uiDefButI(block, NUM, 1, "Number:", xco+10, yco-68, 0.6 * (width-20), 19,
1460 &joy->button, 0, 18, 100, 0,
1461 "Specify which button to use");
1463 str = "Type %t|Pressed %x0|Released %x1";
1464 uiDefButI(block, MENU, B_REDR, str, xco+10 + 0.6 * (width-20), yco-68, 0.4 * (width-20), 19,
1465 &joy->buttonf, 2.0, 31, 0, 0,
1466 "Button pressed or released.");
1468 else if(joy->type == SENS_JOY_AXIS)
1470 uiDefButI(block, NUM, 1, "Number:", xco+10, yco-68, 0.6 * (width-20), 19,
1471 &joy->axis, 1, 2.0, 100, 0,
1472 "Specify which axis to use");
1474 uiDefButI(block, NUM, 1, "Threshold:", xco+10 + 0.6 * (width-20),yco-44, 0.4 * (width-20), 19,
1475 &joy->precision, 0, 32768.0, 100, 0,
1476 "Specify the precision of the axis");
1478 str = "Type %t|Up Axis %x1 |Down Axis %x3|Left Axis %x2|Right Axis %x0";
1479 uiDefButI(block, MENU, B_REDR, str, xco+10 + 0.6 * (width-20), yco-68, 0.4 * (width-20), 19,
1480 &joy->axisf, 2.0, 31, 0, 0,
1481 "The direction of the axis");
1485 uiDefButI(block, NUM, 1, "Number:", xco+10, yco-68, 0.6 * (width-20), 19,
1486 &joy->hat, 1, 2.0, 100, 0,
1487 "Specify which hat to use");
1489 uiDefButI(block, NUM, 1, "Direction:", xco+10 + 0.6 * (width-20), yco-68, 0.4 * (width-20), 19,
1490 &joy->hatf, 0, 12, 100, 0,
1491 "Specify hat direction");
1498 uiBlockSetEmboss(block, UI_EMBOSSM);
1499 uiBlockSetCol(block, TH_AUTO);
1506 static short draw_controllerbuttons(bController *cont, uiBlock *block, short xco, short yco, short width)
1508 bExpressionCont *ec;
1512 uiBlockSetEmboss(block, UI_EMBOSSM);
1514 switch (cont->type) {
1515 case CONT_EXPRESSION:
1518 BIF_ThemeColor(TH_BUT_SETTING);
1519 glRects(xco, yco-ysize, xco+width, yco);
1520 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1522 /* uiDefBut(block, LABEL, 1, "Not yet...", xco,yco-24,80, 19, NULL, 0, 0, 0, 0, ""); */
1524 /* uiDefBut(block, BUT, 1, "Variables", xco,yco-24,80, 19, NULL, 0, 0, 0, 0, "Available variables for expression"); */
1525 uiDefBut(block, TEX, 1, "Exp:", xco + 10 , yco-21, width-20, 19,
1526 ec->str, 0, 127, 0, 0,
1534 if(cont->data==NULL) init_controller(cont);
1537 BIF_ThemeColor(TH_BUT_SETTING1);
1538 glRects(xco, yco-ysize, xco+width, yco);
1539 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1541 uiDefIDPoinBut(block, test_scriptpoin_but, ID_SCRIPT, 1, "Script: ", xco+45,yco-24,width-90, 19, &pc->text, "");
1549 BIF_ThemeColor(TH_BUT_NEUTRAL);
1550 glRects(xco, yco-ysize, xco+width, yco);
1551 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1556 uiBlockSetEmboss(block, UI_EMBOSSM);
1557 uiBlockSetCol(block, TH_AUTO);
1562 static int get_col_actuator(int type)
1565 case ACT_ACTION: return TH_BUT_ACTION;
1566 case ACT_SHAPEACTION: return TH_BUT_ACTION;
1567 case ACT_OBJECT: return TH_BUT_NEUTRAL;
1568 case ACT_IPO: return TH_BUT_SETTING;
1569 case ACT_PROPERTY: return TH_BUT_SETTING1;
1570 case ACT_SOUND: return TH_BUT_SETTING2;
1571 case ACT_CD: return TH_BUT_NUM;
1572 case ACT_CAMERA: return TH_BUT_TEXTFIELD;
1573 case ACT_EDIT_OBJECT: return TH_BUT_POPUP;
1574 case ACT_GROUP: return TH_BUT_ACTION;
1575 case ACT_RANDOM: return TH_BUT_NEUTRAL;
1576 case ACT_SCENE: return TH_BUT_SETTING;
1577 case ACT_MESSAGE: return TH_BUT_SETTING1;
1578 case ACT_GAME: return TH_BUT_SETTING2;
1579 case ACT_VISIBILITY: return TH_BUT_NUM;
1580 case ACT_CONSTRAINT: return TH_BUT_ACTION;
1581 case ACT_STATE: return TH_BUT_SETTING2;
1582 default: return TH_BUT_NEUTRAL;
1585 static void set_col_actuator(int item, int medium)
1587 int col= get_col_actuator(item);
1588 BIF_ThemeColorShade(col, medium?30:10);
1592 static void change_object_actuator(void *act, void *arg)
1594 bObjectActuator *oa = act;
1596 if (oa->type != oa->otype) {
1598 case ACT_OBJECT_NORMAL:
1599 memset(oa, 0, sizeof(bObjectActuator));
1600 oa->flag = ACT_FORCE_LOCAL|ACT_TORQUE_LOCAL|ACT_DLOC_LOCAL|ACT_DROT_LOCAL;
1601 oa->type = ACT_OBJECT_NORMAL;
1604 case ACT_OBJECT_SERVO:
1605 memset(oa, 0, sizeof(bObjectActuator));
1606 oa->flag = ACT_LIN_VEL_LOCAL;
1607 oa->type = ACT_OBJECT_SERVO;
1608 oa->forcerot[0] = 30.0f;
1609 oa->forcerot[1] = 0.5f;
1610 oa->forcerot[2] = 0.0f;
1616 static void change_ipo_actuator(void *arg1_but, void *arg2_ia)
1618 bIpoActuator *ia = arg2_ia;
1619 uiBut *but = arg1_but;
1621 if (but->retval & ACT_IPOFORCE)
1622 ia->flag &= ~ACT_IPOADD;
1623 else if (but->retval & ACT_IPOADD)
1624 ia->flag &= ~ACT_IPOFORCE;
1625 but->retval = B_REDR;
1628 void update_object_actuator_PID(void *act, void *arg)
1630 bObjectActuator *oa = act;
1631 oa->forcerot[0] = 60.0f*oa->forcerot[1];
1634 char *get_state_name(Object *ob, short bit)
1640 cont = ob->controllers.first;
1642 if (cont->state_mask & mask) {
1650 static short draw_actuatorbuttons(Object *ob, bActuator *act, uiBlock *block, short xco, short yco, short width)
1652 bSoundActuator *sa = NULL;
1653 bCDActuator *cda = NULL;
1654 bObjectActuator *oa = NULL;
1655 bIpoActuator *ia = NULL;
1656 bPropertyActuator *pa = NULL;
1657 bCameraActuator *ca = NULL;
1658 bEditObjectActuator *eoa = NULL;
1659 bConstraintActuator *coa = NULL;
1660 bSceneActuator *sca = NULL;
1661 bGroupActuator *ga = NULL;
1662 bRandomActuator *randAct = NULL;
1663 bMessageActuator *ma = NULL;
1664 bActionActuator *aa = NULL;
1665 bGameActuator *gma = NULL;
1666 bVisibilityActuator *visAct = NULL;
1667 bTwoDFilterActuator *tdfa = NULL;
1668 bParentActuator *parAct = NULL;
1669 bStateActuator *staAct = NULL;
1672 short ysize = 0, wval;
1677 /* yco is at the top of the rect, draw downwards */
1678 uiBlockSetEmboss(block, UI_EMBOSSM);
1679 set_col_actuator(act->type, 0);
1686 wval = (width-100)/3;
1687 if (oa->type == ACT_OBJECT_NORMAL)
1689 if ( ob->gameflag & OB_DYNAMIC )
1698 glRects(xco, yco-ysize, xco+width, yco);
1699 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1701 uiDefBut(block, LABEL, 0, "Loc", xco, yco-45, 45, 19, NULL, 0, 0, 0, 0, "Sets the location");
1702 uiDefButF(block, NUM, 0, "", xco+45, yco-45, wval, 19, oa->dloc, -10000.0, 10000.0, 10, 0, "");
1703 uiDefButF(block, NUM, 0, "", xco+45+wval, yco-45, wval, 19, oa->dloc+1, -10000.0, 10000.0, 10, 0, "");
1704 uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-45, wval, 19, oa->dloc+2, -10000.0, 10000.0, 10, 0, "");
1706 uiDefBut(block, LABEL, 0, "Rot", xco, yco-64, 45, 19, NULL, 0, 0, 0, 0, "Sets the rotation");
1707 uiDefButF(block, NUM, 0, "", xco+45, yco-64, wval, 19, oa->drot, -10000.0, 10000.0, 10, 0, "");
1708 uiDefButF(block, NUM, 0, "", xco+45+wval, yco-64, wval, 19, oa->drot+1, -10000.0, 10000.0, 10, 0, "");
1709 uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-64, wval, 19, oa->drot+2, -10000.0, 10000.0, 10, 0, "");
1711 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");
1712 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");
1714 if ( ob->gameflag & OB_DYNAMIC )
1716 uiDefBut(block, LABEL, 0, "Force", xco, yco-87, 55, 19, NULL, 0, 0, 0, 0, "Sets the force");
1717 uiDefButF(block, NUM, 0, "", xco+45, yco-87, wval, 19, oa->forceloc, -10000.0, 10000.0, 10, 0, "");
1718 uiDefButF(block, NUM, 0, "", xco+45+wval, yco-87, wval, 19, oa->forceloc+1, -10000.0, 10000.0, 10, 0, "");
1719 uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-87, wval, 19, oa->forceloc+2, -10000.0, 10000.0, 10, 0, "");
1721 uiDefBut(block, LABEL, 0, "Torque", xco, yco-106, 55, 19, NULL, 0, 0, 0, 0, "Sets the torque");
1722 uiDefButF(block, NUM, 0, "", xco+45, yco-106, wval, 19, oa->forcerot, -10000.0, 10000.0, 10, 0, "");
1723 uiDefButF(block, NUM, 0, "", xco+45+wval, yco-106, wval, 19, oa->forcerot+1, -10000.0, 10000.0, 10, 0, "");
1724 uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-106, wval, 19, oa->forcerot+2, -10000.0, 10000.0, 10, 0, "");
1727 if ( ob->gameflag & OB_DYNAMIC )
1729 uiDefBut(block, LABEL, 0, "LinV", xco, yco-129, 45, 19, NULL, 0, 0, 0, 0, "Sets the linear velocity");
1730 uiDefButF(block, NUM, 0, "", xco+45, yco-129, wval, 19, oa->linearvelocity, -10000.0, 10000.0, 10, 0, "");
1731 uiDefButF(block, NUM, 0, "", xco+45+wval, yco-129, wval, 19, oa->linearvelocity+1, -10000.0, 10000.0, 10, 0, "");
1732 uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-129, wval, 19, oa->linearvelocity+2, -10000.0, 10000.0, 10, 0, "");
1734 uiDefBut(block, LABEL, 0, "AngV", xco, yco-148, 45, 19, NULL, 0, 0, 0, 0, "Sets the angular velocity");
1735 uiDefButF(block, NUM, 0, "", xco+45, yco-148, wval, 19, oa->angularvelocity, -10000.0, 10000.0, 10, 0, "");
1736 uiDefButF(block, NUM, 0, "", xco+45+wval, yco-148, wval, 19, oa->angularvelocity+1, -10000.0, 10000.0, 10, 0, "");
1737 uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-148, wval, 19, oa->angularvelocity+2, -10000.0, 10000.0, 10, 0, "");
1739 uiDefBut(block, LABEL, 0, "Damp", xco, yco-171, 45, 19, NULL, 0, 0, 0, 0, "Number of frames to reach the target velocity");
1740 uiDefButS(block, NUM, 0, "", xco+45, yco-171, wval, 19, &oa->damping, 0.0, 1000.0, 100, 0, "");
1742 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");
1743 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");
1744 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");
1745 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");
1747 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");
1749 } else if (oa->type == ACT_OBJECT_SERVO)
1753 glRects(xco, yco-ysize, xco+width, yco);
1754 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1756 uiDefBut(block, LABEL, 0, "linV", xco, yco-45, 45, 19, NULL, 0, 0, 0, 0, "Sets the target linear velocity, it will be achieve by automatic application of force. Null velocity is a valid target");
1757 uiDefButF(block, NUM, 0, "", xco+45, yco-45, wval, 19, oa->linearvelocity, -10000.0, 10000.0, 10, 0, "");
1758 uiDefButF(block, NUM, 0, "", xco+45+wval, yco-45, wval, 19, oa->linearvelocity+1, -10000.0, 10000.0, 10, 0, "");
1759 uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-45, wval, 19, oa->linearvelocity+2, -10000.0, 10000.0, 10, 0, "");
1760 uiDefButBitS(block, TOG, ACT_LIN_VEL_LOCAL, 0, "L", xco+45+3*wval, yco-45, 15, 19, &oa->flag, 0.0, 0.0, 0, 0, "Velocity is defined in local coordinates");
1762 uiDefBut(block, LABEL, 0, "Limit", xco, yco-68, 45, 19, NULL, 0, 0, 0, 0, "Select if the force need to be limited along certain axis (local or global depending on LinV Local flag)");
1763 uiDefButBitS(block, TOG, ACT_SERVO_LIMIT_X, B_REDR, "X", xco+45, yco-68, wval, 19, &oa->flag, 0.0, 0.0, 0, 0, "Set limit to force along the X axis");
1764 uiDefButBitS(block, TOG, ACT_SERVO_LIMIT_Y, B_REDR, "Y", xco+45+wval, yco-68, wval, 19, &oa->flag, 0.0, 0.0, 0, 0, "Set limit to force along the Y axis");
1765 uiDefButBitS(block, TOG, ACT_SERVO_LIMIT_Z, B_REDR, "Z", xco+45+2*wval, yco-68, wval, 19, &oa->flag, 0.0, 0.0, 0, 0, "Set limit to force along the Z axis");
1766 uiDefBut(block, LABEL, 0, "Max", xco, yco-87, 45, 19, NULL, 0, 0, 0, 0, "Set the upper limit for force");
1767 uiDefBut(block, LABEL, 0, "Min", xco, yco-106, 45, 19, NULL, 0, 0, 0, 0, "Set the lower limit for force");
1768 if (oa->flag & ACT_SERVO_LIMIT_X) {
1769 uiDefButF(block, NUM, 0, "", xco+45, yco-87, wval, 19, oa->dloc, -10000.0, 10000.0, 10, 0, "");
1770 uiDefButF(block, NUM, 0, "", xco+45, yco-106, wval, 19, oa->drot, -10000.0, 10000.0, 10, 0, "");
1772 if (oa->flag & ACT_SERVO_LIMIT_Y) {
1773 uiDefButF(block, NUM, 0, "", xco+45+wval, yco-87, wval, 19, oa->dloc+1, -10000.0, 10000.0, 10, 0, "");
1774 uiDefButF(block, NUM, 0, "", xco+45+wval, yco-106, wval, 19, oa->drot+1, -10000.0, 10000.0, 10, 0, "");
1776 if (oa->flag & ACT_SERVO_LIMIT_Z) {
1777 uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-87, wval, 19, oa->dloc+2, -10000.0, 10000.0, 10, 0, "");
1778 uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-106, wval, 19, oa->drot+2, -10000.0, 10000.0, 10, 0, "");
1780 uiDefBut(block, LABEL, 0, "Servo", xco, yco-129, 45, 19, NULL, 0, 0, 0, 0, "Coefficients of the PID servo controller");
1781 uiDefButF(block, NUMSLI, B_REDR, "P: ", xco+45, yco-129, wval*3, 19, oa->forcerot, 0.00, 200.0, 100, 0, "Proportional coefficient, typical value is 60x Integral coefficient");
1782 uiDefBut(block, LABEL, 0, "Slow", xco, yco-148, 45, 19, NULL, 0, 0, 0, 0, "Low value of I coefficient correspond to slow response");
1783 but = uiDefButF(block, NUMSLI, B_REDR, " I : ", xco+45, yco-148, 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");
1784 uiButSetFunc(but, update_object_actuator_PID, oa, NULL);
1785 uiDefBut(block, LABEL, 0, "Fast", xco+45+3*wval, yco-148, 45, 19, NULL, 0, 0, 0, 0, "High value of I coefficient correspond to fast response");
1786 uiDefButF(block, NUMSLI, B_REDR, "D: ", xco+45, yco-167, wval*3, 19, oa->forcerot+2, -100.0, 100.0, 100, 0, "Derivate coefficient, not required, high values can cause instability");
1788 str= "Motion Type %t|Simple motion %x0|Servo Control %x1";
1789 but = uiDefButS(block, MENU, B_REDR, str, xco+40, yco-23, (width-80), 19, &oa->type, 0.0, 0.0, 0, 0, "");
1790 oa->otype = oa->type;
1791 uiButSetFunc(but, change_object_actuator, oa, NULL);
1796 case ACT_SHAPEACTION:
1799 #ifdef __NLA_ACTION_BY_MOTION_ACTUATOR
1805 glRects(xco, yco-ysize, xco+width, yco);
1806 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1809 wval = (width-60)/3;
1811 // str= "Action types %t|Play %x0|Ping Pong %x1|Flipper %x2|Loop Stop %x3|Loop End %x4|Property %x6";
1812 #ifdef __NLA_ACTION_BY_MOTION_ACTUATOR
1813 str= "Action types %t|Play %x0|Flipper %x2|Loop Stop %x3|Loop End %x4|Property %x6|Displacement %x7";
1815 str= "Action types %t|Play %x0|Flipper %x2|Loop Stop %x3|Loop End %x4|Property %x6";
1817 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");
1818 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");
1820 uiDefButBitS(block, TOGN, 1, 0, "Continue", xco+((width/3)*2)+20, yco-24, 60, 19,
1821 &aa->end_reset, 0.0, 0.0, 0, 0, "Restore last frame when switching on/off, otherwise play from the start each time");
1824 if(aa->type == ACT_ACTION_FROM_PROP)
1826 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");
1830 uiDefButI(block, NUM, 0, "Sta: ",xco+10, yco-44, (width-20)/2, 19, &aa->sta, 0.0, MAXFRAMEF, 0, 0, "Start frame");
1831 uiDefButI(block, NUM, 0, "End: ",xco+10+(width-20)/2, yco-44, (width-20)/2, 19, &aa->end, 0.0, MAXFRAMEF, 0, 0, "End frame");
1834 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");
1835 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");
1837 uiDefBut(block, TEX, 0, "FrameProp: ",xco+10, yco-84, width-20, 19, aa->frameProp, 0.0, 31.0, 0, 0, "Assign this property this actions current frame number");
1840 #ifdef __NLA_ACTION_BY_MOTION_ACTUATOR
1841 if(aa->type == ACT_ACTION_MOTION)
1843 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");
1858 glRects(xco, yco-ysize, xco+width, yco);
1859 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1861 str = "Ipo types %t|Play %x0|Ping Pong %x1|Flipper %x2|Loop Stop %x3|Loop End %x4|Property %x6";
1863 uiDefButS(block, MENU, B_REDR, str, xco+10, yco-24, (width-20)/2, 19, &ia->type, 0, 0, 0, 0, "");
1865 but = uiDefButBitS(block, TOG, ACT_IPOFORCE, ACT_IPOFORCE,
1866 "Force", xco+10+(width-20)/2, yco-24, (width-20)/4-10, 19,
1867 &ia->flag, 0, 0, 0, 0,
1868 "Apply Ipo as a global or local force depending on the local option (dynamic objects only)");
1869 uiButSetFunc(but, change_ipo_actuator, but, ia);
1871 but = uiDefButBitS(block, TOG, ACT_IPOADD, ACT_IPOADD,
1872 "Add", xco+3*(width-20)/4, yco-24, (width-20)/4-10, 19,
1873 &ia->flag, 0, 0, 0, 0,
1874 "Ipo is added to the current loc/rot/scale in global or local coordinate according to Local flag");
1875 uiButSetFunc(but, change_ipo_actuator, but, ia);
1877 /* Only show the do-force-local toggle if force is requested */
1878 if (ia->flag & (ACT_IPOFORCE|ACT_IPOADD)) {
1879 uiDefButBitS(block, TOG, ACT_IPOLOCAL, 0,
1880 "L", xco+width-30, yco-24, 20, 19,
1881 &ia->flag, 0, 0, 0, 0,
1882 "Let the ipo acts in local coordinates, used in Force and Add mode.");
1885 if(ia->type==ACT_IPO_FROM_PROP) {
1886 uiDefBut(block, TEX, 0,
1887 "Prop: ", xco+10, yco-44, width-80, 19,
1888 ia->name, 0.0, 31.0, 0, 0,
1889 "Use this property to define the Ipo position");
1892 uiDefButI(block, NUM, 0,
1893 "Sta", xco+10, yco-44, (width-80)/2, 19,
1894 &ia->sta, 0.0, MAXFRAMEF, 0, 0,
1895 "Start frame, (subtract 1 to match blenders frame numbers)");
1896 uiDefButI(block, NUM, 0,
1897 "End", xco+10+(width-80)/2, yco-44, (width-80)/2, 19,
1898 &ia->end, 0.0, MAXFRAMEF, 0, 0,
1899 "End frame, (subtract 1 to match blenders frame numbers)");
1901 uiDefButBitS(block, TOG, ACT_IPOCHILD, B_REDR,
1902 "Child", xco+10+(width-80), yco-44, 60, 19,
1903 &ia->flag, 0, 0, 0, 0,
1904 "Update IPO on all children Objects as well");
1913 glRects(xco, yco-ysize, xco+width, yco);
1914 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1918 str= "Type %t|Assign %x0|Add %x1|Copy %x2";
1919 uiDefButI(block, MENU, B_REDR, str, xco+30,yco-24,width-60, 19, &pa->type, 0, 31, 0, 0, "Type");
1921 uiDefBut(block, TEX, 1, "Prop: ", xco+30,yco-44,width-60, 19, pa->name, 0, 31, 0, 0, "Property name");
1923 if(pa->type==ACT_PROP_COPY) {
1924 uiDefIDPoinBut(block, test_obpoin_but, ID_OB, 1, "OB:", xco+10, yco-64, (width-20)/2, 19, &(pa->ob), "Copy from this Object");
1925 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");
1928 uiDefBut(block, TEX, 1, "Value: ", xco+30,yco-64,width-60, 19, pa->value, 0, 31, 0, 0, "change with this value");
1941 wval = (width-20)/2;
1942 glRects(xco, yco-ysize, xco+width, yco);
1943 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1945 if(G.main->sound.first) {
1946 IDnames_to_pupstring(&str, "Sound files", NULL, &(G.main->sound), (ID *)sa->sound, &(sa->sndnr));
1947 /* reset this value, it is for handling the event */
1949 uiDefButS(block, MENU, B_SOUNDACT_BROWSE, str, xco+10,yco-22,20,19, &(sa->sndnr), 0, 0, 0, 0, "");
1952 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";
1953 uiDefBut(block, TEX, B_IDNAME, "SO:",xco+30,yco-22,width-40,19, sa->sound->id.name+2, 0.0, 21.0, 0, 0, "");
1954 uiDefButS(block, MENU, 1, dummy_str,xco+10,yco-44,width-20, 19, &sa->type, 0.0, 0.0, 0, 0, "");
1955 uiDefButF(block, NUM, 0, "Volume:", xco+10,yco-66,wval, 19, &sa->sound->volume, 0.0, 1.0, 0, 0, "Sets the volume of this sound");
1956 uiDefButF(block, NUM, 0, "Pitch:",xco+wval+10,yco-66,wval, 19, &sa->sound->pitch,-12.0, 12.0, 0, 0, "Sets the pitch of this sound");
1961 uiDefBut(block, LABEL, 0, "Use Sound window (F10) to load samples", xco, yco-24, width, 19, NULL, 0, 0, 0, 0, "");
1970 char cd_type_str[] = "Sound mode %t|Play all tracks %x0|Play one track %x1|"
1971 "Volume %x3|Stop %x4|Pause %x5|Resume %x6";
1975 if (cda->track == 0) {
1978 cda->type = ACT_CD_PLAY_ALL;
1981 if (cda->type == ACT_CD_PLAY_TRACK || cda->type == ACT_CD_LOOP_TRACK) {
1983 glRects(xco, yco-ysize, xco+width, yco);
1984 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1985 uiDefButS(block, NUM, 0, "Track:", xco+10,yco-44,width-20, 19, &cda->track, 1, 99, 0, 0, "Select the track to be played");
1987 else if (cda->type == ACT_CD_VOLUME) {
1989 glRects(xco, yco-ysize, xco+width, yco);
1990 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1991 uiDefButF(block, NUM, 0, "Volume:", xco+10,yco-44,width-20, 19, &cda->volume, 0, 1, 0, 0, "Set the volume for CD playback");
1995 glRects(xco, yco-ysize, xco+width, yco);
1996 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
1998 uiDefButS(block, MENU, B_REDR, cd_type_str,xco+10,yco-22,width-20, 19, &cda->type, 0.0, 0.0, 0, 0, "");
2007 glRects(xco, yco-ysize, xco+width, yco);
2008 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2012 uiDefIDPoinBut(block, test_obpoin_but, ID_OB, 1, "OB:", xco+10, yco-24, (width-20)/2, 19, &(ca->ob), "Look at this Object");
2013 uiDefButF(block, NUM, 0, "Height:", xco+10+(width-20)/2, yco-24, (width-20)/2, 19, &ca->height, 0.0, 20.0, 0, 0, "");
2015 uiDefButF(block, NUM, 0, "Min:", xco+10, yco-44, (width-60)/2, 19, &ca->min, 0.0, 20.0, 0, 0, "");
2017 if(ca->axis==0) ca->axis= 'x';
2018 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");
2019 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");
2021 uiDefButF(block, NUM, 0, "Max:", xco+20+(width)/2, yco-44, (width-60)/2, 19, &ca->max, 0.0, 20.0, 0, 0, "");
2027 case ACT_EDIT_OBJECT:
2031 if(eoa->type==ACT_EDOB_ADD_OBJECT) {
2032 int wval; /* just a temp width */
2034 glRects(xco, yco-ysize, xco+width, yco);
2035 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2037 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)");
2038 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");
2041 uiDefBut(block, LABEL, 0, "linV", xco, yco-68, 45, 19,
2043 "Velocity upon creation.");
2044 uiDefButF(block, NUM, 0, "", xco+45, yco-68, wval, 19,
2045 eoa->linVelocity, -100.0, 100.0, 10, 0,
2046 "Velocity upon creation, x component.");
2047 uiDefButF(block, NUM, 0, "", xco+45+wval, yco-68, wval, 19,
2048 eoa->linVelocity+1, -100.0, 100.0, 10, 0,
2049 "Velocity upon creation, y component.");
2050 uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-68, wval, 19,
2051 eoa->linVelocity+2, -100.0, 100.0, 10, 0,
2052 "Velocity upon creation, z component.");
2053 uiDefButBitS(block, TOG, ACT_EDOB_LOCAL_LINV, 0, "L", xco+45+3*wval, yco-68, 15, 19,
2054 &eoa->localflag, 0.0, 0.0, 0, 0,
2055 "Apply the transformation locally");
2058 uiDefBut(block, LABEL, 0, "AngV", xco, yco-90, 45, 19,
2060 "Angular velocity upon creation.");
2061 uiDefButF(block, NUM, 0, "", xco+45, yco-90, wval, 19,
2062 eoa->angVelocity, -10000.0, 10000.0, 10, 0,
2063 "Angular velocity upon creation, x component.");
2064 uiDefButF(block, NUM, 0, "", xco+45+wval, yco-90, wval, 19,
2065 eoa->angVelocity+1, -10000.0, 10000.0, 10, 0,
2066 "Angular velocity upon creation, y component.");
2067 uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-90, wval, 19,
2068 eoa->angVelocity+2, -10000.0, 10000.0, 10, 0,
2069 "Angular velocity upon creation, z component.");
2070 uiDefButBitS(block, TOG, ACT_EDOB_LOCAL_ANGV, 0, "L", xco+45+3*wval, yco-90, 15, 19,
2071 &eoa->localflag, 0.0, 0.0, 0, 0,
2072 "Apply the rotation locally");
2076 else if(eoa->type==ACT_EDOB_END_OBJECT) {
2078 glRects(xco, yco-ysize, xco+width, yco);
2079 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2081 else if(eoa->type==ACT_EDOB_REPLACE_MESH) {
2083 glRects(xco, yco-ysize, xco+width, yco);
2084 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2086 uiDefIDPoinBut(block, test_meshpoin_but, ID_ME, 1, "ME:", xco+40, yco-44, (width-80), 19, &(eoa->me), "replace the existing mesh with this one");
2088 else if(eoa->type==ACT_EDOB_TRACK_TO) {
2090 glRects(xco, yco-ysize, xco+width, yco);
2091 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2093 uiDefIDPoinBut(block, test_obpoin_but, ID_OB, 1, "OB:", xco+10, yco-44, (width-20)/2, 19, &(eoa->ob), "Track to this Object");
2094 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");
2095 uiDefButS(block, TOG, 0, "3D", xco+width-50, yco-44, 40, 19, &eoa->flag, 0.0, 0.0, 0, 0, "Enable 3D tracking");
2097 else if(eoa->type==ACT_EDOB_DYNAMICS) {
2099 glRects(xco, yco-ysize, xco+width, yco);
2100 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2102 str= "Dynamic Operation %t|Restore Dynamics %x0|Suspend Dynamics %x1|Enable Rigid Body %x2|Disable Rigid Body %x3";
2103 uiDefButS(block, MENU, B_REDR, str, xco+40, yco-44, (width-80), 19, &(eoa->dyn_operation), 0.0, 0.0, 0, 0, "");
2105 str= "Edit Object %t|Add Object %x0|End Object %x1|Replace Mesh %x2|Track to %x3|Dynamics %x4";
2106 uiDefButS(block, MENU, B_REDR, str, xco+40, yco-24, (width-80), 19, &eoa->type, 0.0, 0.0, 0, 0, "");
2112 case ACT_CONSTRAINT:
2115 if (coa->type == ACT_CONST_TYPE_LOC) {
2118 glRects(xco, yco-ysize, xco+width, yco);
2119 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2121 /* str= "Limit %t|None %x0|Loc X %x1|Loc Y %x2|Loc Z %x4|Rot X %x8|Rot Y %x16|Rot Z %x32"; */
2122 /* coa->flag &= ~(63); */
2123 str= "Limit %t|None %x0|Loc X %x1|Loc Y %x2|Loc Z %x4";
2126 uiDefButS(block, MENU, 1, str, xco+10, yco-65, 70, 19, &coa->flag, 0.0, 0.0, 0, 0, "");
2128 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");
2129 uiDefBut(block, LABEL, 0, "Min", xco+80, yco-45, (width-90)/2, 19, NULL, 0.0, 0.0, 0, 0, "");
2130 uiDefBut(block, LABEL, 0, "Max", xco+80+(width-90)/2, yco-45, (width-90)/2, 19, NULL, 0.0, 0.0, 0, 0, "");
2132 if(coa->flag & ACT_CONST_LOCX) fp= coa->minloc;
2133 else if(coa->flag & ACT_CONST_LOCY) fp= coa->minloc+1;
2134 else if(coa->flag & ACT_CONST_LOCZ) fp= coa->minloc+2;
2135 else if(coa->flag & ACT_CONST_ROTX) fp= coa->minrot;
2136 else if(coa->flag & ACT_CONST_ROTY) fp= coa->minrot+1;
2137 else fp= coa->minrot+2;
2139 uiDefButF(block, NUM, 0, "", xco+80, yco-65, (width-90)/2, 19, fp, -2000.0, 2000.0, 10, 0, "");
2140 uiDefButF(block, NUM, 0, "", xco+80+(width-90)/2, yco-65, (width-90)/2, 19, fp+3, -2000.0, 2000.0, 10, 0, "");
2141 } else if (coa->type == ACT_CONST_TYPE_DIST) {
2144 glRects(xco, yco-ysize, xco+width, yco);
2145 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2147 str= "Direction %t|None %x0|X axis %x1|Y axis %x2|Z axis %x4|-X axis %x8|-Y axis %x16|-Z axis %x32";
2148 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");
2150 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");
2151 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");
2152 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");
2154 if(coa->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= coa->minloc;
2155 else if(coa->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= coa->minloc+1;
2156 else fp= coa->minloc+2;
2158 uiDefButF(block, NUM, 0, "", xco+80, yco-65, (width-115)/2, 19, fp+3, 0.0, 2000.0, 10, 0, "Maximum length of ray");
2159 if (coa->flag & ACT_CONST_DISTANCE)
2160 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");
2161 uiDefButBitS(block, TOG, ACT_CONST_NORMAL, 0, "N", xco+80+(width-115), yco-65, 25, 19,
2162 &coa->flag, 0.0, 0.0, 0, 0, "Set object axis along the normal at hit position");
2163 uiDefButBitS(block, TOG, ACT_CONST_MATERIAL, B_REDR, "M/P", xco+10, yco-84, 40, 19,
2164 &coa->flag, 0.0, 0.0, 0, 0, "Detect material instead of property");
2165 if (coa->flag & ACT_CONST_MATERIAL)
2167 uiDefBut(block, TEX, 1, "Material:", xco + 50, yco-84, (width-60), 19,
2168 coa->matprop, 0, 31, 0, 0,
2169 "Ray detects only Objects with this material");
2173 uiDefBut(block, TEX, 1, "Property:", xco + 50, yco-84, (width-60), 19,
2174 coa->matprop, 0, 31, 0, 0,
2175 "Ray detect only Objects with this property");
2177 uiDefButBitS(block, TOG, ACT_CONST_PERMANENT, 0, "PER", xco+10, yco-103, 40, 19,
2178 &coa->flag, 0.0, 0.0, 0, 0, "Persistent actuator: stays active even if ray does not reach target");
2179 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");
2180 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");
2181 } else if (coa->type == ACT_CONST_TYPE_ORI) {
2184 glRects(xco, yco-ysize, xco+width, yco);
2185 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2187 str= "Direction %t|None %x0|X axis %x1|Y axis %x2|Z axis %x4";
2188 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");
2190 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");
2191 uiDefBut(block, LABEL, 0, "X", xco+80, yco-45, (width-115)/3, 19, NULL, 0.0, 0.0, 0, 0, "");
2192 uiDefBut(block, LABEL, 0, "Y", xco+80+(width-115)/3, yco-45, (width-115)/3, 19, NULL, 0.0, 0.0, 0, 0, "");
2193 uiDefBut(block, LABEL, 0, "Z", xco+80+2*(width-115)/3, yco-45, (width-115)/3, 19, NULL, 0.0, 0.0, 0, 0, "");
2195 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");
2196 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");
2197 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");
2199 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");
2200 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");
2201 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");
2203 str= "Constraint Type %t|Location %x0|Distance %x1|Orientation %x2";
2204 but = uiDefButS(block, MENU, B_REDR, str, xco+40, yco-23, (width-80), 19, &coa->type, 0.0, 0.0, 0, 0, "");
2211 if(sca->type==ACT_SCENE_RESTART) {
2213 glRects(xco, yco-ysize, xco+width, yco);
2214 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2216 else if(sca->type==ACT_SCENE_CAMERA) {
2219 glRects(xco, yco-ysize, xco+width, yco);
2220 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2222 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");
2224 else if(sca->type==ACT_SCENE_SET) {
2227 glRects(xco, yco-ysize, xco+width, yco);
2228 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2230 uiDefIDPoinBut(block, test_scenepoin_but, ID_SCE, 1, "SCE:", xco+40, yco-44, (width-80), 19, &(sca->scene), "Set this Scene");
2232 else if(sca->type==ACT_SCENE_ADD_FRONT) {
2235 glRects(xco, yco-ysize, xco+width, yco);
2236 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2238 uiDefIDPoinBut(block, test_scenepoin_but, ID_SCE, 1, "SCE:", xco+40, yco-44, (width-80), 19, &(sca->scene), "Add an Overlay Scene");
2240 else if(sca->type==ACT_SCENE_ADD_BACK) {
2243 glRects(xco, yco-ysize, xco+width, yco);
2244 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2246 uiDefIDPoinBut(block, test_scenepoin_but, ID_SCE, 1, "SCE:", xco+40, yco-44, (width-80), 19, &(sca->scene), "Add a Background Scene");
2248 else if(sca->type==ACT_SCENE_REMOVE) {
2251 glRects(xco, yco-ysize, xco+width, yco);
2252 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2254 uiDefIDPoinBut(block, test_scenepoin_but, ID_SCE, 1, "SCE:", xco+40, yco-44, (width-80), 19, &(sca->scene), "Remove a Scene");
2256 else if(sca->type==ACT_SCENE_SUSPEND) {
2259 glRects(xco, yco-ysize, xco+width, yco);
2260 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2262 uiDefIDPoinBut(block, test_scenepoin_but, ID_SCE, 1, "SCE:", xco+40, yco-44, (width-80), 19, &(sca->scene), "Pause a Scene");
2264 else if(sca->type==ACT_SCENE_RESUME) {
2267 glRects(xco, yco-ysize, xco+width, yco);
2268 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2270 uiDefIDPoinBut(block, test_scenepoin_but, ID_SCE, 1, "SCE:", xco+40, yco-44, (width-80), 19, &(sca->scene), "Unpause a Scene");
2273 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";
2274 uiDefButS(block, MENU, B_REDR, str, xco+40, yco-24, (width-80), 19, &sca->type, 0.0, 0.0, 0, 0, "");
2281 if (gma->type == ACT_GAME_LOAD)
2285 glRects(xco, yco-ysize, xco+width, yco);
2286 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2287 uiDefBut(block, TEX, 1, "File: ", xco+10, yco-44,width-20,19, &(gma->filename), 0, 63, 0, 0, "Load this file");
2288 // uiDefBut(block, TEX, 1, "Anim: ", xco+10, yco-64,width-20,19, &(gma->loadaniname), 0, 63, 0, 0, "Use this loadinganimation");
2290 /* else if (gma->type == ACT_GAME_START)
2293 glRects(xco, yco-ysize, xco+width, yco);
2294 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2296 uiDefBut(block, TEX, 1, "File: ", xco+10, yco-44,width-20,19, &(gma->filename), 0, 63, 0, 0, "Load this file");
2297 uiDefBut(block, TEX, 1, "Anim: ", xco+10, yco-64,width-20,19, &(gma->loadaniname), 0, 63, 0, 0, "Use this loadinganimation");
2299 */ else if (ELEM4(gma->type, ACT_GAME_RESTART, ACT_GAME_QUIT, ACT_GAME_SAVECFG, ACT_GAME_LOADCFG))
2302 glRects(xco, yco-ysize, xco+width, yco);
2303 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2306 //str = "Scene %t|Load game%x0|Start loaded game%x1|Restart this game%x2|Quit this game %x3";
2307 str = "Scene %t|Start new game%x0|Restart this game%x2|Quit this game %x3|Save GameLogic.globalDict %x4|Load GameLogic.globalDict %x5";
2308 uiDefButS(block, MENU, B_REDR, str, xco+40, yco-24, (width-80), 19, &gma->type, 0.0, 0.0, 0, 0, "");
2318 glRects(xco, yco-ysize, xco+width, yco);
2319 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2321 str= "GroupKey types %t|Set Key %x6|Play %x0|Ping Pong %x1|Flipper %x2|Loop Stop %x3|Loop End %x4|Property %x5";
2323 uiDefButS(block, MENU, 1, str, xco+20, yco-24, width-40, 19, &ga->type, 0, 0, 0, 0, "");
2324 if(ga->type==ACT_GROUP_SET) {
2325 uiDefBut(block, TEX, 0, "Key: ", xco+20, yco-44, (width-10)/2, 19, ga->name, 0.0, 31.0, 0, 0, "This name defines groupkey to be set");
2326 uiDefButI(block, NUM, 0, "Frame:", xco+20+(width-10)/2, yco-44, (width-70)/2, 19, &ga->sta, 0.0, 2500.0, 0, 0, "Set this frame");
2328 else if(ga->type==ACT_GROUP_FROM_PROP) {
2329 uiDefBut(block, TEX, 0, "Prop: ", xco+20, yco-44, width-40, 19, ga->name, 0.0, 31.0, 0, 0, "Use this property to define the Group position");
2332 uiDefButI(block, NUM, 0, "State", xco+20, yco-44, (width-40)/2, 19, &ga->sta, 0.0, 2500.0, 0, 0, "Start frame");
2333 uiDefButI(block, NUM, 0, "End", xco+20+(width-40)/2, yco-44, (width-40)/2, 19, &ga->end, 0.0, 2500.0, 0, 0, "End frame");
2338 case ACT_VISIBILITY:
2341 glRects(xco, yco-ysize, xco+width, yco);
2342 uiEmboss((float)xco,
2343 (float)yco-ysize, (float)xco+width, (float)yco, 1);
2347 str= "Visibility %t|Visible %x0|Invisible %x1|Visible Recursive %x2|Invisible Recursive %x3";
2349 uiDefButI(block, MENU, B_REDR, str,
2350 xco + 10, yco - 24, width - 20, 19, &visAct->flag,
2352 "Make the object invisible or visible.");
2354 uiDefButBitI(block, TOG, ACT_VISIBILITY_INVISIBLE, 0,
2356 xco + 10, yco - 24, width - 20, 19, &visAct->flag,
2358 "Make the object invisible or visible.");
2367 glRects(xco, yco-ysize, xco+width, yco);
2368 uiEmboss((float)xco,
2369 (float)yco-ysize, (float)xco+width, (float)yco, 1);
2373 str= "Operation %t|Cpy %x0|Add %x1|Sub %x2|Inv %x3";
2375 uiDefButI(block, MENU, B_REDR, str,
2376 xco + 10, yco - 24, 65, 19, &staAct->type,
2378 "Select the bit operation on object state mask");
2380 for (wval=0; wval<15; wval+=5) {
2381 uiBlockBeginAlign(block);
2382 for (stbit=0; stbit<5; stbit++) {
2383 uiDefButBitI(block, TOG, (1<<(stbit+wval)), 0, "", (short)(xco+85+12*stbit+13*wval), yco-17, 12, 12, (int *)&(staAct->mask), 0, 0, 0, 0, get_state_name(ob, (short)(wval+stbit)));
2385 for (stbit=0; stbit<5; stbit++) {
2386 uiDefButBitI(block, TOG, (1<<(stbit+wval+15)), 0, "", (short)(xco+85+12*stbit+13*wval), yco-29, 12, 12, (int *)&(staAct->mask), 0, 0, 0, 0, get_state_name(ob, (short)(wval+stbit+15)));
2389 uiBlockEndAlign(block);
2398 glRects(xco, yco-ysize, xco+width, yco);
2399 uiEmboss((float)xco,
2400 (float)yco-ysize, (float)xco+width, (float)yco, 1);
2402 randAct = act->data;
2405 uiDefButI(block, NUM, 1, "Seed: ", (xco+10),yco-24, 0.4 *(width-20), 19,
2406 &randAct->seed, 0, 1000, 0, 0,
2407 "Initial seed of the random generator. Use Python for more freedom. "
2408 " (Choose 0 for not random)");
2410 /* 2. distribution type */
2411 /* One pick per distribution. These numbers MUST match the #defines */
2413 str= "Distribution %t|Bool Constant %x0|Bool Uniform %x1"
2414 "|Bool Bernoulli %x2|Int Constant %x3|Int Uniform %x4"
2415 "|Int Poisson %x5|Float Constant %x6|Float Uniform %x7"
2416 "|Float Normal %x8|Float Neg. Exp. %x9";
2417 uiDefButI(block, MENU, B_REDR, str, (xco+10) + 0.4 * (width-20), yco-24, 0.6 * (width-20), 19,
2418 &randAct->distribution, 0.0, 0.0, 0, 0,
2419 "Choose the type of distribution");
2422 uiDefBut(block, TEX, 1, "Property:", (xco+10), yco-44, (width-20), 19,
2423 &randAct->propname, 0, 31, 0, 0,
2424 "Assign the random value to this property");
2426 /*4. and 5. arguments for the distribution*/
2427 switch (randAct->distribution) {
2428 case ACT_RANDOM_BOOL_CONST:
2429 uiDefButBitI(block, TOG, 1, 1, "Always true", (xco+10), yco-64, (width-20), 19,
2430 &randAct->int_arg_1, 2.0, 1, 0, 0,
2431 "Always false or always true");
2433 case ACT_RANDOM_BOOL_UNIFORM:
2434 uiDefBut(block, LABEL, 0, " Do a 50-50 pick.", (xco+10), yco-64, (width-20), 19,
2436 "Choose between true and false, 50% chance each.");
2438 case ACT_RANDOM_BOOL_BERNOUILLI:
2439 uiDefButF(block, NUM, 1, "Chance", (xco+10), yco-64, (width-20), 19,
2440 &randAct->float_arg_1, 0.0, 1.0, 0, 0,
2441 "Pick a number between 0 and 1. Success if you stay "
2442 "below this value");
2444 case ACT_RANDOM_INT_CONST:
2445 uiDefButI(block, NUM, 1, "Value: ", (xco+10), yco-64, (width-20), 19,
2446 &randAct->int_arg_1, -1000, 1000, 0, 0,
2447 "Always return this number");
2449 case ACT_RANDOM_INT_UNIFORM:
2450 uiDefButI(block, NUM, 1, "Min: ", (xco+10), yco-64, (width-20)/2, 19,
2451 &randAct->int_arg_1, -1000, 1000, 0, 0,
2452 "Choose a number from a range. "
2453 "Lower boundary of the range.");
2454 uiDefButI(block, NUM, 1, "Max: ", (xco+10) + (width-20)/2, yco-64, (width-20)/2, 19,
2455 &randAct->int_arg_2, -1000, 1000, 0, 0,
2456 "Choose a number from a range. "
2457 "Upper boundary of the range.");
2459 case ACT_RANDOM_INT_POISSON:
2460 uiDefButF(block, NUM, 1, "Mean: ", (xco+10), yco-64, (width-20), 19,
2461 &randAct->float_arg_1, 0.01, 100.0, 0, 0,
2462 "Expected mean value of the distribution.");
2464 case ACT_RANDOM_FLOAT_CONST:
2465 uiDefButF(block, NUM, 1, "Value: ", (xco+10), yco-64, (width-20), 19,
2466 &randAct->float_arg_1, 0.0, 1.0, 0, 0,
2467 "Always return this number");
2469 case ACT_RANDOM_FLOAT_UNIFORM:
2470 uiDefButF(block, NUM, 1, "Min: ", (xco+10), yco-64, (width-20)/2, 19,
2471 &randAct->float_arg_1, -10000.0, 10000.0, 0, 0,
2472 "Choose a number from a range. "
2473 "Lower boundary of the range.");
2474 uiDefButF(block, NUM, 1, "Max: ", (xco+10) + (width-20)/2, yco-64, (width-20)/2, 19,
2475 &randAct->float_arg_2, -10000.0, 10000.0, 0, 0,
2476 "Choose a number from a range. "
2477 "Upper boundary of the range.");
2479 case ACT_RANDOM_FLOAT_NORMAL:
2480 uiDefButF(block, NUM, 1, "Mean: ", (xco+10), yco-64, (width-20)/2, 19,
2481 &randAct->float_arg_1, -10000.0, 10000.0, 0, 0,
2482 "A normal distribution. Mean of the distribution.");
2483 uiDefButF(block, NUM, 1, "SD: ", (xco+10) + (width-20)/2, yco-64, (width-20)/2, 19,
2484 &randAct->float_arg_2, 0.0, 10000.0, 0, 0,
2485 "A normal distribution. Standard deviation of the "
2488 case ACT_RANDOM_FLOAT_NEGATIVE_EXPONENTIAL:
2489 uiDefButF(block, NUM, 1, "Half-life time: ", (xco+10), yco-64, (width-20), 19,
2490 &randAct->float_arg_1, 0.001, 10000.0, 0, 0,
2491 "Negative exponential dropoff.");
2494 ; /* don't know what this distro is... can be useful for testing */
2503 #define MESSAGE_SENSOR_TO_FIELD_WORKS /* Really? Not really. Don't remove this ifdef yet */
2505 #ifdef MESSAGE_SENSOR_TO_FIELD_WORKS
2506 ysize = 4 + (3 * 24); /* footer + number of lines * 24 pixels/line */
2508 ysize = 4 + (2 * 24); /* footer + number of lines * 24 pixels/line */
2510 glRects(xco, yco-ysize, xco+width, yco);
2511 uiEmboss((float)xco, (float)yco-ysize,
2512 (float)xco+width, (float)yco, 1);
2517 #ifdef MESSAGE_SENSOR_TO_FIELD_WORKS
2519 uiDefBut(block, TEX, 1, "To: ",
2520 (xco+10), (yco-(myline++*24)), (width-20), 19,
2521 &ma->toPropName, 0, 31, 0, 0,
2522 "Optional send message to objects with this name only (Prefix name with OB)"
2523 ", or empty to broadcast");
2527 /* line 2: Message Subject */
2528 uiDefBut(block, TEX, 1, "Subject: ",
2529 (xco+10), (yco-(myline++*24)), (width-20), 19,
2530 &ma->subject, 0, 31, 0, 0,
2531 "Optional message subject. This is what can be filtered on.");
2533 /* line 3: Text/Property */
2534 uiDefButBitS(block, TOG, 1, B_REDR, "T/P",
2535 (xco+10),(yco-(myline*24)), (0.20 * (width-20)), 19,
2536 &ma->bodyType, 0.0, 0.0, 0, 0,
2537 "Toggle message type: either Text or a PropertyName.");
2539 if (ma->bodyType == ACT_MESG_MESG)
2541 /* line 3: Message Body */
2542 uiDefBut(block, TEX, 1, "Body: ",
2543 (xco+10+(0.20*(width-20))),(yco-(myline++*24)),(0.8*(width-20)),19,
2544 &ma->body, 0, 31, 0, 0,
2545 "Optional message body Text");
2548 /* line 3: Property body (set by property) */
2549 uiDefBut(block, TEX, 1, "Propname: ",
2550 (xco+10+(0.20*(width-20))),(yco-(myline++*24)),(0.8*(width-20)),19,
2551 &ma->body, 0, 31, 0, 0,
2552 "The message body will be set by the Property Value");
2561 if(tdfa->type == ACT_2DFILTER_CUSTOMFILTER)
2565 glRects( xco, yco-ysize, xco+width, yco );
2566 uiEmboss( (float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1 );
2570 case ACT_2DFILTER_MOTIONBLUR:
2573 uiDefButS(block, TOG, B_REDR, "D", xco+30,yco-44,19, 19, &tdfa->flag, 0.0, 0.0, 0.0, 0.0, "Disable Motion Blur");
2574 uiDefButF(block, NUM, B_REDR, "Value:", xco+52,yco-44,width-82,19,&tdfa->float_arg,0.0,1.0,0.0,0.0,"Set motion blur value");
2578 uiDefButS(block, TOG, B_REDR, "Disabled", xco+30,yco-44,width-60, 19, &tdfa->flag, 0.0, 0.0, 0.0, 0.0, "Enable Motion Blur");
2581 case ACT_2DFILTER_BLUR:
2582 case ACT_2DFILTER_SHARPEN:
2583 case ACT_2DFILTER_DILATION:
2584 case ACT_2DFILTER_EROSION:
2585 case ACT_2DFILTER_LAPLACIAN:
2586 case ACT_2DFILTER_SOBEL:
2587 case ACT_2DFILTER_PREWITT:
2588 case ACT_2DFILTER_GRAYSCALE:
2589 case ACT_2DFILTER_SEPIA:
2590 case ACT_2DFILTER_INVERT:
2591 case ACT_2DFILTER_NOFILTER:
2592 case ACT_2DFILTER_DISABLED:
2593 case ACT_2DFILTER_ENABLED:
2594 uiDefButI(block, NUM, B_REDR, "Pass Number:", xco+30,yco-44,width-60,19,&tdfa->int_arg,0.0,MAX_RENDER_PASS-1,0.0,0.0,"Set motion blur value");
2596 case ACT_2DFILTER_CUSTOMFILTER:
2597 uiDefButI(block, NUM, B_REDR, "Pass Number:", xco+30,yco-44,width-60,19,&tdfa->int_arg,0.0,MAX_RENDER_PASS-1,0.0,0.0,"Set motion blur value");
2598 uiDefIDPoinBut(block, test_scriptpoin_but, ID_SCRIPT, 1, "Script: ", xco+30,yco-64,width-60, 19, &tdfa->text, "");
2602 str= "2D Filter %t|Motion Blur %x1|Blur %x2|Sharpen %x3|Dilation %x4|Erosion %x5|"
2603 "Laplacian %x6|Sobel %x7|Prewitt %x8|Gray Scale %x9|Sepia %x10|Invert %x11|Custom Filter %x12|"
2604 "Enable Filter %x-2|Disable Filter %x-1|Remove Filter %x0|";
2605 uiDefButS(block, MENU, B_REDR, str, xco+30,yco-24,width-60, 19, &tdfa->type, 0.0, 0.0, 0.0, 0.0, "2D filter type");
2612 if(parAct->type==ACT_PARENT_SET) {
2615 glRects(xco, yco-ysize, xco+width, yco);
2616 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2618 uiDefIDPoinBut(block, test_obpoin_but, ID_OB, 1, "OB:", xco+40, yco-44, (width-80), 19, &(parAct->ob), "Set this object as parent");
2620 else if(parAct->type==ACT_PARENT_REMOVE) {
2623 glRects(xco, yco-ysize, xco+width, yco);
2624 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2627 str= "Parent %t|Set Parent %x0|Remove Parent %x1";
2628 uiDefButI(block, MENU, B_REDR, str, xco+40, yco-24, (width-80), 19, &parAct->type, 0.0, 0.0, 0, 0, "");
2635 glRects(xco, yco-ysize, xco+width, yco);
2636 uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
2642 uiBlockSetEmboss(block, UI_EMBOSSM);
2647 static void do_sensor_menu(void *arg, int event)