* Added submodule Blender.Material
* Added submodule Blender.Types: Blender Type definitions can't be static anymore. * Some cleanup of now unused defines in Camera.h and Lamp.h
This commit is contained in:
@@ -64,7 +64,7 @@ static Buffer *make_buffer(int type, int ndimensions, int *dimensions)
|
|||||||
|
|
||||||
buf= MEM_mallocN(length*size, "Buffer buffer");
|
buf= MEM_mallocN(length*size, "Buffer buffer");
|
||||||
|
|
||||||
buffer= (Buffer *) PyObject_NEW(Buffer, &Buffer_Type);
|
buffer= (Buffer *) PyObject_NEW(Buffer, &buffer_Type);
|
||||||
buffer->parent= NULL;
|
buffer->parent= NULL;
|
||||||
buffer->ndimensions= ndimensions;
|
buffer->ndimensions= ndimensions;
|
||||||
buffer->dimensions= dimensions;
|
buffer->dimensions= dimensions;
|
||||||
@@ -170,7 +170,7 @@ static PyObject *Buffer_item(PyObject *self, int i)
|
|||||||
}
|
}
|
||||||
size= type_size(buf->type);
|
size= type_size(buf->type);
|
||||||
|
|
||||||
newbuf= (Buffer *) PyObject_NEW(Buffer, &Buffer_Type);
|
newbuf= (Buffer *) PyObject_NEW(Buffer, &buffer_Type);
|
||||||
|
|
||||||
Py_INCREF(self);
|
Py_INCREF(self);
|
||||||
newbuf->parent= self;
|
newbuf->parent= self;
|
||||||
|
@@ -135,7 +135,7 @@ static PyObject *Buffer_dimensions(PyObject *self);
|
|||||||
static PyObject *Buffer_getattr(PyObject *self, char *name);
|
static PyObject *Buffer_getattr(PyObject *self, char *name);
|
||||||
static PyObject *Buffer_repr(PyObject *self);
|
static PyObject *Buffer_repr(PyObject *self);
|
||||||
|
|
||||||
PyTypeObject Buffer_Type = {
|
PyTypeObject buffer_Type = {
|
||||||
PyObject_HEAD_INIT(&PyType_Type)
|
PyObject_HEAD_INIT(&PyType_Type)
|
||||||
0, /*ob_size*/
|
0, /*ob_size*/
|
||||||
"Buffer", /*tp_name*/
|
"Buffer", /*tp_name*/
|
||||||
@@ -179,7 +179,7 @@ PyTypeObject Buffer_Type = {
|
|||||||
|
|
||||||
#define buffer_str "O!"
|
#define buffer_str "O!"
|
||||||
#define buffer_var(number) (bgl_buffer##number)->buf.asvoid
|
#define buffer_var(number) (bgl_buffer##number)->buf.asvoid
|
||||||
#define buffer_ref(number) &Buffer_Type, &bgl_buffer##number
|
#define buffer_ref(number) &buffer_Type, &bgl_buffer##number
|
||||||
#define buffer_def(number) Buffer *bgl_buffer##number
|
#define buffer_def(number) Buffer *bgl_buffer##number
|
||||||
|
|
||||||
/* GL Pointer fields, handled by buffer type */
|
/* GL Pointer fields, handled by buffer type */
|
||||||
@@ -187,62 +187,62 @@ PyTypeObject Buffer_Type = {
|
|||||||
|
|
||||||
#define GLbooleanP_str "O!"
|
#define GLbooleanP_str "O!"
|
||||||
#define GLbooleanP_var(number) (bgl_buffer##number)->buf.asvoid
|
#define GLbooleanP_var(number) (bgl_buffer##number)->buf.asvoid
|
||||||
#define GLbooleanP_ref(number) &Buffer_Type, &bgl_buffer##number
|
#define GLbooleanP_ref(number) &buffer_Type, &bgl_buffer##number
|
||||||
#define GLbooleanP_def(number) Buffer *bgl_buffer##number
|
#define GLbooleanP_def(number) Buffer *bgl_buffer##number
|
||||||
|
|
||||||
#define GLbyteP_str "O!"
|
#define GLbyteP_str "O!"
|
||||||
#define GLbyteP_var(number) (bgl_buffer##number)->buf.asvoid
|
#define GLbyteP_var(number) (bgl_buffer##number)->buf.asvoid
|
||||||
#define GLbyteP_ref(number) &Buffer_Type, &bgl_buffer##number
|
#define GLbyteP_ref(number) &buffer_Type, &bgl_buffer##number
|
||||||
#define GLbyteP_def(number) Buffer *bgl_buffer##number
|
#define GLbyteP_def(number) Buffer *bgl_buffer##number
|
||||||
|
|
||||||
#define GLubyteP_str "O!"
|
#define GLubyteP_str "O!"
|
||||||
#define GLubyteP_var(number) (bgl_buffer##number)->buf.asvoid
|
#define GLubyteP_var(number) (bgl_buffer##number)->buf.asvoid
|
||||||
#define GLubyteP_ref(number) &Buffer_Type, &bgl_buffer##number
|
#define GLubyteP_ref(number) &buffer_Type, &bgl_buffer##number
|
||||||
#define GLubyteP_def(number) Buffer *bgl_buffer##number
|
#define GLubyteP_def(number) Buffer *bgl_buffer##number
|
||||||
|
|
||||||
#define GLintP_str "O!"
|
#define GLintP_str "O!"
|
||||||
#define GLintP_var(number) (bgl_buffer##number)->buf.asvoid
|
#define GLintP_var(number) (bgl_buffer##number)->buf.asvoid
|
||||||
#define GLintP_ref(number) &Buffer_Type, &bgl_buffer##number
|
#define GLintP_ref(number) &buffer_Type, &bgl_buffer##number
|
||||||
#define GLintP_def(number) Buffer *bgl_buffer##number
|
#define GLintP_def(number) Buffer *bgl_buffer##number
|
||||||
|
|
||||||
#define GLuintP_str "O!"
|
#define GLuintP_str "O!"
|
||||||
#define GLuintP_var(number) (bgl_buffer##number)->buf.asvoid
|
#define GLuintP_var(number) (bgl_buffer##number)->buf.asvoid
|
||||||
#define GLuintP_ref(number) &Buffer_Type, &bgl_buffer##number
|
#define GLuintP_ref(number) &buffer_Type, &bgl_buffer##number
|
||||||
#define GLuintP_def(number) Buffer *bgl_buffer##number
|
#define GLuintP_def(number) Buffer *bgl_buffer##number
|
||||||
|
|
||||||
#define GLshortP_str "O!"
|
#define GLshortP_str "O!"
|
||||||
#define GLshortP_var(number) (bgl_buffer##number)->buf.asvoid
|
#define GLshortP_var(number) (bgl_buffer##number)->buf.asvoid
|
||||||
#define GLshortP_ref(number) &Buffer_Type, &bgl_buffer##number
|
#define GLshortP_ref(number) &buffer_Type, &bgl_buffer##number
|
||||||
#define GLshortP_def(number) Buffer *bgl_buffer##number
|
#define GLshortP_def(number) Buffer *bgl_buffer##number
|
||||||
|
|
||||||
#define GLushortP_str "O!"
|
#define GLushortP_str "O!"
|
||||||
#define GLushortP_var(number) (bgl_buffer##number)->buf.asvoid
|
#define GLushortP_var(number) (bgl_buffer##number)->buf.asvoid
|
||||||
#define GLushortP_ref(number) &Buffer_Type, &bgl_buffer##number
|
#define GLushortP_ref(number) &buffer_Type, &bgl_buffer##number
|
||||||
#define GLushortP_def(number) Buffer *bgl_buffer##number
|
#define GLushortP_def(number) Buffer *bgl_buffer##number
|
||||||
|
|
||||||
#define GLfloatP_str "O!"
|
#define GLfloatP_str "O!"
|
||||||
#define GLfloatP_var(number) (bgl_buffer##number)->buf.asvoid
|
#define GLfloatP_var(number) (bgl_buffer##number)->buf.asvoid
|
||||||
#define GLfloatP_ref(number) &Buffer_Type, &bgl_buffer##number
|
#define GLfloatP_ref(number) &buffer_Type, &bgl_buffer##number
|
||||||
#define GLfloatP_def(number) Buffer *bgl_buffer##number
|
#define GLfloatP_def(number) Buffer *bgl_buffer##number
|
||||||
|
|
||||||
#define GLdoubleP_str "O!"
|
#define GLdoubleP_str "O!"
|
||||||
#define GLdoubleP_var(number) (bgl_buffer##number)->buf.asvoid
|
#define GLdoubleP_var(number) (bgl_buffer##number)->buf.asvoid
|
||||||
#define GLdoubleP_ref(number) &Buffer_Type, &bgl_buffer##number
|
#define GLdoubleP_ref(number) &buffer_Type, &bgl_buffer##number
|
||||||
#define GLdoubleP_def(number) Buffer *bgl_buffer##number
|
#define GLdoubleP_def(number) Buffer *bgl_buffer##number
|
||||||
|
|
||||||
#define GLclampfP_str "O!"
|
#define GLclampfP_str "O!"
|
||||||
#define GLclampfP_var(number) (bgl_buffer##number)->buf.asvoid
|
#define GLclampfP_var(number) (bgl_buffer##number)->buf.asvoid
|
||||||
#define GLclampfP_ref(number) &Buffer_Type, &bgl_buffer##number
|
#define GLclampfP_ref(number) &buffer_Type, &bgl_buffer##number
|
||||||
#define GLclampfP_def(number) Buffer *bgl_buffer##number
|
#define GLclampfP_def(number) Buffer *bgl_buffer##number
|
||||||
|
|
||||||
#define GLvoidP_str "O!"
|
#define GLvoidP_str "O!"
|
||||||
#define GLvoidP_var(number) (bgl_buffer##number)->buf.asvoid
|
#define GLvoidP_var(number) (bgl_buffer##number)->buf.asvoid
|
||||||
#define GLvoidP_ref(number) &Buffer_Type, &bgl_buffer##number
|
#define GLvoidP_ref(number) &buffer_Type, &bgl_buffer##number
|
||||||
#define GLvoidP_def(number) Buffer *bgl_buffer##number
|
#define GLvoidP_def(number) Buffer *bgl_buffer##number
|
||||||
|
|
||||||
#define buffer_str "O!"
|
#define buffer_str "O!"
|
||||||
#define buffer_var(number) (bgl_buffer##number)->buf.asvoid
|
#define buffer_var(number) (bgl_buffer##number)->buf.asvoid
|
||||||
#define buffer_ref(number) &Buffer_Type, &bgl_buffer##number
|
#define buffer_ref(number) &buffer_Type, &bgl_buffer##number
|
||||||
#define buffer_def(number) Buffer *bgl_buffer##number
|
#define buffer_def(number) Buffer *bgl_buffer##number
|
||||||
|
|
||||||
/*@The standard GL typedefs are used as prototypes, we can't
|
/*@The standard GL typedefs are used as prototypes, we can't
|
||||||
|
@@ -215,7 +215,9 @@ void M_Blender_Init (void)
|
|||||||
dict = PyModule_GetDict (module);
|
dict = PyModule_GetDict (module);
|
||||||
g_blenderdict = dict;
|
g_blenderdict = dict;
|
||||||
PyDict_SetItemString (dict, "Object", M_Object_Init());
|
PyDict_SetItemString (dict, "Object", M_Object_Init());
|
||||||
|
PyDict_SetItemString (dict, "Types", M_Types_Init());
|
||||||
PyDict_SetItemString (dict, "NMesh", M_NMesh_Init());
|
PyDict_SetItemString (dict, "NMesh", M_NMesh_Init());
|
||||||
|
PyDict_SetItemString (dict, "Material", M_Material_Init());
|
||||||
PyDict_SetItemString (dict, "Camera", M_Camera_Init());
|
PyDict_SetItemString (dict, "Camera", M_Camera_Init());
|
||||||
PyDict_SetItemString (dict, "Lamp", M_Lamp_Init());
|
PyDict_SetItemString (dict, "Lamp", M_Lamp_Init());
|
||||||
PyDict_SetItemString (dict, "Curve", M_Curve_Init());
|
PyDict_SetItemString (dict, "Curve", M_Curve_Init());
|
||||||
@@ -224,6 +226,6 @@ void M_Blender_Init (void)
|
|||||||
PyDict_SetItemString (dict, "Draw", M_Draw_Init());
|
PyDict_SetItemString (dict, "Draw", M_Draw_Init());
|
||||||
PyDict_SetItemString (dict, "BGL", M_BGL_Init());
|
PyDict_SetItemString (dict, "BGL", M_BGL_Init());
|
||||||
PyDict_SetItemString (dict, "Text", M_Text_Init());
|
PyDict_SetItemString (dict, "Text", M_Text_Init());
|
||||||
// PyDict_SetItemString (dict, "Effect", M_Text_Init());
|
/* PyDict_SetItemString (dict, "Effect", M_Effect_Init()); */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -57,20 +57,14 @@
|
|||||||
#define EXPP_CAM_MODE_SHOWLIMITS 1
|
#define EXPP_CAM_MODE_SHOWLIMITS 1
|
||||||
#define EXPP_CAM_MODE_SHOWMIST 2
|
#define EXPP_CAM_MODE_SHOWMIST 2
|
||||||
|
|
||||||
/* Camera default and MIN, MAX values */
|
/* Camera MIN, MAX values */
|
||||||
|
|
||||||
#define EXPP_CAM_TYPE EXPP_CAM_TYPE_PERSP
|
|
||||||
#define EXPP_CAM_MODE 0
|
|
||||||
#define EXPP_CAM_LENS 35.0
|
|
||||||
#define EXPP_CAM_LENS_MIN 1.0
|
#define EXPP_CAM_LENS_MIN 1.0
|
||||||
#define EXPP_CAM_LENS_MAX 250.0
|
#define EXPP_CAM_LENS_MAX 250.0
|
||||||
#define EXPP_CAM_CLIPSTART 0.10
|
|
||||||
#define EXPP_CAM_CLIPSTART_MIN 0.00
|
#define EXPP_CAM_CLIPSTART_MIN 0.00
|
||||||
#define EXPP_CAM_CLIPSTART_MAX 100.00
|
#define EXPP_CAM_CLIPSTART_MAX 100.00
|
||||||
#define EXPP_CAM_CLIPEND 100.0
|
|
||||||
#define EXPP_CAM_CLIPEND_MIN 1.0
|
#define EXPP_CAM_CLIPEND_MIN 1.0
|
||||||
#define EXPP_CAM_CLIPEND_MAX 5000.0
|
#define EXPP_CAM_CLIPEND_MAX 5000.0
|
||||||
#define EXPP_CAM_DRAWSIZE 0.5
|
|
||||||
#define EXPP_CAM_DRAWSIZE_MIN 0.1
|
#define EXPP_CAM_DRAWSIZE_MIN 0.1
|
||||||
#define EXPP_CAM_DRAWSIZE_MAX 10.0
|
#define EXPP_CAM_DRAWSIZE_MAX 10.0
|
||||||
|
|
||||||
@@ -207,7 +201,7 @@ int CameraCheckPyObject (PyObject *pyobj);
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Python Camera_Type structure definition: */
|
/* Python Camera_Type structure definition: */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
static PyTypeObject Camera_Type =
|
PyTypeObject Camera_Type =
|
||||||
{
|
{
|
||||||
PyObject_HEAD_INIT(&PyType_Type)
|
PyObject_HEAD_INIT(&PyType_Type)
|
||||||
0, /* ob_size */
|
0, /* ob_size */
|
||||||
|
@@ -140,7 +140,7 @@ static PyObject *ImageRepr (C_Image *self);
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Python Image_Type structure definition: */
|
/* Python Image_Type structure definition: */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
static PyTypeObject Image_Type =
|
PyTypeObject Image_Type =
|
||||||
{
|
{
|
||||||
PyObject_HEAD_INIT(&PyType_Type)
|
PyObject_HEAD_INIT(&PyType_Type)
|
||||||
0, /* ob_size */
|
0, /* ob_size */
|
||||||
|
@@ -154,18 +154,60 @@ static PyObject *M_Lamp_Get(PyObject *self, PyObject *args)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject *M_Lamp_TypesDict (void)
|
||||||
|
{ /* create the Blender.Lamp.Types constant dict */
|
||||||
|
PyObject *Types = M_constant_New();
|
||||||
|
|
||||||
|
if (Types) {
|
||||||
|
C_constant *c = (C_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));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return Types;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject *M_Lamp_ModesDict (void)
|
||||||
|
{ /* create the Blender.Lamp.Modes constant dict */
|
||||||
|
PyObject *Modes = M_constant_New();
|
||||||
|
|
||||||
|
if (Modes) {
|
||||||
|
C_constant *c = (C_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));
|
||||||
|
}
|
||||||
|
|
||||||
|
return Modes;
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Function: M_Lamp_Init */
|
/* Function: M_Lamp_Init */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Needed by the Blender module, to register the Blender.Lamp submodule */
|
/* Needed by the Blender module, to register the Blender.Lamp submodule */
|
||||||
PyObject *M_Lamp_Init (void)
|
PyObject *M_Lamp_Init (void)
|
||||||
{
|
{
|
||||||
PyObject *submodule;
|
PyObject *submodule, *Types, *Modes;
|
||||||
|
|
||||||
printf ("In M_Lamp_Init()\n");
|
Types = M_Lamp_TypesDict ();
|
||||||
|
Modes = M_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);
|
||||||
|
|
||||||
return (submodule);
|
return (submodule);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -193,7 +235,7 @@ PyObject *Lamp_createPyObject (Lamp *lamp)
|
|||||||
rgb[1] = &lamp->g;
|
rgb[1] = &lamp->g;
|
||||||
rgb[2] = &lamp->b;
|
rgb[2] = &lamp->b;
|
||||||
|
|
||||||
pylamp->color = rgbTuple_New(rgb);
|
pylamp->color = (C_rgbTuple *)rgbTuple_New(rgb);
|
||||||
|
|
||||||
return (PyObject *)pylamp;
|
return (PyObject *)pylamp;
|
||||||
}
|
}
|
||||||
@@ -393,7 +435,7 @@ static PyObject *Lamp_getQuad2(C_Lamp *self)
|
|||||||
|
|
||||||
static PyObject *Lamp_getCol(C_Lamp *self)
|
static PyObject *Lamp_getCol(C_Lamp *self)
|
||||||
{
|
{
|
||||||
return rgbTuple_getCol((C_rgbTuple *)self->color);
|
return rgbTuple_getCol(self->color);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *Lamp_setName(C_Lamp *self, PyObject *args)
|
static PyObject *Lamp_setName(C_Lamp *self, PyObject *args)
|
||||||
@@ -461,7 +503,7 @@ static PyObject *Lamp_setIntType(C_Lamp *self, PyObject *args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *Lamp_setMode(C_Lamp *self, PyObject *args)
|
static PyObject *Lamp_setMode(C_Lamp *self, PyObject *args)
|
||||||
{/* Quad, Sphere, Shadows, Halo, Layer, Negative, OnlyShadow, Square */
|
{
|
||||||
char *m[8] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
|
char *m[8] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
|
||||||
short i, flag = 0;
|
short i, flag = 0;
|
||||||
|
|
||||||
@@ -524,12 +566,8 @@ static PyObject *Lamp_setSamples(C_Lamp *self, PyObject *args)
|
|||||||
return (EXPP_ReturnPyObjError (PyExc_TypeError,
|
return (EXPP_ReturnPyObjError (PyExc_TypeError,
|
||||||
"expected int argument in [1,16]"));
|
"expected int argument in [1,16]"));
|
||||||
|
|
||||||
if (value >= EXPP_LAMP_SAMPLES_MIN &&
|
self->lamp->samp = EXPP_ClampInt (value,
|
||||||
value <= EXPP_LAMP_SAMPLES_MAX)
|
EXPP_LAMP_SAMPLES_MIN, EXPP_LAMP_SAMPLES_MAX);
|
||||||
self->lamp->samp = value;
|
|
||||||
else
|
|
||||||
return (EXPP_ReturnPyObjError (PyExc_ValueError,
|
|
||||||
"expected int argument in [1,16]"));
|
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
return Py_None;
|
return Py_None;
|
||||||
@@ -543,12 +581,8 @@ static PyObject *Lamp_setBufferSize(C_Lamp *self, PyObject *args)
|
|||||||
return (EXPP_ReturnPyObjError (PyExc_TypeError,
|
return (EXPP_ReturnPyObjError (PyExc_TypeError,
|
||||||
"expected int argument in [512, 5120]"));
|
"expected int argument in [512, 5120]"));
|
||||||
|
|
||||||
if (value >= EXPP_LAMP_BUFFERSIZE_MIN &&
|
self->lamp->bufsize = EXPP_ClampInt (value,
|
||||||
value <= EXPP_LAMP_BUFFERSIZE_MAX)
|
EXPP_LAMP_BUFFERSIZE_MIN, EXPP_LAMP_BUFFERSIZE_MAX);
|
||||||
self->lamp->bufsize = value;
|
|
||||||
else
|
|
||||||
return (EXPP_ReturnPyObjError (PyExc_ValueError,
|
|
||||||
"expected int argument in [512, 5120]"));
|
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
return Py_None;
|
return Py_None;
|
||||||
@@ -562,33 +596,8 @@ static PyObject *Lamp_setHaloStep(C_Lamp *self, PyObject *args)
|
|||||||
return (EXPP_ReturnPyObjError (PyExc_TypeError,
|
return (EXPP_ReturnPyObjError (PyExc_TypeError,
|
||||||
"expected int argument in [0,12]"));
|
"expected int argument in [0,12]"));
|
||||||
|
|
||||||
if (value >= EXPP_LAMP_HALOSTEP_MIN &&
|
self->lamp->shadhalostep = EXPP_ClampInt (value,
|
||||||
value <= EXPP_LAMP_HALOSTEP_MAX)
|
EXPP_LAMP_HALOSTEP_MIN, EXPP_LAMP_HALOSTEP_MAX);
|
||||||
self->lamp->shadhalostep = value;
|
|
||||||
else
|
|
||||||
return (EXPP_ReturnPyObjError (PyExc_ValueError,
|
|
||||||
"expected int argument in [0,12]"));
|
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
|
||||||
return Py_None;
|
|
||||||
}
|
|
||||||
|
|
||||||
static PyObject *Lamp_setColorComponent(C_Lamp *self, char *key, PyObject *args)
|
|
||||||
{
|
|
||||||
float value;
|
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "f", &value))
|
|
||||||
return (EXPP_ReturnPyObjError (PyExc_TypeError,
|
|
||||||
"expected float argument in [0.0, 1.0]"));
|
|
||||||
|
|
||||||
value = EXPP_ClampFloat (value, 0.0, 1.0);
|
|
||||||
|
|
||||||
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);
|
Py_INCREF(Py_None);
|
||||||
return Py_None;
|
return Py_None;
|
||||||
@@ -602,8 +611,8 @@ static PyObject *Lamp_setEnergy(C_Lamp *self, PyObject *args)
|
|||||||
return (EXPP_ReturnPyObjError (PyExc_TypeError,
|
return (EXPP_ReturnPyObjError (PyExc_TypeError,
|
||||||
"expected float argument"));
|
"expected float argument"));
|
||||||
|
|
||||||
value = EXPP_ClampFloat (value, EXPP_LAMP_ENERGY_MIN, EXPP_LAMP_ENERGY_MAX);
|
self->lamp->energy = EXPP_ClampFloat (value,
|
||||||
self->lamp->energy = value;
|
EXPP_LAMP_ENERGY_MIN, EXPP_LAMP_ENERGY_MAX);
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
return Py_None;
|
return Py_None;
|
||||||
@@ -617,8 +626,8 @@ static PyObject *Lamp_setDist(C_Lamp *self, PyObject *args)
|
|||||||
return (EXPP_ReturnPyObjError (PyExc_TypeError,
|
return (EXPP_ReturnPyObjError (PyExc_TypeError,
|
||||||
"expected float argument"));
|
"expected float argument"));
|
||||||
|
|
||||||
value = EXPP_ClampFloat (value, EXPP_LAMP_DIST_MIN, EXPP_LAMP_DIST_MAX);
|
self->lamp->dist = EXPP_ClampFloat (value,
|
||||||
self->lamp->dist = value;
|
EXPP_LAMP_DIST_MIN, EXPP_LAMP_DIST_MAX);
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
return Py_None;
|
return Py_None;
|
||||||
@@ -632,9 +641,8 @@ static PyObject *Lamp_setSpotSize(C_Lamp *self, PyObject *args)
|
|||||||
return (EXPP_ReturnPyObjError (PyExc_TypeError,
|
return (EXPP_ReturnPyObjError (PyExc_TypeError,
|
||||||
"expected float argument"));
|
"expected float argument"));
|
||||||
|
|
||||||
value = EXPP_ClampFloat (value, EXPP_LAMP_SPOTSIZE_MIN,
|
self->lamp->spotsize = EXPP_ClampFloat (value,
|
||||||
EXPP_LAMP_SPOTSIZE_MAX);
|
EXPP_LAMP_SPOTSIZE_MIN, EXPP_LAMP_SPOTSIZE_MAX);
|
||||||
self->lamp->spotsize = value;
|
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
return Py_None;
|
return Py_None;
|
||||||
@@ -648,9 +656,8 @@ static PyObject *Lamp_setSpotBlend(C_Lamp *self, PyObject *args)
|
|||||||
return (EXPP_ReturnPyObjError (PyExc_TypeError,
|
return (EXPP_ReturnPyObjError (PyExc_TypeError,
|
||||||
"expected float argument"));
|
"expected float argument"));
|
||||||
|
|
||||||
value = EXPP_ClampFloat (value, EXPP_LAMP_SPOTBLEND_MIN,
|
self->lamp->spotblend = EXPP_ClampFloat (value,
|
||||||
EXPP_LAMP_SPOTBLEND_MAX);
|
EXPP_LAMP_SPOTBLEND_MIN, EXPP_LAMP_SPOTBLEND_MAX);
|
||||||
self->lamp->spotblend = value;
|
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
return Py_None;
|
return Py_None;
|
||||||
@@ -664,9 +671,8 @@ static PyObject *Lamp_setClipStart(C_Lamp *self, PyObject *args)
|
|||||||
return (EXPP_ReturnPyObjError (PyExc_TypeError,
|
return (EXPP_ReturnPyObjError (PyExc_TypeError,
|
||||||
"expected float argument"));
|
"expected float argument"));
|
||||||
|
|
||||||
value = EXPP_ClampFloat (value, EXPP_LAMP_CLIPSTART_MIN,
|
self->lamp->clipsta = EXPP_ClampFloat (value,
|
||||||
EXPP_LAMP_CLIPSTART_MAX);
|
EXPP_LAMP_CLIPSTART_MIN, EXPP_LAMP_CLIPSTART_MAX);
|
||||||
self->lamp->clipsta = value;
|
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
return Py_None;
|
return Py_None;
|
||||||
@@ -680,9 +686,8 @@ static PyObject *Lamp_setClipEnd(C_Lamp *self, PyObject *args)
|
|||||||
return (EXPP_ReturnPyObjError (PyExc_TypeError,
|
return (EXPP_ReturnPyObjError (PyExc_TypeError,
|
||||||
"expected float argument"));
|
"expected float argument"));
|
||||||
|
|
||||||
value = EXPP_ClampFloat (value, EXPP_LAMP_CLIPEND_MIN,
|
self->lamp->clipend = EXPP_ClampFloat (value,
|
||||||
EXPP_LAMP_CLIPEND_MAX);
|
EXPP_LAMP_CLIPEND_MIN, EXPP_LAMP_CLIPEND_MAX);
|
||||||
self->lamp->clipend = value;
|
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
return Py_None;
|
return Py_None;
|
||||||
@@ -696,8 +701,8 @@ static PyObject *Lamp_setBias(C_Lamp *self, PyObject *args)
|
|||||||
return (EXPP_ReturnPyObjError (PyExc_TypeError,
|
return (EXPP_ReturnPyObjError (PyExc_TypeError,
|
||||||
"expected float argument"));
|
"expected float argument"));
|
||||||
|
|
||||||
value = EXPP_ClampFloat (value, EXPP_LAMP_BIAS_MIN, EXPP_LAMP_BIAS_MAX);
|
self->lamp->bias = EXPP_ClampFloat (value,
|
||||||
self->lamp->bias = value;
|
EXPP_LAMP_BIAS_MIN, EXPP_LAMP_BIAS_MAX);
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
return Py_None;
|
return Py_None;
|
||||||
@@ -711,9 +716,8 @@ static PyObject *Lamp_setSoftness(C_Lamp *self, PyObject *args)
|
|||||||
return (EXPP_ReturnPyObjError (PyExc_TypeError,
|
return (EXPP_ReturnPyObjError (PyExc_TypeError,
|
||||||
"expected float argument"));
|
"expected float argument"));
|
||||||
|
|
||||||
value = EXPP_ClampFloat (value, EXPP_LAMP_SOFTNESS_MIN,
|
self->lamp->soft = EXPP_ClampFloat (value,
|
||||||
EXPP_LAMP_SOFTNESS_MAX);
|
EXPP_LAMP_SOFTNESS_MIN, EXPP_LAMP_SOFTNESS_MAX);
|
||||||
self->lamp->soft = value;
|
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
return Py_None;
|
return Py_None;
|
||||||
@@ -727,9 +731,8 @@ static PyObject *Lamp_setHaloInt(C_Lamp *self, PyObject *args)
|
|||||||
return (EXPP_ReturnPyObjError (PyExc_TypeError,
|
return (EXPP_ReturnPyObjError (PyExc_TypeError,
|
||||||
"expected float argument"));
|
"expected float argument"));
|
||||||
|
|
||||||
value = EXPP_ClampFloat (value, EXPP_LAMP_HALOINT_MIN,
|
self->lamp->haint = EXPP_ClampFloat (value,
|
||||||
EXPP_LAMP_HALOINT_MAX);
|
EXPP_LAMP_HALOINT_MIN, EXPP_LAMP_HALOINT_MAX);
|
||||||
self->lamp->haint = value;
|
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
return Py_None;
|
return Py_None;
|
||||||
@@ -743,9 +746,8 @@ static PyObject *Lamp_setQuad1(C_Lamp *self, PyObject *args)
|
|||||||
return (EXPP_ReturnPyObjError (PyExc_TypeError,
|
return (EXPP_ReturnPyObjError (PyExc_TypeError,
|
||||||
"expected float argument"));
|
"expected float argument"));
|
||||||
|
|
||||||
value = EXPP_ClampFloat (value, EXPP_LAMP_QUAD1_MIN,
|
self->lamp->att1 = EXPP_ClampFloat (value,
|
||||||
EXPP_LAMP_QUAD1_MAX);
|
EXPP_LAMP_QUAD1_MIN, EXPP_LAMP_QUAD1_MAX);
|
||||||
self->lamp->att1 = value;
|
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
return Py_None;
|
return Py_None;
|
||||||
@@ -759,9 +761,31 @@ static PyObject *Lamp_setQuad2(C_Lamp *self, PyObject *args)
|
|||||||
return (EXPP_ReturnPyObjError (PyExc_TypeError,
|
return (EXPP_ReturnPyObjError (PyExc_TypeError,
|
||||||
"expected float argument"));
|
"expected float argument"));
|
||||||
|
|
||||||
value = EXPP_ClampFloat (value, EXPP_LAMP_QUAD2_MIN,
|
self->lamp->att2 = EXPP_ClampFloat (value,
|
||||||
EXPP_LAMP_QUAD2_MAX);
|
EXPP_LAMP_QUAD2_MIN, EXPP_LAMP_QUAD2_MAX);
|
||||||
self->lamp->att2 = value;
|
|
||||||
|
Py_INCREF(Py_None);
|
||||||
|
return Py_None;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject *Lamp_setColorComponent(C_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]"));
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
return Py_None;
|
return Py_None;
|
||||||
@@ -769,7 +793,7 @@ static PyObject *Lamp_setQuad2(C_Lamp *self, PyObject *args)
|
|||||||
|
|
||||||
static PyObject *Lamp_setCol(C_Lamp *self, PyObject *args)
|
static PyObject *Lamp_setCol(C_Lamp *self, PyObject *args)
|
||||||
{
|
{
|
||||||
return rgbTuple_setCol((C_rgbTuple *)self->color, args);
|
return rgbTuple_setCol(self->color, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@@ -811,7 +835,7 @@ static PyObject *LampGetAttr (C_Lamp *self, char *name)
|
|||||||
else if (strcmp(name, "B") == 0)
|
else if (strcmp(name, "B") == 0)
|
||||||
attr = PyFloat_FromDouble(self->lamp->b);
|
attr = PyFloat_FromDouble(self->lamp->b);
|
||||||
else if (strcmp(name, "col") == 0)
|
else if (strcmp(name, "col") == 0)
|
||||||
attr = EXPP_incr_ret(self->color);
|
attr = Lamp_getCol(self);
|
||||||
else if (strcmp(name, "energy") == 0)
|
else if (strcmp(name, "energy") == 0)
|
||||||
attr = PyFloat_FromDouble(self->lamp->energy);
|
attr = PyFloat_FromDouble(self->lamp->energy);
|
||||||
else if (strcmp(name, "dist") == 0)
|
else if (strcmp(name, "dist") == 0)
|
||||||
|
@@ -72,52 +72,38 @@
|
|||||||
#define EXPP_LAMP_MODE_OSATEX 512
|
#define EXPP_LAMP_MODE_OSATEX 512
|
||||||
#define EXPP_LAMP_MODE_DEEPSHADOW 1024
|
#define EXPP_LAMP_MODE_DEEPSHADOW 1024
|
||||||
|
|
||||||
/* Lamp default and MIN, MAX values */
|
/* Lamp MIN, MAX values */
|
||||||
|
|
||||||
#define EXPP_LAMP_TYPE EXPP_LAMP_TYPE_LAMP
|
|
||||||
#define EXPP_LAMP_MODE EXPP_LAMP_MODE_SHADOWS
|
|
||||||
#define EXPP_LAMP_SAMPLES 3
|
|
||||||
#define EXPP_LAMP_SAMPLES_MIN 1
|
#define EXPP_LAMP_SAMPLES_MIN 1
|
||||||
#define EXPP_LAMP_SAMPLES_MAX 16
|
#define EXPP_LAMP_SAMPLES_MAX 16
|
||||||
#define EXPP_LAMP_BUFFERSIZE 512
|
|
||||||
#define EXPP_LAMP_BUFFERSIZE_MIN 512
|
#define EXPP_LAMP_BUFFERSIZE_MIN 512
|
||||||
#define EXPP_LAMP_BUFFERSIZE_MAX 5120
|
#define EXPP_LAMP_BUFFERSIZE_MAX 5120
|
||||||
#define EXPP_LAMP_ENERGY 1.0
|
|
||||||
#define EXPP_LAMP_ENERGY_MIN 0.0
|
#define EXPP_LAMP_ENERGY_MIN 0.0
|
||||||
#define EXPP_LAMP_ENERGY_MAX 10.0
|
#define EXPP_LAMP_ENERGY_MAX 10.0
|
||||||
#define EXPP_LAMP_DIST 20.0
|
|
||||||
#define EXPP_LAMP_DIST_MIN 0.1
|
#define EXPP_LAMP_DIST_MIN 0.1
|
||||||
#define EXPP_LAMP_DIST_MAX 5000.0
|
#define EXPP_LAMP_DIST_MAX 5000.0
|
||||||
#define EXPP_LAMP_SPOTSIZE 45.0
|
|
||||||
#define EXPP_LAMP_SPOTSIZE_MIN 1.0
|
#define EXPP_LAMP_SPOTSIZE_MIN 1.0
|
||||||
#define EXPP_LAMP_SPOTSIZE_MAX 180.0
|
#define EXPP_LAMP_SPOTSIZE_MAX 180.0
|
||||||
#define EXPP_LAMP_SPOTBLEND 0.15
|
|
||||||
#define EXPP_LAMP_SPOTBLEND_MIN 0.00
|
#define EXPP_LAMP_SPOTBLEND_MIN 0.00
|
||||||
#define EXPP_LAMP_SPOTBLEND_MAX 1.00
|
#define EXPP_LAMP_SPOTBLEND_MAX 1.00
|
||||||
#define EXPP_LAMP_CLIPSTART 0.5
|
|
||||||
#define EXPP_LAMP_CLIPSTART_MIN 0.1
|
#define EXPP_LAMP_CLIPSTART_MIN 0.1
|
||||||
#define EXPP_LAMP_CLIPSTART_MAX 1000.0
|
#define EXPP_LAMP_CLIPSTART_MAX 1000.0
|
||||||
#define EXPP_LAMP_CLIPEND 40.0
|
|
||||||
#define EXPP_LAMP_CLIPEND_MIN 1.0
|
#define EXPP_LAMP_CLIPEND_MIN 1.0
|
||||||
#define EXPP_LAMP_CLIPEND_MAX 5000.0
|
#define EXPP_LAMP_CLIPEND_MAX 5000.0
|
||||||
#define EXPP_LAMP_BIAS 1.00
|
|
||||||
#define EXPP_LAMP_BIAS_MIN 0.01
|
#define EXPP_LAMP_BIAS_MIN 0.01
|
||||||
#define EXPP_LAMP_BIAS_MAX 5.00
|
#define EXPP_LAMP_BIAS_MAX 5.00
|
||||||
#define EXPP_LAMP_SOFTNESS 3.0
|
|
||||||
#define EXPP_LAMP_SOFTNESS_MIN 1.0
|
#define EXPP_LAMP_SOFTNESS_MIN 1.0
|
||||||
#define EXPP_LAMP_SOFTNESS_MAX 100.0
|
#define EXPP_LAMP_SOFTNESS_MAX 100.0
|
||||||
#define EXPP_LAMP_HALOINT 1.0
|
|
||||||
#define EXPP_LAMP_HALOINT_MIN 0.0
|
#define EXPP_LAMP_HALOINT_MIN 0.0
|
||||||
#define EXPP_LAMP_HALOINT_MAX 5.0
|
#define EXPP_LAMP_HALOINT_MAX 5.0
|
||||||
#define EXPP_LAMP_HALOSTEP 0
|
|
||||||
#define EXPP_LAMP_HALOSTEP_MIN 0
|
#define EXPP_LAMP_HALOSTEP_MIN 0
|
||||||
#define EXPP_LAMP_HALOSTEP_MAX 12
|
#define EXPP_LAMP_HALOSTEP_MAX 12
|
||||||
#define EXPP_LAMP_QUAD1 0.0
|
|
||||||
#define EXPP_LAMP_QUAD1_MIN 0.0
|
#define EXPP_LAMP_QUAD1_MIN 0.0
|
||||||
#define EXPP_LAMP_QUAD1_MAX 1.0
|
#define EXPP_LAMP_QUAD1_MAX 1.0
|
||||||
#define EXPP_LAMP_QUAD2 1.0
|
|
||||||
#define EXPP_LAMP_QUAD2_MIN 0.0
|
#define EXPP_LAMP_QUAD2_MIN 0.0
|
||||||
#define EXPP_LAMP_QUAD2_MAX 1.0
|
#define EXPP_LAMP_QUAD2_MAX 1.0
|
||||||
|
#define EXPP_LAMP_COL_MIN 0.0
|
||||||
|
#define EXPP_LAMP_COL_MAX 1.0
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Python API function prototypes for the Lamp module. */
|
/* Python API function prototypes for the Lamp module. */
|
||||||
@@ -166,7 +152,7 @@ struct PyMethodDef M_Lamp_methods[] = {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
PyObject_HEAD
|
PyObject_HEAD
|
||||||
Lamp *lamp;
|
Lamp *lamp;
|
||||||
PyObject *color;
|
C_rgbTuple *color;
|
||||||
|
|
||||||
} C_Lamp;
|
} C_Lamp;
|
||||||
|
|
||||||
@@ -315,7 +301,7 @@ int LampCheckPyObject (PyObject *pyobj);
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Python TypeLamp structure definition: */
|
/* Python TypeLamp structure definition: */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
static PyTypeObject Lamp_Type =
|
PyTypeObject Lamp_Type =
|
||||||
{
|
{
|
||||||
PyObject_HEAD_INIT(&PyType_Type)
|
PyObject_HEAD_INIT(&PyType_Type)
|
||||||
0, /* ob_size */
|
0, /* ob_size */
|
||||||
|
1032
source/blender/python/api2_2x/Material.c
Normal file
1032
source/blender/python/api2_2x/Material.c
Normal file
File diff suppressed because it is too large
Load Diff
360
source/blender/python/api2_2x/Material.h
Normal file
360
source/blender/python/api2_2x/Material.h
Normal file
@@ -0,0 +1,360 @@
|
|||||||
|
/*
|
||||||
|
*
|
||||||
|
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version. The Blender
|
||||||
|
* Foundation also sells licenses for use in proprietary software under
|
||||||
|
* the Blender License. See http://www.blender.org/BL/ for information
|
||||||
|
* about this.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This is a new part of Blender.
|
||||||
|
*
|
||||||
|
* Contributor(s): Willian P. Germano
|
||||||
|
*
|
||||||
|
* ***** END GPL/BL DUAL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef EXPP_MATERIAL_H
|
||||||
|
#define EXPP_MATERIAL_H
|
||||||
|
|
||||||
|
#include <Python.h>
|
||||||
|
|
||||||
|
#include <BKE_main.h>
|
||||||
|
#include <BKE_global.h>
|
||||||
|
#include <BKE_library.h>
|
||||||
|
#include <DNA_ID.h>
|
||||||
|
#include <BKE_material.h>
|
||||||
|
#include <BLI_blenlib.h>
|
||||||
|
#include <DNA_material_types.h>
|
||||||
|
|
||||||
|
#include "constant.h"
|
||||||
|
#include "rgbTuple.h"
|
||||||
|
#include "gen_utils.h"
|
||||||
|
#include "modules.h"
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Python C_Material defaults: */
|
||||||
|
/*****************************************************************************/
|
||||||
|
#define EXPP_MAT_MODE_TRACEABLE MA_TRACEBLE
|
||||||
|
#define EXPP_MAT_MODE_SHADOW MA_SHADOW
|
||||||
|
#define EXPP_MAT_MODE_SHADELESS MA_SHLESS
|
||||||
|
#define EXPP_MAT_MODE_WIRE MA_WIRE
|
||||||
|
#define EXPP_MAT_MODE_VCOLLIGHT MA_VERTEXCOL
|
||||||
|
#define EXPP_MAT_MODE_HALO MA_HALO
|
||||||
|
#define EXPP_MAT_MODE_ZTRANSP MA_ZTRA
|
||||||
|
#define EXPP_MAT_MODE_VCOLPAINT MA_VERTEXCOLP
|
||||||
|
#define EXPP_MAT_MODE_ZINVERT MA_ZINV
|
||||||
|
#define EXPP_MAT_MODE_HALORINGS MA_HALO_RINGS
|
||||||
|
#define EXPP_MAT_MODE_ENV MA_ENV
|
||||||
|
#define EXPP_MAT_MODE_HALOLINES MA_HALO_LINES
|
||||||
|
#define EXPP_MAT_MODE_ONLYSHADOW MA_ONLYSHADOW
|
||||||
|
#define EXPP_MAT_MODE_XALPHA MA_HALO_XALPHA
|
||||||
|
#define EXPP_MAT_MODE_STAR MA_STAR
|
||||||
|
#define EXPP_MAT_MODE_FACETEX MA_FACETEXTURE
|
||||||
|
#define EXPP_MAT_MODE_HALOTEX MA_HALOTEX
|
||||||
|
#define EXPP_MAT_MODE_HALOPUNO MA_HALOPUNO
|
||||||
|
#define EXPP_MAT_MODE_NOMIST MA_NOMIST
|
||||||
|
#define EXPP_MAT_MODE_HALOSHADE MA_HALO_SHADE
|
||||||
|
#define EXPP_MAT_MODE_HALOFLARE MA_HALO_FLARE
|
||||||
|
|
||||||
|
/* Material MIN, MAX values */
|
||||||
|
#define EXPP_MAT_ADD_MIN 0.0
|
||||||
|
#define EXPP_MAT_ADD_MAX 1.0
|
||||||
|
#define EXPP_MAT_ALPHA_MIN 0.0
|
||||||
|
#define EXPP_MAT_ALPHA_MAX 1.0
|
||||||
|
#define EXPP_MAT_AMB_MIN 0.0
|
||||||
|
#define EXPP_MAT_AMB_MAX 1.0
|
||||||
|
#define EXPP_MAT_ANG_MIN 0.0 /* XXX Confirm these two */
|
||||||
|
#define EXPP_MAT_ANG_MAX 1.0
|
||||||
|
#define EXPP_MAT_COL_MIN 0.0 /* min/max for all ... */
|
||||||
|
#define EXPP_MAT_COL_MAX 1.0 /* ... color triplets */
|
||||||
|
#define EXPP_MAT_EMIT_MIN 0.0
|
||||||
|
#define EXPP_MAT_EMIT_MAX 1.0
|
||||||
|
#define EXPP_MAT_REF_MIN 0.0
|
||||||
|
#define EXPP_MAT_REF_MAX 1.0
|
||||||
|
#define EXPP_MAT_SPEC_MIN 0.0
|
||||||
|
#define EXPP_MAT_SPEC_MAX 2.0
|
||||||
|
#define EXPP_MAT_SPECTRA_MIN 0.0
|
||||||
|
#define EXPP_MAT_SPECTRA_MAX 1.0
|
||||||
|
#define EXPP_MAT_ZOFFS_MIN 0.0
|
||||||
|
#define EXPP_MAT_ZOFFS_MAX 10.0
|
||||||
|
#define EXPP_MAT_HALOSIZE_MIN 0.0
|
||||||
|
#define EXPP_MAT_HALOSIZE_MAX 100.0
|
||||||
|
#define EXPP_MAT_FLARESIZE_MIN 0.1
|
||||||
|
#define EXPP_MAT_FLARESIZE_MAX 25.0
|
||||||
|
#define EXPP_MAT_FLAREBOOST_MIN 0.1
|
||||||
|
#define EXPP_MAT_FLAREBOOST_MAX 10.0
|
||||||
|
#define EXPP_MAT_SUBSIZE_MIN 0.1
|
||||||
|
#define EXPP_MAT_SUBSIZE_MAX 25.0
|
||||||
|
|
||||||
|
#define EXPP_MAT_HARD_MIN 1
|
||||||
|
#define EXPP_MAT_HARD_MAX 255 /* 127 with MODE HALO ON */
|
||||||
|
#define EXPP_MAT_NFLARES_MIN 1
|
||||||
|
#define EXPP_MAT_NFLARES_MAX 32
|
||||||
|
#define EXPP_MAT_NSTARS_MIN 3
|
||||||
|
#define EXPP_MAT_NSTARS_MAX 50
|
||||||
|
#define EXPP_MAT_NLINES_MIN 0
|
||||||
|
#define EXPP_MAT_NLINES_MAX 250
|
||||||
|
#define EXPP_MAT_NRINGS_MIN 0
|
||||||
|
#define EXPP_MAT_NRINGS_MAX 24
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Python API function prototypes for the Material module. */
|
||||||
|
/*****************************************************************************/
|
||||||
|
static PyObject *M_Material_New (PyObject *self, PyObject *args,
|
||||||
|
PyObject *keywords);
|
||||||
|
static PyObject *M_Material_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.Material.__doc__ */
|
||||||
|
/*****************************************************************************/
|
||||||
|
char M_Material_doc[] =
|
||||||
|
"The Blender Material module";
|
||||||
|
|
||||||
|
char M_Material_New_doc[] =
|
||||||
|
"(name) - return a new material called 'name'\n\
|
||||||
|
() - return a new material called 'Mat'";
|
||||||
|
|
||||||
|
char M_Material_Get_doc[] =
|
||||||
|
"(name) - return the material called 'name', None if not found.\n\
|
||||||
|
() - return a list of all materials in the current scene.";
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Python method structure definition for Blender.Material module: */
|
||||||
|
/*****************************************************************************/
|
||||||
|
struct PyMethodDef M_Material_methods[] = {
|
||||||
|
{"New",(PyCFunction)M_Material_New, METH_VARARGS|METH_KEYWORDS,
|
||||||
|
M_Material_New_doc},
|
||||||
|
{"Get", M_Material_Get, METH_VARARGS, M_Material_Get_doc},
|
||||||
|
{"get", M_Material_Get, METH_VARARGS, M_Material_Get_doc},
|
||||||
|
{NULL, NULL, 0, NULL}
|
||||||
|
};
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Python C_Material structure definition: */
|
||||||
|
/*****************************************************************************/
|
||||||
|
typedef struct {
|
||||||
|
PyObject_HEAD
|
||||||
|
Material *material;
|
||||||
|
C_rgbTuple *rgb, *amb, *spec, *mir;
|
||||||
|
|
||||||
|
} C_Material;
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Python C_Material methods declarations: */
|
||||||
|
/*****************************************************************************/
|
||||||
|
static PyObject *Material_getName(C_Material *self);
|
||||||
|
static PyObject *Material_getMode(C_Material *self);
|
||||||
|
static PyObject *Material_getRGBCol(C_Material *self);
|
||||||
|
static PyObject *Material_getAmbCol(C_Material *self);
|
||||||
|
static PyObject *Material_getSpecCol(C_Material *self);
|
||||||
|
static PyObject *Material_getMirCol(C_Material *self);
|
||||||
|
static PyObject *Material_getAmb(C_Material *self);
|
||||||
|
static PyObject *Material_getAng(C_Material *self);
|
||||||
|
static PyObject *Material_getEmit(C_Material *self);
|
||||||
|
static PyObject *Material_getAlpha(C_Material *self);
|
||||||
|
static PyObject *Material_getRef(C_Material *self);
|
||||||
|
static PyObject *Material_getSpec(C_Material *self);
|
||||||
|
static PyObject *Material_getSpecTransp(C_Material *self);
|
||||||
|
static PyObject *Material_getAdd(C_Material *self);
|
||||||
|
static PyObject *Material_getZOffset(C_Material *self);
|
||||||
|
static PyObject *Material_getHaloSize(C_Material *self);
|
||||||
|
static PyObject *Material_getFlareSize(C_Material *self);
|
||||||
|
static PyObject *Material_getFlareBoost(C_Material *self);
|
||||||
|
static PyObject *Material_getSubSize(C_Material *self);
|
||||||
|
static PyObject *Material_getHardness(C_Material *self);
|
||||||
|
static PyObject *Material_getNFlares(C_Material *self);
|
||||||
|
static PyObject *Material_getNStars(C_Material *self);
|
||||||
|
static PyObject *Material_getNLines(C_Material *self);
|
||||||
|
static PyObject *Material_getNRings(C_Material *self);
|
||||||
|
static PyObject *Material_setName(C_Material *self, PyObject *args);
|
||||||
|
static PyObject *Material_setMode(C_Material *self, PyObject *args);
|
||||||
|
static PyObject *Material_setIntMode(C_Material *self, PyObject *args);
|
||||||
|
static PyObject *Material_setRGBCol(C_Material *self, PyObject *args);
|
||||||
|
static PyObject *Material_setAmbCol(C_Material *self, PyObject *args);
|
||||||
|
static PyObject *Material_setSpecCol(C_Material *self, PyObject *args);
|
||||||
|
static PyObject *Material_setMirCol(C_Material *self, PyObject *args);
|
||||||
|
static PyObject *Material_setAmb(C_Material *self, PyObject *args);
|
||||||
|
static PyObject *Material_setEmit(C_Material *self, PyObject *args);
|
||||||
|
static PyObject *Material_setAng(C_Material *self, PyObject *args);
|
||||||
|
static PyObject *Material_setAlpha(C_Material *self, PyObject *args);
|
||||||
|
static PyObject *Material_setRef(C_Material *self, PyObject *args);
|
||||||
|
static PyObject *Material_setSpec(C_Material *self, PyObject *args);
|
||||||
|
static PyObject *Material_setSpecTransp(C_Material *self, PyObject *args);
|
||||||
|
static PyObject *Material_setAdd(C_Material *self, PyObject *args);
|
||||||
|
static PyObject *Material_setZOffset(C_Material *self, PyObject *args);
|
||||||
|
static PyObject *Material_setHaloSize(C_Material *self, PyObject *args);
|
||||||
|
static PyObject *Material_setFlareSize(C_Material *self, PyObject *args);
|
||||||
|
static PyObject *Material_setFlareBoost(C_Material *self, PyObject *args);
|
||||||
|
static PyObject *Material_setSubSize(C_Material *self, PyObject *args);
|
||||||
|
static PyObject *Material_setHardness(C_Material *self, PyObject *args);
|
||||||
|
static PyObject *Material_setNFlares(C_Material *self, PyObject *args);
|
||||||
|
static PyObject *Material_setNStars(C_Material *self, PyObject *args);
|
||||||
|
static PyObject *Material_setNLines(C_Material *self, PyObject *args);
|
||||||
|
static PyObject *Material_setNRings(C_Material *self, PyObject *args);
|
||||||
|
|
||||||
|
static PyObject *Material_setColorComponent(C_Material *self, char *key,
|
||||||
|
PyObject *args);
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Python C_Material methods table: */
|
||||||
|
/*****************************************************************************/
|
||||||
|
static PyMethodDef C_Material_methods[] = {
|
||||||
|
/* name, method, flags, doc */
|
||||||
|
{"getName", (PyCFunction)Material_getName, METH_NOARGS,
|
||||||
|
"() - Return Material Data name"},
|
||||||
|
{"getMode", (PyCFunction)Material_getMode, METH_NOARGS,
|
||||||
|
"() - Return Material mode flags"},
|
||||||
|
{"getRGBCol", (PyCFunction)Material_getRGBCol, METH_NOARGS,
|
||||||
|
"() - Return Material's rgb color triplet"},
|
||||||
|
{"getAmbCol", (PyCFunction)Material_getAmbCol, METH_NOARGS,
|
||||||
|
"() - Return Material's ambient color"},
|
||||||
|
{"getSpecCol", (PyCFunction)Material_getSpecCol, METH_NOARGS,
|
||||||
|
"() - Return Material's specular color"},
|
||||||
|
{"getMirCol", (PyCFunction)Material_getMirCol, METH_NOARGS,
|
||||||
|
"() - Return Material's mirror color"},
|
||||||
|
{"getAmb", (PyCFunction)Material_getAmb, METH_NOARGS,
|
||||||
|
"() - Return Material's ambient color blend factor"},
|
||||||
|
{"getAng", (PyCFunction)Material_getAng, METH_NOARGS,
|
||||||
|
"() - Return Material's ????"},
|
||||||
|
{"getEmit", (PyCFunction)Material_getEmit, METH_NOARGS,
|
||||||
|
"() - Return Material's emitting light intensity"},
|
||||||
|
{"getAlpha", (PyCFunction)Material_getAlpha, METH_NOARGS,
|
||||||
|
"() - Return Material's alpha (transparency) value"},
|
||||||
|
{"getRef", (PyCFunction)Material_getRef, METH_NOARGS,
|
||||||
|
"() - Return Material's reflectivity"},
|
||||||
|
{"getSpec", (PyCFunction)Material_getSpec, METH_NOARGS,
|
||||||
|
"() - Return Material's specularity"},
|
||||||
|
{"getSpecTransp", (PyCFunction)Material_getSpecTransp, METH_NOARGS,
|
||||||
|
"() - Return Material's specular transparency"},
|
||||||
|
{"getAdd", (PyCFunction)Material_getAdd, METH_NOARGS,
|
||||||
|
"() - Return Material's glow factor"},
|
||||||
|
{"getZOffset", (PyCFunction)Material_getZOffset, METH_NOARGS,
|
||||||
|
"() - Return Material's artificial offset "},
|
||||||
|
{"getHaloSize", (PyCFunction)Material_getHaloSize, METH_NOARGS,
|
||||||
|
"() - Return Material's halo size"},
|
||||||
|
{"getFlareSize", (PyCFunction)Material_getFlareSize, METH_NOARGS,
|
||||||
|
"() - Return Material's (flare size)/(halo size) factor"},
|
||||||
|
{"getFlareBoost", (PyCFunction)Material_getFlareBoost, METH_NOARGS,
|
||||||
|
"() - Return Material's flare boost"},
|
||||||
|
{"getSubSize", (PyCFunction)Material_getSubSize, METH_NOARGS,
|
||||||
|
"() - Return Material's dimension of subflare, dots and circles"},
|
||||||
|
{"getHardness", (PyCFunction)Material_getHardness, METH_NOARGS,
|
||||||
|
"() - Return Material's hardness"},
|
||||||
|
{"getNFlares", (PyCFunction)Material_getNFlares, METH_NOARGS,
|
||||||
|
"() - Return Material's number of flares in halo"},
|
||||||
|
{"getNStars", (PyCFunction)Material_getNStars, METH_NOARGS,
|
||||||
|
"() - Return Material's number of stars in halo"},
|
||||||
|
{"getNLines", (PyCFunction)Material_getNLines, METH_NOARGS,
|
||||||
|
"() - Return Material's number of lines in halo"},
|
||||||
|
{"getNRings", (PyCFunction)Material_getNRings, METH_NOARGS,
|
||||||
|
"() - Return Material's number of rings in halo"},
|
||||||
|
{"setName", (PyCFunction)Material_setName, METH_VARARGS,
|
||||||
|
"(s) - Change Material Data name"},
|
||||||
|
{"setMode", (PyCFunction)Material_setMode, METH_VARARGS,
|
||||||
|
"([s[,s]]) - Set Material mode flag(s)"},
|
||||||
|
{"setRGBCol", (PyCFunction)Material_setMode, METH_VARARGS,
|
||||||
|
"([s[,s]]) - Set Material's rgb color triplet"},
|
||||||
|
{"setAmbCol", (PyCFunction)Material_setMode, METH_VARARGS,
|
||||||
|
"([s[,s]]) - Set Material's ambient color"},
|
||||||
|
{"setSpecCol", (PyCFunction)Material_setMode, METH_VARARGS,
|
||||||
|
"([s[,s]]) - Set Material's specular color"},
|
||||||
|
{"setMirCol", (PyCFunction)Material_setMode, METH_VARARGS,
|
||||||
|
"([s[,s]]) - Set Material's mirror color"},
|
||||||
|
{"setAmb", (PyCFunction)Material_setAmb, METH_VARARGS,
|
||||||
|
"(f) - Set how much the Material's color is affected"
|
||||||
|
" by \nthe global ambient colors - [0.0, 1.0]"},
|
||||||
|
{"setAng", (PyCFunction)Material_setAng, METH_VARARGS,
|
||||||
|
"(f) - Set Material's ?????"},
|
||||||
|
{"setEmit", (PyCFunction)Material_setEmit, METH_VARARGS,
|
||||||
|
"(f) - Set Material's emitting light intensity - [0.0, 1.0]"},
|
||||||
|
{"setAlpha", (PyCFunction)Material_setAlpha, METH_VARARGS,
|
||||||
|
"(f) - Set Material's alpha (transparency) - [0.0, 1.0]"},
|
||||||
|
{"setRef", (PyCFunction)Material_setRef, METH_VARARGS,
|
||||||
|
"(f) - Set Material's reflectivity - [0.0, 1.0]"},
|
||||||
|
{"setSpec", (PyCFunction)Material_setSpec, METH_VARARGS,
|
||||||
|
"(f) - Set Material's specularity - [0.0, 2.0]"},
|
||||||
|
{"setSpecTransp", (PyCFunction)Material_setSpecTransp, METH_VARARGS,
|
||||||
|
"(f) - Set Material's specular transparency - [0.0, 1.0]"},
|
||||||
|
{"setAdd", (PyCFunction)Material_setAdd, METH_VARARGS,
|
||||||
|
"(f) - Set Material's glow factor - [0.0, 1.0]"},
|
||||||
|
{"setZOffset", (PyCFunction)Material_setZOffset, METH_VARARGS,
|
||||||
|
"(f) - Set Material's artificial offset - [0.0, 10.0]"},
|
||||||
|
{"setHaloSize", (PyCFunction)Material_setHaloSize, METH_VARARGS,
|
||||||
|
"(f) - Set Material's halo size - [0.0, 100.0]"},
|
||||||
|
{"setFlareSize", (PyCFunction)Material_setFlareSize, METH_VARARGS,
|
||||||
|
"(f) - Set Material's factor: (flare size)/(halo size) - [0.1, 25.0]"},
|
||||||
|
{"setFlareBoost", (PyCFunction)Material_setFlareBoost, METH_VARARGS,
|
||||||
|
"(f) - Set Material's flare boost - [0.1, 10.0]"},
|
||||||
|
{"setSubSize", (PyCFunction)Material_setSubSize, METH_VARARGS,
|
||||||
|
"(f) - Set Material's dimension of subflare,"
|
||||||
|
" dots and circles - [0.1, 25.0]"},
|
||||||
|
{"setHardness", (PyCFunction)Material_setFlareBoost, METH_VARARGS,
|
||||||
|
"(f) - Set Material's hardness - [1, 255 (127 if halo mode is ON)]"},
|
||||||
|
{"setNFlares", (PyCFunction)Material_setFlareBoost, METH_VARARGS,
|
||||||
|
"(f) - Set Material's number of flares in halo - [1, 32]"},
|
||||||
|
{"setNStars", (PyCFunction)Material_setFlareBoost, METH_VARARGS,
|
||||||
|
"(f) - Set Material's number of stars in halo - [3, 50]"},
|
||||||
|
{"setNLines", (PyCFunction)Material_setFlareBoost, METH_VARARGS,
|
||||||
|
"(f) - Set Material's number of lines in halo - [0, 250]"},
|
||||||
|
{"setNRings", (PyCFunction)Material_setNRings, METH_VARARGS,
|
||||||
|
"(f) - Set Material's number of rings in halo - [0, 24]"},
|
||||||
|
{0}
|
||||||
|
};
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Python Material_Type callback function prototypes: */
|
||||||
|
/*****************************************************************************/
|
||||||
|
static void MaterialDeAlloc (C_Material *self);
|
||||||
|
static int MaterialPrint (C_Material *self, FILE *fp, int flags);
|
||||||
|
static int MaterialSetAttr (C_Material *self, char *name, PyObject *v);
|
||||||
|
static PyObject *MaterialGetAttr (C_Material *self, char *name);
|
||||||
|
static PyObject *MaterialRepr (C_Material *self);
|
||||||
|
static PyObject *Material_createPyObject (Material *mat);
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Python Material_Type structure definition: */
|
||||||
|
/*****************************************************************************/
|
||||||
|
PyTypeObject Material_Type =
|
||||||
|
{
|
||||||
|
PyObject_HEAD_INIT(&PyType_Type)
|
||||||
|
0, /* ob_size */
|
||||||
|
"Material", /* tp_name */
|
||||||
|
sizeof (C_Material), /* tp_basicsize */
|
||||||
|
0, /* tp_itemsize */
|
||||||
|
/* methods */
|
||||||
|
(destructor)MaterialDeAlloc, /* tp_dealloc */
|
||||||
|
(printfunc)MaterialPrint, /* tp_print */
|
||||||
|
(getattrfunc)MaterialGetAttr, /* tp_getattr */
|
||||||
|
(setattrfunc)MaterialSetAttr, /* tp_setattr */
|
||||||
|
0, /* tp_compare */
|
||||||
|
(reprfunc)MaterialRepr, /* 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,
|
||||||
|
C_Material_methods, /* tp_methods */
|
||||||
|
0, /* tp_members */
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* EXPP_MATERIAL_H */
|
@@ -170,7 +170,7 @@ PyObject *M_Object_New(PyObject *self, PyObject *args)
|
|||||||
G.totobj++;
|
G.totobj++;
|
||||||
|
|
||||||
/* Create a Python object from it. */
|
/* Create a Python object from it. */
|
||||||
blen_object = (C_Object*)PyObject_NEW (C_Object, &object_type);
|
blen_object = (C_Object*)PyObject_NEW (C_Object, &Object_Type);
|
||||||
blen_object->object = object;
|
blen_object->object = object;
|
||||||
blen_object->data = NULL;
|
blen_object->data = NULL;
|
||||||
blen_object->parent = NULL;
|
blen_object->parent = NULL;
|
||||||
@@ -203,7 +203,7 @@ PyObject *M_Object_Get(PyObject *self, PyObject *args)
|
|||||||
return (PythonReturnErrorObject (PyExc_AttributeError,
|
return (PythonReturnErrorObject (PyExc_AttributeError,
|
||||||
"Unknown object specified."));
|
"Unknown object specified."));
|
||||||
}
|
}
|
||||||
blen_object = (C_Object*)PyObject_NEW (C_Object, &object_type);
|
blen_object = (C_Object*)PyObject_NEW (C_Object, &Object_Type);
|
||||||
blen_object->object = object;
|
blen_object->object = object;
|
||||||
blen_object->data = NULL;
|
blen_object->data = NULL;
|
||||||
|
|
||||||
@@ -262,7 +262,7 @@ PyObject *M_Object_GetSelected (PyObject *self, PyObject *args)
|
|||||||
(G.scene->basact->lay & G.vd->lay)))
|
(G.scene->basact->lay & G.vd->lay)))
|
||||||
{
|
{
|
||||||
/* Active object is first in the list. */
|
/* Active object is first in the list. */
|
||||||
blen_object = (C_Object*)PyObject_NEW (C_Object, &object_type);
|
blen_object = (C_Object*)PyObject_NEW (C_Object, &Object_Type);
|
||||||
if (blen_object == NULL)
|
if (blen_object == NULL)
|
||||||
{
|
{
|
||||||
Py_DECREF (list);
|
Py_DECREF (list);
|
||||||
@@ -281,7 +281,7 @@ PyObject *M_Object_GetSelected (PyObject *self, PyObject *args)
|
|||||||
(base_iter->lay & G.vd->lay)) &&
|
(base_iter->lay & G.vd->lay)) &&
|
||||||
(base_iter != G.scene->basact))
|
(base_iter != G.scene->basact))
|
||||||
{
|
{
|
||||||
blen_object = (C_Object*)PyObject_NEW (C_Object, &object_type);
|
blen_object = (C_Object*)PyObject_NEW (C_Object, &Object_Type);
|
||||||
if (blen_object == NULL)
|
if (blen_object == NULL)
|
||||||
{
|
{
|
||||||
Py_DECREF (list);
|
Py_DECREF (list);
|
||||||
@@ -777,7 +777,7 @@ PyObject* M_ObjectCreatePyObject (struct Object *obj)
|
|||||||
|
|
||||||
printf ("In M_ObjectCreatePyObject\n");
|
printf ("In M_ObjectCreatePyObject\n");
|
||||||
|
|
||||||
blen_object = (C_Object*)PyObject_NEW (C_Object, &object_type);
|
blen_object = (C_Object*)PyObject_NEW (C_Object, &Object_Type);
|
||||||
|
|
||||||
if (blen_object == NULL)
|
if (blen_object == NULL)
|
||||||
{
|
{
|
||||||
@@ -794,7 +794,7 @@ PyObject* M_ObjectCreatePyObject (struct Object *obj)
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
int M_ObjectCheckPyObject (PyObject *py_obj)
|
int M_ObjectCheckPyObject (PyObject *py_obj)
|
||||||
{
|
{
|
||||||
return (py_obj->ob_type == &object_type);
|
return (py_obj->ob_type == &Object_Type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@@ -216,7 +216,7 @@ static PyObject* ObjectRepr (C_Object *obj);
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Python TypeObject structure definition. */
|
/* Python TypeObject structure definition. */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
static PyTypeObject object_type =
|
PyTypeObject Object_Type =
|
||||||
{
|
{
|
||||||
PyObject_HEAD_INIT(&PyType_Type)
|
PyObject_HEAD_INIT(&PyType_Type)
|
||||||
0, /* ob_size */
|
0, /* ob_size */
|
||||||
|
@@ -152,7 +152,7 @@ static PyObject *TextRepr (C_Text *self);
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Python Text_Type structure definition: */
|
/* Python Text_Type structure definition: */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
static PyTypeObject Text_Type =
|
PyTypeObject Text_Type =
|
||||||
{
|
{
|
||||||
PyObject_HEAD_INIT(&PyType_Type)
|
PyObject_HEAD_INIT(&PyType_Type)
|
||||||
0, /* ob_size */
|
0, /* ob_size */
|
||||||
|
74
source/blender/python/api2_2x/Types.c
Normal file
74
source/blender/python/api2_2x/Types.c
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
/*
|
||||||
|
*
|
||||||
|
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version. The Blender
|
||||||
|
* Foundation also sells licenses for use in proprietary software under
|
||||||
|
* the Blender License. See http://www.blender.org/BL/ for information
|
||||||
|
* about this.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This is a new part of Blender.
|
||||||
|
*
|
||||||
|
* Contributor(s): Willian P. Germano
|
||||||
|
*
|
||||||
|
* ***** END GPL/BL DUAL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Types.h"
|
||||||
|
|
||||||
|
struct PyMethodDef Null_methods[] = {{NULL, NULL}};
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Function: M_Types_Init */
|
||||||
|
/*****************************************************************************/
|
||||||
|
PyObject *M_Types_Init (void)
|
||||||
|
{
|
||||||
|
PyObject *submodule, *dict;
|
||||||
|
|
||||||
|
submodule = Py_InitModule3("Blender.Types", Null_methods, M_Types_doc);
|
||||||
|
|
||||||
|
dict = PyModule_GetDict(submodule);
|
||||||
|
|
||||||
|
/* The Blender Object Type */
|
||||||
|
|
||||||
|
PyDict_SetItemString(dict, "ObjectType", (PyObject *)&Object_Type);
|
||||||
|
|
||||||
|
/* Blender Object Data Types */
|
||||||
|
|
||||||
|
PyDict_SetItemString(dict, "NMeshType", (PyObject *)&NMesh_Type);
|
||||||
|
PyDict_SetItemString(dict, "NMFaceType", (PyObject *)&NMFace_Type);
|
||||||
|
PyDict_SetItemString(dict, "NMVertType", (PyObject *)&NMVert_Type);
|
||||||
|
PyDict_SetItemString(dict, "NMColType", (PyObject *)&NMCol_Type);
|
||||||
|
|
||||||
|
PyDict_SetItemString(dict, "CameraType", (PyObject *)&Camera_Type);
|
||||||
|
PyDict_SetItemString(dict, "ImageType", (PyObject *)&Image_Type);
|
||||||
|
PyDict_SetItemString(dict, "LampType", (PyObject *)&Lamp_Type);
|
||||||
|
PyDict_SetItemString(dict, "TextType", (PyObject *)&Text_Type);
|
||||||
|
|
||||||
|
PyDict_SetItemString(dict, "ButtonType", (PyObject *)&Button_Type);
|
||||||
|
PyDict_SetItemString(dict, "MaterialType",(PyObject *)&Material_Type);
|
||||||
|
|
||||||
|
/* External helper Types available to the main ones above */
|
||||||
|
|
||||||
|
PyDict_SetItemString(dict, "vectorType", (PyObject *)&vector_Type);
|
||||||
|
PyDict_SetItemString(dict, "bufferType", (PyObject *)&buffer_Type);
|
||||||
|
PyDict_SetItemString(dict, "constantType", (PyObject *)&constant_Type);
|
||||||
|
PyDict_SetItemString(dict, "rgbTupleType", (PyObject *)&rgbTuple_Type);
|
||||||
|
|
||||||
|
return (submodule);
|
||||||
|
}
|
50
source/blender/python/api2_2x/Types.h
Normal file
50
source/blender/python/api2_2x/Types.h
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
*
|
||||||
|
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version. The Blender
|
||||||
|
* Foundation also sells licenses for use in proprietary software under
|
||||||
|
* the Blender License. See http://www.blender.org/BL/ for information
|
||||||
|
* about this.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This is a new part of Blender.
|
||||||
|
*
|
||||||
|
* Contributor(s): Willian P. Germano
|
||||||
|
*
|
||||||
|
* ***** END GPL/BL DUAL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef EXPP_TYPES_H
|
||||||
|
#define EXPP_TYPES_H
|
||||||
|
|
||||||
|
#include "Python.h"
|
||||||
|
|
||||||
|
extern PyTypeObject Button_Type, Material_Type;
|
||||||
|
|
||||||
|
extern PyTypeObject Object_Type;
|
||||||
|
extern PyTypeObject NMesh_Type, NMFace_Type, NMVert_Type, NMCol_Type;
|
||||||
|
extern PyTypeObject Camera_Type, Lamp_Type, Image_Type, Text_Type;
|
||||||
|
|
||||||
|
extern PyTypeObject vector_Type, buffer_Type, rgbTuple_Type,
|
||||||
|
constant_Type;
|
||||||
|
|
||||||
|
static char M_Types_doc[] =
|
||||||
|
"The Blender Types module\n\n\
|
||||||
|
This module is a dictionary of all Blender Python types";
|
||||||
|
|
||||||
|
#endif /* EXPP_TYPES_H */
|
@@ -115,10 +115,9 @@ static PyObject *new_const(void)
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Python C_constant methods: */
|
/* Python C_constant methods: */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void constant_insert(C_constant *self, char *key, PyObject *value)
|
int constant_insert (C_constant *self, char *name, PyObject *value)
|
||||||
{
|
{
|
||||||
if (self->dict)
|
return PyDict_SetItemString (self->dict, name, value);
|
||||||
PyDict_SetItemString(self->dict, key, value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@@ -51,11 +51,12 @@ PyObject *M_constant_New (void);
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
PyObject_HEAD
|
PyObject_HEAD
|
||||||
PyObject *dict;
|
PyObject *dict;
|
||||||
|
|
||||||
} C_constant;
|
} C_constant;
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Python C_constant methods declarations: */
|
/* Python C_constant methods declarations: */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void constant_insert(C_constant *self, char *name, PyObject *args);
|
int constant_insert(C_constant *self, char *name, PyObject *value);
|
||||||
|
|
||||||
#endif /* EXPP_constant_H */
|
#endif /* EXPP_constant_H */
|
||||||
|
@@ -49,15 +49,15 @@ ID *GetIdFromList(ListBase *list, char *name);
|
|||||||
|
|
||||||
PyObject *PythonReturnErrorObject (PyObject * type, char * error_msg);
|
PyObject *PythonReturnErrorObject (PyObject * type, char * error_msg);
|
||||||
PyObject *PythonIncRef (PyObject *object);
|
PyObject *PythonIncRef (PyObject *object);
|
||||||
PyObject * EXPP_incr_ret (PyObject *object);
|
|
||||||
|
|
||||||
char * event_to_name (short event);
|
char * event_to_name (short event);
|
||||||
|
|
||||||
float EXPP_ClampFloat (float value, float min, float max);
|
float EXPP_ClampFloat (float value, float min, float max);
|
||||||
int EXPP_ClampInt (int value, int min, int max);
|
int EXPP_ClampInt (int value, int min, int max);
|
||||||
|
|
||||||
int EXPP_ReturnIntError (PyObject *type, char *error_msg);
|
PyObject *EXPP_incr_ret (PyObject *object);
|
||||||
PyObject *EXPP_ReturnPyObjError (PyObject * type, char * error_msg);
|
PyObject *EXPP_ReturnPyObjError (PyObject * type, char * error_msg);
|
||||||
|
int EXPP_ReturnIntError (PyObject *type, char *error_msg);
|
||||||
|
|
||||||
int EXPP_check_sequence_consistency (PyObject *seq, PyTypeObject *against);
|
int EXPP_check_sequence_consistency (PyObject *seq, PyTypeObject *against);
|
||||||
|
|
||||||
|
@@ -58,9 +58,15 @@ PyObject * M_ObjectCreatePyObject (struct Object *obj);
|
|||||||
int M_ObjectCheckPyObject (PyObject *py_obj);
|
int M_ObjectCheckPyObject (PyObject *py_obj);
|
||||||
struct Object * M_ObjectFromPyObject (PyObject *py_obj);
|
struct Object * M_ObjectFromPyObject (PyObject *py_obj);
|
||||||
|
|
||||||
|
/* Types */
|
||||||
|
PyObject * M_Types_Init (void);
|
||||||
|
|
||||||
/* NMesh Data */
|
/* NMesh Data */
|
||||||
PyObject * M_NMesh_Init (void);
|
PyObject * M_NMesh_Init (void);
|
||||||
|
|
||||||
|
/* Material */
|
||||||
|
PyObject * M_Material_Init (void);
|
||||||
|
|
||||||
/* Camera Data */
|
/* Camera Data */
|
||||||
PyObject * M_Camera_Init (void);
|
PyObject * M_Camera_Init (void);
|
||||||
PyObject * Camera_createPyObject (struct Camera *cam);
|
PyObject * Camera_createPyObject (struct Camera *cam);
|
||||||
|
@@ -110,7 +110,7 @@ PyTypeObject rgbTuple_Type =
|
|||||||
/* Function: rgbTuple_New */
|
/* Function: rgbTuple_New */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
PyObject *rgbTuple_New(float *rgb[3])
|
PyObject *rgbTuple_New(float *rgb[3])
|
||||||
{ /* this is the static one */
|
{
|
||||||
C_rgbTuple *rgbTuple;
|
C_rgbTuple *rgbTuple;
|
||||||
|
|
||||||
printf ("In rgbTuple_New()\n");
|
printf ("In rgbTuple_New()\n");
|
||||||
|
@@ -35,7 +35,7 @@
|
|||||||
/*****************************/
|
/*****************************/
|
||||||
/* Vector Python Object */
|
/* Vector Python Object */
|
||||||
/*****************************/
|
/*****************************/
|
||||||
#define VectorObject_Check(v) ((v)->ob_type == &Vector_Type)
|
#define VectorObject_Check(v) ((v)->ob_type == &vector_Type)
|
||||||
|
|
||||||
static void Vector_dealloc(VectorObject *self)
|
static void Vector_dealloc(VectorObject *self)
|
||||||
{
|
{
|
||||||
@@ -191,7 +191,7 @@ static PySequenceMethods Vector_SeqMethods =
|
|||||||
(intintobjargproc) Vector_ass_slice, /* sq_ass_slice */
|
(intintobjargproc) Vector_ass_slice, /* sq_ass_slice */
|
||||||
};
|
};
|
||||||
|
|
||||||
PyTypeObject Vector_Type =
|
PyTypeObject vector_Type =
|
||||||
{
|
{
|
||||||
PyObject_HEAD_INIT(&PyType_Type)
|
PyObject_HEAD_INIT(&PyType_Type)
|
||||||
0, /*ob_size*/
|
0, /*ob_size*/
|
||||||
@@ -213,7 +213,7 @@ PyObject *newVectorObject(float *vec, int size)
|
|||||||
{
|
{
|
||||||
VectorObject *self;
|
VectorObject *self;
|
||||||
|
|
||||||
self= PyObject_NEW(VectorObject, &Vector_Type);
|
self= PyObject_NEW(VectorObject, &vector_Type);
|
||||||
|
|
||||||
self->vec= vec;
|
self->vec= vec;
|
||||||
self->size= size;
|
self->size= size;
|
||||||
|
Reference in New Issue
Block a user