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:
authorPorteries Tristan <republicthunderbolt9@gmail.com>2015-10-23 11:41:13 +0300
committerPorteries Tristan <republicthunderbolt9@gmail.com>2015-10-23 11:54:08 +0300
commit0d638172ec1fb8af808533f7d9535a52af23b33d (patch)
tree29ca2354b167548f05b1aa629285a80643e0ba1c /source/gameengine
parentd04ad07f9822b9052410f223e271cc298a79d25d (diff)
BGE: Fix T30179 action actuator not stoped when state changed.
The function SCA_IActuator::DecLink is now under virtual : in some case the actuator have to know when is useless.
Diffstat (limited to 'source/gameengine')
-rw-r--r--source/gameengine/Converter/BL_ActionActuator.cpp11
-rw-r--r--source/gameengine/Converter/BL_ActionActuator.h2
-rw-r--r--source/gameengine/GameLogic/SCA_IActuator.h2
3 files changed, 14 insertions, 1 deletions
diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp b/source/gameengine/Converter/BL_ActionActuator.cpp
index 372be85dacd..d9865c1f4fb 100644
--- a/source/gameengine/Converter/BL_ActionActuator.cpp
+++ b/source/gameengine/Converter/BL_ActionActuator.cpp
@@ -336,6 +336,17 @@ bool BL_ActionActuator::Update(double curtime, bool frame)
return m_flag & ACT_FLAG_ACTIVE;
}
+void BL_ActionActuator::DecLink()
+{
+ SCA_IActuator::DecLink();
+ /* In this case no controllers use this action actuator,
+ and it should stop its action. */
+ if (m_links == 0) {
+ KX_GameObject *obj = (KX_GameObject *)GetParent();
+ obj->StopAction(m_layer);
+ }
+}
+
#ifdef WITH_PYTHON
/* ------------------------------------------------------------------------- */
diff --git a/source/gameengine/Converter/BL_ActionActuator.h b/source/gameengine/Converter/BL_ActionActuator.h
index f488b0c76a6..a43cf0f0a7b 100644
--- a/source/gameengine/Converter/BL_ActionActuator.h
+++ b/source/gameengine/Converter/BL_ActionActuator.h
@@ -69,6 +69,8 @@ public:
bAction* GetAction() { return m_action; }
void SetAction(bAction* act) { m_action= act; }
+ virtual void DecLink();
+
#ifdef WITH_PYTHON
KX_PYMETHOD_O(BL_ActionActuator,GetChannel)
diff --git a/source/gameengine/GameLogic/SCA_IActuator.h b/source/gameengine/GameLogic/SCA_IActuator.h
index 8c22fb39c80..b63cb633b4e 100644
--- a/source/gameengine/GameLogic/SCA_IActuator.h
+++ b/source/gameengine/GameLogic/SCA_IActuator.h
@@ -156,7 +156,7 @@ public:
void ClrLink() { m_links=0; }
void IncLink() { m_links++; }
- void DecLink();
+ virtual void DecLink();
bool IsNoLink() const { return !m_links; }
bool IsType(KX_ACTUATOR_TYPE type) { return m_type == type; }