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:
authorStephen Swaney <sswaney@centurytel.net>2004-09-26 00:30:40 +0400
committerStephen Swaney <sswaney@centurytel.net>2004-09-26 00:30:40 +0400
commita509b8adc9b8952cdb395c69406e821f57a9a6c7 (patch)
tree7c0e3c7b81007acc6b3e268e59a6af5fcb4bd93f /source/blender/python/api2_2x/Lamp.c
parentbd371ddb9ff947d4e598ad04af9402d89fa80d5e (diff)
Another round in the Great BPy Cleanup:
Run everything thru indent to cleanup spaces vs tabs. Clean up some of the comments by hand. BGL.c was not touched due to all that macro wackyness. There are no functional changes to the code. Pre-indent versions of source are tagged with tag bpy-cleanup-20040925 , just in case.
Diffstat (limited to 'source/blender/python/api2_2x/Lamp.c')
-rw-r--r--source/blender/python/api2_2x/Lamp.c1847
1 files changed, 949 insertions, 898 deletions
diff --git a/source/blender/python/api2_2x/Lamp.c b/source/blender/python/api2_2x/Lamp.c
index 7f48ce53960..dc4e6f17159 100644
--- a/source/blender/python/api2_2x/Lamp.c
+++ b/source/blender/python/api2_2x/Lamp.c
@@ -43,7 +43,7 @@
#include "rgbTuple.h"
#include "gen_utils.h"
#include "modules.h"
-#include "bpy_types.h" /* for the BPy_Lamp declaration */
+#include "bpy_types.h" /* for the BPy_Lamp declaration */
/*****************************************************************************/
/* Python BPy_Lamp defaults: */
@@ -107,16 +107,16 @@
/*****************************************************************************/
/* Python API function prototypes for the Lamp module. */
/*****************************************************************************/
-static PyObject *M_Lamp_New (PyObject *self, PyObject *args, PyObject *keywords);
-static PyObject *M_Lamp_Get (PyObject *self, PyObject *args);
+static PyObject *M_Lamp_New( PyObject * self, PyObject * args,
+ PyObject * keywords );
+static PyObject *M_Lamp_Get( PyObject * self, PyObject * args );
/*****************************************************************************/
/* The following string definitions are used for documentation strings. */
/* In Python these will be written to the console when doing a */
/* Blender.Lamp.__doc__ */
/*****************************************************************************/
-static char M_Lamp_doc[] =
-"The Blender Lamp module\n\n\
+static char M_Lamp_doc[] = "The Blender Lamp module\n\n\
This module provides control over **Lamp Data** objects in Blender.\n\n\
Example::\n\n\
from Blender import Lamp\n\
@@ -125,12 +125,10 @@ Example::\n\n\
ob = Object.New('Lamp') # create new lamp object\n\
ob.link(l) # link lamp obj with lamp data\n";
-static char M_Lamp_New_doc[] =
-"Lamp.New (type = 'Lamp', name = 'LampData'):\n\
+static char M_Lamp_New_doc[] = "Lamp.New (type = 'Lamp', name = 'LampData'):\n\
Return a new Lamp Data object with the given type and name.";
-static char M_Lamp_Get_doc[] =
-"Lamp.Get (name = None):\n\
+static char M_Lamp_Get_doc[] = "Lamp.Get (name = None):\n\
Return the Lamp Data with the given name, None if not found, or\n\
Return a list with all Lamp Data objects in the current scene,\n\
if no argument was given.";
@@ -139,249 +137,250 @@ static char M_Lamp_Get_doc[] =
/* Python method structure definition for Blender.Lamp module: */
/*****************************************************************************/
struct PyMethodDef M_Lamp_methods[] = {
- {"New",(PyCFunction)M_Lamp_New, METH_VARARGS|METH_KEYWORDS,
- M_Lamp_New_doc},
- {"Get", M_Lamp_Get, METH_VARARGS, M_Lamp_Get_doc},
- {"get", M_Lamp_Get, METH_VARARGS, M_Lamp_Get_doc},
- {NULL, NULL, 0, NULL}
+ {"New", ( PyCFunction ) M_Lamp_New, METH_VARARGS | METH_KEYWORDS,
+ M_Lamp_New_doc},
+ {"Get", M_Lamp_Get, METH_VARARGS, M_Lamp_Get_doc},
+ {"get", M_Lamp_Get, METH_VARARGS, M_Lamp_Get_doc},
+ {NULL, NULL, 0, NULL}
};
/*****************************************************************************/
/* Python BPy_Lamp methods declarations: */
/*****************************************************************************/
-static PyObject *Lamp_getName(BPy_Lamp *self);
-static PyObject *Lamp_getType(BPy_Lamp *self);
-static PyObject *Lamp_getMode(BPy_Lamp *self);
-static PyObject *Lamp_getSamples(BPy_Lamp *self);
-static PyObject *Lamp_getBufferSize(BPy_Lamp *self);
-static PyObject *Lamp_getHaloStep(BPy_Lamp *self);
-static PyObject *Lamp_getEnergy(BPy_Lamp *self);
-static PyObject *Lamp_getDist(BPy_Lamp *self);
-static PyObject *Lamp_getSpotSize(BPy_Lamp *self);
-static PyObject *Lamp_getSpotBlend(BPy_Lamp *self);
-static PyObject *Lamp_getClipStart(BPy_Lamp *self);
-static PyObject *Lamp_getClipEnd(BPy_Lamp *self);
-static PyObject *Lamp_getBias(BPy_Lamp *self);
-static PyObject *Lamp_getSoftness(BPy_Lamp *self);
-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);
-static PyObject *Lamp_setMode(BPy_Lamp *self, PyObject *args);
-static PyObject *Lamp_setIntMode(BPy_Lamp *self, PyObject *args);
-static PyObject *Lamp_setSamples(BPy_Lamp *self, PyObject *args);
-static PyObject *Lamp_setBufferSize(BPy_Lamp *self, PyObject *args);
-static PyObject *Lamp_setHaloStep(BPy_Lamp *self, PyObject *args);
-static PyObject *Lamp_setEnergy(BPy_Lamp *self, PyObject *args);
-static PyObject *Lamp_setDist(BPy_Lamp *self, PyObject *args);
-static PyObject *Lamp_setSpotSize(BPy_Lamp *self, PyObject *args);
-static PyObject *Lamp_setSpotBlend(BPy_Lamp *self, PyObject *args);
-static PyObject *Lamp_setClipStart(BPy_Lamp *self, PyObject *args);
-static PyObject *Lamp_setClipEnd(BPy_Lamp *self, PyObject *args);
-static PyObject *Lamp_setBias(BPy_Lamp *self, PyObject *args);
-static PyObject *Lamp_setSoftness(BPy_Lamp *self, PyObject *args);
-static PyObject *Lamp_setHaloInt(BPy_Lamp *self, PyObject *args);
-static PyObject *Lamp_setQuad1(BPy_Lamp *self, PyObject *args);
-static PyObject *Lamp_setQuad2(BPy_Lamp *self, PyObject *args);
-static PyObject *Lamp_setCol(BPy_Lamp *self, PyObject *args);
-static PyObject *Lamp_setColorComponent(BPy_Lamp *self, char *key,
- PyObject *args);
-static PyObject *Lamp_getScriptLinks(BPy_Lamp *self, PyObject *args);
-static PyObject *Lamp_addScriptLink(BPy_Lamp *self, PyObject *args);
-static PyObject *Lamp_clearScriptLinks(BPy_Lamp *self);
+static PyObject *Lamp_getName( BPy_Lamp * self );
+static PyObject *Lamp_getType( BPy_Lamp * self );
+static PyObject *Lamp_getMode( BPy_Lamp * self );
+static PyObject *Lamp_getSamples( BPy_Lamp * self );
+static PyObject *Lamp_getBufferSize( BPy_Lamp * self );
+static PyObject *Lamp_getHaloStep( BPy_Lamp * self );
+static PyObject *Lamp_getEnergy( BPy_Lamp * self );
+static PyObject *Lamp_getDist( BPy_Lamp * self );
+static PyObject *Lamp_getSpotSize( BPy_Lamp * self );
+static PyObject *Lamp_getSpotBlend( BPy_Lamp * self );
+static PyObject *Lamp_getClipStart( BPy_Lamp * self );
+static PyObject *Lamp_getClipEnd( BPy_Lamp * self );
+static PyObject *Lamp_getBias( BPy_Lamp * self );
+static PyObject *Lamp_getSoftness( BPy_Lamp * self );
+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 );
+static PyObject *Lamp_setMode( BPy_Lamp * self, PyObject * args );
+static PyObject *Lamp_setIntMode( BPy_Lamp * self, PyObject * args );
+static PyObject *Lamp_setSamples( BPy_Lamp * self, PyObject * args );
+static PyObject *Lamp_setBufferSize( BPy_Lamp * self, PyObject * args );
+static PyObject *Lamp_setHaloStep( BPy_Lamp * self, PyObject * args );
+static PyObject *Lamp_setEnergy( BPy_Lamp * self, PyObject * args );
+static PyObject *Lamp_setDist( BPy_Lamp * self, PyObject * args );
+static PyObject *Lamp_setSpotSize( BPy_Lamp * self, PyObject * args );
+static PyObject *Lamp_setSpotBlend( BPy_Lamp * self, PyObject * args );
+static PyObject *Lamp_setClipStart( BPy_Lamp * self, PyObject * args );
+static PyObject *Lamp_setClipEnd( BPy_Lamp * self, PyObject * args );
+static PyObject *Lamp_setBias( BPy_Lamp * self, PyObject * args );
+static PyObject *Lamp_setSoftness( BPy_Lamp * self, PyObject * args );
+static PyObject *Lamp_setHaloInt( BPy_Lamp * self, PyObject * args );
+static PyObject *Lamp_setQuad1( BPy_Lamp * self, PyObject * args );
+static PyObject *Lamp_setQuad2( BPy_Lamp * self, PyObject * args );
+static PyObject *Lamp_setCol( BPy_Lamp * self, PyObject * args );
+static PyObject *Lamp_setColorComponent( BPy_Lamp * self, char *key,
+ PyObject * args );
+static PyObject *Lamp_getScriptLinks( BPy_Lamp * self, PyObject * args );
+static PyObject *Lamp_addScriptLink( BPy_Lamp * self, PyObject * args );
+static PyObject *Lamp_clearScriptLinks( BPy_Lamp * self );
/*****************************************************************************/
/* Python BPy_Lamp methods table: */
/*****************************************************************************/
static PyMethodDef BPy_Lamp_methods[] = {
- /* name, method, flags, doc */
- {"getName", (PyCFunction)Lamp_getName, METH_NOARGS,
- "() - return Lamp name"},
- {"getType", (PyCFunction)Lamp_getType, METH_NOARGS,
- "() - return Lamp type - 'Lamp':0, 'Sun':1, 'Spot':2, 'Hemi':3"},
- {"getMode", (PyCFunction)Lamp_getMode, METH_NOARGS,
- "() - return Lamp mode flags (or'ed value)"},
- {"getSamples", (PyCFunction)Lamp_getSamples, METH_NOARGS,
- "() - return Lamp samples value"},
- {"getBufferSize", (PyCFunction)Lamp_getBufferSize, METH_NOARGS,
- "() - return Lamp buffer size value"},
- {"getHaloStep", (PyCFunction)Lamp_getHaloStep, METH_NOARGS,
- "() - return Lamp halo step value"},
- {"getEnergy", (PyCFunction)Lamp_getEnergy, METH_NOARGS,
- "() - return Lamp energy value"},
- {"getDist", (PyCFunction)Lamp_getDist, METH_NOARGS,
- "() - return Lamp clipping distance value"},
- {"getSpotSize", (PyCFunction)Lamp_getSpotSize, METH_NOARGS,
- "() - return Lamp spot size value"},
- {"getSpotBlend", (PyCFunction)Lamp_getSpotBlend, METH_NOARGS,
- "() - return Lamp spot blend value"},
- {"getClipStart", (PyCFunction)Lamp_getClipStart, METH_NOARGS,
- "() - return Lamp clip start value"},
- {"getClipEnd", (PyCFunction)Lamp_getClipEnd, METH_NOARGS,
- "() - return Lamp clip end value"},
- {"getBias", (PyCFunction)Lamp_getBias, METH_NOARGS,
- "() - return Lamp bias value"},
- {"getSoftness", (PyCFunction)Lamp_getSoftness, METH_NOARGS,
- "() - return Lamp softness value"},
- {"getHaloInt", (PyCFunction)Lamp_getHaloInt, METH_NOARGS,
- "() - return Lamp halo intensity value"},
- {"getQuad1", (PyCFunction)Lamp_getQuad1, METH_NOARGS,
- "() - return light intensity value #1 for a Quad Lamp"},
- {"getQuad2", (PyCFunction)Lamp_getQuad2, METH_NOARGS,
- "() - return light intensity value #2 for a Quad Lamp"},
- {"getCol", (PyCFunction)Lamp_getCol, METH_NOARGS,
- "() - return light rgb color triplet"},
- {"setName", (PyCFunction)Lamp_setName, METH_VARARGS,
- "(str) - rename Lamp"},
- {"setType", (PyCFunction)Lamp_setType, METH_VARARGS,
- "(str) - change Lamp type, which can be 'persp' or 'ortho'"},
- {"setMode", (PyCFunction)Lamp_setMode, METH_VARARGS,
- "([up to eight str's]) - Set Lamp mode flag(s)"},
- {"setSamples", (PyCFunction)Lamp_setSamples, METH_VARARGS,
- "(int) - change Lamp samples value"},
- {"setBufferSize", (PyCFunction)Lamp_setBufferSize, METH_VARARGS,
- "(int) - change Lamp buffer size value"},
- {"setHaloStep", (PyCFunction)Lamp_setHaloStep, METH_VARARGS,
- "(int) - change Lamp halo step value"},
- {"setEnergy", (PyCFunction)Lamp_setEnergy, METH_VARARGS,
- "(float) - change Lamp energy value"},
- {"setDist", (PyCFunction)Lamp_setDist, METH_VARARGS,
- "(float) - change Lamp clipping distance value"},
- {"setSpotSize", (PyCFunction)Lamp_setSpotSize, METH_VARARGS,
- "(float) - change Lamp spot size value"},
- {"setSpotBlend", (PyCFunction)Lamp_setSpotBlend, METH_VARARGS,
- "(float) - change Lamp spot blend value"},
- {"setClipStart", (PyCFunction)Lamp_setClipStart, METH_VARARGS,
- "(float) - change Lamp clip start value"},
- {"setClipEnd", (PyCFunction)Lamp_setClipEnd, METH_VARARGS,
- "(float) - change Lamp clip end value"},
- {"setBias", (PyCFunction)Lamp_setBias, METH_VARARGS,
- "(float) - change Lamp draw size value"},
- {"setSoftness", (PyCFunction)Lamp_setSoftness, METH_VARARGS,
- "(float) - change Lamp softness value"},
- {"setHaloInt", (PyCFunction)Lamp_setHaloInt, METH_VARARGS,
- "(float) - change Lamp halo intensity value"},
- {"setQuad1", (PyCFunction)Lamp_setQuad1, METH_VARARGS,
- "(float) - change light intensity value #1 for a Quad Lamp"},
- {"setQuad2", (PyCFunction)Lamp_setQuad2, METH_VARARGS,
- "(float) - change light intensity value #2 for a Quad Lamp"},
- {"setCol", (PyCFunction)Lamp_setCol, METH_VARARGS,
- "(f,f,f) or ([f,f,f]) - change light's rgb color triplet"},
- {"getScriptLinks", (PyCFunction)Lamp_getScriptLinks, METH_VARARGS,
- "(eventname) - Get a list of this lamp's scriptlinks (Text names) "
- "of the given type\n"
- "(eventname) - string: FrameChanged or Redraw."},
- {"addScriptLink", (PyCFunction)Lamp_addScriptLink, METH_VARARGS,
- "(text, evt) - Add a new lamp scriptlink.\n"
- "(text) - string: an existing Blender Text name;\n"
- "(evt) string: FrameChanged or Redraw."},
- {"clearScriptLinks", (PyCFunction)Lamp_clearScriptLinks, METH_NOARGS,
- "() - Delete all scriptlinks from this lamp."},
- {"getIpo", (PyCFunction)Lamp_getIpo, METH_NOARGS,
- "() - get IPO for this lamp"},
- {"clearIpo", (PyCFunction)Lamp_clearIpo, METH_NOARGS,
- "() - unlink the IPO for this lamp"},
- {"setIpo", (PyCFunction)Lamp_setIpo, METH_VARARGS,
- "( lamp-ipo ) - link an IPO to this lamp"},
- {NULL, NULL, 0, NULL}
+ /* name, method, flags, doc */
+ {"getName", ( PyCFunction ) Lamp_getName, METH_NOARGS,
+ "() - return Lamp name"},
+ {"getType", ( PyCFunction ) Lamp_getType, METH_NOARGS,
+ "() - return Lamp type - 'Lamp':0, 'Sun':1, 'Spot':2, 'Hemi':3"},
+ {"getMode", ( PyCFunction ) Lamp_getMode, METH_NOARGS,
+ "() - return Lamp mode flags (or'ed value)"},
+ {"getSamples", ( PyCFunction ) Lamp_getSamples, METH_NOARGS,
+ "() - return Lamp samples value"},
+ {"getBufferSize", ( PyCFunction ) Lamp_getBufferSize, METH_NOARGS,
+ "() - return Lamp buffer size value"},
+ {"getHaloStep", ( PyCFunction ) Lamp_getHaloStep, METH_NOARGS,
+ "() - return Lamp halo step value"},
+ {"getEnergy", ( PyCFunction ) Lamp_getEnergy, METH_NOARGS,
+ "() - return Lamp energy value"},
+ {"getDist", ( PyCFunction ) Lamp_getDist, METH_NOARGS,
+ "() - return Lamp clipping distance value"},
+ {"getSpotSize", ( PyCFunction ) Lamp_getSpotSize, METH_NOARGS,
+ "() - return Lamp spot size value"},
+ {"getSpotBlend", ( PyCFunction ) Lamp_getSpotBlend, METH_NOARGS,
+ "() - return Lamp spot blend value"},
+ {"getClipStart", ( PyCFunction ) Lamp_getClipStart, METH_NOARGS,
+ "() - return Lamp clip start value"},
+ {"getClipEnd", ( PyCFunction ) Lamp_getClipEnd, METH_NOARGS,
+ "() - return Lamp clip end value"},
+ {"getBias", ( PyCFunction ) Lamp_getBias, METH_NOARGS,
+ "() - return Lamp bias value"},
+ {"getSoftness", ( PyCFunction ) Lamp_getSoftness, METH_NOARGS,
+ "() - return Lamp softness value"},
+ {"getHaloInt", ( PyCFunction ) Lamp_getHaloInt, METH_NOARGS,
+ "() - return Lamp halo intensity value"},
+ {"getQuad1", ( PyCFunction ) Lamp_getQuad1, METH_NOARGS,
+ "() - return light intensity value #1 for a Quad Lamp"},
+ {"getQuad2", ( PyCFunction ) Lamp_getQuad2, METH_NOARGS,
+ "() - return light intensity value #2 for a Quad Lamp"},
+ {"getCol", ( PyCFunction ) Lamp_getCol, METH_NOARGS,
+ "() - return light rgb color triplet"},
+ {"setName", ( PyCFunction ) Lamp_setName, METH_VARARGS,
+ "(str) - rename Lamp"},
+ {"setType", ( PyCFunction ) Lamp_setType, METH_VARARGS,
+ "(str) - change Lamp type, which can be 'persp' or 'ortho'"},
+ {"setMode", ( PyCFunction ) Lamp_setMode, METH_VARARGS,
+ "([up to eight str's]) - Set Lamp mode flag(s)"},
+ {"setSamples", ( PyCFunction ) Lamp_setSamples, METH_VARARGS,
+ "(int) - change Lamp samples value"},
+ {"setBufferSize", ( PyCFunction ) Lamp_setBufferSize, METH_VARARGS,
+ "(int) - change Lamp buffer size value"},
+ {"setHaloStep", ( PyCFunction ) Lamp_setHaloStep, METH_VARARGS,
+ "(int) - change Lamp halo step value"},
+ {"setEnergy", ( PyCFunction ) Lamp_setEnergy, METH_VARARGS,
+ "(float) - change Lamp energy value"},
+ {"setDist", ( PyCFunction ) Lamp_setDist, METH_VARARGS,
+ "(float) - change Lamp clipping distance value"},
+ {"setSpotSize", ( PyCFunction ) Lamp_setSpotSize, METH_VARARGS,
+ "(float) - change Lamp spot size value"},
+ {"setSpotBlend", ( PyCFunction ) Lamp_setSpotBlend, METH_VARARGS,
+ "(float) - change Lamp spot blend value"},
+ {"setClipStart", ( PyCFunction ) Lamp_setClipStart, METH_VARARGS,
+ "(float) - change Lamp clip start value"},
+ {"setClipEnd", ( PyCFunction ) Lamp_setClipEnd, METH_VARARGS,
+ "(float) - change Lamp clip end value"},
+ {"setBias", ( PyCFunction ) Lamp_setBias, METH_VARARGS,
+ "(float) - change Lamp draw size value"},
+ {"setSoftness", ( PyCFunction ) Lamp_setSoftness, METH_VARARGS,
+ "(float) - change Lamp softness value"},
+ {"setHaloInt", ( PyCFunction ) Lamp_setHaloInt, METH_VARARGS,
+ "(float) - change Lamp halo intensity value"},
+ {"setQuad1", ( PyCFunction ) Lamp_setQuad1, METH_VARARGS,
+ "(float) - change light intensity value #1 for a Quad Lamp"},
+ {"setQuad2", ( PyCFunction ) Lamp_setQuad2, METH_VARARGS,
+ "(float) - change light intensity value #2 for a Quad Lamp"},
+ {"setCol", ( PyCFunction ) Lamp_setCol, METH_VARARGS,
+ "(f,f,f) or ([f,f,f]) - change light's rgb color triplet"},
+ {"getScriptLinks", ( PyCFunction ) Lamp_getScriptLinks, METH_VARARGS,
+ "(eventname) - Get a list of this lamp's scriptlinks (Text names) "
+ "of the given type\n"
+ "(eventname) - string: FrameChanged or Redraw."},
+ {"addScriptLink", ( PyCFunction ) Lamp_addScriptLink, METH_VARARGS,
+ "(text, evt) - Add a new lamp scriptlink.\n"
+ "(text) - string: an existing Blender Text name;\n"
+ "(evt) string: FrameChanged or Redraw."},
+ {"clearScriptLinks", ( PyCFunction ) Lamp_clearScriptLinks,
+ METH_NOARGS,
+ "() - Delete all scriptlinks from this lamp."},
+ {"getIpo", ( PyCFunction ) Lamp_getIpo, METH_NOARGS,
+ "() - get IPO for this lamp"},
+ {"clearIpo", ( PyCFunction ) Lamp_clearIpo, METH_NOARGS,
+ "() - unlink the IPO for this lamp"},
+ {"setIpo", ( PyCFunction ) Lamp_setIpo, METH_VARARGS,
+ "( lamp-ipo ) - link an IPO to this lamp"},
+ {NULL, NULL, 0, NULL}
};
/*****************************************************************************/
/* Python TypeLamp callback function prototypes: */
/*****************************************************************************/
-static void Lamp_dealloc (BPy_Lamp *lamp);
-static PyObject *Lamp_getAttr (BPy_Lamp *lamp, char *name);
-static int Lamp_setAttr (BPy_Lamp *lamp, char *name, PyObject *v);
-static int Lamp_compare (BPy_Lamp *a, BPy_Lamp *b);
-static PyObject *Lamp_repr (BPy_Lamp *lamp);
+static void Lamp_dealloc( BPy_Lamp * lamp );
+static PyObject *Lamp_getAttr( BPy_Lamp * lamp, char *name );
+static int Lamp_setAttr( BPy_Lamp * lamp, char *name, PyObject * v );
+static int Lamp_compare( BPy_Lamp * a, BPy_Lamp * b );
+static PyObject *Lamp_repr( BPy_Lamp * lamp );
/*****************************************************************************/
/* Python TypeLamp structure definition: */
/*****************************************************************************/
-PyTypeObject Lamp_Type =
-{
- PyObject_HEAD_INIT(NULL)
- 0, /* ob_size */
- "Blender Lamp", /* tp_name */
- sizeof (BPy_Lamp), /* tp_basicsize */
- 0, /* tp_itemsize */
- /* methods */
- (destructor)Lamp_dealloc, /* tp_dealloc */
- 0, /* tp_print */
- (getattrfunc)Lamp_getAttr, /* tp_getattr */
- (setattrfunc)Lamp_setAttr, /* tp_setattr */
- (cmpfunc)Lamp_compare, /* tp_compare */
- (reprfunc)Lamp_repr, /* tp_repr */
- 0, /* tp_as_number */
- 0, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- 0, /* tp_as_hash */
- 0,0,0,0,0,0,
- 0, /* tp_doc */
- 0,0,0,0,0,0,
- BPy_Lamp_methods, /* tp_methods */
- 0, /* tp_members */
+PyTypeObject Lamp_Type = {
+ PyObject_HEAD_INIT( NULL )
+ 0, /* ob_size */
+ "Blender Lamp", /* tp_name */
+ sizeof( BPy_Lamp ), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ /* methods */
+ ( destructor ) Lamp_dealloc, /* tp_dealloc */
+ 0, /* tp_print */
+ ( getattrfunc ) Lamp_getAttr, /* tp_getattr */
+ ( setattrfunc ) Lamp_setAttr, /* tp_setattr */
+ ( cmpfunc ) Lamp_compare, /* tp_compare */
+ ( reprfunc ) Lamp_repr, /* tp_repr */
+ 0, /* tp_as_number */
+ 0, /* tp_as_sequence */
+ 0, /* tp_as_mapping */
+ 0, /* tp_as_hash */
+ 0, 0, 0, 0, 0, 0,
+ 0, /* tp_doc */
+ 0, 0, 0, 0, 0, 0,
+ BPy_Lamp_methods, /* tp_methods */
+ 0, /* tp_members */
};
/*****************************************************************************/
/* Function: M_Lamp_New */
/* Python equivalent: Blender.Lamp.New */
/*****************************************************************************/
-static PyObject *M_Lamp_New(PyObject *self, PyObject *args, PyObject *keywords)
+static PyObject *M_Lamp_New( PyObject * self, PyObject * args,
+ PyObject * keywords )
{
- char *type_str = "Lamp";
- char *name_str = "LampData";
- static char *kwlist[] = {"type_str", "name_str", NULL};
- BPy_Lamp *py_lamp; /* for Lamp Data object wrapper in Python */
- Lamp *bl_lamp; /* for actual Lamp Data we create in Blender */
- char buf[21];
-
- if (!PyArg_ParseTupleAndKeywords(args, keywords, "|ss", kwlist,
- &type_str, &name_str))
- return (EXPP_ReturnPyObjError (PyExc_AttributeError,
- "expected string(s) or empty argument"));
-
- bl_lamp = add_lamp(); /* first create in Blender */
- if (bl_lamp) /* now create the wrapper obj in Python */
- py_lamp = (BPy_Lamp *)Lamp_CreatePyObject(bl_lamp);
- else
- return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
- "couldn't create Lamp Data in Blender"));
+ char *type_str = "Lamp";
+ char *name_str = "LampData";
+ static char *kwlist[] = { "type_str", "name_str", NULL };
+ BPy_Lamp *py_lamp; /* for Lamp Data object wrapper in Python */
+ Lamp *bl_lamp; /* for actual Lamp Data we create in Blender */
+ char buf[21];
+
+ if( !PyArg_ParseTupleAndKeywords( args, keywords, "|ss", kwlist,
+ &type_str, &name_str ) )
+ return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
+ "expected string(s) or empty argument" ) );
+
+ bl_lamp = add_lamp( ); /* first create in Blender */
+ if( bl_lamp ) /* now create the wrapper obj in Python */
+ py_lamp = ( BPy_Lamp * ) Lamp_CreatePyObject( bl_lamp );
+ else
+ return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
+ "couldn't create Lamp Data in Blender" ) );
/* let's return user count to zero, because ... */
- bl_lamp->id.us = 0; /* ... add_lamp() incref'ed it */
-
- if (py_lamp == NULL)
- return (EXPP_ReturnPyObjError (PyExc_MemoryError,
- "couldn't create Lamp Data object"));
-
- if (strcmp (type_str, "Lamp") == 0)
- bl_lamp->type = (short)EXPP_LAMP_TYPE_LAMP;
- else if (strcmp (type_str, "Sun") == 0)
- bl_lamp->type = (short)EXPP_LAMP_TYPE_SUN;
- else if (strcmp (type_str, "Spot") == 0)
- bl_lamp->type = (short)EXPP_LAMP_TYPE_SPOT;
- else if (strcmp (type_str, "Hemi") == 0)
- bl_lamp->type = (short)EXPP_LAMP_TYPE_HEMI;
- else
- return (EXPP_ReturnPyObjError (PyExc_AttributeError,
- "unknown lamp type"));
-
- if (strcmp(name_str, "LampData") == 0)
- return (PyObject *)py_lamp;
- else { /* user gave us a name for the lamp, use it */
- PyOS_snprintf(buf, sizeof(buf), "%s", name_str);
- rename_id(&bl_lamp->id, buf);
- }
-
- return (PyObject *)py_lamp;
+ bl_lamp->id.us = 0; /* ... add_lamp() incref'ed it */
+
+ if( py_lamp == NULL )
+ return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
+ "couldn't create Lamp Data object" ) );
+
+ if( strcmp( type_str, "Lamp" ) == 0 )
+ bl_lamp->type = ( short ) EXPP_LAMP_TYPE_LAMP;
+ else if( strcmp( type_str, "Sun" ) == 0 )
+ bl_lamp->type = ( short ) EXPP_LAMP_TYPE_SUN;
+ else if( strcmp( type_str, "Spot" ) == 0 )
+ bl_lamp->type = ( short ) EXPP_LAMP_TYPE_SPOT;
+ else if( strcmp( type_str, "Hemi" ) == 0 )
+ bl_lamp->type = ( short ) EXPP_LAMP_TYPE_HEMI;
+ else
+ return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
+ "unknown lamp type" ) );
+
+ if( strcmp( name_str, "LampData" ) == 0 )
+ return ( PyObject * ) py_lamp;
+ else { /* user gave us a name for the lamp, use it */
+ PyOS_snprintf( buf, sizeof( buf ), "%s", name_str );
+ rename_id( &bl_lamp->id, buf );
+ }
+
+ return ( PyObject * ) py_lamp;
}
/*****************************************************************************/
@@ -392,127 +391,145 @@ static PyObject *M_Lamp_New(PyObject *self, PyObject *args, PyObject *keywords)
/* passed in, a list of all lamp data names in the */
/* current scene is returned. */
/*****************************************************************************/
-static PyObject *M_Lamp_Get(PyObject *self, PyObject *args)
+static PyObject *M_Lamp_Get( PyObject * self, PyObject * args )
{
- char *name = NULL;
- Lamp *lamp_iter;
+ char *name = NULL;
+ Lamp *lamp_iter;
- if (!PyArg_ParseTuple(args, "|s", &name))
- return (EXPP_ReturnPyObjError (PyExc_TypeError,
- "expected string argument (or nothing)"));
+ if( !PyArg_ParseTuple( args, "|s", &name ) )
+ return ( EXPP_ReturnPyObjError( PyExc_TypeError,
+ "expected string argument (or nothing)" ) );
- lamp_iter = G.main->lamp.first;
+ lamp_iter = G.main->lamp.first;
- if (name) { /* (name) - Search lamp by name */
+ if( name ) { /* (name) - Search lamp by name */
- BPy_Lamp *wanted_lamp = NULL;
+ BPy_Lamp *wanted_lamp = NULL;
- while ((lamp_iter) && (wanted_lamp == NULL)) {
+ while( ( lamp_iter ) && ( wanted_lamp == NULL ) ) {
- if (strcmp (name, lamp_iter->id.name+2) == 0)
- wanted_lamp = (BPy_Lamp *)Lamp_CreatePyObject(lamp_iter);
+ if( strcmp( name, lamp_iter->id.name + 2 ) == 0 )
+ wanted_lamp =
+ ( BPy_Lamp * )
+ Lamp_CreatePyObject( lamp_iter );
- lamp_iter = lamp_iter->id.next;
- }
+ lamp_iter = lamp_iter->id.next;
+ }
- if (wanted_lamp == NULL) { /* Requested lamp doesn't exist */
- char error_msg[64];
- PyOS_snprintf(error_msg, sizeof(error_msg),
- "Lamp \"%s\" not found", name);
- return (EXPP_ReturnPyObjError (PyExc_NameError, error_msg));
- }
+ if( wanted_lamp == NULL ) { /* Requested lamp doesn't exist */
+ char error_msg[64];
+ PyOS_snprintf( error_msg, sizeof( error_msg ),
+ "Lamp \"%s\" not found", name );
+ return ( EXPP_ReturnPyObjError
+ ( PyExc_NameError, error_msg ) );
+ }
- return (PyObject *)wanted_lamp;
- }
+ return ( PyObject * ) wanted_lamp;
+ }
- else { /* () - return a list of all lamps in the scene */
- int index = 0;
- PyObject *lamplist, *pyobj;
+ else { /* () - return a list of all lamps in the scene */
+ int index = 0;
+ PyObject *lamplist, *pyobj;
- lamplist = PyList_New (BLI_countlist (&(G.main->lamp)));
+ lamplist = PyList_New( BLI_countlist( &( G.main->lamp ) ) );
- if (lamplist == NULL)
- return (EXPP_ReturnPyObjError (PyExc_MemoryError,
- "couldn't create PyList"));
+ if( lamplist == NULL )
+ return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
+ "couldn't create PyList" ) );
- while (lamp_iter) {
- pyobj = Lamp_CreatePyObject (lamp_iter);
+ while( lamp_iter ) {
+ pyobj = Lamp_CreatePyObject( lamp_iter );
- if (!pyobj)
- return (EXPP_ReturnPyObjError (PyExc_MemoryError,
- "couldn't create PyString"));
+ if( !pyobj )
+ return ( EXPP_ReturnPyObjError
+ ( PyExc_MemoryError,
+ "couldn't create PyString" ) );
- PyList_SET_ITEM (lamplist, index, pyobj);
+ PyList_SET_ITEM( lamplist, index, pyobj );
- lamp_iter = lamp_iter->id.next;
- index++;
- }
+ lamp_iter = lamp_iter->id.next;
+ index++;
+ }
- return lamplist;
- }
+ return lamplist;
+ }
}
-static PyObject *Lamp_TypesDict (void)
-{ /* create the Blender.Lamp.Types constant dict */
- PyObject *Types = M_constant_New();
+static PyObject *Lamp_TypesDict( void )
+{ /* create the Blender.Lamp.Types constant dict */
+ PyObject *Types = M_constant_New( );
- if (Types) {
- BPy_constant *c = (BPy_constant *)Types;
+ if( Types ) {
+ BPy_constant *c = ( BPy_constant * ) Types;
- constant_insert (c, "Lamp", PyInt_FromLong (EXPP_LAMP_TYPE_LAMP));
- constant_insert (c, "Sun", PyInt_FromLong (EXPP_LAMP_TYPE_SUN));
- constant_insert (c, "Spot", PyInt_FromLong (EXPP_LAMP_TYPE_SPOT));
- constant_insert (c, "Hemi", PyInt_FromLong (EXPP_LAMP_TYPE_HEMI));
+ constant_insert( c, "Lamp",
+ PyInt_FromLong( EXPP_LAMP_TYPE_LAMP ) );
+ constant_insert( c, "Sun",
+ PyInt_FromLong( EXPP_LAMP_TYPE_SUN ) );
+ constant_insert( c, "Spot",
+ PyInt_FromLong( EXPP_LAMP_TYPE_SPOT ) );
+ constant_insert( c, "Hemi",
+ PyInt_FromLong( EXPP_LAMP_TYPE_HEMI ) );
- }
+ }
- return Types;
+ return Types;
}
-static PyObject *Lamp_ModesDict (void)
-{ /* create the Blender.Lamp.Modes constant dict */
- PyObject *Modes = M_constant_New();
-
- if (Modes) {
- BPy_constant *c = (BPy_constant *)Modes;
-
- constant_insert (c, "Shadows", PyInt_FromLong (EXPP_LAMP_MODE_SHADOWS));
- constant_insert (c, "Halo", PyInt_FromLong (EXPP_LAMP_MODE_HALO));
- constant_insert (c, "Layer", PyInt_FromLong (EXPP_LAMP_MODE_LAYER));
- constant_insert (c, "Quad", PyInt_FromLong (EXPP_LAMP_MODE_QUAD));
- constant_insert (c, "Negative", PyInt_FromLong (EXPP_LAMP_MODE_NEGATIVE));
- constant_insert (c, "Sphere", PyInt_FromLong (EXPP_LAMP_MODE_SPHERE));
- constant_insert (c, "Square", PyInt_FromLong (EXPP_LAMP_MODE_SQUARE));
- constant_insert (c, "OnlyShadow",
- PyInt_FromLong (EXPP_LAMP_MODE_ONLYSHADOW));
- constant_insert (c, "NoDiffuse",
- PyInt_FromLong (EXPP_LAMP_MODE_NODIFFUSE));
- constant_insert (c, "NoSpecular",
- PyInt_FromLong (EXPP_LAMP_MODE_NOSPECULAR));
- }
-
- return Modes;
+static PyObject *Lamp_ModesDict( void )
+{ /* create the Blender.Lamp.Modes constant dict */
+ PyObject *Modes = M_constant_New( );
+
+ if( Modes ) {
+ BPy_constant *c = ( BPy_constant * ) Modes;
+
+ constant_insert( c, "Shadows",
+ PyInt_FromLong( EXPP_LAMP_MODE_SHADOWS ) );
+ constant_insert( c, "Halo",
+ PyInt_FromLong( EXPP_LAMP_MODE_HALO ) );
+ constant_insert( c, "Layer",
+ PyInt_FromLong( EXPP_LAMP_MODE_LAYER ) );
+ constant_insert( c, "Quad",
+ PyInt_FromLong( EXPP_LAMP_MODE_QUAD ) );
+ constant_insert( c, "Negative",
+ PyInt_FromLong( EXPP_LAMP_MODE_NEGATIVE ) );
+ constant_insert( c, "Sphere",
+ PyInt_FromLong( EXPP_LAMP_MODE_SPHERE ) );
+ constant_insert( c, "Square",
+ PyInt_FromLong( EXPP_LAMP_MODE_SQUARE ) );
+ constant_insert( c, "OnlyShadow",
+ PyInt_FromLong( EXPP_LAMP_MODE_ONLYSHADOW ) );
+ constant_insert( c, "NoDiffuse",
+ PyInt_FromLong( EXPP_LAMP_MODE_NODIFFUSE ) );
+ constant_insert( c, "NoSpecular",
+ PyInt_FromLong( EXPP_LAMP_MODE_NOSPECULAR ) );
+ }
+
+ return Modes;
}
/*****************************************************************************/
/* Function: Lamp_Init */
/*****************************************************************************/
/* Needed by the Blender module, to register the Blender.Lamp submodule */
-PyObject *Lamp_Init (void)
+PyObject *Lamp_Init( void )
{
- PyObject *submodule, *Types, *Modes;
+ PyObject *submodule, *Types, *Modes;
- Lamp_Type.ob_type = &PyType_Type;
+ Lamp_Type.ob_type = &PyType_Type;
- Types = Lamp_TypesDict ();
- Modes = Lamp_ModesDict ();
+ Types = Lamp_TypesDict( );
+ Modes = Lamp_ModesDict( );
- submodule = Py_InitModule3("Blender.Lamp", M_Lamp_methods, M_Lamp_doc);
+ submodule =
+ Py_InitModule3( "Blender.Lamp", M_Lamp_methods, M_Lamp_doc );
- if (Types) PyModule_AddObject(submodule, "Types", Types);
- if (Modes) PyModule_AddObject(submodule, "Modes", Modes);
+ if( Types )
+ PyModule_AddObject( submodule, "Types", Types );
+ if( Modes )
+ PyModule_AddObject( submodule, "Modes", Modes );
- return submodule;
+ return submodule;
}
/* Three Python Lamp_Type helper functions needed by the Object module: */
@@ -522,26 +539,26 @@ PyObject *Lamp_Init (void)
/* Description: This function will create a new BPy_Lamp from an existing */
/* Blender lamp structure. */
/*****************************************************************************/
-PyObject *Lamp_CreatePyObject (Lamp *lamp)
+PyObject *Lamp_CreatePyObject( Lamp * lamp )
{
- BPy_Lamp *pylamp;
- float *rgb[3];
+ BPy_Lamp *pylamp;
+ float *rgb[3];
- pylamp = (BPy_Lamp *)PyObject_NEW (BPy_Lamp, &Lamp_Type);
+ pylamp = ( BPy_Lamp * ) PyObject_NEW( BPy_Lamp, &Lamp_Type );
- if (!pylamp)
- return EXPP_ReturnPyObjError (PyExc_MemoryError,
- "couldn't create BPy_Lamp object");
+ if( !pylamp )
+ return EXPP_ReturnPyObjError( PyExc_MemoryError,
+ "couldn't create BPy_Lamp object" );
- pylamp->lamp = lamp;
+ pylamp->lamp = lamp;
- rgb[0] = &lamp->r;
- rgb[1] = &lamp->g;
- rgb[2] = &lamp->b;
+ rgb[0] = &lamp->r;
+ rgb[1] = &lamp->g;
+ rgb[2] = &lamp->b;
- pylamp->color = (BPy_rgbTuple *)rgbTuple_New(rgb);
+ pylamp->color = ( BPy_rgbTuple * ) rgbTuple_New( rgb );
- return (PyObject *)pylamp;
+ return ( PyObject * ) pylamp;
}
/*****************************************************************************/
@@ -549,9 +566,9 @@ PyObject *Lamp_CreatePyObject (Lamp *lamp)
/* Description: This function returns true when the given PyObject is of the */
/* type Lamp. Otherwise it will return false. */
/*****************************************************************************/
-int Lamp_CheckPyObject (PyObject *pyobj)
+int Lamp_CheckPyObject( PyObject * pyobj )
{
- return (pyobj->ob_type == &Lamp_Type);
+ return ( pyobj->ob_type == &Lamp_Type );
}
/*****************************************************************************/
@@ -559,9 +576,9 @@ int Lamp_CheckPyObject (PyObject *pyobj)
/* Description: This function returns the Blender lamp from the given */
/* PyObject. */
/*****************************************************************************/
-Lamp *Lamp_FromPyObject (PyObject *pyobj)
+Lamp *Lamp_FromPyObject( PyObject * pyobj )
{
- return ((BPy_Lamp *)pyobj)->lamp;
+ return ( ( BPy_Lamp * ) pyobj )->lamp;
}
/*****************************************************************************/
@@ -572,15 +589,13 @@ Lamp *Lamp_FromPyObject (PyObject *pyobj)
/* The function will return NULL when no lamp with the given */
/* name is found. */
/*****************************************************************************/
-Lamp * GetLampByName (char * name)
+Lamp *GetLampByName( char *name )
{
- Lamp * lamp_iter;
+ Lamp *lamp_iter;
- lamp_iter = G.main->lamp.first;
- while (lamp_iter)
- {
- if (StringEqual (name, GetIdName (&(lamp_iter->id))))
- {
+ lamp_iter = G.main->lamp.first;
+ while( lamp_iter ) {
+ if( StringEqual( name, GetIdName( &( lamp_iter->id ) ) ) ) {
return lamp_iter;
}
lamp_iter = lamp_iter->id.next;
@@ -593,220 +608,237 @@ Lamp * GetLampByName (char * name)
/*****************************************************************************/
/* Python BPy_Lamp methods: */
/*****************************************************************************/
-static PyObject *Lamp_getName(BPy_Lamp *self)
+static PyObject *Lamp_getName( BPy_Lamp * self )
{
- PyObject *attr = PyString_FromString(self->lamp->id.name+2);
+ PyObject *attr = PyString_FromString( self->lamp->id.name + 2 );
- if (attr) return attr;
+ if( attr )
+ return attr;
- return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
- "couldn't get Lamp.name attribute"));
+ return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
+ "couldn't get Lamp.name attribute" ) );
}
-static PyObject *Lamp_getType(BPy_Lamp *self)
-{
- PyObject *attr = PyInt_FromLong(self->lamp->type);
+static PyObject *Lamp_getType( BPy_Lamp * self )
+{
+ PyObject *attr = PyInt_FromLong( self->lamp->type );
- if (attr) return attr;
+ if( attr )
+ return attr;
- return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
- "couldn't get Lamp.type attribute"));
+ return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
+ "couldn't get Lamp.type attribute" ) );
}
-static PyObject *Lamp_getMode(BPy_Lamp *self)
+static PyObject *Lamp_getMode( BPy_Lamp * self )
{
- PyObject *attr = PyInt_FromLong(self->lamp->mode);
+ PyObject *attr = PyInt_FromLong( self->lamp->mode );
- if (attr) return attr;
+ if( attr )
+ return attr;
- return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
- "couldn't get Lamp.mode attribute"));
+ return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
+ "couldn't get Lamp.mode attribute" ) );
}
-static PyObject *Lamp_getSamples(BPy_Lamp *self)
+static PyObject *Lamp_getSamples( BPy_Lamp * self )
{
- PyObject *attr = PyInt_FromLong(self->lamp->samp);
+ PyObject *attr = PyInt_FromLong( self->lamp->samp );
- if (attr) return attr;
+ if( attr )
+ return attr;
- return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
- "couldn't get Lamp.samples attribute"));
+ return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
+ "couldn't get Lamp.samples attribute" ) );
}
-static PyObject *Lamp_getBufferSize(BPy_Lamp *self)
+static PyObject *Lamp_getBufferSize( BPy_Lamp * self )
{
- PyObject *attr = PyInt_FromLong(self->lamp->bufsize);
+ PyObject *attr = PyInt_FromLong( self->lamp->bufsize );
- if (attr) return attr;
+ if( attr )
+ return attr;
- return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
- "couldn't get Lamp.bufferSize attribute"));
+ return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
+ "couldn't get Lamp.bufferSize attribute" ) );
}
-static PyObject *Lamp_getHaloStep(BPy_Lamp *self)
+static PyObject *Lamp_getHaloStep( BPy_Lamp * self )
{
- PyObject *attr = PyInt_FromLong(self->lamp->shadhalostep);
+ PyObject *attr = PyInt_FromLong( self->lamp->shadhalostep );
- if (attr) return attr;
+ if( attr )
+ return attr;
- return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
- "couldn't get Lamp.haloStep attribute"));
+ return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
+ "couldn't get Lamp.haloStep attribute" ) );
}
-static PyObject *Lamp_getEnergy(BPy_Lamp *self)
+static PyObject *Lamp_getEnergy( BPy_Lamp * self )
{
- PyObject *attr = PyFloat_FromDouble(self->lamp->energy);
+ PyObject *attr = PyFloat_FromDouble( self->lamp->energy );
- if (attr) return attr;
+ if( attr )
+ return attr;
- return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
- "couldn't get Lamp.energy attribute"));
+ return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
+ "couldn't get Lamp.energy attribute" ) );
}
-static PyObject *Lamp_getDist(BPy_Lamp *self)
+static PyObject *Lamp_getDist( BPy_Lamp * self )
{
- PyObject *attr = PyFloat_FromDouble(self->lamp->dist);
+ PyObject *attr = PyFloat_FromDouble( self->lamp->dist );
- if (attr) return attr;
+ if( attr )
+ return attr;
- return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
- "couldn't get Lamp.dist attribute"));
+ return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
+ "couldn't get Lamp.dist attribute" ) );
}
-static PyObject *Lamp_getSpotSize(BPy_Lamp *self)
+static PyObject *Lamp_getSpotSize( BPy_Lamp * self )
{
- PyObject *attr = PyFloat_FromDouble(self->lamp->spotsize);
+ PyObject *attr = PyFloat_FromDouble( self->lamp->spotsize );
- if (attr) return attr;
+ if( attr )
+ return attr;
- return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
- "couldn't get Lamp.spotSize attribute"));
+ return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
+ "couldn't get Lamp.spotSize attribute" ) );
}
-static PyObject *Lamp_getSpotBlend(BPy_Lamp *self)
+static PyObject *Lamp_getSpotBlend( BPy_Lamp * self )
{
- PyObject *attr = PyFloat_FromDouble(self->lamp->spotblend);
+ PyObject *attr = PyFloat_FromDouble( self->lamp->spotblend );
- if (attr) return attr;
+ if( attr )
+ return attr;
- return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
- "couldn't get Lamp.spotBlend attribute"));
+ return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
+ "couldn't get Lamp.spotBlend attribute" ) );
}
-static PyObject *Lamp_getClipStart(BPy_Lamp *self)
+static PyObject *Lamp_getClipStart( BPy_Lamp * self )
{
- PyObject *attr = PyFloat_FromDouble(self->lamp->clipsta);
+ PyObject *attr = PyFloat_FromDouble( self->lamp->clipsta );
- if (attr) return attr;
+ if( attr )
+ return attr;
- return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
- "couldn't get Lamp.clipStart attribute"));
+ return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
+ "couldn't get Lamp.clipStart attribute" ) );
}
-static PyObject *Lamp_getClipEnd(BPy_Lamp *self)
+static PyObject *Lamp_getClipEnd( BPy_Lamp * self )
{
- PyObject *attr = PyFloat_FromDouble(self->lamp->clipend);
+ PyObject *attr = PyFloat_FromDouble( self->lamp->clipend );
- if (attr) return attr;
+ if( attr )
+ return attr;
- return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
- "couldn't get Lamp.clipEnd attribute"));
+ return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
+ "couldn't get Lamp.clipEnd attribute" ) );
}
-static PyObject *Lamp_getBias(BPy_Lamp *self)
+static PyObject *Lamp_getBias( BPy_Lamp * self )
{
- PyObject *attr = PyFloat_FromDouble(self->lamp->bias);
+ PyObject *attr = PyFloat_FromDouble( self->lamp->bias );
- if (attr) return attr;
+ if( attr )
+ return attr;
- return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
- "couldn't get Lamp.bias attribute"));
+ return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
+ "couldn't get Lamp.bias attribute" ) );
}
-static PyObject *Lamp_getSoftness(BPy_Lamp *self)
+static PyObject *Lamp_getSoftness( BPy_Lamp * self )
{
- PyObject *attr = PyFloat_FromDouble(self->lamp->soft);
+ PyObject *attr = PyFloat_FromDouble( self->lamp->soft );
- if (attr) return attr;
+ if( attr )
+ return attr;
- return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
- "couldn't get Lamp.softness attribute"));
+ return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
+ "couldn't get Lamp.softness attribute" ) );
}
-static PyObject *Lamp_getHaloInt(BPy_Lamp *self)
+static PyObject *Lamp_getHaloInt( BPy_Lamp * self )
{
- PyObject *attr = PyFloat_FromDouble(self->lamp->haint);
+ PyObject *attr = PyFloat_FromDouble( self->lamp->haint );
- if (attr) return attr;
+ if( attr )
+ return attr;
- return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
- "couldn't get Lamp.haloInt attribute"));
+ return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
+ "couldn't get Lamp.haloInt attribute" ) );
}
-static PyObject *Lamp_getQuad1(BPy_Lamp *self)
-{ /* should we complain if Lamp is not of type Quad? */
- PyObject *attr = PyFloat_FromDouble(self->lamp->att1);
+static PyObject *Lamp_getQuad1( BPy_Lamp * self )
+{ /* should we complain if Lamp is not of type Quad? */
+ PyObject *attr = PyFloat_FromDouble( self->lamp->att1 );
- if (attr) return attr;
+ if( attr )
+ return attr;
- return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
- "couldn't get Lamp.quad1 attribute"));
+ return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
+ "couldn't get Lamp.quad1 attribute" ) );
}
-static PyObject *Lamp_getQuad2(BPy_Lamp *self)
-{ /* should we complain if Lamp is not of type Quad? */
- PyObject *attr = PyFloat_FromDouble(self->lamp->att2);
+static PyObject *Lamp_getQuad2( BPy_Lamp * self )
+{ /* should we complain if Lamp is not of type Quad? */
+ PyObject *attr = PyFloat_FromDouble( self->lamp->att2 );
- if (attr) return attr;
+ if( attr )
+ return attr;
- return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
- "couldn't get Lamp.quad2 attribute"));
+ return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
+ "couldn't get Lamp.quad2 attribute" ) );
}
-static PyObject *Lamp_getCol(BPy_Lamp *self)
+static PyObject *Lamp_getCol( BPy_Lamp * self )
{
- return rgbTuple_getCol(self->color);
+ return rgbTuple_getCol( self->color );
}
-static PyObject *Lamp_setName(BPy_Lamp *self, PyObject *args)
+static PyObject *Lamp_setName( BPy_Lamp * self, PyObject * args )
{
- char *name = NULL;
- char buf[21];
+ char *name = NULL;
+ char buf[21];
- if (!PyArg_ParseTuple(args, "s", &name))
- return (EXPP_ReturnPyObjError (PyExc_TypeError,
- "expected string argument"));
-
- PyOS_snprintf(buf, sizeof(buf), "%s", name);
+ if( !PyArg_ParseTuple( args, "s", &name ) )
+ return ( EXPP_ReturnPyObjError( PyExc_TypeError,
+ "expected string argument" ) );
- rename_id(&self->lamp->id, buf);
+ PyOS_snprintf( buf, sizeof( buf ), "%s", name );
- Py_INCREF(Py_None);
- return Py_None;
+ rename_id( &self->lamp->id, buf );
+
+ Py_INCREF( Py_None );
+ return Py_None;
}
-static PyObject *Lamp_setType(BPy_Lamp *self, PyObject *args)
+static PyObject *Lamp_setType( BPy_Lamp * self, PyObject * args )
{
- char *type;
-
- if (!PyArg_ParseTuple(args, "s", &type))
- return (EXPP_ReturnPyObjError (PyExc_TypeError,
- "expected string argument"));
-
- if (strcmp (type, "Lamp") == 0)
- self->lamp->type = (short)EXPP_LAMP_TYPE_LAMP;
- else if (strcmp (type, "Sun") == 0)
- self->lamp->type = (short)EXPP_LAMP_TYPE_SUN;
- else if (strcmp (type, "Spot") == 0)
- self->lamp->type = (short)EXPP_LAMP_TYPE_SPOT;
- else if (strcmp (type, "Hemi") == 0)
- self->lamp->type = (short)EXPP_LAMP_TYPE_HEMI;
- else
- return (EXPP_ReturnPyObjError (PyExc_AttributeError,
- "unknown lamp type"));
-
- Py_INCREF(Py_None);
- return Py_None;
+ char *type;
+
+ if( !PyArg_ParseTuple( args, "s", &type ) )
+ return ( EXPP_ReturnPyObjError( PyExc_TypeError,
+ "expected string argument" ) );
+
+ if( strcmp( type, "Lamp" ) == 0 )
+ self->lamp->type = ( short ) EXPP_LAMP_TYPE_LAMP;
+ else if( strcmp( type, "Sun" ) == 0 )
+ self->lamp->type = ( short ) EXPP_LAMP_TYPE_SUN;
+ else if( strcmp( type, "Spot" ) == 0 )
+ self->lamp->type = ( short ) EXPP_LAMP_TYPE_SPOT;
+ else if( strcmp( type, "Hemi" ) == 0 )
+ self->lamp->type = ( short ) EXPP_LAMP_TYPE_HEMI;
+ else
+ return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
+ "unknown lamp type" ) );
+
+ Py_INCREF( Py_None );
+ return Py_None;
}
/* This one is 'private'. It is not really a method, just a helper function for
@@ -814,359 +846,380 @@ static PyObject *Lamp_setType(BPy_Lamp *self, PyObject *args)
* the first case t shoud be an int and in the second it should be a string. So
* while the method setType expects a string ('persp' or 'ortho') or an empty
* argument, this function should receive an int (0 or 1). */
-static PyObject *Lamp_setIntType(BPy_Lamp *self, PyObject *args)
+static PyObject *Lamp_setIntType( BPy_Lamp * self, PyObject * args )
{
- short value;
+ short value;
- if (!PyArg_ParseTuple(args, "h", &value))
- return (EXPP_ReturnPyObjError (PyExc_TypeError,
- "expected int argument in [0,3]"));
+ if( !PyArg_ParseTuple( args, "h", &value ) )
+ return ( EXPP_ReturnPyObjError( PyExc_TypeError,
+ "expected int argument in [0,3]" ) );
- if (value >= 0 && value <= 3)
- self->lamp->type = value;
- else
- return (EXPP_ReturnPyObjError (PyExc_ValueError,
- "expected int argument in [0,3]"));
+ if( value >= 0 && value <= 3 )
+ self->lamp->type = value;
+ else
+ return ( EXPP_ReturnPyObjError( PyExc_ValueError,
+ "expected int argument in [0,3]" ) );
- Py_INCREF(Py_None);
- return Py_None;
+ Py_INCREF( Py_None );
+ return Py_None;
}
-static PyObject *Lamp_setMode(BPy_Lamp *self, PyObject *args)
+static PyObject *Lamp_setMode( BPy_Lamp * self, PyObject * args )
{
- char *m[10] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
- short i, flag = 0;
-
- if (!PyArg_ParseTuple(args, "|ssssssss", &m[0], &m[1], &m[2],
- &m[3], &m[4], &m[5], &m[6], &m[7], &m[8], &m[9]))
- return (EXPP_ReturnPyObjError (PyExc_AttributeError,
- "expected from none to 10 string argument(s)"));
-
- for (i = 0; i < 10; i++) {
- if (m[i] == NULL) break;
- if (strcmp(m[i], "Shadows") == 0)
- flag |= (short)EXPP_LAMP_MODE_SHADOWS;
- else if (strcmp(m[i], "Halo") == 0)
- flag |= (short)EXPP_LAMP_MODE_HALO;
- else if (strcmp(m[i], "Layer") == 0)
- flag |= (short)EXPP_LAMP_MODE_LAYER;
- else if (strcmp(m[i], "Quad") == 0)
- flag |= (short)EXPP_LAMP_MODE_QUAD;
- else if (strcmp(m[i], "Negative") == 0)
- flag |= (short)EXPP_LAMP_MODE_NEGATIVE;
- else if (strcmp(m[i], "OnlyShadow") == 0)
- flag |= (short)EXPP_LAMP_MODE_ONLYSHADOW;
- else if (strcmp(m[i], "Sphere") == 0)
- flag |= (short)EXPP_LAMP_MODE_SPHERE;
- else if (strcmp(m[i], "Square") == 0)
- flag |= (short)EXPP_LAMP_MODE_SQUARE;
- else if (strcmp(m[i], "NoDiffuse") == 0)
- flag |= (short)EXPP_LAMP_MODE_NODIFFUSE;
- else if (strcmp(m[i], "NoSpecular") == 0)
- flag |= (short)EXPP_LAMP_MODE_NOSPECULAR;
- else
- return (EXPP_ReturnPyObjError (PyExc_AttributeError,
- "unknown lamp flag argument"));
- }
-
- self->lamp->mode = flag;
-
- Py_INCREF(Py_None);
- return Py_None;
+ char *m[10] =
+ { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };
+ short i, flag = 0;
+
+ if( !PyArg_ParseTuple( args, "|ssssssss", &m[0], &m[1], &m[2],
+ &m[3], &m[4], &m[5], &m[6], &m[7], &m[8],
+ &m[9] ) )
+ return ( EXPP_ReturnPyObjError
+ ( PyExc_AttributeError,
+ "expected from none to 10 string argument(s)" ) );
+
+ for( i = 0; i < 10; i++ ) {
+ if( m[i] == NULL )
+ break;
+ if( strcmp( m[i], "Shadows" ) == 0 )
+ flag |= ( short ) EXPP_LAMP_MODE_SHADOWS;
+ else if( strcmp( m[i], "Halo" ) == 0 )
+ flag |= ( short ) EXPP_LAMP_MODE_HALO;
+ else if( strcmp( m[i], "Layer" ) == 0 )
+ flag |= ( short ) EXPP_LAMP_MODE_LAYER;
+ else if( strcmp( m[i], "Quad" ) == 0 )
+ flag |= ( short ) EXPP_LAMP_MODE_QUAD;
+ else if( strcmp( m[i], "Negative" ) == 0 )
+ flag |= ( short ) EXPP_LAMP_MODE_NEGATIVE;
+ else if( strcmp( m[i], "OnlyShadow" ) == 0 )
+ flag |= ( short ) EXPP_LAMP_MODE_ONLYSHADOW;
+ else if( strcmp( m[i], "Sphere" ) == 0 )
+ flag |= ( short ) EXPP_LAMP_MODE_SPHERE;
+ else if( strcmp( m[i], "Square" ) == 0 )
+ flag |= ( short ) EXPP_LAMP_MODE_SQUARE;
+ else if( strcmp( m[i], "NoDiffuse" ) == 0 )
+ flag |= ( short ) EXPP_LAMP_MODE_NODIFFUSE;
+ else if( strcmp( m[i], "NoSpecular" ) == 0 )
+ flag |= ( short ) EXPP_LAMP_MODE_NOSPECULAR;
+ else
+ return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
+ "unknown lamp flag argument" ) );
+ }
+
+ self->lamp->mode = flag;
+
+ Py_INCREF( Py_None );
+ return Py_None;
}
/* Another helper function, for the same reason.
* (See comment before Lamp_setIntType above). */
-static PyObject *Lamp_setIntMode(BPy_Lamp *self, PyObject *args)
+static PyObject *Lamp_setIntMode( BPy_Lamp * self, PyObject * args )
{
- short value;
+ short value;
- if (!PyArg_ParseTuple(args, "h", &value))
- return (EXPP_ReturnPyObjError (PyExc_TypeError,
- "expected int argument"));
+ if( !PyArg_ParseTuple( args, "h", &value ) )
+ return ( EXPP_ReturnPyObjError( PyExc_TypeError,
+ "expected int argument" ) );
/* well, with so many flag bits, we just accept any short int, no checking */
- self->lamp->mode = value;
+ self->lamp->mode = value;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_INCREF( Py_None );
+ return Py_None;
}
-static PyObject *Lamp_setSamples(BPy_Lamp *self, PyObject *args)
+static PyObject *Lamp_setSamples( BPy_Lamp * self, PyObject * args )
{
- short value;
+ short value;
- if (!PyArg_ParseTuple(args, "h", &value))
- return (EXPP_ReturnPyObjError (PyExc_TypeError,
- "expected int argument in [1,16]"));
+ if( !PyArg_ParseTuple( args, "h", &value ) )
+ return ( EXPP_ReturnPyObjError( PyExc_TypeError,
+ "expected int argument in [1,16]" ) );
- self->lamp->samp = EXPP_ClampInt (value,
- EXPP_LAMP_SAMPLES_MIN, EXPP_LAMP_SAMPLES_MAX);
+ self->lamp->samp = EXPP_ClampInt( value,
+ EXPP_LAMP_SAMPLES_MIN,
+ EXPP_LAMP_SAMPLES_MAX );
- Py_INCREF(Py_None);
- return Py_None;
+ Py_INCREF( Py_None );
+ return Py_None;
}
-static PyObject *Lamp_setBufferSize(BPy_Lamp *self, PyObject *args)
+static PyObject *Lamp_setBufferSize( BPy_Lamp * self, PyObject * args )
{
- short value;
+ short value;
+
+ if( !PyArg_ParseTuple( args, "h", &value ) )
+ return ( EXPP_ReturnPyObjError( PyExc_TypeError,
+ "expected int argument in [512, 5120]" ) );
- if (!PyArg_ParseTuple(args, "h", &value))
- return (EXPP_ReturnPyObjError (PyExc_TypeError,
- "expected int argument in [512, 5120]"));
-
- self->lamp->bufsize = EXPP_ClampInt (value,
- EXPP_LAMP_BUFFERSIZE_MIN, EXPP_LAMP_BUFFERSIZE_MAX);
+ self->lamp->bufsize = EXPP_ClampInt( value,
+ EXPP_LAMP_BUFFERSIZE_MIN,
+ EXPP_LAMP_BUFFERSIZE_MAX );
- Py_INCREF(Py_None);
- return Py_None;
+ Py_INCREF( Py_None );
+ return Py_None;
}
-static PyObject *Lamp_setHaloStep(BPy_Lamp *self, PyObject *args)
+static PyObject *Lamp_setHaloStep( BPy_Lamp * self, PyObject * args )
{
- short value;
+ short value;
- if (!PyArg_ParseTuple(args, "h", &value))
- return (EXPP_ReturnPyObjError (PyExc_TypeError,
- "expected int argument in [0,12]"));
+ if( !PyArg_ParseTuple( args, "h", &value ) )
+ return ( EXPP_ReturnPyObjError( PyExc_TypeError,
+ "expected int argument in [0,12]" ) );
- self->lamp->shadhalostep = EXPP_ClampInt (value,
- EXPP_LAMP_HALOSTEP_MIN, EXPP_LAMP_HALOSTEP_MAX);
+ self->lamp->shadhalostep = EXPP_ClampInt( value,
+ EXPP_LAMP_HALOSTEP_MIN,
+ EXPP_LAMP_HALOSTEP_MAX );
- Py_INCREF(Py_None);
- return Py_None;
+ Py_INCREF( Py_None );
+ return Py_None;
}
-static PyObject *Lamp_setEnergy(BPy_Lamp *self, PyObject *args)
+static PyObject *Lamp_setEnergy( BPy_Lamp * self, PyObject * args )
{
- float value;
-
- if (!PyArg_ParseTuple(args, "f", &value))
- return (EXPP_ReturnPyObjError (PyExc_TypeError,
- "expected float argument"));
+ float value;
+
+ if( !PyArg_ParseTuple( args, "f", &value ) )
+ return ( EXPP_ReturnPyObjError( PyExc_TypeError,
+ "expected float argument" ) );
- self->lamp->energy = EXPP_ClampFloat (value,
- EXPP_LAMP_ENERGY_MIN, EXPP_LAMP_ENERGY_MAX);
+ self->lamp->energy = EXPP_ClampFloat( value,
+ EXPP_LAMP_ENERGY_MIN,
+ EXPP_LAMP_ENERGY_MAX );
- Py_INCREF(Py_None);
- return Py_None;
+ Py_INCREF( Py_None );
+ return Py_None;
}
-static PyObject *Lamp_setDist(BPy_Lamp *self, PyObject *args)
+static PyObject *Lamp_setDist( BPy_Lamp * self, PyObject * args )
{
- float value;
-
- if (!PyArg_ParseTuple(args, "f", &value))
- return (EXPP_ReturnPyObjError (PyExc_TypeError,
- "expected float argument"));
+ float value;
- self->lamp->dist = EXPP_ClampFloat (value,
- EXPP_LAMP_DIST_MIN, EXPP_LAMP_DIST_MAX);
+ if( !PyArg_ParseTuple( args, "f", &value ) )
+ return ( EXPP_ReturnPyObjError( PyExc_TypeError,
+ "expected float argument" ) );
- Py_INCREF(Py_None);
- return Py_None;
+ self->lamp->dist = EXPP_ClampFloat( value,
+ EXPP_LAMP_DIST_MIN,
+ EXPP_LAMP_DIST_MAX );
+
+ Py_INCREF( Py_None );
+ return Py_None;
}
-static PyObject *Lamp_setSpotSize(BPy_Lamp *self, PyObject *args)
+static PyObject *Lamp_setSpotSize( BPy_Lamp * self, PyObject * args )
{
- float value;
-
- if (!PyArg_ParseTuple(args, "f", &value))
- return (EXPP_ReturnPyObjError (PyExc_TypeError,
- "expected float argument"));
+ float value;
+
+ if( !PyArg_ParseTuple( args, "f", &value ) )
+ return ( EXPP_ReturnPyObjError( PyExc_TypeError,
+ "expected float argument" ) );
- self->lamp->spotsize = EXPP_ClampFloat (value,
- EXPP_LAMP_SPOTSIZE_MIN, EXPP_LAMP_SPOTSIZE_MAX);
+ self->lamp->spotsize = EXPP_ClampFloat( value,
+ EXPP_LAMP_SPOTSIZE_MIN,
+ EXPP_LAMP_SPOTSIZE_MAX );
- Py_INCREF(Py_None);
- return Py_None;
+ Py_INCREF( Py_None );
+ return Py_None;
}
-static PyObject *Lamp_setSpotBlend(BPy_Lamp *self, PyObject *args)
+static PyObject *Lamp_setSpotBlend( BPy_Lamp * self, PyObject * args )
{
- float value;
-
- if (!PyArg_ParseTuple(args, "f", &value))
- return (EXPP_ReturnPyObjError (PyExc_TypeError,
- "expected float argument"));
+ float value;
+
+ if( !PyArg_ParseTuple( args, "f", &value ) )
+ return ( EXPP_ReturnPyObjError( PyExc_TypeError,
+ "expected float argument" ) );
- self->lamp->spotblend = EXPP_ClampFloat (value,
- EXPP_LAMP_SPOTBLEND_MIN, EXPP_LAMP_SPOTBLEND_MAX);
+ self->lamp->spotblend = EXPP_ClampFloat( value,
+ EXPP_LAMP_SPOTBLEND_MIN,
+ EXPP_LAMP_SPOTBLEND_MAX );
- Py_INCREF(Py_None);
- return Py_None;
+ Py_INCREF( Py_None );
+ return Py_None;
}
-static PyObject *Lamp_setClipStart(BPy_Lamp *self, PyObject *args)
+static PyObject *Lamp_setClipStart( BPy_Lamp * self, PyObject * args )
{
- float value;
-
- if (!PyArg_ParseTuple(args, "f", &value))
- return (EXPP_ReturnPyObjError (PyExc_TypeError,
- "expected float argument"));
-
- self->lamp->clipsta = EXPP_ClampFloat (value,
- EXPP_LAMP_CLIPSTART_MIN, EXPP_LAMP_CLIPSTART_MAX);
-
- Py_INCREF(Py_None);
- return Py_None;
+ float value;
+
+ if( !PyArg_ParseTuple( args, "f", &value ) )
+ return ( EXPP_ReturnPyObjError( PyExc_TypeError,
+ "expected float argument" ) );
+
+ self->lamp->clipsta = EXPP_ClampFloat( value,
+ EXPP_LAMP_CLIPSTART_MIN,
+ EXPP_LAMP_CLIPSTART_MAX );
+
+ Py_INCREF( Py_None );
+ return Py_None;
}
-static PyObject *Lamp_setClipEnd(BPy_Lamp *self, PyObject *args)
+static PyObject *Lamp_setClipEnd( BPy_Lamp * self, PyObject * args )
{
- float value;
+ float value;
- if (!PyArg_ParseTuple(args, "f", &value))
- return (EXPP_ReturnPyObjError (PyExc_TypeError,
- "expected float argument"));
+ if( !PyArg_ParseTuple( args, "f", &value ) )
+ return ( EXPP_ReturnPyObjError( PyExc_TypeError,
+ "expected float argument" ) );
- self->lamp->clipend = EXPP_ClampFloat (value,
- EXPP_LAMP_CLIPEND_MIN, EXPP_LAMP_CLIPEND_MAX);
+ self->lamp->clipend = EXPP_ClampFloat( value,
+ EXPP_LAMP_CLIPEND_MIN,
+ EXPP_LAMP_CLIPEND_MAX );
- Py_INCREF(Py_None);
- return Py_None;
+ Py_INCREF( Py_None );
+ return Py_None;
}
-static PyObject *Lamp_setBias(BPy_Lamp *self, PyObject *args)
+static PyObject *Lamp_setBias( BPy_Lamp * self, PyObject * args )
{
- float value;
-
- if (!PyArg_ParseTuple(args, "f", &value))
- return (EXPP_ReturnPyObjError (PyExc_TypeError,
- "expected float argument"));
+ float value;
+
+ if( !PyArg_ParseTuple( args, "f", &value ) )
+ return ( EXPP_ReturnPyObjError( PyExc_TypeError,
+ "expected float argument" ) );
- self->lamp->bias = EXPP_ClampFloat (value,
- EXPP_LAMP_BIAS_MIN, EXPP_LAMP_BIAS_MAX);
+ self->lamp->bias = EXPP_ClampFloat( value,
+ EXPP_LAMP_BIAS_MIN,
+ EXPP_LAMP_BIAS_MAX );
- Py_INCREF(Py_None);
- return Py_None;
+ Py_INCREF( Py_None );
+ return Py_None;
}
-static PyObject *Lamp_setSoftness(BPy_Lamp *self, PyObject *args)
+static PyObject *Lamp_setSoftness( BPy_Lamp * self, PyObject * args )
{
- float value;
-
- if (!PyArg_ParseTuple(args, "f", &value))
- return (EXPP_ReturnPyObjError (PyExc_TypeError,
- "expected float argument"));
+ float value;
+
+ if( !PyArg_ParseTuple( args, "f", &value ) )
+ return ( EXPP_ReturnPyObjError( PyExc_TypeError,
+ "expected float argument" ) );
- self->lamp->soft = EXPP_ClampFloat (value,
- EXPP_LAMP_SOFTNESS_MIN, EXPP_LAMP_SOFTNESS_MAX);
+ self->lamp->soft = EXPP_ClampFloat( value,
+ EXPP_LAMP_SOFTNESS_MIN,
+ EXPP_LAMP_SOFTNESS_MAX );
- Py_INCREF(Py_None);
- return Py_None;
+ Py_INCREF( Py_None );
+ return Py_None;
}
-static PyObject *Lamp_setHaloInt(BPy_Lamp *self, PyObject *args)
+static PyObject *Lamp_setHaloInt( BPy_Lamp * self, PyObject * args )
{
- float value;
+ float value;
- if (!PyArg_ParseTuple(args, "f", &value))
- return (EXPP_ReturnPyObjError (PyExc_TypeError,
- "expected float argument"));
+ if( !PyArg_ParseTuple( args, "f", &value ) )
+ return ( EXPP_ReturnPyObjError( PyExc_TypeError,
+ "expected float argument" ) );
- self->lamp->haint = EXPP_ClampFloat (value,
- EXPP_LAMP_HALOINT_MIN, EXPP_LAMP_HALOINT_MAX);
+ self->lamp->haint = EXPP_ClampFloat( value,
+ EXPP_LAMP_HALOINT_MIN,
+ EXPP_LAMP_HALOINT_MAX );
- Py_INCREF(Py_None);
- return Py_None;
+ Py_INCREF( Py_None );
+ return Py_None;
}
-static PyObject *Lamp_setQuad1(BPy_Lamp *self, PyObject *args)
+static PyObject *Lamp_setQuad1( BPy_Lamp * self, PyObject * args )
{
- float value;
+ float value;
- if (!PyArg_ParseTuple(args, "f", &value))
- return (EXPP_ReturnPyObjError (PyExc_TypeError,
- "expected float argument"));
+ if( !PyArg_ParseTuple( args, "f", &value ) )
+ return ( EXPP_ReturnPyObjError( PyExc_TypeError,
+ "expected float argument" ) );
- self->lamp->att1 = EXPP_ClampFloat (value,
- EXPP_LAMP_QUAD1_MIN, EXPP_LAMP_QUAD1_MAX);
+ self->lamp->att1 = EXPP_ClampFloat( value,
+ EXPP_LAMP_QUAD1_MIN,
+ EXPP_LAMP_QUAD1_MAX );
- Py_INCREF(Py_None);
- return Py_None;
+ Py_INCREF( Py_None );
+ return Py_None;
}
-static PyObject *Lamp_setQuad2(BPy_Lamp *self, PyObject *args)
+static PyObject *Lamp_setQuad2( BPy_Lamp * self, PyObject * args )
{
- float value;
+ float value;
- if (!PyArg_ParseTuple(args, "f", &value))
- return (EXPP_ReturnPyObjError (PyExc_TypeError,
- "expected float argument"));
+ if( !PyArg_ParseTuple( args, "f", &value ) )
+ return ( EXPP_ReturnPyObjError( PyExc_TypeError,
+ "expected float argument" ) );
- self->lamp->att2 = EXPP_ClampFloat (value,
- EXPP_LAMP_QUAD2_MIN, EXPP_LAMP_QUAD2_MAX);
+ self->lamp->att2 = EXPP_ClampFloat( value,
+ EXPP_LAMP_QUAD2_MIN,
+ EXPP_LAMP_QUAD2_MAX );
- Py_INCREF(Py_None);
- return Py_None;
+ Py_INCREF( Py_None );
+ return Py_None;
}
-static PyObject *Lamp_setColorComponent(BPy_Lamp *self, char *key,
- PyObject *args)
-{ /* for compatibility with old bpython */
- float value;
+static PyObject *Lamp_setColorComponent( BPy_Lamp * self, char *key,
+ PyObject * args )
+{ /* for compatibility with old bpython */
+ float value;
- if (!PyArg_ParseTuple(args, "f", &value))
- return (EXPP_ReturnPyObjError (PyExc_TypeError,
- "expected float argument in [0.0, 1.0]"));
+ if( !PyArg_ParseTuple( args, "f", &value ) )
+ return ( EXPP_ReturnPyObjError( PyExc_TypeError,
+ "expected float argument in [0.0, 1.0]" ) );
- value = EXPP_ClampFloat (value, EXPP_LAMP_COL_MIN,
- EXPP_LAMP_COL_MAX);
+ value = EXPP_ClampFloat( value, EXPP_LAMP_COL_MIN, EXPP_LAMP_COL_MAX );
- if (!strcmp(key, "R"))
- self->lamp->r = value;
- else if (!strcmp(key, "G"))
- self->lamp->g = value;
- else if (!strcmp(key, "B"))
- self->lamp->b = value;
+ if( !strcmp( key, "R" ) )
+ self->lamp->r = value;
+ else if( !strcmp( key, "G" ) )
+ self->lamp->g = value;
+ else if( !strcmp( key, "B" ) )
+ self->lamp->b = value;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_INCREF( Py_None );
+ return Py_None;
}
-static PyObject *Lamp_setCol(BPy_Lamp *self, PyObject *args)
+static PyObject *Lamp_setCol( BPy_Lamp * self, PyObject * args )
{
- return rgbTuple_setCol(self->color, args);
+ return rgbTuple_setCol( self->color, args );
}
/* lamp.addScriptLink */
-static PyObject *Lamp_addScriptLink (BPy_Lamp *self, PyObject *args)
+static PyObject *Lamp_addScriptLink( BPy_Lamp * self, PyObject * args )
{
Lamp *lamp = self->lamp;
ScriptLink *slink = NULL;
- slink = &(lamp)->scriptlink;
+ slink = &( lamp )->scriptlink;
- if (!EXPP_addScriptLink(slink, args, 0))
- return EXPP_incr_ret (Py_None);
- else return NULL;
+ if( !EXPP_addScriptLink( slink, args, 0 ) )
+ return EXPP_incr_ret( Py_None );
+ else
+ return NULL;
}
/* lamp.clearScriptLinks */
-static PyObject *Lamp_clearScriptLinks (BPy_Lamp *self)
+static PyObject *Lamp_clearScriptLinks( BPy_Lamp * self )
{
Lamp *lamp = self->lamp;
ScriptLink *slink = NULL;
- slink = &(lamp)->scriptlink;
+ slink = &( lamp )->scriptlink;
- return EXPP_incr_ret(Py_BuildValue("i", EXPP_clearScriptLinks (slink)));
+ return EXPP_incr_ret( Py_BuildValue
+ ( "i", EXPP_clearScriptLinks( slink ) ) );
}
/* mat.getScriptLinks */
-static PyObject *Lamp_getScriptLinks (BPy_Lamp *self, PyObject *args)
+static PyObject *Lamp_getScriptLinks( BPy_Lamp * self, PyObject * args )
{
Lamp *lamp = self->lamp;
ScriptLink *slink = NULL;
PyObject *ret = NULL;
- slink = &(lamp)->scriptlink;
+ slink = &( lamp )->scriptlink;
- ret = EXPP_getScriptLinks(slink, args, 0);
+ ret = EXPP_getScriptLinks( slink, args, 0 );
- if (ret) return ret;
- else return NULL;
+ if( ret )
+ return ret;
+ else
+ return NULL;
}
/*****************************************************************************/
@@ -1174,10 +1227,10 @@ static PyObject *Lamp_getScriptLinks (BPy_Lamp *self, PyObject *args)
/* Description: This is a callback function for the BPy_Lamp type. It is */
/* the destructor function. */
/*****************************************************************************/
-static void Lamp_dealloc (BPy_Lamp *self)
+static void Lamp_dealloc( BPy_Lamp * self )
{
- Py_DECREF (self->color);
- PyObject_DEL (self);
+ Py_DECREF( self->color );
+ PyObject_DEL( self );
}
/*****************************************************************************/
@@ -1186,93 +1239,95 @@ static void Lamp_dealloc (BPy_Lamp *self)
/* the function that accesses BPy_Lamp member variables and */
/* methods. */
/*****************************************************************************/
-static PyObject *Lamp_getAttr (BPy_Lamp *self, char *name)
+static PyObject *Lamp_getAttr( BPy_Lamp * self, char *name )
{
- PyObject *attr = Py_None;
-
- if (strcmp(name, "name") == 0)
- attr = PyString_FromString(self->lamp->id.name+2);
- else if (strcmp(name, "type") == 0)
- attr = PyInt_FromLong(self->lamp->type);
- else if (strcmp(name, "mode") == 0)
- attr = PyInt_FromLong(self->lamp->mode);
- else if (strcmp(name, "samples") == 0)
- attr = PyInt_FromLong(self->lamp->samp);
- else if (strcmp(name, "bufferSize") == 0)
- attr = PyInt_FromLong(self->lamp->bufsize);
- else if (strcmp(name, "haloStep") == 0)
- attr = PyInt_FromLong(self->lamp->shadhalostep);
- else if (strcmp(name, "R") == 0)
- attr = PyFloat_FromDouble(self->lamp->r);
- else if (strcmp(name, "G") == 0)
- attr = PyFloat_FromDouble(self->lamp->g);
- else if (strcmp(name, "B") == 0)
- attr = PyFloat_FromDouble(self->lamp->b);
- else if (strcmp(name, "col") == 0)
- attr = Lamp_getCol(self);
- else if (strcmp(name, "energy") == 0)
- attr = PyFloat_FromDouble(self->lamp->energy);
- else if (strcmp(name, "dist") == 0)
- attr = PyFloat_FromDouble(self->lamp->dist);
- else if (strcmp(name, "spotSize") == 0)
- attr = PyFloat_FromDouble(self->lamp->spotsize);
- else if (strcmp(name, "spotBlend") == 0)
- attr = PyFloat_FromDouble(self->lamp->spotblend);
- else if (strcmp(name, "clipStart") == 0)
- attr = PyFloat_FromDouble(self->lamp->clipsta);
- else if (strcmp(name, "clipEnd") == 0)
- attr = PyFloat_FromDouble(self->lamp->clipend);
- else if (strcmp(name, "bias") == 0)
- attr = PyFloat_FromDouble(self->lamp->bias);
- else if (strcmp(name, "softness") == 0)
- attr = PyFloat_FromDouble(self->lamp->soft);
- else if (strcmp(name, "haloInt") == 0)
- attr = PyFloat_FromDouble(self->lamp->haint);
- else if (strcmp(name, "quad1") == 0)
- attr = PyFloat_FromDouble(self->lamp->att1);
- else if (strcmp(name, "quad2") == 0)
- attr = PyFloat_FromDouble(self->lamp->att2);
-
- else if (strcmp(name, "Types") == 0) {
- attr = Py_BuildValue("{s:h,s:h,s:h,s:h}",
- "Lamp", EXPP_LAMP_TYPE_LAMP,
- "Sun" , EXPP_LAMP_TYPE_SUN,
- "Spot", EXPP_LAMP_TYPE_SPOT,
- "Hemi", EXPP_LAMP_TYPE_HEMI);
- }
-
- else if (strcmp(name, "Modes") == 0) {
- attr = Py_BuildValue("{s:h,s:h,s:h,s:h,s:h,s:h,s:h,s:h,s:h,s:h}",
- "Shadows", EXPP_LAMP_MODE_SHADOWS,
- "Halo", EXPP_LAMP_MODE_HALO,
- "Layer", EXPP_LAMP_MODE_LAYER,
- "Quad", EXPP_LAMP_MODE_QUAD,
- "Negative", EXPP_LAMP_MODE_NEGATIVE,
- "OnlyShadow", EXPP_LAMP_MODE_ONLYSHADOW,
- "Sphere", EXPP_LAMP_MODE_SPHERE,
- "Square", EXPP_LAMP_MODE_SQUARE,
- "NoDiffuse", EXPP_LAMP_MODE_NODIFFUSE,
- "NoSpecular", EXPP_LAMP_MODE_NOSPECULAR);
- }
-
- else if (strcmp(name, "__members__") == 0) {
- /* 23 entries */
- attr = Py_BuildValue("[s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s]",
- "name", "type", "mode", "samples", "bufferSize",
- "haloStep", "R", "G", "B", "energy", "dist",
- "spotSize", "spotBlend", "clipStart", "clipEnd",
- "bias", "softness", "haloInt", "quad1", "quad2",
- "Types", "Modes", "col");
- }
-
- if (!attr)
- return (EXPP_ReturnPyObjError (PyExc_MemoryError,
- "couldn't create PyObject"));
-
- if (attr != Py_None) return attr; /* member attribute found, return it */
-
- /* not an attribute, search the methods table */
- return Py_FindMethod(BPy_Lamp_methods, (PyObject *)self, name);
+ PyObject *attr = Py_None;
+
+ if( strcmp( name, "name" ) == 0 )
+ attr = PyString_FromString( self->lamp->id.name + 2 );
+ else if( strcmp( name, "type" ) == 0 )
+ attr = PyInt_FromLong( self->lamp->type );
+ else if( strcmp( name, "mode" ) == 0 )
+ attr = PyInt_FromLong( self->lamp->mode );
+ else if( strcmp( name, "samples" ) == 0 )
+ attr = PyInt_FromLong( self->lamp->samp );
+ else if( strcmp( name, "bufferSize" ) == 0 )
+ attr = PyInt_FromLong( self->lamp->bufsize );
+ else if( strcmp( name, "haloStep" ) == 0 )
+ attr = PyInt_FromLong( self->lamp->shadhalostep );
+ else if( strcmp( name, "R" ) == 0 )
+ attr = PyFloat_FromDouble( self->lamp->r );
+ else if( strcmp( name, "G" ) == 0 )
+ attr = PyFloat_FromDouble( self->lamp->g );
+ else if( strcmp( name, "B" ) == 0 )
+ attr = PyFloat_FromDouble( self->lamp->b );
+ else if( strcmp( name, "col" ) == 0 )
+ attr = Lamp_getCol( self );
+ else if( strcmp( name, "energy" ) == 0 )
+ attr = PyFloat_FromDouble( self->lamp->energy );
+ else if( strcmp( name, "dist" ) == 0 )
+ attr = PyFloat_FromDouble( self->lamp->dist );
+ else if( strcmp( name, "spotSize" ) == 0 )
+ attr = PyFloat_FromDouble( self->lamp->spotsize );
+ else if( strcmp( name, "spotBlend" ) == 0 )
+ attr = PyFloat_FromDouble( self->lamp->spotblend );
+ else if( strcmp( name, "clipStart" ) == 0 )
+ attr = PyFloat_FromDouble( self->lamp->clipsta );
+ else if( strcmp( name, "clipEnd" ) == 0 )
+ attr = PyFloat_FromDouble( self->lamp->clipend );
+ else if( strcmp( name, "bias" ) == 0 )
+ attr = PyFloat_FromDouble( self->lamp->bias );
+ else if( strcmp( name, "softness" ) == 0 )
+ attr = PyFloat_FromDouble( self->lamp->soft );
+ else if( strcmp( name, "haloInt" ) == 0 )
+ attr = PyFloat_FromDouble( self->lamp->haint );
+ else if( strcmp( name, "quad1" ) == 0 )
+ attr = PyFloat_FromDouble( self->lamp->att1 );
+ else if( strcmp( name, "quad2" ) == 0 )
+ attr = PyFloat_FromDouble( self->lamp->att2 );
+
+ else if( strcmp( name, "Types" ) == 0 ) {
+ attr = Py_BuildValue( "{s:h,s:h,s:h,s:h}",
+ "Lamp", EXPP_LAMP_TYPE_LAMP,
+ "Sun", EXPP_LAMP_TYPE_SUN,
+ "Spot", EXPP_LAMP_TYPE_SPOT,
+ "Hemi", EXPP_LAMP_TYPE_HEMI );
+ }
+
+ else if( strcmp( name, "Modes" ) == 0 ) {
+ attr = Py_BuildValue
+ ( "{s:h,s:h,s:h,s:h,s:h,s:h,s:h,s:h,s:h,s:h}",
+ "Shadows", EXPP_LAMP_MODE_SHADOWS, "Halo",
+ EXPP_LAMP_MODE_HALO, "Layer", EXPP_LAMP_MODE_LAYER,
+ "Quad", EXPP_LAMP_MODE_QUAD, "Negative",
+ EXPP_LAMP_MODE_NEGATIVE, "OnlyShadow",
+ EXPP_LAMP_MODE_ONLYSHADOW, "Sphere",
+ EXPP_LAMP_MODE_SPHERE, "Square",
+ EXPP_LAMP_MODE_SQUARE, "NoDiffuse",
+ EXPP_LAMP_MODE_NODIFFUSE, "NoSpecular",
+ EXPP_LAMP_MODE_NOSPECULAR );
+ }
+
+ else if( strcmp( name, "__members__" ) == 0 ) {
+ /* 23 entries */
+ attr = Py_BuildValue
+ ( "[s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s]",
+ "name", "type", "mode", "samples", "bufferSize",
+ "haloStep", "R", "G", "B", "energy", "dist",
+ "spotSize", "spotBlend", "clipStart", "clipEnd",
+ "bias", "softness", "haloInt", "quad1", "quad2",
+ "Types", "Modes", "col" );
+ }
+
+ if( !attr )
+ return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
+ "couldn't create PyObject" ) );
+
+ if( attr != Py_None )
+ return attr; /* member attribute found, return it */
+
+ /* not an attribute, search the methods table */
+ return Py_FindMethod( BPy_Lamp_methods, ( PyObject * ) self, name );
}
/*****************************************************************************/
@@ -1281,79 +1336,80 @@ static PyObject *Lamp_getAttr (BPy_Lamp *self, char *name)
/* function that changes Lamp Data members values. If this */
/* data is linked to a Blender Lamp, it also gets updated. */
/*****************************************************************************/
-static int Lamp_setAttr (BPy_Lamp *self, char *name, PyObject *value)
+static int Lamp_setAttr( BPy_Lamp * self, char *name, PyObject * value )
{
- PyObject *valtuple;
- PyObject *error = NULL;
-
- valtuple = Py_BuildValue("(O)", value); /*the set* functions expect a tuple*/
-
- if (!valtuple)
- return EXPP_ReturnIntError(PyExc_MemoryError,
- "LampSetAttr: couldn't create tuple");
-
- if (strcmp (name, "name") == 0)
- error = Lamp_setName (self, valtuple);
- else if (strcmp (name, "type") == 0)
- error = Lamp_setIntType (self, valtuple); /* special case */
- else if (strcmp (name, "mode") == 0)
- error = Lamp_setIntMode (self, valtuple); /* special case */
- else if (strcmp (name, "samples") == 0)
- error = Lamp_setSamples (self, valtuple);
- else if (strcmp (name, "bufferSize") == 0)
- error = Lamp_setBufferSize (self, valtuple);
- else if (strcmp (name, "haloStep") == 0)
- error = Lamp_setHaloStep (self, valtuple);
- else if (strcmp (name, "R") == 0)
- error = Lamp_setColorComponent (self, "R", valtuple);
- else if (strcmp (name, "G") == 0)
- error = Lamp_setColorComponent (self, "G", valtuple);
- else if (strcmp (name, "B") == 0)
- error = Lamp_setColorComponent (self, "B", valtuple);
- else if (strcmp (name, "energy") == 0)
- error = Lamp_setEnergy (self, valtuple);
- else if (strcmp (name, "dist") == 0)
- error = Lamp_setDist (self, valtuple);
- else if (strcmp (name, "spotSize") == 0)
- error = Lamp_setSpotSize (self, valtuple);
- else if (strcmp (name, "spotBlend") == 0)
- error = Lamp_setSpotBlend (self, valtuple);
- else if (strcmp (name, "clipStart") == 0)
- error = Lamp_setClipStart (self, valtuple);
- else if (strcmp (name, "clipEnd") == 0)
- error = Lamp_setClipEnd (self, valtuple);
- else if (strcmp (name, "bias") == 0)
- error = Lamp_setBias (self, valtuple);
- else if (strcmp (name, "softness") == 0)
- error = Lamp_setSoftness (self, valtuple);
- else if (strcmp (name, "haloInt") == 0)
- error = Lamp_setHaloInt (self, valtuple);
- else if (strcmp (name, "quad1") == 0)
- error = Lamp_setQuad1 (self, valtuple);
- else if (strcmp (name, "quad2") == 0)
- error = Lamp_setQuad2 (self, valtuple);
- else if (strcmp (name, "col") == 0)
- error = Lamp_setCol (self, valtuple);
-
- else { /* Error */
- Py_DECREF(valtuple);
-
- if ((strcmp (name, "Types") == 0) || /* user tried to change a */
- (strcmp (name, "Modes") == 0)) /* constant dict type ... */
- return (EXPP_ReturnIntError (PyExc_AttributeError,
- "constant dictionary -- cannot be changed"));
-
- else /* ... or no member with the given name was found */
- return (EXPP_ReturnIntError (PyExc_AttributeError,
- "attribute not found"));
- }
-
- Py_DECREF(valtuple);
-
- if (error != Py_None) return -1;
-
- Py_DECREF(Py_None); /* was incref'ed by the called Lamp_set* function */
- return 0; /* normal exit */
+ PyObject *valtuple;
+ PyObject *error = NULL;
+
+ valtuple = Py_BuildValue( "(O)", value ); /*the set* functions expect a tuple */
+
+ if( !valtuple )
+ return EXPP_ReturnIntError( PyExc_MemoryError,
+ "LampSetAttr: couldn't create tuple" );
+
+ if( strcmp( name, "name" ) == 0 )
+ error = Lamp_setName( self, valtuple );
+ else if( strcmp( name, "type" ) == 0 )
+ error = Lamp_setIntType( self, valtuple ); /* special case */
+ else if( strcmp( name, "mode" ) == 0 )
+ error = Lamp_setIntMode( self, valtuple ); /* special case */
+ else if( strcmp( name, "samples" ) == 0 )
+ error = Lamp_setSamples( self, valtuple );
+ else if( strcmp( name, "bufferSize" ) == 0 )
+ error = Lamp_setBufferSize( self, valtuple );
+ else if( strcmp( name, "haloStep" ) == 0 )
+ error = Lamp_setHaloStep( self, valtuple );
+ else if( strcmp( name, "R" ) == 0 )
+ error = Lamp_setColorComponent( self, "R", valtuple );
+ else if( strcmp( name, "G" ) == 0 )
+ error = Lamp_setColorComponent( self, "G", valtuple );
+ else if( strcmp( name, "B" ) == 0 )
+ error = Lamp_setColorComponent( self, "B", valtuple );
+ else if( strcmp( name, "energy" ) == 0 )
+ error = Lamp_setEnergy( self, valtuple );
+ else if( strcmp( name, "dist" ) == 0 )
+ error = Lamp_setDist( self, valtuple );
+ else if( strcmp( name, "spotSize" ) == 0 )
+ error = Lamp_setSpotSize( self, valtuple );
+ else if( strcmp( name, "spotBlend" ) == 0 )
+ error = Lamp_setSpotBlend( self, valtuple );
+ else if( strcmp( name, "clipStart" ) == 0 )
+ error = Lamp_setClipStart( self, valtuple );
+ else if( strcmp( name, "clipEnd" ) == 0 )
+ error = Lamp_setClipEnd( self, valtuple );
+ else if( strcmp( name, "bias" ) == 0 )
+ error = Lamp_setBias( self, valtuple );
+ else if( strcmp( name, "softness" ) == 0 )
+ error = Lamp_setSoftness( self, valtuple );
+ else if( strcmp( name, "haloInt" ) == 0 )
+ error = Lamp_setHaloInt( self, valtuple );
+ else if( strcmp( name, "quad1" ) == 0 )
+ error = Lamp_setQuad1( self, valtuple );
+ else if( strcmp( name, "quad2" ) == 0 )
+ error = Lamp_setQuad2( self, valtuple );
+ else if( strcmp( name, "col" ) == 0 )
+ error = Lamp_setCol( self, valtuple );
+
+ else { /* Error */
+ Py_DECREF( valtuple );
+
+ if( ( strcmp( name, "Types" ) == 0 ) || /* user tried to change a */
+ ( strcmp( name, "Modes" ) == 0 ) ) /* constant dict type ... */
+ return ( EXPP_ReturnIntError( PyExc_AttributeError,
+ "constant dictionary -- cannot be changed" ) );
+
+ else /* ... or no member with the given name was found */
+ return ( EXPP_ReturnIntError( PyExc_AttributeError,
+ "attribute not found" ) );
+ }
+
+ Py_DECREF( valtuple );
+
+ if( error != Py_None )
+ return -1;
+
+ Py_DECREF( Py_None ); /* was incref'ed by the called Lamp_set* function */
+ return 0; /* normal exit */
}
/*****************************************************************************/
@@ -1364,10 +1420,10 @@ static int Lamp_setAttr (BPy_Lamp *self, char *name, PyObject *value)
/* they don't point to the same Blender Lamp struct. */
/* In Python it becomes 1 if they are equal, 0 otherwise. */
/*****************************************************************************/
-static int Lamp_compare (BPy_Lamp *a, BPy_Lamp *b)
+static int Lamp_compare( BPy_Lamp * a, BPy_Lamp * b )
{
- Lamp *pa = a->lamp, *pb = b->lamp;
- return (pa == pb) ? 0:-1;
+ Lamp *pa = a->lamp, *pb = b->lamp;
+ return ( pa == pb ) ? 0 : -1;
}
/*****************************************************************************/
@@ -1375,80 +1431,75 @@ static int Lamp_compare (BPy_Lamp *a, BPy_Lamp *b)
/* Description: This is a callback function for the BPy_Lamp type. It */
/* builds a meaninful string to represent lamp objects. */
/*****************************************************************************/
-static PyObject *Lamp_repr (BPy_Lamp *self)
+static PyObject *Lamp_repr( BPy_Lamp * self )
{
- return PyString_FromFormat("[Lamp \"%s\"]", self->lamp->id.name+2);
+ return PyString_FromFormat( "[Lamp \"%s\"]", self->lamp->id.name + 2 );
}
-static PyObject *
-Lamp_getIpo (BPy_Lamp * self)
+static PyObject *Lamp_getIpo( BPy_Lamp * self )
{
- struct Ipo *ipo = self->lamp->ipo;
+ struct Ipo *ipo = self->lamp->ipo;
- if (!ipo)
- {
- Py_INCREF (Py_None);
- return Py_None;
- }
+ if( !ipo ) {
+ Py_INCREF( Py_None );
+ return Py_None;
+ }
- return Ipo_CreatePyObject (ipo);
+ return Ipo_CreatePyObject( ipo );
}
extern PyTypeObject Ipo_Type;
-static PyObject *
-Lamp_setIpo (BPy_Lamp * self, PyObject * args)
+static PyObject *Lamp_setIpo( BPy_Lamp * self, PyObject * args )
{
- PyObject *pyipo = 0;
- Ipo *ipo = NULL;
- Ipo *oldipo;
+ 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");
+ if( !PyArg_ParseTuple( args, "O!", &Ipo_Type, &pyipo ) )
+ return EXPP_ReturnPyObjError( PyExc_TypeError,
+ "expected Ipo as argument" );
- ipo = Ipo_FromPyObject (pyipo);
+ ipo = Ipo_FromPyObject( pyipo );
- if (!ipo)
- return EXPP_ReturnPyObjError (PyExc_RuntimeError, "null ipo!");
+ 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");
+ 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--;
- }
+ oldipo = self->lamp->ipo;
+ if( oldipo ) {
+ ID *id = &oldipo->id;
+ if( id->us > 0 )
+ id->us--;
+ }
- ((ID *) & ipo->id)->us++;
+ ( ( ID * ) & ipo->id )->us++;
- self->lamp->ipo = ipo;
+ self->lamp->ipo = ipo;
- Py_INCREF (Py_None);
- return Py_None;
+ Py_INCREF( Py_None );
+ return Py_None;
}
-static PyObject *
-Lamp_clearIpo (BPy_Lamp * self)
+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;
+ 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;
}