[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11035] branches/pyapi_devel/source/ blender/python/api2_2x: made Materials use getsetattr bool attributes instead of geeky bitmasks - as decieded at this meeting .

Campbell Barton cbarton at metavr.com
Sun Jun 24 22:03:56 CEST 2007


Revision: 11035
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11035
Author:   campbellbarton
Date:     2007-06-24 22:03:55 +0200 (Sun, 24 Jun 2007)

Log Message:
-----------
made Materials use getsetattr bool attributes instead of geeky bitmasks - as decieded at this meeting.

removed NMesh

Modified Paths:
--------------
    branches/pyapi_devel/source/blender/python/api2_2x/Blender.c
    branches/pyapi_devel/source/blender/python/api2_2x/Camera.c
    branches/pyapi_devel/source/blender/python/api2_2x/Key.c
    branches/pyapi_devel/source/blender/python/api2_2x/Material.c
    branches/pyapi_devel/source/blender/python/api2_2x/Object.c
    branches/pyapi_devel/source/blender/python/api2_2x/Scene.c
    branches/pyapi_devel/source/blender/python/api2_2x/Types.c
    branches/pyapi_devel/source/blender/python/api2_2x/bpy_data.c
    branches/pyapi_devel/source/blender/python/api2_2x/bpy_list.c

Removed Paths:
-------------
    branches/pyapi_devel/source/blender/python/api2_2x/NMesh.c
    branches/pyapi_devel/source/blender/python/api2_2x/NMesh.h

Modified: branches/pyapi_devel/source/blender/python/api2_2x/Blender.c
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/Blender.c	2007-06-24 01:58:51 UTC (rev 11034)
+++ branches/pyapi_devel/source/blender/python/api2_2x/Blender.c	2007-06-24 20:03:55 UTC (rev 11035)
@@ -81,7 +81,6 @@
 #include "Mesh.h"
 #include "Metaball.h"
 #include "Modifier.h"
-#include "NMesh.h"
 #include "Object.h"
 #include "Group.h"
 #include "Registry.h"
@@ -964,7 +963,6 @@
 	PyDict_SetItemString(dict, "Mathutils", Mathutils_Init());
 	PyDict_SetItemString(dict, "Geometry", Geometry_Init());
 	PyDict_SetItemString(dict, "Modifier", Modifier_Init());
-	PyDict_SetItemString(dict, "NMesh", NMesh_Init());
 	PyDict_SetItemString(dict, "Noise", Noise_Init());
 	PyDict_SetItemString(dict, "Object", Object_Init());
 	PyDict_SetItemString(dict, "Group", Group_Init());

Modified: branches/pyapi_devel/source/blender/python/api2_2x/Camera.c
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/Camera.c	2007-06-24 01:58:51 UTC (rev 11034)
+++ branches/pyapi_devel/source/blender/python/api2_2x/Camera.c	2007-06-24 20:03:55 UTC (rev 11035)
@@ -71,12 +71,12 @@
 /*****************************************************************************/
 
 /*
- * Camera_insertIpoKey()
+ * Camera_insertKey()
  *  inserts Camera IPO key for LENS and CLIPPING
  * - TODO- Replce constants.
  */
 
