[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39286] branches/soc-2011-pepper/source/ gameengine/Converter: BGE Animations: Updating BL_ActionActuator. frame to work with the new actuator.

Mitchell Stokes mogurijin at gmail.com
Thu Aug 11 05:27:50 CEST 2011


Revision: 39286
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39286
Author:   moguri
Date:     2011-08-11 03:27:47 +0000 (Thu, 11 Aug 2011)
Log Message:
-----------
BGE Animations: Updating BL_ActionActuator.frame to work with the new actuator.

Modified Paths:
--------------
    branches/soc-2011-pepper/source/gameengine/Converter/BL_ActionActuator.cpp
    branches/soc-2011-pepper/source/gameengine/Converter/BL_ActionActuator.h

Modified: branches/soc-2011-pepper/source/gameengine/Converter/BL_ActionActuator.cpp
===================================================================
--- branches/soc-2011-pepper/source/gameengine/Converter/BL_ActionActuator.cpp	2011-08-11 01:24:11 UTC (rev 39285)
+++ branches/soc-2011-pepper/source/gameengine/Converter/BL_ActionActuator.cpp	2011-08-11 03:27:47 UTC (rev 39286)
@@ -461,7 +461,7 @@
 	KX_PYATTRIBUTE_RW_FUNCTION("action", BL_ActionActuator, pyattr_get_action, pyattr_set_action),
 	KX_PYATTRIBUTE_RO_FUNCTION("channelNames", BL_ActionActuator, pyattr_get_channel_names),
 	KX_PYATTRIBUTE_SHORT_RW("priority", 0, 100, false, BL_ActionActuator, m_priority),
-	KX_PYATTRIBUTE_FLOAT_RW_CHECK("frame", 0, MAXFRAMEF, BL_ActionActuator, m_localtime, CheckFrame),
+	KX_PYATTRIBUTE_RW_FUNCTION("frame", BL_ActionActuator, pyattr_get_frame, pyattr_set_frame),
 	KX_PYATTRIBUTE_STRING_RW("propName", 0, 31, false, BL_ActionActuator, m_propname),
 	KX_PYATTRIBUTE_STRING_RW("framePropName", 0, 31, false, BL_ActionActuator, m_framepropname),
 	KX_PYATTRIBUTE_RW_FUNCTION("useContinue", BL_ActionActuator, pyattr_get_use_continue, pyattr_set_use_continue),
@@ -542,4 +542,19 @@
 	return PY_SET_ATTR_SUCCESS;
 }
 
+PyObject* BL_ActionActuator::pyattr_get_frame(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+	BL_ActionActuator* self= static_cast<BL_ActionActuator*>(self_v);
+	return PyFloat_FromDouble(((KX_GameObject*)self->m_gameobj)->GetActionFrame(self->m_layer));
+}
+
+int BL_ActionActuator::pyattr_set_frame(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
+{
+	BL_ActionActuator* self= static_cast<BL_ActionActuator*>(self_v);
+	
+	((KX_GameObject*)self->m_gameobj)->SetActionFrame(self->m_layer, PyFloat_AsDouble(value));
+	
+	return PY_SET_ATTR_SUCCESS;
+}
+
 #endif // WITH_PYTHON

Modified: branches/soc-2011-pepper/source/gameengine/Converter/BL_ActionActuator.h
===================================================================
--- branches/soc-2011-pepper/source/gameengine/Converter/BL_ActionActuator.h	2011-08-11 01:24:11 UTC (rev 39285)
+++ branches/soc-2011-pepper/source/gameengine/Converter/BL_ActionActuator.h	2011-08-11 03:27:47 UTC (rev 39286)
@@ -78,20 +78,9 @@
 	static PyObject*	pyattr_get_channel_names(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
 	static PyObject*	pyattr_get_use_continue(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
 	static int			pyattr_set_use_continue(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+	static PyObject*	pyattr_get_frame(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+	static int			pyattr_set_frame(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
 
-	/* attribute check */
-	static int CheckFrame(void *self, const PyAttributeDef*)
-	{
-		BL_ActionActuator* act = reinterpret_cast<BL_ActionActuator*>(self);
-
-		if (act->m_localtime < act->m_startframe)
-			act->m_localtime = act->m_startframe;
-		else if (act->m_localtime > act->m_endframe)
-			act->m_localtime = act->m_endframe;
-
-		return 0;
-	}
-
 	static int CheckBlendTime(void *self, const PyAttributeDef*)
 	{
 		BL_ActionActuator* act = reinterpret_cast<BL_ActionActuator*>(self);




More information about the Bf-blender-cvs mailing list