diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-06-17 16:32:28 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-06-17 16:32:28 +0400 |
commit | 95335af1b908be6044a02ccfb0a0edf529a61eff (patch) | |
tree | e2b8e179a7ec45bd780bafbe20c594ab247b331a /source/gameengine/Ketsji | |
parent | 2519da917a736bfce3616e9f66e0a03e1a6c015f (diff) |
fix for a bug reported by zapman on blenderartist.
De-activating a loop-end actuator didnt work (it kept looping).
Looked into this further and it turns out that the actuators run with both positive and negative events false, the sound actuator assumes because its not negative that its a positive event and plays the sound anyway.
Fix by checking that its a positive event before playing.
The size limit on the message actuator was 100 which broke some scripts, set to 16384 instead.
Diffstat (limited to 'source/gameengine/Ketsji')
-rw-r--r-- | source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp | 2 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_SoundActuator.cpp | 16 |
2 files changed, 14 insertions, 4 deletions
diff --git a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp index 63773352d96..32f0c3611b7 100644 --- a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp +++ b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp @@ -151,7 +151,7 @@ PyAttributeDef KX_NetworkMessageActuator::Attributes[] = { KX_PYATTRIBUTE_STRING_RW("propName", 0, 100, false, KX_NetworkMessageActuator, m_toPropName), KX_PYATTRIBUTE_STRING_RW("subject", 0, 100, false, KX_NetworkMessageActuator, m_subject), KX_PYATTRIBUTE_BOOL_RW("usePropBody", KX_NetworkMessageActuator, m_bPropBody), - KX_PYATTRIBUTE_STRING_RW("body", 0, 100, false, KX_NetworkMessageActuator, m_body), + KX_PYATTRIBUTE_STRING_RW("body", 0, 16384, false, KX_NetworkMessageActuator, m_body), { NULL } //Sentinel }; diff --git a/source/gameengine/Ketsji/KX_SoundActuator.cpp b/source/gameengine/Ketsji/KX_SoundActuator.cpp index c13271f66a5..9e005cd04bb 100644 --- a/source/gameengine/Ketsji/KX_SoundActuator.cpp +++ b/source/gameengine/Ketsji/KX_SoundActuator.cpp @@ -105,7 +105,8 @@ bool KX_SoundActuator::Update(double curtime, bool frame) // do nothing on negative events, otherwise sounds are played twice! bool bNegativeEvent = IsNegativeEvent(); - + bool bPositiveEvent = m_posevent; + RemoveAllEvents(); if (!m_soundObject) @@ -154,8 +155,17 @@ bool KX_SoundActuator::Update(double curtime, bool frame) // remember that we tried to stop the actuator m_isplaying = false; } - else - { + +#if 1 + // Warning: when de-activating the actuator, after a single negative event this runs again with... + // m_posevent==false && m_posevent==false, in this case IsNegativeEvent() returns false + // and assumes this is a positive event. + // check that we actually have a positive event so as not to play sounds when being disabled. + else if(bPositiveEvent) { // <- added since 2.49 +#else + else { // <- works in most cases except a loop-end sound will never stop unless + // the negative pulse is done continuesly +#endif if (!m_isplaying) { switch (m_type) |