-static PyObject *Camera_insertIpoKey( BPy_Camera * self, PyObject * args )
+static PyObject *Camera_insertKey( BPy_Camera * self, PyObject * args )
 {
 	int key = 0;
 
@@ -133,7 +133,7 @@
 /*****************************************************************************/
 static PyMethodDef BPy_Camera_methods[] = {
 	/* name, method, flags, doc */
-    {"insertIpoKey", ( PyCFunction ) Camera_insertIpoKey, METH_VARARGS,
+    {"insertKey", ( PyCFunction ) Camera_insertKey, METH_VARARGS,
 	 "( Camera IPO type ) - Inserts a key into IPO"},
 	{"__copy__", ( PyCFunction ) Camera_copy, METH_NOARGS,
 	 "() - Return a copy of the camera."},

Modified: branches/pyapi_devel/source/blender/python/api2_2x/Key.c
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/Key.c	2007-06-24 01:58:51 UTC (rev 11034)
+++ branches/pyapi_devel/source/blender/python/api2_2x/Key.c	2007-06-24 20:03:55 UTC (rev 11035)
@@ -34,6 +34,7 @@
 #include "Key.h" /*This must come first*/
 
 #include "DNA_scene_types.h"
+#include "DNA_meshdata_types.h"
 
 #include <BLI_blenlib.h>
 #include <BKE_global.h>
@@ -43,9 +44,9 @@
 #include "BIF_space.h"
 
 #include "Ipocurve.h"
-#include "NMesh.h" /* we create NMesh.NMVert objects */
 #include "Ipo.h"
 #include "BezTriple.h"
+#include "vector.h"
 
 #include "BSE_editipo.h"
 #include "mydevice.h"
@@ -512,23 +513,8 @@
 	case ID_ME:
 
 		for (i=0, datap = kb->keyblock->data; i<kb->keyblock->totelem; i++) {
-
-			BPy_NMVert *mv = PyObject_NEW( BPy_NMVert, &NMVert_Type );
 			MVert *vert = (MVert *) datap;
-
-			mv->co[0]=vert->co[0];
-			mv->co[1]=vert->co[1];
-			mv->co[2]=vert->co[2];
-			mv->no[0] = 0.0;
-			mv->no[1] = 0.0;
-			mv->no[2] = 0.0;
-
-			mv->uvco[0] = mv->uvco[1] = mv->uvco[2] = 0.0;
-			mv->index = i;
-			mv->flag = 0;
-
-			PyList_SetItem(l, i, ( PyObject * ) mv);
-
+			PyList_SetItem(l, i, ( PyObject * ) newVectorObject( vert->co, 3, Py_WRAP ));
 			datap += kb->key->elemsize;
 		}
 		break;

Modified: branches/pyapi_devel/source/blender/python/api2_2x/Material.c
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/Material.c	2007-06-24 01:58:51 UTC (rev 11034)
+++ branches/pyapi_devel/source/blender/python/api2_2x/Material.c	2007-06-24 20:03:55 UTC (rev 11035)
@@ -161,54 +161,54 @@
 	{NULL, NULL, 0, NULL}
 };
 
-static PyObject *Material_ModesDict( void )
-{
-	PyObject *Modes = PyConstant_New(  );
+//static PyObject *Material_ModesDict( void )
+//{
+//	PyObject *Modes = PyConstant_New(  );
+//
+//	if( Modes ) {
+//		BPy_constant *c = ( BPy_constant * ) Modes;
+//
+//		PyConstant_Insert(c, "TRACEABLE", PyInt_FromLong(MA_TRACEBLE));
+//		PyConstant_Insert(c, "SHADOW", PyInt_FromLong(MA_SHADOW));
+//		PyConstant_Insert(c, "SHADOWBUF", PyInt_FromLong(MA_SHADBUF));
+//		PyConstant_Insert(c, "TANGENTSTR", PyInt_FromLong(MA_TANGENT_STR));
+//		PyConstant_Insert(c, "FULLOSA", PyInt_FromLong(MA_FULL_OSA));
+//		PyConstant_Insert(c, "RAYBIAS", PyInt_FromLong(MA_RAYBIAS));
+//		PyConstant_Insert(c, "TRANSPSHADOW", PyInt_FromLong(MA_SHADOW_TRA));
+//		PyConstant_Insert(c, "RAMPCOL", PyInt_FromLong(MA_RAMP_COL));
+//		PyConstant_Insert(c, "RAMPSPEC", PyInt_FromLong(MA_RAMP_SPEC));
+//		PyConstant_Insert(c, "SHADELESS", PyInt_FromLong(MA_SHLESS));
+//		PyConstant_Insert(c, "WIRE", PyInt_FromLong(MA_WIRE));
+//		PyConstant_Insert(c, "VCOL_LIGHT", PyInt_FromLong(MA_VERTEXCOL));
+//		PyConstant_Insert(c, "HALO", PyInt_FromLong(MA_HALO));
+//		PyConstant_Insert(c, "ZTRANSP", PyInt_FromLong(MA_ZTRA));
+//		PyConstant_Insert(c, "VCOL_PAINT", PyInt_FromLong(MA_VERTEXCOLP));
+//		PyConstant_Insert(c, "ZINVERT", PyInt_FromLong(MA_ZINV));
+//		PyConstant_Insert(c, "HALORINGS", PyInt_FromLong(MA_HALO_RINGS));
+//		PyConstant_Insert(c, "ENV", PyInt_FromLong(MA_ENV));
+//		PyConstant_Insert(c, "HALOLINES", PyInt_FromLong(MA_HALO_LINES));
+//		PyConstant_Insert(c, "ONLYSHADOW", PyInt_FromLong(MA_ONLYSHADOW));
+//		PyConstant_Insert(c, "HALOXALPHA", PyInt_FromLong(MA_HALO_XALPHA));
+//		PyConstant_Insert(c, "HALOSTAR", PyInt_FromLong(MA_STAR));
+//		PyConstant_Insert(c, "TEXFACE", PyInt_FromLong(MA_FACETEXTURE));
+//		PyConstant_Insert(c, "HALOTEX", PyInt_FromLong(MA_HALOTEX));
+//		PyConstant_Insert(c, "HALOPUNO", PyInt_FromLong(MA_HALOPUNO));
+//		PyConstant_Insert(c, "NOMIST", PyInt_FromLong(MA_NOMIST));
+//		PyConstant_Insert(c, "HALOSHADE", PyInt_FromLong(MA_HALO_SHADE));
+//		PyConstant_Insert(c, "HALOFLARE", PyInt_FromLong(MA_HALO_FLARE));
+//		PyConstant_Insert(c, "RADIO", PyInt_FromLong(MA_RADIO));
+//		PyConstant_Insert(c, "RAYMIRROR", PyInt_FromLong(MA_RAYMIRROR));
+//		PyConstant_Insert(c, "ZTRA", PyInt_FromLong(MA_ZTRA));
+//		PyConstant_Insert(c, "RAYTRANSP", PyInt_FromLong(MA_RAYTRANSP));
+//		PyConstant_Insert(c, "TANGENT_V", PyInt_FromLong(MA_TANGENT_V));
+//		PyConstant_Insert(c, "NMAP_TS", PyInt_FromLong(MA_NORMAP_TANG));
+//		PyConstant_Insert(c, "GROUP_EXCLUSIVE", PyInt_FromLong(MA_GROUP_NOLAY));
+//	}
+//
+//	return Modes;
+//}
 
-	if( Modes ) {
-		BPy_constant *c = ( BPy_constant * ) Modes;
 
-		PyConstant_Insert(c, "TRACEABLE", PyInt_FromLong(MA_TRACEBLE));
-		PyConstant_Insert(c, "SHADOW", PyInt_FromLong(MA_SHADOW));
-		PyConstant_Insert(c, "SHADOWBUF", PyInt_FromLong(MA_SHADBUF));
-		PyConstant_Insert(c, "TANGENTSTR", PyInt_FromLong(MA_TANGENT_STR));
-		PyConstant_Insert(c, "FULLOSA", PyInt_FromLong(MA_FULL_OSA));
-		PyConstant_Insert(c, "RAYBIAS", PyInt_FromLong(MA_RAYBIAS));
-		PyConstant_Insert(c, "TRANSPSHADOW", PyInt_FromLong(MA_SHADOW_TRA));
-		PyConstant_Insert(c, "RAMPCOL", PyInt_FromLong(MA_RAMP_COL));
-		PyConstant_Insert(c, "RAMPSPEC", PyInt_FromLong(MA_RAMP_SPEC));
-		PyConstant_Insert(c, "SHADELESS", PyInt_FromLong(MA_SHLESS));
-		PyConstant_Insert(c, "WIRE", PyInt_FromLong(MA_WIRE));
-		PyConstant_Insert(c, "VCOL_LIGHT", PyInt_FromLong(MA_VERTEXCOL));
-		PyConstant_Insert(c, "HALO", PyInt_FromLong(MA_HALO));
-		PyConstant_Insert(c, "ZTRANSP", PyInt_FromLong(MA_ZTRA));
-		PyConstant_Insert(c, "VCOL_PAINT", PyInt_FromLong(MA_VERTEXCOLP));
-		PyConstant_Insert(c, "ZINVERT", PyInt_FromLong(MA_ZINV));
-		PyConstant_Insert(c, "HALORINGS", PyInt_FromLong(MA_HALO_RINGS));
-		PyConstant_Insert(c, "ENV", PyInt_FromLong(MA_ENV));
-		PyConstant_Insert(c, "HALOLINES", PyInt_FromLong(MA_HALO_LINES));
-		PyConstant_Insert(c, "ONLYSHADOW", PyInt_FromLong(MA_ONLYSHADOW));
-		PyConstant_Insert(c, "HALOXALPHA", PyInt_FromLong(MA_HALO_XALPHA));
-		PyConstant_Insert(c, "HALOSTAR", PyInt_FromLong(MA_STAR));
-		PyConstant_Insert(c, "TEXFACE", PyInt_FromLong(MA_FACETEXTURE));
-		PyConstant_Insert(c, "HALOTEX", PyInt_FromLong(MA_HALOTEX));
-		PyConstant_Insert(c, "HALOPUNO", PyInt_FromLong(MA_HALOPUNO));
-		PyConstant_Insert(c, "NOMIST", PyInt_FromLong(MA_NOMIST));
-		PyConstant_Insert(c, "HALOSHADE", PyInt_FromLong(MA_HALO_SHADE));
-		PyConstant_Insert(c, "HALOFLARE", PyInt_FromLong(MA_HALO_FLARE));
-		PyConstant_Insert(c, "RADIO", PyInt_FromLong(MA_RADIO));
-		PyConstant_Insert(c, "RAYMIRROR", PyInt_FromLong(MA_RAYMIRROR));
-		PyConstant_Insert(c, "ZTRA", PyInt_FromLong(MA_ZTRA));
-		PyConstant_Insert(c, "RAYTRANSP", PyInt_FromLong(MA_RAYTRANSP));
-		PyConstant_Insert(c, "TANGENT_V", PyInt_FromLong(MA_TANGENT_V));
-		PyConstant_Insert(c, "NMAP_TS", PyInt_FromLong(MA_NORMAP_TANG));
-		PyConstant_Insert(c, "GROUP_EXCLUSIVE", PyInt_FromLong(MA_GROUP_NOLAY));
-	}
-
-	return Modes;
-}
-
-
 static PyObject *Material_ShadersDict( void )
 {
 	PyObject *Shaders = PyConstant_New(  );
@@ -242,17 +242,15 @@
 	if( PyType_Ready( &Material_Type ) < 0)
 		return NULL;
 
-	Modes = Material_ModesDict(  );
 	Shaders = Material_ShadersDict(  );
 
 	submodule = Py_InitModule3( "Blender.Material",
 				    M_Material_methods, M_Material_doc );
-
-	if( Modes )
-		PyModule_AddObject( submodule, "Modes", Modes );
+	
 	if( Shaders )
 		PyModule_AddObject( submodule, "Shaders", Shaders );
 	
+	/* TODO - these are in a silly place */
 	PyModule_AddIntConstant( submodule, "RGB", IPOKEY_RGB );
 	PyModule_AddIntConstant( submodule, "ALPHA", IPOKEY_ALPHA );
 	PyModule_AddIntConstant( submodule, "HALOSIZE", IPOKEY_HALOSIZE );
@@ -273,7 +271,6 @@
 static int Material_setLightGroup( BPy_Material * self, PyObject * value );
 static int Material_setSssEnable( BPy_Material * self, PyObject * value );
 
-static int Material_setMode( BPy_Material * self, PyObject * value );
 static int Material_setRGBCol( BPy_Material * self, PyObject * value );
 static int Material_setSpecCol( BPy_Material * self, PyObject * value );
 static int Material_setMirCol( BPy_Material * self, PyObject * value );
@@ -285,9 +282,12 @@
 /*****************************************************************************/
 /* Python BPy_Material methods declarations: */
 /*****************************************************************************/
+
+static PyObject *Material_getMode(BPy_Material *self, void *flag);

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list