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:
authorDalai Felinto <dfelinto@gmail.com>2011-02-16 22:53:39 +0300
committerDalai Felinto <dfelinto@gmail.com>2011-02-16 22:53:39 +0300
commit230aed624220a5c7eee956254b5bf36eaf3b04f6 (patch)
treef30f05544ea9d4f8c0d44050063471d42899ef37 /source/gameengine
parent0ea7f1ce155147e873ffc4350f8faf4489c9052a (diff)
BGE: Action and ShapeKey Actuator PingPong playmode.
I have no idea why this hasn't been implemented before (the DEFINES were even there already). But since the Ipo (Fcurve) Actuator supports it I don't see why Action and ShapeKey shouldn't. More than a new feature or a bugfix this is actually a step forward into unifying them.
Diffstat (limited to 'source/gameengine')
-rw-r--r--source/gameengine/Converter/BL_ActionActuator.cpp22
-rw-r--r--source/gameengine/Converter/BL_ActionActuator.h1
-rw-r--r--source/gameengine/Converter/BL_ShapeActionActuator.cpp22
-rw-r--r--source/gameengine/Converter/BL_ShapeActionActuator.h1
-rw-r--r--source/gameengine/Ketsji/KX_PythonInit.cpp1
5 files changed, 47 insertions, 0 deletions
diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp b/source/gameengine/Converter/BL_ActionActuator.cpp
index ac35007129a..859bcab5c6a 100644
--- a/source/gameengine/Converter/BL_ActionActuator.cpp
+++ b/source/gameengine/Converter/BL_ActionActuator.cpp
@@ -232,6 +232,16 @@ bool BL_ActionActuator::Update(double curtime, bool frame)
apply=false;
}
break;
+ case ACT_ACTION_PINGPONG:
+ if (bPositiveEvent){
+ if (!(m_flag & ACT_FLAG_LOCKINPUT)){
+ m_flag &= ~ACT_FLAG_KEYUP;
+ m_localtime = m_starttime;
+ m_starttime = curtime;
+ m_flag |= ACT_FLAG_LOCKINPUT;
+ }
+ }
+ break;
case ACT_ACTION_FLIPPER:
if (bPositiveEvent){
if (!(m_flag & ACT_FLAG_LOCKINPUT)){
@@ -306,6 +316,18 @@ bool BL_ActionActuator::Update(double curtime, bool frame)
break;
case ACT_ACTION_LOOP_STOP:
break;
+ case ACT_ACTION_PINGPONG:
+ if (wrap){
+ if (!(m_flag & ACT_FLAG_REVERSE))
+ m_localtime = m_endframe;
+ else
+ m_localtime = m_startframe;
+
+ m_flag &= ~ACT_FLAG_LOCKINPUT;
+ m_flag ^= ACT_FLAG_REVERSE; //flip direction
+ keepgoing = false;
+ }
+ break;
case ACT_ACTION_FLIPPER:
if (wrap){
if (!(m_flag & ACT_FLAG_REVERSE)){
diff --git a/source/gameengine/Converter/BL_ActionActuator.h b/source/gameengine/Converter/BL_ActionActuator.h
index 9682c0e45f7..bfbb160e464 100644
--- a/source/gameengine/Converter/BL_ActionActuator.h
+++ b/source/gameengine/Converter/BL_ActionActuator.h
@@ -121,6 +121,7 @@ public:
switch (act->m_playtype) {
case ACT_ACTION_PLAY:
+ case ACT_ACTION_PINGPONG:
case ACT_ACTION_FLIPPER:
case ACT_ACTION_LOOP_STOP:
case ACT_ACTION_LOOP_END:
diff --git a/source/gameengine/Converter/BL_ShapeActionActuator.cpp b/source/gameengine/Converter/BL_ShapeActionActuator.cpp
index 4f6e07206dd..d4ced2634ea 100644
--- a/source/gameengine/Converter/BL_ShapeActionActuator.cpp
+++ b/source/gameengine/Converter/BL_ShapeActionActuator.cpp
@@ -226,6 +226,16 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
apply=false;
}
break;
+ case ACT_ACTION_PINGPONG:
+ if (bPositiveEvent){
+ if (!(m_flag & ACT_FLAG_LOCKINPUT)){
+ m_flag &= ~ACT_FLAG_KEYUP;
+ m_localtime = m_starttime;
+ m_starttime = curtime;
+ m_flag |= ACT_FLAG_LOCKINPUT;
+ }
+ }
+ break;
case ACT_ACTION_FLIPPER:
if (bPositiveEvent){
if (!(m_flag & ACT_FLAG_LOCKINPUT)){
@@ -300,6 +310,18 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
break;
case ACT_ACTION_LOOP_STOP:
break;
+ case ACT_ACTION_PINGPONG:
+ if (wrap){
+ if (!(m_flag & ACT_FLAG_REVERSE))
+ m_localtime = m_endframe;
+ else
+ m_localtime = m_startframe;
+
+ m_flag &= ~ACT_FLAG_LOCKINPUT;
+ m_flag ^= ACT_FLAG_REVERSE; //flip direction
+ keepgoing = false;
+ }
+ break;
case ACT_ACTION_FLIPPER:
if (wrap){
if (!(m_flag & ACT_FLAG_REVERSE)){
diff --git a/source/gameengine/Converter/BL_ShapeActionActuator.h b/source/gameengine/Converter/BL_ShapeActionActuator.h
index e6457e2c686..64b75967874 100644
--- a/source/gameengine/Converter/BL_ShapeActionActuator.h
+++ b/source/gameengine/Converter/BL_ShapeActionActuator.h
@@ -113,6 +113,7 @@ public:
switch (act->m_playtype) {
case ACT_ACTION_PLAY:
+ case ACT_ACTION_PINGPONG:
case ACT_ACTION_FLIPPER:
case ACT_ACTION_LOOP_STOP:
case ACT_ACTION_LOOP_END:
diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp
index 8cc62e2c2fb..d0a6a9a9bec 100644
--- a/source/gameengine/Ketsji/KX_PythonInit.cpp
+++ b/source/gameengine/Ketsji/KX_PythonInit.cpp
@@ -1398,6 +1398,7 @@ PyObject* initGameLogic(KX_KetsjiEngine *engine, KX_Scene* scene) // quick hack
/* 7. Action actuator */
KX_MACRO_addTypesToDict(d, KX_ACTIONACT_PLAY, ACT_ACTION_PLAY);
+ KX_MACRO_addTypesToDict(d, KX_ACTIONACT_PINGPONG, ACT_ACTION_PINGPONG);
KX_MACRO_addTypesToDict(d, KX_ACTIONACT_FLIPPER, ACT_ACTION_FLIPPER);
KX_MACRO_addTypesToDict(d, KX_ACTIONACT_LOOPSTOP, ACT_ACTION_LOOP_STOP);
KX_MACRO_addTypesToDict(d, KX_ACTIONACT_LOOPEND, ACT_ACTION_LOOP_END);