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.
This commit is contained in:
parent
d04ad07f98
commit
0d638172ec
Notes:
blender-bot
2023-02-14 14:02:24 +01:00
Referenced by issue #30179, ActionActuator do not deactivate on state change
|
@ -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
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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; }
|
||||
|
||||
|
|
Loading…
Reference in New Issue