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
path: root/source
diff options
context:
space:
mode:
authorBenoit Bolsee <benoit.bolsee@online.be>2008-10-02 01:17:00 +0400
committerBenoit Bolsee <benoit.bolsee@online.be>2008-10-02 01:17:00 +0400
commitc2b8702a83c93cca28262606ed610e31fef22947 (patch)
treee326afddbb592bd7ff83113f47417e1865e32c84 /source
parent8550c2b594fb1a2544b77b7f3abec84b29b1745d (diff)
BGE patch: add frameProp to Ipo actuator (Carsten's request).
Diffstat (limited to 'source')
-rw-r--r--source/blender/makesdna/DNA_actuator_types.h1
-rw-r--r--source/blender/src/buttons_logic.c6
-rw-r--r--source/gameengine/Converter/KX_ConvertActuators.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_IpoActuator.cpp18
-rw-r--r--source/gameengine/Ketsji/KX_IpoActuator.h4
5 files changed, 30 insertions, 3 deletions
diff --git a/source/blender/makesdna/DNA_actuator_types.h b/source/blender/makesdna/DNA_actuator_types.h
index 0af1ec0a2c7..43dada97d0e 100644
--- a/source/blender/makesdna/DNA_actuator_types.h
+++ b/source/blender/makesdna/DNA_actuator_types.h
@@ -113,6 +113,7 @@ typedef struct bIpoActuator {
short flag, type;
int sta, end;
char name[32];
+ char frameProp[32]; /* Set this property to the actions current frame */
short pad1, cur, butsta, butend;
diff --git a/source/blender/src/buttons_logic.c b/source/blender/src/buttons_logic.c
index 052bf3f1ae4..a54f20b85c2 100644
--- a/source/blender/src/buttons_logic.c
+++ b/source/blender/src/buttons_logic.c
@@ -1866,7 +1866,7 @@ static short draw_actuatorbuttons(Object *ob, bActuator *act, uiBlock *block, sh
{
ia= act->data;
- ysize= 52;
+ ysize= 72;
glRects(xco, yco-ysize, xco+width, yco);
uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
@@ -1915,6 +1915,10 @@ static short draw_actuatorbuttons(Object *ob, bActuator *act, uiBlock *block, sh
"Child", xco+10+(width-80), yco-44, 60, 19,
&ia->flag, 0, 0, 0, 0,
"Update IPO on all children Objects as well");
+ uiDefBut(block, TEX, 0,
+ "FrameProp: ", xco+10, yco-64, width-20, 19,
+ ia->frameProp, 0.0, 31.0, 0, 0,
+ "Assign this property this action current frame number");
yco-= ysize;
break;
diff --git a/source/gameengine/Converter/KX_ConvertActuators.cpp b/source/gameengine/Converter/KX_ConvertActuators.cpp
index b739e3b2094..d5f304c38e7 100644
--- a/source/gameengine/Converter/KX_ConvertActuators.cpp
+++ b/source/gameengine/Converter/KX_ConvertActuators.cpp
@@ -235,7 +235,8 @@ void BL_ConvertActuators(char* maggiename,
{
bIpoActuator* ipoact = (bIpoActuator*) bact->data;
bool ipochild = (ipoact->flag & ACT_IPOCHILD) !=0;
- STR_String propname = ( ipoact->name ? ipoact->name : "");
+ STR_String propname = ipoact->name;
+ STR_String frameProp = ipoact->frameProp;
// first bit?
bool ipo_as_force = (ipoact->flag & ACT_IPOFORCE);
bool local = (ipoact->flag & ACT_IPOLOCAL);
@@ -244,6 +245,7 @@ void BL_ConvertActuators(char* maggiename,
KX_IpoActuator* tmpbaseact = new KX_IpoActuator(
gameobj,
propname ,
+ frameProp,
ipoact->sta,
ipoact->end,
ipochild,
diff --git a/source/gameengine/Ketsji/KX_IpoActuator.cpp b/source/gameengine/Ketsji/KX_IpoActuator.cpp
index d9945a4b131..a6a3d03d60e 100644
--- a/source/gameengine/Ketsji/KX_IpoActuator.cpp
+++ b/source/gameengine/Ketsji/KX_IpoActuator.cpp
@@ -37,6 +37,7 @@
#include "KX_IpoActuator.h"
#include "KX_GameObject.h"
+#include "FloatValue.h"
#ifdef HAVE_CONFIG_H
#include <config.h>
@@ -62,6 +63,7 @@ STR_String KX_IpoActuator::S_KX_ACT_IPO_FROM_PROP_STRING = "FromProp";
KX_IpoActuator::KX_IpoActuator(SCA_IObject* gameobj,
const STR_String& propname,
+ const STR_String& framePropname,
float starttime,
float endtime,
bool recurse,
@@ -78,6 +80,7 @@ KX_IpoActuator::KX_IpoActuator(SCA_IObject* gameobj,
m_localtime(starttime),
m_direction(1),
m_propname(propname),
+ m_framepropname(framePropname),
m_ipo_as_force(ipo_as_force),
m_ipo_add(ipo_add),
m_ipo_local(ipo_local),
@@ -356,7 +359,20 @@ bool KX_IpoActuator::Update(double curtime, bool frame)
default:
result = false;
}
-
+
+ /* Set the property if its defined */
+ if (m_framepropname[0] != '\0') {
+ CValue* propowner = GetParent();
+ CValue* oldprop = propowner->GetProperty(m_framepropname);
+ CValue* newval = new CFloatValue(m_localtime);
+ if (oldprop) {
+ oldprop->SetValue(newval);
+ } else {
+ propowner->SetProperty(m_framepropname, newval);
+ }
+ newval->Release();
+ }
+
if (!result)
{
if (m_type != KX_ACT_IPO_LOOPSTOP)
diff --git a/source/gameengine/Ketsji/KX_IpoActuator.h b/source/gameengine/Ketsji/KX_IpoActuator.h
index d6f52f8d59d..8e5baed0530 100644
--- a/source/gameengine/Ketsji/KX_IpoActuator.h
+++ b/source/gameengine/Ketsji/KX_IpoActuator.h
@@ -72,6 +72,9 @@ protected:
/** Name of the property (only used in from_prop mode). */
STR_String m_propname;
+ /** Name of the property where we write the current frame number */
+ STR_String m_framepropname;
+
/** Interpret the ipo as a force? */
bool m_ipo_as_force;
@@ -111,6 +114,7 @@ public:
KX_IpoActuator(SCA_IObject* gameobj,
const STR_String& propname,
+ const STR_String& framePropname,
float starttime,
float endtime,
bool recurse,