[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11342] branches/pyapi_devel/source/ blender/python: finished the Texture upgrade (still needs testing)

Campbell Barton cbarton at metavr.com
Mon Jul 23 04:24:12 CEST 2007


Revision: 11342
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11342
Author:   campbellbarton
Date:     2007-07-23 04:24:07 +0200 (Mon, 23 Jul 2007)

Log Message:
-----------
finished the Texture upgrade (still needs testing)
added initializers for Vector, and Mathutils types.
more variable renaming. misc updates/changes

Modified Paths:
--------------
    branches/pyapi_devel/source/blender/python/BPY_interface.c
    branches/pyapi_devel/source/blender/python/api2_2x/Armature.c
    branches/pyapi_devel/source/blender/python/api2_2x/Armature.h
    branches/pyapi_devel/source/blender/python/api2_2x/BezTriple.c
    branches/pyapi_devel/source/blender/python/api2_2x/BezTriple.h
    branches/pyapi_devel/source/blender/python/api2_2x/Blender.c
    branches/pyapi_devel/source/blender/python/api2_2x/Bone.c
    branches/pyapi_devel/source/blender/python/api2_2x/Bone.h
    branches/pyapi_devel/source/blender/python/api2_2x/Camera.c
    branches/pyapi_devel/source/blender/python/api2_2x/Camera.h
    branches/pyapi_devel/source/blender/python/api2_2x/Const.c
    branches/pyapi_devel/source/blender/python/api2_2x/Const.h
    branches/pyapi_devel/source/blender/python/api2_2x/Constraint.c
    branches/pyapi_devel/source/blender/python/api2_2x/Constraint.h
    branches/pyapi_devel/source/blender/python/api2_2x/CurNurb.c
    branches/pyapi_devel/source/blender/python/api2_2x/CurNurb.h
    branches/pyapi_devel/source/blender/python/api2_2x/Curve.c
    branches/pyapi_devel/source/blender/python/api2_2x/Curve.h
    branches/pyapi_devel/source/blender/python/api2_2x/Draw.c
    branches/pyapi_devel/source/blender/python/api2_2x/Draw.h
    branches/pyapi_devel/source/blender/python/api2_2x/Effect.c
    branches/pyapi_devel/source/blender/python/api2_2x/Effect.h
    branches/pyapi_devel/source/blender/python/api2_2x/Font.c
    branches/pyapi_devel/source/blender/python/api2_2x/Font.h
    branches/pyapi_devel/source/blender/python/api2_2x/Geometry.c
    branches/pyapi_devel/source/blender/python/api2_2x/Group.c
    branches/pyapi_devel/source/blender/python/api2_2x/Group.h
    branches/pyapi_devel/source/blender/python/api2_2x/IDProp.c
    branches/pyapi_devel/source/blender/python/api2_2x/IDProp.h
    branches/pyapi_devel/source/blender/python/api2_2x/Image.c
    branches/pyapi_devel/source/blender/python/api2_2x/Image.h
    branches/pyapi_devel/source/blender/python/api2_2x/Ipo.c
    branches/pyapi_devel/source/blender/python/api2_2x/Ipo.h
    branches/pyapi_devel/source/blender/python/api2_2x/Ipocurve.c
    branches/pyapi_devel/source/blender/python/api2_2x/Ipocurve.h
    branches/pyapi_devel/source/blender/python/api2_2x/Key.c
    branches/pyapi_devel/source/blender/python/api2_2x/Key.h
    branches/pyapi_devel/source/blender/python/api2_2x/Lamp.c
    branches/pyapi_devel/source/blender/python/api2_2x/Lamp.h
    branches/pyapi_devel/source/blender/python/api2_2x/Lattice.c
    branches/pyapi_devel/source/blender/python/api2_2x/Lattice.h
    branches/pyapi_devel/source/blender/python/api2_2x/Library.c
    branches/pyapi_devel/source/blender/python/api2_2x/Library.h
    branches/pyapi_devel/source/blender/python/api2_2x/MTex.c
    branches/pyapi_devel/source/blender/python/api2_2x/MTex.h
    branches/pyapi_devel/source/blender/python/api2_2x/Material.c
    branches/pyapi_devel/source/blender/python/api2_2x/Material.h
    branches/pyapi_devel/source/blender/python/api2_2x/Mathutils.c
    branches/pyapi_devel/source/blender/python/api2_2x/Mathutils.h
    branches/pyapi_devel/source/blender/python/api2_2x/Mesh.c
    branches/pyapi_devel/source/blender/python/api2_2x/Mesh.h
    branches/pyapi_devel/source/blender/python/api2_2x/Metaball.c
    branches/pyapi_devel/source/blender/python/api2_2x/Metaball.h
    branches/pyapi_devel/source/blender/python/api2_2x/Modifier.c
    branches/pyapi_devel/source/blender/python/api2_2x/Modifier.h
    branches/pyapi_devel/source/blender/python/api2_2x/NLA.c
    branches/pyapi_devel/source/blender/python/api2_2x/NLA.h
    branches/pyapi_devel/source/blender/python/api2_2x/Node.c
    branches/pyapi_devel/source/blender/python/api2_2x/Node.h
    branches/pyapi_devel/source/blender/python/api2_2x/Object.c
    branches/pyapi_devel/source/blender/python/api2_2x/Object.h
    branches/pyapi_devel/source/blender/python/api2_2x/Particle.c
    branches/pyapi_devel/source/blender/python/api2_2x/Particle.h
    branches/pyapi_devel/source/blender/python/api2_2x/Pose.c
    branches/pyapi_devel/source/blender/python/api2_2x/Pose.h
    branches/pyapi_devel/source/blender/python/api2_2x/Scene.c
    branches/pyapi_devel/source/blender/python/api2_2x/Scene.h
    branches/pyapi_devel/source/blender/python/api2_2x/Sound.c
    branches/pyapi_devel/source/blender/python/api2_2x/Sound.h
    branches/pyapi_devel/source/blender/python/api2_2x/SurfNurb.c
    branches/pyapi_devel/source/blender/python/api2_2x/SurfNurb.h
    branches/pyapi_devel/source/blender/python/api2_2x/Text.c
    branches/pyapi_devel/source/blender/python/api2_2x/Text.h
    branches/pyapi_devel/source/blender/python/api2_2x/Text3d.c
    branches/pyapi_devel/source/blender/python/api2_2x/Text3d.h
    branches/pyapi_devel/source/blender/python/api2_2x/Texture.c
    branches/pyapi_devel/source/blender/python/api2_2x/Texture.h
    branches/pyapi_devel/source/blender/python/api2_2x/Types.c
    branches/pyapi_devel/source/blender/python/api2_2x/Window.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/bpy_config.c
    branches/pyapi_devel/source/blender/python/api2_2x/bpy_config.h
    branches/pyapi_devel/source/blender/python/api2_2x/bpy_data.c
    branches/pyapi_devel/source/blender/python/api2_2x/bpy_data.h
    branches/pyapi_devel/source/blender/python/api2_2x/bpy_float.c
    branches/pyapi_devel/source/blender/python/api2_2x/bpy_float.h
    branches/pyapi_devel/source/blender/python/api2_2x/bpy_list.c
    branches/pyapi_devel/source/blender/python/api2_2x/bpy_list.h
    branches/pyapi_devel/source/blender/python/api2_2x/bpy_types.c
    branches/pyapi_devel/source/blender/python/api2_2x/charRGBA.c
    branches/pyapi_devel/source/blender/python/api2_2x/charRGBA.h
    branches/pyapi_devel/source/blender/python/api2_2x/color.c
    branches/pyapi_devel/source/blender/python/api2_2x/color.h
    branches/pyapi_devel/source/blender/python/api2_2x/constant.c
    branches/pyapi_devel/source/blender/python/api2_2x/constant.h
    branches/pyapi_devel/source/blender/python/api2_2x/euler.c
    branches/pyapi_devel/source/blender/python/api2_2x/euler.h
    branches/pyapi_devel/source/blender/python/api2_2x/gen_library.c
    branches/pyapi_devel/source/blender/python/api2_2x/gen_library.h
    branches/pyapi_devel/source/blender/python/api2_2x/gen_utils.c
    branches/pyapi_devel/source/blender/python/api2_2x/gen_utils.h
    branches/pyapi_devel/source/blender/python/api2_2x/layer_set.c
    branches/pyapi_devel/source/blender/python/api2_2x/layer_set.h
    branches/pyapi_devel/source/blender/python/api2_2x/logic.c
    branches/pyapi_devel/source/blender/python/api2_2x/logic.h
    branches/pyapi_devel/source/blender/python/api2_2x/matrix.c
    branches/pyapi_devel/source/blender/python/api2_2x/matrix.h
    branches/pyapi_devel/source/blender/python/api2_2x/meshPrimitive.c
    branches/pyapi_devel/source/blender/python/api2_2x/object_softbody.c
    branches/pyapi_devel/source/blender/python/api2_2x/object_softbody.h
    branches/pyapi_devel/source/blender/python/api2_2x/quat.c
    branches/pyapi_devel/source/blender/python/api2_2x/quat.h
    branches/pyapi_devel/source/blender/python/api2_2x/sceneRadio.c
    branches/pyapi_devel/source/blender/python/api2_2x/sceneRadio.h
    branches/pyapi_devel/source/blender/python/api2_2x/sceneRender.c
    branches/pyapi_devel/source/blender/python/api2_2x/sceneRender.h
    branches/pyapi_devel/source/blender/python/api2_2x/sceneSequence.c
    branches/pyapi_devel/source/blender/python/api2_2x/sceneSequence.h
    branches/pyapi_devel/source/blender/python/api2_2x/sceneTimeLine.c
    branches/pyapi_devel/source/blender/python/api2_2x/sceneTimeLine.h
    branches/pyapi_devel/source/blender/python/api2_2x/vector.c
    branches/pyapi_devel/source/blender/python/api2_2x/vector.h
    branches/pyapi_devel/source/blender/python/api2_2x/windowTheme.c
    branches/pyapi_devel/source/blender/python/api2_2x/windowTheme.h

