Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2004-07-27 01:44:55 +0400
committerTon Roosendaal <ton@blender.org>2004-07-27 01:44:55 +0400
commit73f1da749b5e721005dec2dec27134074f7e7679 (patch)
tree1e7e44c3ff5ab4b45ec49f9a6eeb6c293000aa72 /source/blender/python/api2_2x/Lamp.c
parent0437f23008e7b3932e4febff26abb81182811c86 (diff)
Nathan's huge ipo patch.
- now more than 31 channels possible for ipos - added lotsa new channels all over - Texture block has ipo now too - recoded getname_ei functions (Will ask nathan to give release log info when he's back!)
Diffstat (limited to 'source/blender/python/api2_2x/Lamp.c')
-rw-r--r--source/blender/python/api2_2x/Lamp.c78
1 files changed, 77 insertions, 1 deletions
diff --git a/source/blender/python/api2_2x/Lamp.c b/source/blender/python/api2_2x/Lamp.c
index 74f2718a5fa..1fd5164626b 100644
--- a/source/blender/python/api2_2x/Lamp.c
+++ b/source/blender/python/api2_2x/Lamp.c
@@ -24,7 +24,7 @@
*
* This is a new part of Blender.
*
- * Contributor(s): Willian P. Germano
+ * Contributor(s): Willian P. Germano, Nathan Letwory
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
@@ -167,6 +167,9 @@ static PyObject *Lamp_getHaloInt(BPy_Lamp *self);
static PyObject *Lamp_getQuad1(BPy_Lamp *self);
static PyObject *Lamp_getQuad2(BPy_Lamp *self);
static PyObject *Lamp_getCol(BPy_Lamp *self);
+static PyObject *Lamp_getIpo(BPy_Lamp *self);
+static PyObject *Lamp_clearIpo(BPy_Lamp *self);
+static PyObject *Lamp_setIpo(BPy_Lamp *self, PyObject *args);
static PyObject *Lamp_setName(BPy_Lamp *self, PyObject *args);
static PyObject *Lamp_setType(BPy_Lamp *self, PyObject *args);
static PyObject *Lamp_setIntType(BPy_Lamp *self, PyObject *args);
@@ -1370,3 +1373,76 @@ static PyObject *Lamp_repr (BPy_Lamp *self)
{
return PyString_FromFormat("[Lamp \"%s\"]", self->lamp->id.name+2);
}
+
+static PyObject *
+Lamp_getIpo (BPy_Lamp * self)
+{
+ struct Ipo *ipo = self->lamp->ipo;
+
+ if (!ipo)
+ {
+ Py_INCREF (Py_None);
+ return Py_None;
+ }
+
+ return Ipo_CreatePyObject (ipo);
+}
+
+extern PyTypeObject Ipo_Type;
+
+static PyObject *
+Lamp_setIpo (BPy_Lamp * self, PyObject * args)
+{
+ PyObject *pyipo = 0;
+ Ipo *ipo = NULL;
+ Ipo *oldipo;
+
+ if (!PyArg_ParseTuple (args, "O!", &Ipo_Type, &pyipo))
+ return EXPP_ReturnPyObjError (PyExc_TypeError,
+ "expected Ipo as argument");
+
+ ipo = Ipo_FromPyObject (pyipo);
+
+ if (!ipo)
+ return EXPP_ReturnPyObjError (PyExc_RuntimeError, "null ipo!");
+
+ if (ipo->blocktype != ID_TE)
+ return EXPP_ReturnPyObjError (PyExc_TypeError,
+ "this ipo is not a lamp data ipo");
+
+ oldipo = self->lamp->ipo;
+ if (oldipo)
+ {
+ ID *id = &oldipo->id;
+ if (id->us > 0)
+ id->us--;
+ }
+
+ ((ID *) & ipo->id)->us++;
+
+ self->lamp->ipo = ipo;
+
+ Py_INCREF (Py_None);
+ return Py_None;
+}
+
+static PyObject *
+Lamp_clearIpo (BPy_Lamp * self)
+{
+ Lamp *lamp = self->lamp;
+ Ipo *ipo = (Ipo *) lamp->ipo;
+
+ if (ipo)
+ {
+ ID *id = &ipo->id;
+ if (id->us > 0)
+ id->us--;
+ lamp->ipo = NULL;
+
+ Py_INCREF (Py_True);
+ return Py_True;
+ }
+
+ Py_INCREF (Py_False); /* no ipo found */
+ return Py_False;
+}