[Bf-blender-cvs] [0d63817] master: BGE: Fix T30179 action actuator not stoped when state changed.
Porteries Tristan
noreply at git.blender.org
Fri Oct 23 10:54:23 CEST 2015
Commit: 0d638172ec1fb8af808533f7d9535a52af23b33d
Author: Porteries Tristan
Date: Fri Oct 23 10:41:13 2015 +0200
Branches: master
https://developer.blender.org/rB0d638172ec1fb8af808533f7d9535a52af23b33d
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.
===================================================================
M source/gameengine/Converter/BL_ActionActuator.cpp
M source/gameengine/Converter/BL_ActionActuator.h
M source/gameengine/GameLogic/SCA_IActuator.h
===================================================================
diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp b/source/gameengine/Converter/BL_ActionActuator.cpp
index 372be85..d9865c1 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 f488b0c..a43cf0f 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 8c22fb3..b63cb63 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; }
More information about the Bf-blender-cvs
mailing list