diff options
author | Benoit Bolsee <benoit.bolsee@online.be> | 2008-10-02 01:17:00 +0400 |
---|---|---|
committer | Benoit Bolsee <benoit.bolsee@online.be> | 2008-10-02 01:17:00 +0400 |
commit | c2b8702a83c93cca28262606ed610e31fef22947 (patch) | |
tree | e326afddbb592bd7ff83113f47417e1865e32c84 /source/gameengine | |
parent | 8550c2b594fb1a2544b77b7f3abec84b29b1745d (diff) |
BGE patch: add frameProp to Ipo actuator (Carsten's request).
Diffstat (limited to 'source/gameengine')
-rw-r--r-- | source/gameengine/Converter/KX_ConvertActuators.cpp | 4 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_IpoActuator.cpp | 18 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_IpoActuator.h | 4 |
3 files changed, 24 insertions, 2 deletions
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, |