[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [19416] trunk/blender/source: Added attributes for Ipo Actuator settings (replacing all methods)
Campbell Barton
ideasman42 at gmail.com
Thu Mar 26 02:42:02 CET 2009
Revision: 19416
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19416
Author: campbellbarton
Date: 2009-03-26 02:42:01 +0100 (Thu, 26 Mar 2009)
Log Message:
-----------
Added attributes for Ipo Actuator settings (replacing all methods)
Modified Paths:
--------------
trunk/blender/source/blender/render/intern/source/convertblender.c
trunk/blender/source/gameengine/Ketsji/KX_IpoActuator.cpp
trunk/blender/source/gameengine/Ketsji/KX_IpoActuator.h
trunk/blender/source/gameengine/Ketsji/KX_PythonInit.cpp
trunk/blender/source/gameengine/PyDoc/KX_IpoActuator.py
Modified: trunk/blender/source/blender/render/intern/source/convertblender.c
===================================================================
--- trunk/blender/source/blender/render/intern/source/convertblender.c 2009-03-25 23:09:17 UTC (rev 19415)
+++ trunk/blender/source/blender/render/intern/source/convertblender.c 2009-03-26 01:42:01 UTC (rev 19416)
@@ -1988,12 +1988,12 @@
part->bb_align,part->draw&PART_DRAW_BB_LOCK,
a,totpart+totchild,part->bb_uv_split,part->bb_anim,part->bb_split_offset,random,pa_time,part->bb_offset,uv);
}
- else if(strandbuf) {
+ else if(strandbuf) { if(svert) {
VECCOPY(svert->co, loc);
svert->strandco= -1.0f + 2.0f*time;
svert++;
strand->totvert++;
- }
+ } }
else{
if(k==1){
VECSUB(loc0,loc1,loc);
Modified: trunk/blender/source/gameengine/Ketsji/KX_IpoActuator.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_IpoActuator.cpp 2009-03-25 23:09:17 UTC (rev 19415)
+++ trunk/blender/source/gameengine/Ketsji/KX_IpoActuator.cpp 2009-03-26 01:42:01 UTC (rev 19416)
@@ -84,7 +84,7 @@
m_ipo_as_force(ipo_as_force),
m_ipo_add(ipo_add),
m_ipo_local(ipo_local),
- m_type((IpoActType)acttype)
+ m_type(acttype)
{
m_starttime = -2.0*fabs(m_endframe - m_startframe) - 1.0;
m_bIpoPlaying = false;
@@ -190,7 +190,7 @@
}
}
- switch (m_type)
+ switch ((IpoActType)m_type)
{
case KX_ACT_IPO_PLAY:
@@ -383,7 +383,7 @@
return result;
}
-KX_IpoActuator::IpoActType KX_IpoActuator::string2mode(char* modename) {
+int KX_IpoActuator::string2mode(char* modename) {
IpoActType res = KX_ACT_IPO_NODEF;
if (modename == S_KX_ACT_IPO_PLAY_STRING) {
@@ -441,6 +441,8 @@
PyMethodDef KX_IpoActuator::Methods[] = {
{"set", (PyCFunction) KX_IpoActuator::sPySet, METH_VARARGS, (PY_METHODCHAR)Set_doc},
+
+ // deprecated
{"setProperty", (PyCFunction) KX_IpoActuator::sPySetProperty, METH_VARARGS, (PY_METHODCHAR)SetProperty_doc},
{"setStart", (PyCFunction) KX_IpoActuator::sPySetStart, METH_VARARGS, (PY_METHODCHAR)SetStart_doc},
{"getStart", (PyCFunction) KX_IpoActuator::sPyGetStart, METH_NOARGS, (PY_METHODCHAR)GetStart_doc},
@@ -450,23 +452,48 @@
{"getIpoAsForce", (PyCFunction) KX_IpoActuator::sPyGetIpoAsForce, METH_NOARGS, (PY_METHODCHAR)GetIpoAsForce_doc},
{"setIpoAdd", (PyCFunction) KX_IpoActuator::sPySetIpoAdd, METH_VARARGS, (PY_METHODCHAR)SetIpoAdd_doc},
{"getIpoAdd", (PyCFunction) KX_IpoActuator::sPyGetIpoAdd, METH_NOARGS, (PY_METHODCHAR)GetIpoAdd_doc},
+ {"setForceIpoActsLocal", (PyCFunction) KX_IpoActuator::sPySetForceIpoActsLocal, METH_VARARGS, (PY_METHODCHAR)SetForceIpoActsLocal_doc},
+ {"getForceIpoActsLocal", (PyCFunction) KX_IpoActuator::sPyGetForceIpoActsLocal, METH_NOARGS, (PY_METHODCHAR)GetForceIpoActsLocal_doc},
{"setType", (PyCFunction) KX_IpoActuator::sPySetType, METH_VARARGS, (PY_METHODCHAR)SetType_doc},
{"getType", (PyCFunction) KX_IpoActuator::sPyGetType, METH_NOARGS, (PY_METHODCHAR)GetType_doc},
- {"setForceIpoActsLocal", (PyCFunction) KX_IpoActuator::sPySetForceIpoActsLocal, METH_VARARGS, (PY_METHODCHAR)SetForceIpoActsLocal_doc},
- {"getForceIpoActsLocal", (PyCFunction) KX_IpoActuator::sPyGetForceIpoActsLocal, METH_NOARGS, (PY_METHODCHAR)GetForceIpoActsLocal_doc},
{NULL,NULL} //Sentinel
};
PyAttributeDef KX_IpoActuator::Attributes[] = {
+ KX_PYATTRIBUTE_FLOAT_RW("startFrame", 0, 300000, KX_IpoActuator, m_startframe),
+ KX_PYATTRIBUTE_FLOAT_RW("endFrame", 0, 300000, KX_IpoActuator, m_endframe),
+ KX_PYATTRIBUTE_STRING_RW("propName", 0, 64, false, KX_IpoActuator, m_propname),
+ KX_PYATTRIBUTE_STRING_RW("framePropName", 0, 64, false, KX_IpoActuator, m_framepropname),
+ KX_PYATTRIBUTE_INT_RW("type", KX_ACT_IPO_NODEF+1, KX_ACT_IPO_MAX-1, true, KX_IpoActuator, m_type),
+ KX_PYATTRIBUTE_BOOL_RW("useIpoAsForce", KX_IpoActuator, m_ipo_as_force),
+ KX_PYATTRIBUTE_BOOL_RW("useIpoAdd", KX_IpoActuator, m_ipo_add),
+ KX_PYATTRIBUTE_BOOL_RW("useIpoLocal", KX_IpoActuator, m_ipo_local),
+ KX_PYATTRIBUTE_BOOL_RW("useChildren", KX_IpoActuator, m_recurse),
+
{ NULL } //Sentinel
};
PyObject* KX_IpoActuator::_getattr(const char *attr) {
+ PyObject* object = _getattr_self(Attributes, this, attr);
+ if (object != NULL)
+ return object;
+
+ if (!strcmp(attr, "__dict__")) { /* python 3.0 uses .__dir__()*/
+ return _getattr_dict(SCA_IActuator::_getattr(attr), Methods, Attributes);
+ }
+
_getattr_up(SCA_IActuator);
}
+int KX_IpoActuator::_setattr(const char *attr, PyObject *value) // _setattr method
+{
+ int ret = _setattr_self(Attributes, this, attr, value);
+ if (ret >= 0)
+ return ret;
+
+ return SCA_IActuator::_setattr(attr, value);
+}
-
/* set --------------------------------------------------------------------- */
const char KX_IpoActuator::Set_doc[] =
"set(type, startframe, endframe, mode?)\n"
@@ -478,12 +505,15 @@
PyObject* KX_IpoActuator::PySet(PyObject* self,
PyObject* args,
PyObject* kwds) {
+
+ ShowDeprecationWarning("set()", "a number properties");
+
/* sets modes PLAY, PINGPONG, FLIPPER, LOOPSTOP, LOOPEND */
/* arg 1 = mode string, arg 2 = startframe, arg3 = stopframe, */
/* arg4 = force toggle */
char* mode;
int forceToggle;
- IpoActType modenum;
+ int modenum;
int startFrame, stopFrame;
if(!PyArg_ParseTuple(args, "siii", &mode, &startFrame,
&stopFrame, &forceToggle)) {
@@ -518,6 +548,9 @@
PyObject* KX_IpoActuator::PySetProperty(PyObject* self,
PyObject* args,
PyObject* kwds) {
+
+ ShowDeprecationWarning("setProperty()", "the propName property");
+
/* mode is implicit here, but not supported yet... */
/* args: property */
char *propertyName;
@@ -538,6 +571,9 @@
PyObject* KX_IpoActuator::PySetStart(PyObject* self,
PyObject* args,
PyObject* kwds) {
+
+ ShowDeprecationWarning("setStart()", "the startFrame property");
+
float startArg;
if(!PyArg_ParseTuple(args, "f", &startArg)) {
return NULL;
@@ -552,6 +588,7 @@
"getStart()\n"
"\tReturns the frame from which the ipo starts playing.\n";
PyObject* KX_IpoActuator::PyGetStart(PyObject* self) {
+ ShowDeprecationWarning("getStart()", "the startFrame property");
return PyFloat_FromDouble(m_startframe);
}
@@ -563,6 +600,7 @@
PyObject* KX_IpoActuator::PySetEnd(PyObject* self,
PyObject* args,
PyObject* kwds) {
+ ShowDeprecationWarning("setEnd()", "the endFrame property");
float endArg;
if(!PyArg_ParseTuple(args, "f", &endArg)) {
return NULL;
@@ -577,6 +615,7 @@
"getEnd()\n"
"\tReturns the frame at which the ipo stops playing.\n";
PyObject* KX_IpoActuator::PyGetEnd(PyObject* self) {
+ ShowDeprecationWarning("getEnd()", "the endFrame property");
return PyFloat_FromDouble(m_endframe);
}
@@ -588,6 +627,7 @@
PyObject* KX_IpoActuator::PySetIpoAsForce(PyObject* self,
PyObject* args,
PyObject* kwds) {
+ ShowDeprecationWarning("setIpoAsForce()", "the useIpoAsForce property");
int boolArg;
if (!PyArg_ParseTuple(args, "i", &boolArg)) {
@@ -605,6 +645,7 @@
"getIpoAsForce()\n"
"\tReturns whether to interpret the ipo as a force rather than a displacement.\n";
PyObject* KX_IpoActuator::PyGetIpoAsForce(PyObject* self) {
+ ShowDeprecationWarning("getIpoAsForce()", "the useIpoAsForce property");
return BoolToPyArg(m_ipo_as_force);
}
@@ -616,6 +657,7 @@
PyObject* KX_IpoActuator::PySetIpoAdd(PyObject* self,
PyObject* args,
PyObject* kwds) {
+ ShowDeprecationWarning("setIpoAdd()", "the useIpoAdd property");
int boolArg;
if (!PyArg_ParseTuple(args, "i", &boolArg)) {
@@ -633,6 +675,7 @@
"getIpoAsAdd()\n"
"\tReturns whether to interpret the ipo as additive rather than absolute.\n";
PyObject* KX_IpoActuator::PyGetIpoAdd(PyObject* self) {
+ ShowDeprecationWarning("getIpoAdd()", "the useIpoAdd property");
return BoolToPyArg(m_ipo_add);
}
@@ -644,6 +687,7 @@
PyObject* KX_IpoActuator::PySetType(PyObject* self,
PyObject* args,
PyObject* kwds) {
+ ShowDeprecationWarning("setType()", "the type property");
int typeArg;
if (!PyArg_ParseTuple(args, "i", &typeArg)) {
@@ -651,8 +695,8 @@
}
if ( (typeArg > KX_ACT_IPO_NODEF)
- && (typeArg < KX_ACT_IPO_KEY2KEY) ) {
- m_type = (IpoActType) typeArg;
+ && (typeArg < KX_ACT_IPO_MAX) ) {
+ m_type = typeArg;
}
Py_RETURN_NONE;
@@ -662,6 +706,7 @@
"getType()\n"
"\tReturns the operation mode of the actuator.\n";
PyObject* KX_IpoActuator::PyGetType(PyObject* self) {
+ ShowDeprecationWarning("getType()", "the type property");
return PyInt_FromLong(m_type);
}
@@ -675,6 +720,7 @@
PyObject* KX_IpoActuator::PySetForceIpoActsLocal(PyObject* self,
PyObject* args,
PyObject* kwds) {
+ ShowDeprecationWarning("setForceIpoActsLocal()", "the useIpoLocal property");
int boolArg;
if (!PyArg_ParseTuple(args, "i", &boolArg)) {
@@ -691,6 +737,7 @@
"\tReturn whether to apply the force in the object's local\n"
"\tcoordinates rather than the world global coordinates.\n";
PyObject* KX_IpoActuator::PyGetForceIpoActsLocal(PyObject* self) {
+ ShowDeprecationWarning("getForceIpoActsLocal()", "the useIpoLocal property");
return BoolToPyArg(m_ipo_local);
}
Modified: trunk/blender/source/gameengine/Ketsji/KX_IpoActuator.h
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_IpoActuator.h 2009-03-25 23:09:17 UTC (rev 19415)
+++ trunk/blender/source/gameengine/Ketsji/KX_IpoActuator.h 2009-03-26 01:42:01 UTC (rev 19416)
@@ -108,9 +108,9 @@
static STR_String S_KX_ACT_IPO_KEY2KEY_STRING;
static STR_String S_KX_ACT_IPO_FROM_PROP_STRING;
- IpoActType string2mode(char* modename);
+ int string2mode(char* modename);
- IpoActType m_type;
+ int m_type;
KX_IpoActuator(SCA_IObject* gameobj,
const STR_String& propname,
@@ -142,6 +142,8 @@
/* --------------------------------------------------------------------- */
virtual PyObject* _getattr(const char *attr);
+ virtual int _setattr(const char *attr, PyObject *value);
+
//KX_PYMETHOD_DOC
KX_PYMETHOD_DOC(KX_IpoActuator,Set);
KX_PYMETHOD_DOC(KX_IpoActuator,SetProperty);
Modified: trunk/blender/source/gameengine/Ketsji/KX_PythonInit.cpp
===================================================================
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list