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/Ketsji | |
parent | 8550c2b594fb1a2544b77b7f3abec84b29b1745d (diff) |
BGE patch: add frameProp to Ipo actuator (Carsten's request).
Diffstat (limited to 'source/gameengine/Ketsji')
-rw-r--r-- | source/gameengine/Ketsji/KX_IpoActuator.cpp | 18 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_IpoActuator.h | 4 |
2 files changed, 21 insertions, 1 deletions
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, |