Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/src/buttons_logic.c')
-rw-r--r--source/blender/src/buttons_logic.c38
1 files changed, 32 insertions, 6 deletions
diff --git a/source/blender/src/buttons_logic.c b/source/blender/src/buttons_logic.c
index 5cf1958678e..e16e058e093 100644
--- a/source/blender/src/buttons_logic.c
+++ b/source/blender/src/buttons_logic.c
@@ -683,6 +683,8 @@ static char *sensor_name(int type)
return "Property";
case SENS_ACTUATOR:
return "Actuator";
+ case SENS_DELAY:
+ return "Delay";
case SENS_MOUSE:
return "Mouse";
case SENS_COLLISION:
@@ -704,7 +706,7 @@ static char *sensor_name(int type)
static char *sensor_pup(void)
{
/* the number needs to match defines in game.h */
- return "Sensors %t|Always %x0|Keyboard %x3|Mouse %x5|"
+ return "Sensors %t|Always %x0|Delay %x13|Keyboard %x3|Mouse %x5|"
"Touch %x1|Collision %x6|Near %x2|Radar %x7|"
"Property %x4|Random %x8|Ray %x9|Message %x10|Joystick %x11|Actuator %x12";
}
@@ -1000,6 +1002,7 @@ static int get_col_sensor(int type)
{
switch(type) {
case SENS_ALWAYS: return TH_BUT_ACTION;
+ case SENS_DELAY: return TH_BUT_ACTION;
case SENS_TOUCH: return TH_BUT_NEUTRAL;
case SENS_COLLISION: return TH_BUT_SETTING;
case SENS_NEAR: return TH_BUT_SETTING1;
@@ -1070,8 +1073,8 @@ static short draw_sensorbuttons(bSensor *sens, uiBlock *block, short xco, short
bRaySensor *raySens = NULL;
bMessageSensor *mes = NULL;
bJoystickSensor *joy = NULL;
- bActuatorSensor *as = NULL;
-
+ bActuatorSensor *as = NULL;
+ bDelaySensor *ds = NULL;
short ysize;
char *str;
@@ -1297,6 +1300,27 @@ static short draw_sensorbuttons(bSensor *sens, uiBlock *block, short xco, short
yco-= ysize;
break;
}
+ case SENS_DELAY:
+ {
+ ysize= 48;
+
+ glRects(xco, yco-ysize, xco+width, yco);
+ uiEmboss((float)xco, (float)yco-ysize,
+ (float)xco+width, (float)yco, 1);
+
+ draw_default_sensor_header(sens, block, xco, yco, width);
+ ds = sens->data;
+
+ uiDefButS(block, NUM, 0, "Delay",(short)(10+xco),(short)(yco-44),(short)((width-22)*0.4+10), 19,
+ &ds->delay, 0.0, 5000.0, 0, 0, "Delay in number of frames before the positive trigger");
+ uiDefButS(block, NUM, 0, "Dur",(short)(10+xco+(width-22)*0.4+10),(short)(yco-44),(short)((width-22)*0.4-10), 19,
+ &ds->duration, 0.0, 5000.0, 0, 0, "If >0, delay in number of frames before the negative trigger following the positive trigger");
+ uiDefButBitS(block, TOG, SENS_DELAY_REPEAT, 0, "REP",(short)(xco + 10 + (width-22)*0.8),(short)(yco - 44),
+ (short)(0.20 * (width-22)), 19, &ds->flag, 0.0, 0.0, 0, 0,
+ "Toggle repeat option. If selected, the sensor restarts after Delay+Dur frames");
+ yco-= ysize;
+ break;
+ }
case SENS_MOUSE:
{
ms= sens->data;
@@ -1689,7 +1713,7 @@ static short draw_actuatorbuttons(Object *ob, bActuator *act, uiBlock *block, sh
uiDefBut(block, LABEL, 0, "Torque", xco, yco-106, 55, 19, NULL, 0, 0, 0, 0, "Sets the torque");
uiDefButF(block, NUM, 0, "", xco+45, yco-106, wval, 19, oa->forcerot, -10000.0, 10000.0, 10, 0, "");
uiDefButF(block, NUM, 0, "", xco+45+wval, yco-106, wval, 19, oa->forcerot+1, -10000.0, 10000.0, 10, 0, "");
- uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-6106, wval, 19, oa->forcerot+2, -10000.0, 10000.0, 10, 0, "");
+ uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-106, wval, 19, oa->forcerot+2, -10000.0, 10000.0, 10, 0, "");
}
if ( ob->gameflag & OB_DYNAMIC )
@@ -3183,7 +3207,8 @@ void logic_buts(void)
while(cont) {
for (iact=0; iact<cont->totlinks; iact++) {
act = cont->links[iact];
- act->flag |= ACT_LINKED;
+ if (act)
+ act->flag |= ACT_LINKED;
}
controller_state_mask |= cont->state_mask;
cont = cont->next;
@@ -3231,7 +3256,8 @@ void logic_buts(void)
/* this controller is visible, mark all its actuator */
for (iact=0; iact<cont->totlinks; iact++) {
act = cont->links[iact];
- act->flag |= ACT_VISIBLE;
+ if (act)
+ act->flag |= ACT_VISIBLE;
}
uiBlockSetEmboss(block, UI_EMBOSSM);
uiDefIconButBitS(block, TOG, CONT_DEL, B_DEL_CONT, ICON_X, xco, yco, 22, 19, &cont->flag, 0, 0, 0, 0, "Delete Controller");