Modified: branches/pyapi_devel/source/blender/python/BPY_interface.c
===================================================================
--- branches/pyapi_devel/source/blender/python/BPY_interface.c	2007-07-23 01:47:07 UTC (rev 11341)
+++ branches/pyapi_devel/source/blender/python/BPY_interface.c	2007-07-23 02:24:07 UTC (rev 11342)
@@ -140,7 +140,7 @@
  * These are TOP-LEVEL modules e.g. import `module` - there is no
  * support for packages here e.g. import `package.module` */
 
-static struct _inittab BPy_Inittab_Modules[] = {
+static struct _inittab BPyInittab_Modules[] = {
 	{"Blender", M_Blender_Init},
 	{"bpy", m_bpy_init},
 	{NULL, NULL}
@@ -227,7 +227,7 @@
 
 static void genlib_invalidate(void * genlib)
 {
-	((BPy_GenericLib *)genlib)->id = NULL;
+	((BPyGenericLibObject *)genlib)->id = NULL;
 }
 
 /* Use when removing the data data */
@@ -244,7 +244,7 @@
 /* Use when creating a new pyobject */
 void BPY_idhash_add(void *value)
 {
-	ID *id = ((BPy_GenericLib *)value)->id;
+	ID *id = ((BPyGenericLibObject *)value)->id;
 	printf("adding hash\n");
 	BLI_ghash_insert(idhash__internal(id), (void *)id, (void *)value);
 }	
@@ -296,7 +296,7 @@
 
 
 	//Initialize the TOP-LEVEL modules
-	PyImport_ExtendInittab(BPy_Inittab_Modules);
+	PyImport_ExtendInittab(BPyInittab_Modules);
 	
 	//Start the interpreter
 	Py_Initialize(  );
@@ -1264,7 +1264,7 @@
 	PyObject *globals;
 	PyObject *gval;
 	PyObject *pyargs, *retval;
-	BPy_Matrix *retmat;
+	BPyMatrixObject *retmat;
 	int row, col;
 	
 	if ( !con->text ) return;
@@ -1274,7 +1274,7 @@
 	
 	srcmat = Matrix_CreatePyObject( (float*)ownermat, 4, 4, (PyObject *)NULL );
 	tarmat = Matrix_CreatePyObject( (float*)targetmat, 4, 4, (PyObject *)NULL );
-	idprop = BPy_Wrap_IDProperty( NULL, con->prop, NULL);
+	idprop = IDProperty_CreatePyObject( NULL, con->prop, NULL);
 	
 /*  since I can't remember what the armature weakrefs do, I'll just leave this here
     commented out.  This function was based on pydrivers, and it might still be relevent.
@@ -1342,7 +1342,7 @@
 	}
 	
 	
-	if (!PyObject_TypeCheck(retval, &Matrix_Type)) {
+	if (!BPyMatrix_Check(retval)) {
 		printf("Error in PyConstraint - doConstraint: Function not returning a matrix!\n");
 		con->flag |= PYCON_SCRIPTERROR;
 		ReleaseGlobalDictionary( globals );
@@ -1354,7 +1354,7 @@
 		return;
 	}
 	
-	retmat = (BPy_Matrix *) retval;
+	retmat = (BPyMatrixObject *) retval;
 	if (retmat->rowSize != 4 || retmat->colSize != 4) {
 		printf("Error in PyConstraint - doConstraint: Matrix returned is the wrong size!\n");
 		con->flag |= PYCON_SCRIPTERROR;
@@ -1394,7 +1394,7 @@
 	PyObject *globals;
 	PyObject *gval, *gval2;
 	PyObject *pyargs, *retval;
-	BPy_Matrix *retmat;
+	BPyMatrixObject *retmat;
 	bPoseChannel *pchan;
 	int row, col;
 	
@@ -1411,7 +1411,7 @@
 	subtar = PyPoseBone_FromPosechannel( pchan );
 	
 	tarmat = Matrix_CreatePyObject( (float*)targetmat, 4, 4, (PyObject *)NULL );
-	idprop = BPy_Wrap_IDProperty( NULL, con->prop, NULL);
+	idprop = IDProperty_CreatePyObject( NULL, con->prop, NULL);
 	
 /*  since I can't remember what the armature weakrefs do, I'll just leave this here
     commented out.  This function was based on pydrivers, and it might still be relevent.
@@ -1495,7 +1495,7 @@
 		return -1;
 	}
 	
-	if (!PyObject_TypeCheck(retval, &Matrix_Type)) {
+	if (!BPyMatrix_Check(retval)) {
 		ReleaseGlobalDictionary( globals );
 		
 		Py_XDECREF( tar );
@@ -1506,7 +1506,7 @@
 		return -1;
 	}
 	
-	retmat = (BPy_Matrix *) retval;
+	retmat = (BPyMatrixObject *) retval;
 	if (retmat->rowSize != 4 || retmat->colSize != 4) {
 		printf("Error in PyConstraint - doTarget: Matrix returned is the wrong size!\n");
 		con->flag |= PYCON_SCRIPTERROR;
@@ -1553,7 +1553,7 @@
 	
 	globals = CreateGlobalDictionary();
 	
-	idprop = BPy_Wrap_IDProperty( NULL, con->prop, NULL);
+	idprop = IDProperty_CreatePyObject( NULL, con->prop, NULL);
 	
 	retval = RunPython( con->text, globals );
 
@@ -1699,7 +1699,7 @@
 		return pydriver_error(driver);
 	}
 
-	result = ( float )EXPP_PyNumber_AsDouble( retval );
+	result = ( float )PyFloat_AsDouble( retval );
 	
 	if (result == -1 && PyErr_Occurred()) 
 		return pydriver_error(driver);
@@ -1713,7 +1713,7 @@
 	return result;
 }
 
-/* Button Python Evaluation */
+/* BPyButtonObject Python Evaluation */
 
 /* Python evaluation for gui buttons:
  *	users can write any valid Python expression (that evals to an int or float)
@@ -1754,7 +1754,7 @@
 	if (!bpy_pydriver_Dict) {
 		if (bpy_pydriver_create_dict() != 0) {
 			fprintf(stderr,
-				"Button Python Eval error: couldn't create Python dictionary");
+				"BPyButtonObject Python Eval error: couldn't create Python dictionary");
 			return -1;
 		}
 	}

Modified: branches/pyapi_devel/source/blender/python/api2_2x/Armature.c
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/Armature.c	2007-07-23 01:47:07 UTC (rev 11341)
+++ branches/pyapi_devel/source/blender/python/api2_2x/Armature.c	2007-07-23 02:24:07 UTC (rev 11342)
@@ -61,7 +61,7 @@
 static const char sModuleError[] = "Blender.Armature - Error: ";
 static const char sModuleBadArgs[] = "Blender.Armature - Bad Arguments: ";
 
-//################## BonesDict_Type (internal) ########################
+//################## BPyBonesDict_Type (internal) ########################
 /*This is an internal psuedo-dictionary type that allows for manipulation
 * of bones inside of an armature. It is a subobject of armature.
 * i.e. Armature.bones['key']*/
@@ -70,7 +70,7 @@
 //------------------METHOD IMPLEMENTATIONS-----------------------------
 //------------------------Armature.bones.items()
 //Returns a list of key:value pairs like dict.items()
-static PyObject* BonesDict_items(BPy_BonesDict *self)
+static PyObject* BonesDict_items(BPyBonesDictObject *self)
 {
 	if (self->editmode_flag){
 		return PyDict_Items(self->editbonesMap); 
@@ -80,7 +80,7 @@
 }
 //------------------------Armature.bones.keys()
 //Returns a list of keys like dict.keys()
-static PyObject* BonesDict_keys(BPy_BonesDict *self)
+static PyObject* BonesDict_keys(BPyBonesDictObject *self)
 {
 	if (self->editmode_flag){
 		return PyDict_Keys(self->editbonesMap);
@@ -90,7 +90,7 @@
 }
 //------------------------Armature.bones.values()
 //Returns a list of values like dict.values()
-static PyObject* BonesDict_values(BPy_BonesDict *self)
+static PyObject* BonesDict_values(BPyBonesDictObject *self)
 {
 	if (self->editmode_flag){
 		return PyDict_Values(self->editbonesMap);
@@ -102,12 +102,12 @@
 //------------------TYPE_OBECT IMPLEMENTATION-----------------------
 //------------------------tp_doc
 //The __doc__ string for this object
-static char BPy_BonesDict_doc[] = "This is an internal subobject of armature\
+static char BPyBonesDict_doc[] = "This is an internal subobject of armature\
 designed to act as a Py_Bone dictionary.";
 
 //------------------------tp_methods
 //This contains a list of all methods the object contains
-static PyMethodDef BPy_BonesDict_methods[] = {
+static PyMethodDef BPyBonesDict_methods[] = {
 	{"items", (PyCFunction) BonesDict_items, METH_NOARGS, 
 		"() - Returns the key:value pairs from the dictionary"},
 	{"keys", (PyCFunction) BonesDict_keys, METH_NOARGS, 
@@ -157,7 +157,7 @@
 	return 0;
 }
 //----------------- BonesDict_InitBones
-static int BonesDict_InitBones(BPy_BonesDict *self)
+static int BonesDict_InitBones(BPyBonesDictObject *self)
 {
 	PyDict_Clear(self->bonesMap);
 	if (BoneMapping_Init(self->bonesMap, self->bones) == -1)
@@ -165,7 +165,7 @@
 	return 1;
 } 
 //----------------- BonesDict_InitEditBones
-static int BonesDict_InitEditBones(BPy_BonesDict *self)
+static int BonesDict_InitEditBones(BPyBonesDictObject *self)
 {
 	PyDict_Clear(self->editbonesMap);
 	if (EditBoneMapping_Init(self->editbonesMap, &self->editbones) == -1)
@@ -174,7 +174,7 @@
 }
 //------------------------tp_repr
 //This is the string representation of the object
-static PyObject *BonesDict_repr(BPy_BonesDict *self)
+static PyObject *BonesDict_repr(BPyBonesDictObject *self)
 {
 	char str[2048];
 	PyObject *key, *value;
@@ -213,7 +213,7 @@
 
 //------------------------tp_dealloc
 //This tells how to 'tear-down' our object when ref count hits 0
-static void BonesDict_dealloc(BPy_BonesDict * self)
+static void BonesDict_dealloc(BPyBonesDictObject * self)
 {
 	Py_DECREF(self->bonesMap);
 	Py_DECREF(self->editbonesMap);
@@ -223,7 +223,7 @@
 }
 //------------------------mp_length
 //This gets the size of the dictionary
-static int BonesDict_len(BPy_BonesDict *self)
+static int BonesDict_len(BPyBonesDictObject *self)
 {
 	if (self->editmode_flag){
 		return BLI_countlist(&self->editbones);
@@ -233,7 +233,7 @@
 }
 //-----------------------mp_subscript
 //This defines getting a bone from the dictionary - x = Bones['key']
-static PyObject *BonesDict_GetItem(BPy_BonesDict *self, PyObject* key)
+static PyObject *BonesDict_GetItem(BPyBonesDictObject *self, PyObject* key)
 { 
 	PyObject *value = NULL;
 
@@ -259,9 +259,9 @@
 }
 //-----------------------mp_ass_subscript
 //This does dict assignment - Bones['key'] = value
-static int BonesDict_SetItem(BPy_BonesDict *self, PyObject *key, PyObject *value)
+static int BonesDict_SetItem(BPyBonesDictObject *self, PyObject *key, PyObject *value)
 {
-	BPy_EditBone *editbone_for_deletion;
+	BPyEditBoneObject *editbone_for_deletion;
 	struct EditBone *editbone = NULL;
 	char *key_str = "";
 
@@ -273,36 +273,36 @@
 			goto AttributeError;
 		}
 		//parse value for assignment
-		if (value && EditBoneObject_Check(value)){
+		if (value && BPyEditBone_Check(value)){
 			//create a new editbone
 			editbone = MEM_callocN(sizeof(EditBone), "eBone");
 			BLI_strncpy(editbone->name, key_str, 32);
 			unique_editbone_name(NULL, editbone->name);
-			editbone->dist = ((BPy_EditBone*)value)->dist;
-			editbone->ease1 = ((BPy_EditBone*)value)->ease1;
-			editbone->ease2 = ((BPy_EditBone*)value)->ease2;
-			editbone->flag = ((BPy_EditBone*)value)->flag;
-			editbone->parent = ((BPy_EditBone*)value)->parent;
-			editbone->rad_head = ((BPy_EditBone*)value)->rad_head;
-			editbone->rad_tail = ((BPy_EditBone*)value)->rad_tail;
-			editbone->roll = ((BPy_EditBone*)value)->roll;
-			editbone->segments = ((BPy_EditBone*)value)->segments;
-			editbone->weight = ((BPy_EditBone*)value)->weight;
-			editbone->xwidth = ((BPy_EditBone*)value)->xwidth;
-			editbone->zwidth = ((BPy_EditBone*)value)->zwidth;
-			VECCOPY(editbone->head, ((BPy_EditBone*)value)->head);

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list