[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11211] branches/pyapi_devel/source/ blender/python/api2_2x: rewite for most parts of the world module,
Campbell Barton
cbarton at metavr.com
Tue Jul 10 18:57:49 CEST 2007
Revision: 11211
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11211
Author: campbellbarton
Date: 2007-07-10 18:57:49 +0200 (Tue, 10 Jul 2007)
Log Message:
-----------
rewite for most parts of the world module,
* getseters
* AO settings (access wasnt there before)
* amb, zen, hoz - use BPy_Color
* remove access to 'mode' - use multiple bool attributes instead.
* removed Blender.World
Modified Paths:
--------------
branches/pyapi_devel/source/blender/python/api2_2x/Blender.c
branches/pyapi_devel/source/blender/python/api2_2x/Material.c
branches/pyapi_devel/source/blender/python/api2_2x/World.c
branches/pyapi_devel/source/blender/python/api2_2x/World.h
branches/pyapi_devel/source/blender/python/api2_2x/color.c
branches/pyapi_devel/source/blender/python/api2_2x/color.h
Modified: branches/pyapi_devel/source/blender/python/api2_2x/Blender.c
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/Blender.c 2007-07-10 16:52:59 UTC (rev 11210)
+++ branches/pyapi_devel/source/blender/python/api2_2x/Blender.c 2007-07-10 16:57:49 UTC (rev 11211)
@@ -977,7 +977,7 @@
PyDict_SetItemString(dict, "Text3d", Text3d_Init());
PyDict_SetItemString(dict, "Texture", Texture_Init());
PyDict_SetItemString(dict, "Window", Window_Init());
- PyDict_SetItemString(dict, "World", World_Init());
+ World_Init();
BPyList_Init();
LayerSet_Init();
Modified: branches/pyapi_devel/source/blender/python/api2_2x/Material.c
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/Material.c 2007-07-10 16:52:59 UTC (rev 11210)
+++ branches/pyapi_devel/source/blender/python/api2_2x/Material.c 2007-07-10 16:57:49 UTC (rev 11211)
@@ -1208,7 +1208,6 @@
float *param;
struct Material *mat = self->material;
float min, max;
- int ret;
switch( (int)type ) {
@@ -1216,62 +1215,62 @@
case EXPP_MAT_COMP_R:
min = 0.0f;
max = 1.0f;
- param = &self->material->r;
+ param = &mat->r;
break;
case EXPP_MAT_COMP_G:
min = 0.0f;
max = 1.0f;
- param = &self->material->g;
+ param = &mat->g;
break;
case EXPP_MAT_COMP_B:
min = 0.0f;
max = 1.0f;
- param = &self->material->b;
+ param = &mat->b;
break;
case EXPP_MAT_COMP_SPECR:
min = 0.0f;
max = 1.0f;
- param = &self->material->specr;
+ param = &mat->specr;
break;
case EXPP_MAT_COMP_SPECG:
min = 0.0f;
max = 1.0f;
- param = &self->material->specg;
+ param = &mat->specg;
break;
case EXPP_MAT_COMP_SPECB:
min = 0.0f;
max = 1.0f;
- param = &self->material->specb;
+ param = &mat->specb;
break;
case EXPP_MAT_COMP_MIRR:
min = 0.0f;
max = 1.0f;
- param = &self->material->mirr;
+ param = &mat->mirr;
break;
case EXPP_MAT_COMP_MIRG:
min = 0.0f;
max = 1.0f;
- param = &self->material->mirg;
+ param = &mat->mirg;
break;
case EXPP_MAT_COMP_MIRB:
min = 0.0f;
max = 1.0f;
- param = &self->material->mirb;
+ param = &mat->mirb;
break;
case EXPP_MAT_COMP_SSSR:
min = 0.0f;
max = 1.0f;
- param = &self->material->sss_col[0];
+ param = &mat->sss_col[0];
break;
case EXPP_MAT_COMP_SSSG:
min = 0.0f;
max = 1.0f;
- param = &self->material->sss_col[1];
+ param = &mat->sss_col[1];
break;
case EXPP_MAT_COMP_SSSB:
min = 0.0f;
max = 1.0f;
- param = &self->material->sss_col[2];
+ param = &mat->sss_col[2];
break;
/* Other floating point values */
@@ -1493,8 +1492,8 @@
"undefined type in setFloatAttrClamp" );
}
- ret = EXPP_setFloatClamped( value, param, min, max );
- return ret;
+ return EXPP_setFloatClamped( value, param, min, max );
+
}
Modified: branches/pyapi_devel/source/blender/python/api2_2x/World.c
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/World.c 2007-07-10 16:52:59 UTC (rev 11210)
+++ branches/pyapi_devel/source/blender/python/api2_2x/World.c 2007-07-10 16:57:49 UTC (rev 11211)
@@ -30,10 +30,6 @@
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
-/* TODO - world->mode
- * starts, zen */
-
-
/**
* \file World.c
* \ingroup scripts
@@ -62,6 +58,7 @@
#include "gen_utils.h"
#include "gen_library.h"
#include "bpy_list.h"
+#include "color.h"
#define IPOKEY_ZENITH 0
#define IPOKEY_HORIZON 1
@@ -69,25 +66,44 @@
#define IPOKEY_STARS 3
#define IPOKEY_OFFSET 4
#define IPOKEY_SIZE 5
+
+enum mat_float_consts {
+ EXPP_WORLD_ATTR_EXP = 0,
+ EXPP_WORLD_ATTR_RANGE,
+ /* linfac logfac */
+ EXPP_WORLD_ATTR_GRAVITY,
+ /* activityBoxRadius */
+ EXPP_WORLD_ATTR_MIST,
+ EXPP_WORLD_ATTR_MIST_START,
+ EXPP_WORLD_ATTR_MIST_DIST,
+ EXPP_WORLD_ATTR_MIST_HEIGHT,
+ EXPP_WORLD_ATTR_STAR_SIZE,
+ EXPP_WORLD_ATTR_STAR_MIN_DIST,
+ EXPP_WORLD_ATTR_STAR_DIST,
+ EXPP_WORLD_ATTR_STAR_COL_NOISE,
+ EXPP_WORLD_ATTR_AO_DIST,
+
+ EXPP_WORLD_ATTR_AO_DIST_FAC,
+ EXPP_WORLD_ATTR_AO_ENERGY,
+ EXPP_WORLD_ATTR_AO_BIAS,
+};
+
+/* int/short/char */
+enum mat_int_consts {
+ EXPP_WORLD_ATTR_MIST_TYPE = 0,
+ EXPP_WORLD_ATTR_AO_SAMP,
+ EXPP_WORLD_ATTR_AO_MIX,
+ EXPP_WORLD_ATTR_AO_COLOR,
+};
+
+
+
/*****************************************************************************/
/* Python BPy_World methods declarations: */
/*****************************************************************************/
-static PyObject *World_getRange( BPy_World * self );
-static PyObject *World_setRange( BPy_World * self, PyObject * args );
static PyObject *World_getIpo( BPy_World * self );
static int World_setIpo( BPy_World * self, PyObject * args );
static PyObject *World_insertIpoKey( BPy_World * self, PyObject * args );
-//static int World_setSkytype( BPy_World * self, PyObject * args );
-static PyObject *World_getMistype( BPy_World * self );
-static int World_setMistype( BPy_World * self, PyObject * args );
-static PyObject *World_getHor( BPy_World * self );
-static int World_setHor( BPy_World * self, PyObject * args );
-//static PyObject *World_getZen( BPy_World * self );
-//static int World_setZen( BPy_World * self, PyObject * args );
-static PyObject *World_getAmb( BPy_World * self );
-static int World_setAmb( BPy_World * self, PyObject * args );
-//static PyObject *World_getMist( BPy_World * self );
-//static int World_setMist( BPy_World * self, PyObject * args );
static PyObject *World_copy( BPy_World * self );
@@ -102,25 +118,13 @@
static int World_Compare( BPy_World * a, BPy_World * b );
static PyObject *World_Repr( BPy_World * self );
-
-
/*****************************************************************************/
-/* The following string definitions are used for documentation strings. */
-/* In Python these will be written to the console when doing a */
-/* Blender.World.__doc__ */
-/*****************************************************************************/
-static char M_World_doc[] = "The Blender World module\n\n\
-This module provides access to **World Data** objects in Blender\n\n";
-
-/*****************************************************************************/
/* Python method structure definition for Blender.World module: */
/*****************************************************************************/
struct PyMethodDef M_World_methods[] = {
{NULL, NULL, 0, NULL}
};
-
-
/*****************************************************************************/
/* Python BPy_World methods table: */
/*****************************************************************************/
@@ -134,156 +138,7 @@
{NULL, NULL, 0, NULL}
};
-/*****************************************************************************/
-/* Python attributes get/set structure: */
-/*****************************************************************************/
-static PyGetSetDef BPy_World_getseters[] = {
- GENERIC_LIB_GETSETATTR,
- GENERIC_LIB_GETSETATTR_SCRIPTLINK,
- {"range", (getter)World_getRange, (setter)World_setRange,
- "range settings", NULL},
- //{"skytype", (getter)World_getSkytype, (setter)World_setSkytype,
- // "sky settings as a list", NULL},
- {"mistype", (getter)World_getMistype, (setter)World_setMistype,
- "world mist type", NULL},
- {"hor", (getter)World_getHor, (setter)World_setHor,
- "world horizon color", NULL},
- {"amb", (getter)World_getAmb, (setter)World_setAmb,
- "world ambient color", NULL},
- //{"mist", (getter)World_getMist, (setter)World_setMist,
- // "world mist settings", NULL},
- {"ipo", (getter)World_getIpo, (setter)World_setIpo,
- "world ipo", NULL},
- {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
-};
-/*****************************************************************************/
-/* Python World_Type structure definition: */
-/*****************************************************************************/
-PyTypeObject World_Type = {
- PyObject_HEAD_INIT( NULL )
- 0, /* ob_size */
- "World", /* tp_name */
- sizeof( BPy_World ), /* tp_basicsize */
- 0, /* tp_itemsize */
- /* methods */
- NULL, /* tp_dealloc */
- 0, /* tp_print */
- NULL, /* tp_getattr */
- NULL, /* tp_setattr */
- ( cmpfunc ) World_Compare, /* tp_compare */
- ( reprfunc ) World_Repr, /* tp_repr */
-
- /* Method suites for standard classes */
-
- NULL, /* PyNumberMethods *tp_as_number; */
- NULL, /* PySequenceMethods *tp_as_sequence; */
- NULL, /* PyMappingMethods *tp_as_mapping; */
-
- /* More standard operations (here for binary compatibility) */
-
- ( hashfunc ) GenericLib_hash, /* hashfunc tp_hash; */
- NULL, /* ternaryfunc tp_call; */
- NULL, /* reprfunc tp_str; */
- NULL, /* getattrofunc tp_getattro; */
- NULL, /* setattrofunc tp_setattro; */
-
- /* Functions to access object as input/output buffer */
- NULL, /* PyBufferProcs *tp_as_buffer; */
-
- /*** Flags to define presence of optional/expanded features ***/
- Py_TPFLAGS_DEFAULT, /* long tp_flags; */
-
- NULL, /* char *tp_doc; Documentation string */
- /*** Assigned meaning in release 2.0 ***/
- /* call function for all accessible objects */
- NULL, /* traverseproc tp_traverse; */
-
- /* delete references to contained objects */
- NULL, /* inquiry tp_clear; */
-
- /*** Assigned meaning in release 2.1 ***/
- /*** rich comparisons ***/
- NULL, /* richcmpfunc tp_richcompare; */
-
- /*** weak reference enabler ***/
- 0, /* long tp_weaklistoffset; */
-
- /*** Added in release 2.2 ***/
- /* Iterators */
- NULL, /* getiterfunc tp_iter; */
- NULL, /* iternextfunc tp_iternext; */
-
- /*** Attribute descriptor and subclassing stuff ***/
- BPy_World_methods, /* struct PyMethodDef *tp_methods; */
- NULL, /* struct PyMemberDef *tp_members; */
- BPy_World_getseters, /* struct PyGetSetDef *tp_getset; */
- NULL, /* struct _typeobject *tp_base; */
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list