[Bf-committers] Python - Object.getTimeOffset, Object.setTimeOffset
Anders Nilsson
bf-committers@blender.org
02 Apr 2004 19:49:52 +0200
--=-vaixMAG9QaOKa7KsXAU1
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
One patch adding timeOffset from the animation settings into the python
api.
Anders Nilsson (breakin)
--=-vaixMAG9QaOKa7KsXAU1
Content-Disposition: attachment; filename=patch.txt
Content-Type: text/x-patch; name=patch.txt; charset=UTF-8
Content-Transfer-Encoding: 7bit
Index: source/blender/python/api2_2x/Object.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/python/api2_2x/Object.c,v
retrieving revision 1.63
diff -u -r1.63 Object.c
--- source/blender/python/api2_2x/Object.c 11 Mar 2004 12:23:53 -0000 1.63
+++ source/blender/python/api2_2x/Object.c 2 Apr 2004 17:50:25 -0000
@@ -102,6 +102,7 @@
static PyObject *Object_getName (BPy_Object *self);
static PyObject *Object_getParent (BPy_Object *self);
static PyObject *Object_getSize (BPy_Object *self, PyObject *args);
+static PyObject *Object_getTimeOffset (BPy_Object *self);
static PyObject *Object_getTracked (BPy_Object *self);
static PyObject *Object_getType (BPy_Object *self);
static PyObject *Object_getBoundBox (BPy_Object *self);
@@ -119,6 +120,7 @@
static PyObject *Object_setMaterials (BPy_Object *self, PyObject *args);
static PyObject *Object_setName (BPy_Object *self, PyObject *args);
static PyObject *Object_setSize (BPy_Object *self, PyObject *args);
+static PyObject *Object_setTimeOffset (BPy_Object *self, PyObject *args);
static PyObject *Object_shareFrom (BPy_Object *self, PyObject *args);
/*****************************************************************************/
@@ -159,6 +161,8 @@
"Returns the object's parent object"},
{"getSize", (PyCFunction)Object_getSize, METH_VARARGS,
"Returns the object's size (x, y, z)"},
+ {"getTimeOffset", (PyCFunction)Object_getTimeOffset, METH_NOARGS,
+ "Returns the object's time offset"},
{"getTracked", (PyCFunction)Object_getTracked, METH_NOARGS,
"Returns the object's tracked object"},
{"getType", (PyCFunction)Object_getType, METH_NOARGS,
@@ -208,6 +212,8 @@
{"setSize", (PyCFunction)Object_setSize, METH_VARARGS,
"Set the object's size. The first argument must be a vector\n\
triple."},
+ {"setTimeOffset", (PyCFunction)Object_setTimeOffset, METH_VARARGS,
+ "Set the object's time offset."},
{"shareFrom", (PyCFunction)Object_shareFrom, METH_VARARGS,
"Link data of self with object specified in the argument. This\n\
works only if self and the object specified are of the same type."},
@@ -843,6 +849,17 @@
"couldn't get Object.size attributes"));
}
+static PyObject *Object_getTimeOffset (BPy_Object *self)
+{
+ PyObject *attr = Py_BuildValue ("f", self->object->sf);
+
+ if (attr) return (attr);
+
+ return (PythonReturnErrorObject (PyExc_RuntimeError,
+ "couldn't get Object.sf attributes"));
+}
+
+
static PyObject *Object_getTracked (BPy_Object *self)
{
PyObject *attr;
@@ -1389,6 +1406,23 @@
Py_INCREF (Py_None);
return (Py_None);
}
+
+static PyObject *Object_setTimeOffset (BPy_Object *self, PyObject *args)
+{
+ float newTimeOffset;
+
+ if (!PyArg_ParseTuple (args, "f", &newTimeOffset))
+ {
+ return (PythonReturnErrorObject (PyExc_AttributeError,
+ "expected a float as argument"));
+ }
+
+ object->sf=newTimeOffset;
+
+ Py_INCREF (Py_None);
+ return (Py_None);
+}
+
static PyObject *Object_shareFrom (BPy_Object *self, PyObject *args)
{
--=-vaixMAG9QaOKa7KsXAU1--