diff options
author | Willian Padovani Germano <wpgermano@gmail.com> | 2003-05-20 07:56:41 +0400 |
---|---|---|
committer | Willian Padovani Germano <wpgermano@gmail.com> | 2003-05-20 07:56:41 +0400 |
commit | 4ca6f542a216260314eaca71d8f4af109a9c1cdf (patch) | |
tree | a9253668408fc9c4440611be0310f417ddba6ade /source/blender/python/api2_2x/Lamp.c | |
parent | 1a87f3a4aa7045d2f7e4c85ed2e5d0ae117c71b0 (diff) |
* Implemented the 3 functions needed by the Object module:
For Camera and Lamp
* Minor updates, NMesh is not finished yet.
Diffstat (limited to 'source/blender/python/api2_2x/Lamp.c')
-rw-r--r-- | source/blender/python/api2_2x/Lamp.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/source/blender/python/api2_2x/Lamp.c b/source/blender/python/api2_2x/Lamp.c index 5ae29a75196..111d01266cf 100644 --- a/source/blender/python/api2_2x/Lamp.c +++ b/source/blender/python/api2_2x/Lamp.c @@ -157,6 +157,7 @@ static PyObject *M_Lamp_Get(PyObject *self, PyObject *args) /*****************************************************************************/ /* Function: M_Lamp_Init */ /*****************************************************************************/ +/* Needed by the Blender module, to register the Blender.Lamp submodule */ PyObject *M_Lamp_Init (void) { PyObject *submodule; @@ -168,6 +169,48 @@ PyObject *M_Lamp_Init (void) return (submodule); } +/* Three Python Lamp_Type helper functions needed by the Object module: */ + +/*****************************************************************************/ +/* Function: Lamp_createPyObject */ +/* Description: This function will create a new C_Lamp from an existing */ +/* Blender camera structure. */ +/*****************************************************************************/ +PyObject *Lamp_createPyObject (Lamp *lamp) +{ + C_Lamp *pylamp; + + pylamp = (C_Lamp *)PyObject_NEW (C_Lamp, &Lamp_Type); + + if (!pylamp) + return EXPP_ReturnPyObjError (PyExc_MemoryError, + "couldn't create C_Lamp object"); + + pylamp->lamp = lamp; + + return (PyObject *)pylamp; +} + +/*****************************************************************************/ +/* Function: Lamp_checkPyObject */ +/* Description: This function returns true when the given PyObject is of the */ +/* type Lamp. Otherwise it will return false. */ +/*****************************************************************************/ +int Lamp_checkPyObject (PyObject *pyobj) +{ + return (pyobj->ob_type == &Lamp_Type); +} + +/*****************************************************************************/ +/* Function: Lamp_fromPyObject */ +/* Description: This function returns the Blender lamp from the given */ +/* PyObject. */ +/*****************************************************************************/ +Lamp *Lamp_fromPyObject (PyObject *pyobj) +{ + return ((C_Lamp *)pyobj)->lamp; +} + /*****************************************************************************/ /* Python C_Lamp methods: */ /*****************************************************************************/ |