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:
authorCampbell Barton <ideasman42@gmail.com>2008-08-27 07:34:53 +0400
committerCampbell Barton <ideasman42@gmail.com>2008-08-27 07:34:53 +0400
commitd5667656353a6ce8247d1e1c125471688c679bd8 (patch)
tree2868244c59159d783d2e2ceb93162ed5af6d40b8 /source/blender
parent6778c8dc2914e5714f0211d0643c1ade34864d02 (diff)
get/set Angular velocity for KX_GameObjects python api and for the AddObject actuator.
Needed so objects created in an explosion could start spinning without having motion actuators and collision sensors on each item.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/makesdna/DNA_actuator_types.h7
-rw-r--r--source/blender/src/buttons_logic.c22
2 files changed, 26 insertions, 3 deletions
diff --git a/source/blender/makesdna/DNA_actuator_types.h b/source/blender/makesdna/DNA_actuator_types.h
index 7444ce95f56..59d0555b452 100644
--- a/source/blender/makesdna/DNA_actuator_types.h
+++ b/source/blender/makesdna/DNA_actuator_types.h
@@ -81,7 +81,9 @@ typedef struct bEditObjectActuator {
struct Mesh *me;
char name[32];
float linVelocity[3]; /* initial lin. velocity on creation */
- short localflag; /* flag for the lin. vel: apply locally */
+ float angVelocity[3]; /* initial ang. velocity on creation */
+ float pad;
+ short localflag; /* flag for the lin & ang. vel: apply locally */
short dyn_operation;
} bEditObjectActuator;
@@ -384,6 +386,9 @@ typedef struct FreeCamera {
#define ACT_EDOB_TRACK_TO 3
#define ACT_EDOB_DYNAMICS 4
+/* editObjectActuator->localflag */
+#define ACT_EDOB_LOCAL_LINV 2
+#define ACT_EDOB_LOCAL_ANGV 4
/* editObjectActuator->flag */
diff --git a/source/blender/src/buttons_logic.c b/source/blender/src/buttons_logic.c
index 2dd6d705a9e..78bab43a3c1 100644
--- a/source/blender/src/buttons_logic.c
+++ b/source/blender/src/buttons_logic.c
@@ -2022,7 +2022,7 @@ static short draw_actuatorbuttons(Object *ob, bActuator *act, uiBlock *block, sh
if(eoa->type==ACT_EDOB_ADD_OBJECT) {
int wval; /* just a temp width */
- ysize = 72;
+ ysize = 92;
glRects(xco, yco-ysize, xco+width, yco);
uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
@@ -2042,9 +2042,27 @@ static short draw_actuatorbuttons(Object *ob, bActuator *act, uiBlock *block, sh
uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-68, wval, 19,
eoa->linVelocity+2, -100.0, 100.0, 10, 0,
"Velocity upon creation, z component.");
- uiDefButBitS(block, TOG, 2, 0, "L", xco+45+3*wval, yco-68, 15, 19,
+ uiDefButBitS(block, TOG, ACT_EDOB_LOCAL_LINV, 0, "L", xco+45+3*wval, yco-68, 15, 19,
&eoa->localflag, 0.0, 0.0, 0, 0,
"Apply the transformation locally");
+
+
+ uiDefBut(block, LABEL, 0, "AngV", xco, yco-90, 45, 19,
+ NULL, 0, 0, 0, 0,
+ "Angular velocity upon creation.");
+ uiDefButF(block, NUM, 0, "", xco+45, yco-90, wval, 19,
+ eoa->angVelocity, -10000.0, 10000.0, 10, 0,
+ "Angular velocity upon creation, x component.");
+ uiDefButF(block, NUM, 0, "", xco+45+wval, yco-90, wval, 19,
+ eoa->angVelocity+1, -10000.0, 10000.0, 10, 0,
+ "Angular velocity upon creation, y component.");
+ uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-90, wval, 19,
+ eoa->angVelocity+2, -10000.0, 10000.0, 10, 0,
+ "Angular velocity upon creation, z component.");
+ uiDefButBitS(block, TOG, ACT_EDOB_LOCAL_ANGV, 0, "L", xco+45+3*wval, yco-90, 15, 19,
+ &eoa->localflag, 0.0, 0.0, 0, 0,
+ "Apply the rotation locally");
+
}
else if(eoa->type==ACT_EDOB_END_OBJECT) {