[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16689] trunk/blender/source/gameengine: BGE patch #17569 approved: Make FrameProp: work in Shape Action.
Benoit Bolsee
benoit.bolsee at online.be
Mon Sep 22 23:49:49 CEST 2008
Revision: 16689
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16689
Author: ben2610
Date: 2008-09-22 23:49:48 +0200 (Mon, 22 Sep 2008)
Log Message:
-----------
BGE patch #17569 approved: Make FrameProp: work in Shape Action. PyDoc updated.
Modified Paths:
--------------
trunk/blender/source/gameengine/Converter/BL_ShapeActionActuator.cpp
trunk/blender/source/gameengine/Converter/BL_ShapeActionActuator.h
trunk/blender/source/gameengine/Converter/KX_ConvertActuators.cpp
trunk/blender/source/gameengine/PyDoc/BL_ActionActuator.py
trunk/blender/source/gameengine/PyDoc/BL_ShapeActionActuator.py
Modified: trunk/blender/source/gameengine/Converter/BL_ShapeActionActuator.cpp
===================================================================
--- trunk/blender/source/gameengine/Converter/BL_ShapeActionActuator.cpp 2008-09-22 21:22:16 UTC (rev 16688)
+++ trunk/blender/source/gameengine/Converter/BL_ShapeActionActuator.cpp 2008-09-22 21:49:48 UTC (rev 16689)
@@ -49,6 +49,7 @@
#include "BLI_arithb.h"
#include "MT_Matrix4x4.h"
#include "BKE_utildefines.h"
+#include "FloatValue.h"
#include "PyObjectPlus.h"
#ifdef HAVE_CONFIG_H
@@ -342,7 +343,19 @@
break;
}
-
+ /* Set the property if its defined */
+ if (m_framepropname[0] != '\0') {
+ CValue* propowner = GetParent();
+ CValue* oldprop = propowner->GetProperty(m_framepropname);
+ CValue* newval = new CFloatValue(m_localtime);
+ if (oldprop) {
+ oldprop->SetValue(newval);
+ } else {
+ propowner->SetProperty(m_framepropname, newval);
+ }
+ newval->Release();
+ }
+
if (bNegativeEvent)
m_blendframe=0.0f;
@@ -442,6 +455,7 @@
{"setPriority", (PyCFunction) BL_ShapeActionActuator::sPySetPriority, METH_VARARGS, SetPriority_doc},
{"setFrame", (PyCFunction) BL_ShapeActionActuator::sPySetFrame, METH_VARARGS, SetFrame_doc},
{"setProperty", (PyCFunction) BL_ShapeActionActuator::sPySetProperty, METH_VARARGS, SetProperty_doc},
+ {"setFrameProperty", (PyCFunction) BL_ShapeActionActuator::sPySetFrameProperty, METH_VARARGS, SetFrameProperty_doc},
{"setBlendtime", (PyCFunction) BL_ShapeActionActuator::sPySetBlendtime, METH_VARARGS, SetBlendtime_doc},
{"getAction", (PyCFunction) BL_ShapeActionActuator::sPyGetAction, METH_NOARGS, GetAction_doc},
@@ -451,6 +465,7 @@
{"getPriority", (PyCFunction) BL_ShapeActionActuator::sPyGetPriority, METH_NOARGS, GetPriority_doc},
{"getFrame", (PyCFunction) BL_ShapeActionActuator::sPyGetFrame, METH_NOARGS, GetFrame_doc},
{"getProperty", (PyCFunction) BL_ShapeActionActuator::sPyGetProperty, METH_NOARGS, GetProperty_doc},
+ {"getFrameProperty", (PyCFunction) BL_ShapeActionActuator::sPyGetFrameProperty, METH_NOARGS, GetFrameProperty_doc},
{"getType", (PyCFunction) BL_ShapeActionActuator::sPyGetType, METH_NOARGS, GetType_doc},
{"setType", (PyCFunction) BL_ShapeActionActuator::sPySetType, METH_NOARGS, SetType_doc},
{NULL,NULL} //Sentinel
@@ -706,6 +721,20 @@
Py_RETURN_NONE;
}
+/* getProperty */
+const char BL_ShapeActionActuator::GetFrameProperty_doc[] =
+"getFrameProperty()\n"
+"\tReturns the name of the property, that is set to the current frame number.\n";
+
+PyObject* BL_ShapeActionActuator::PyGetFrameProperty(PyObject* self) {
+ PyObject *result;
+
+ result = Py_BuildValue("s", (const char *)m_framepropname);
+
+ return result;
+}
+
+
/* setFrame */
const char BL_ShapeActionActuator::SetFrame_doc[] =
"setFrame(frame)\n"
@@ -753,6 +782,27 @@
Py_RETURN_NONE;
}
+/* setFrameProperty */
+const char BL_ShapeActionActuator::SetFrameProperty_doc[] =
+"setFrameProperty(prop)\n"
+"\t - prop : A string specifying the property of the frame set up update.\n";
+
+PyObject* BL_ShapeActionActuator::PySetFrameProperty(PyObject* self,
+ PyObject* args,
+ PyObject* kwds) {
+ char *string;
+
+ if (PyArg_ParseTuple(args,"s",&string))
+ {
+ m_framepropname = string;
+ }
+ else {
+ return NULL;
+ }
+
+ Py_RETURN_NONE;
+}
+
/* getType */
const char BL_ShapeActionActuator::GetType_doc[] =
"getType()\n"
Modified: trunk/blender/source/gameengine/Converter/BL_ShapeActionActuator.h
===================================================================
--- trunk/blender/source/gameengine/Converter/BL_ShapeActionActuator.h 2008-09-22 21:22:16 UTC (rev 16688)
+++ trunk/blender/source/gameengine/Converter/BL_ShapeActionActuator.h 2008-09-22 21:49:48 UTC (rev 16689)
@@ -42,6 +42,7 @@
Py_Header;
BL_ShapeActionActuator(SCA_IObject* gameobj,
const STR_String& propname,
+ const STR_String& framepropname,
float starttime,
float endtime,
struct bAction *action,
@@ -66,6 +67,7 @@
m_playtype(playtype),
m_priority(priority),
m_action(action),
+ m_framepropname(framepropname),
m_propname(propname)
{
};
@@ -84,6 +86,7 @@
KX_PYMETHOD_DOC(BL_ShapeActionActuator,SetEnd);
KX_PYMETHOD_DOC(BL_ShapeActionActuator,SetFrame);
KX_PYMETHOD_DOC(BL_ShapeActionActuator,SetProperty);
+ KX_PYMETHOD_DOC(BL_ShapeActionActuator,SetFrameProperty);
KX_PYMETHOD_DOC(BL_ShapeActionActuator,SetBlendtime);
KX_PYMETHOD_DOC(BL_ShapeActionActuator,SetChannel);
@@ -94,6 +97,7 @@
KX_PYMETHOD_DOC_NOARGS(BL_ShapeActionActuator,GetEnd);
KX_PYMETHOD_DOC_NOARGS(BL_ShapeActionActuator,GetFrame);
KX_PYMETHOD_DOC_NOARGS(BL_ShapeActionActuator,GetProperty);
+ KX_PYMETHOD_DOC_NOARGS(BL_ShapeActionActuator,GetFrameProperty);
// KX_PYMETHOD(BL_ActionActuator,GetChannel);
KX_PYMETHOD_DOC_NOARGS(BL_ShapeActionActuator,GetType);
KX_PYMETHOD_DOC(BL_ShapeActionActuator,SetType);
@@ -126,6 +130,7 @@
short m_priority;
struct bAction *m_action;
STR_String m_propname;
+ STR_String m_framepropname;
vector<float> m_blendshape;
};
Modified: trunk/blender/source/gameengine/Converter/KX_ConvertActuators.cpp
===================================================================
--- trunk/blender/source/gameengine/Converter/KX_ConvertActuators.cpp 2008-09-22 21:22:16 UTC (rev 16688)
+++ trunk/blender/source/gameengine/Converter/KX_ConvertActuators.cpp 2008-09-22 21:49:48 UTC (rev 16689)
@@ -210,10 +210,12 @@
if (blenderobject->type==OB_MESH){
bActionActuator* actact = (bActionActuator*) bact->data;
STR_String propname = (actact->name ? actact->name : "");
+ STR_String propframe = (actact->frameProp ? actact->frameProp : "");
BL_ShapeActionActuator* tmpbaseact = new BL_ShapeActionActuator(
gameobj,
propname,
+ propframe,
actact->sta,
actact->end,
actact->act,
Modified: trunk/blender/source/gameengine/PyDoc/BL_ActionActuator.py
===================================================================
--- trunk/blender/source/gameengine/PyDoc/BL_ActionActuator.py 2008-09-22 21:22:16 UTC (rev 16688)
+++ trunk/blender/source/gameengine/PyDoc/BL_ActionActuator.py 2008-09-22 21:49:48 UTC (rev 16689)
@@ -164,5 +164,14 @@
@param mode: True for armature/world space, False for bone space
@type mode: boolean
"""
-
-
+ def setFrameProperty(prop):
+ """
+ @param prop: A string specifying the property of the object that will be updated with the action frame number.
+ @type prop: string
+ """
+ def getFrameProperty():
+ """
+ Returns the name of the property that is set to the current frame number.
+
+ @rtype: string
+ """
Modified: trunk/blender/source/gameengine/PyDoc/BL_ShapeActionActuator.py
===================================================================
--- trunk/blender/source/gameengine/PyDoc/BL_ShapeActionActuator.py 2008-09-22 21:22:16 UTC (rev 16688)
+++ trunk/blender/source/gameengine/PyDoc/BL_ShapeActionActuator.py 2008-09-22 21:49:48 UTC (rev 16689)
@@ -154,5 +154,14 @@
@rtype: string
"""
-
-
+ def setFrameProperty(prop):
+ """
+ @param prop: A string specifying the property of the object that will be updated with the action frame number.
+ @type prop: string
+ """
+ def getFrameProperty():
+ """
+ Returns the name of the property that is set to the current frame number.
+
+ @rtype: string
+ """
More information about the Bf-blender-cvs
mailing list