[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [20957] trunk/blender/source/gameengine/ Ketsji: fix for a bug reported by zapman on blenderartist.

Campbell Barton ideasman42 at gmail.com
Wed Jun 17 14:32:28 CEST 2009


Revision: 20957
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20957
Author:   campbellbarton
Date:     2009-06-17 14:32:28 +0200 (Wed, 17 Jun 2009)

Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp
    trunk/blender/source/gameengine/Ketsji/KX_SoundActuator.cpp

Modified: trunk/blender/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp	2009-06-17 11:35:35 UTC (rev 20956)
+++ trunk/blender/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp	2009-06-17 12:32:28 UTC (rev 20957)
@@ -151,7 +151,7 @@
 	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
 };
 

Modified: trunk/blender/source/gameengine/Ketsji/KX_SoundActuator.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_SoundActuator.cpp	2009-06-17 11:35:35 UTC (rev 20956)
+++ trunk/blender/source/gameengine/Ketsji/KX_SoundActuator.cpp	2009-06-17 12:32:28 UTC (rev 20957)
@@ -105,7 +105,8 @@
 
 	// 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 @@
 		// 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)





More information about the Bf-blender-cvs mailing list