[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11416] branches/pyapi_devel/source/ blender/python: * migration from Blender to bpy module

Campbell Barton cbarton at metavr.com
Sun Jul 29 16:30:06 CEST 2007


Revision: 11416
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11416
Author:   campbellbarton
Date:     2007-07-29 16:30:06 +0200 (Sun, 29 Jul 2007)

Log Message:
-----------
* migration from Blender to bpy module
* made sure all types are accounted for in bpy.types.*
* Blender module has some cruft we cant get rid of yet, in bpy.blender for the moment

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/BGL.c
    branches/pyapi_devel/source/blender/python/api2_2x/BGL.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/Blender.h
    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/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/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/Font.c
    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/IDProp.c
    branches/pyapi_devel/source/blender/python/api2_2x/IDProp.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/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/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/Object.c
    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/Registry.c
    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/Texture.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.c
    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/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/object_softbody.c
    branches/pyapi_devel/source/blender/python/api2_2x/object_softbody.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/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-29 11:37:34 UTC (rev 11415)
+++ branches/pyapi_devel/source/blender/python/BPY_interface.c	2007-07-29 14:30:06 UTC (rev 11416)
@@ -141,7 +141,6 @@
  * support for packages here e.g. import `package.module` */
 
 static struct _inittab BPyInittab_Modules[] = {
-	{"Blender", M_Blender_Init},
 	{"bpy", m_bpy_init},
 	{NULL, NULL}
 };

Modified: branches/pyapi_devel/source/blender/python/api2_2x/Armature.c
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/Armature.c	2007-07-29 11:37:34 UTC (rev 11415)
+++ branches/pyapi_devel/source/blender/python/api2_2x/Armature.c	2007-07-29 14:30:06 UTC (rev 11416)
@@ -61,7 +61,7 @@
 static const char sModuleError[] = "Blender.Armature - Error: ";
 static const char sModuleBadArgs[] = "Blender.Armature - Bad Arguments: ";
 
-//################## BPyBonesDict_Type (internal) ########################
+//################## BPyBoneDict_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(BPyBonesDictObject *self)
+static PyObject* BonesDict_items(BPyBoneDictObject *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(BPyBonesDictObject *self)
+static PyObject* BonesDict_keys(BPyBoneDictObject *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(BPyBonesDictObject *self)
+static PyObject* BonesDict_values(BPyBoneDictObject *self)
 {
 	if (self->editmode_flag){
 		return PyDict_Values(self->editbonesMap);
@@ -157,7 +157,7 @@
 	return 0;
 }
 //----------------- BonesDict_InitBones
-static int BonesDict_InitBones(BPyBonesDictObject *self)
+static int BonesDict_InitBones(BPyBoneDictObject *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(BPyBonesDictObject *self)
+static int BonesDict_InitEditBones(BPyBoneDictObject *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(BPyBonesDictObject *self)
+static PyObject *BonesDict_repr(BPyBoneDictObject *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(BPyBonesDictObject * self)
+static void BonesDict_dealloc(BPyBoneDictObject * 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(BPyBonesDictObject *self)
+static int BonesDict_len(BPyBoneDictObject *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(BPyBonesDictObject *self, PyObject* key)
+static PyObject *BonesDict_GetItem(BPyBoneDictObject *self, PyObject* key)
 { 
 	PyObject *value = NULL;
 
@@ -259,7 +259,7 @@
 }
 //-----------------------mp_ass_subscript
 //This does dict assignment - Bones['key'] = value
-static int BonesDict_SetItem(BPyBonesDictObject *self, PyObject *key, PyObject *value)
+static int BonesDict_SetItem(BPyBoneDictObject *self, PyObject *key, PyObject *value)
 {
 	BPyEditBoneObject *editbone_for_deletion;
 	struct EditBone *editbone = NULL;
@@ -373,11 +373,11 @@
 	(objobjargproc)BonesDict_SetItem,	//mp_ass_subscript
 };
 //BonesDict TypeObject
-PyTypeObject BPyBonesDict_Type = {
+PyTypeObject BPyBoneDict_Type = {
 	PyObject_HEAD_INIT(NULL)			//tp_head
 	0,												//tp_internal
 	"BonesDict",								//tp_name
-	sizeof(BPyBonesDictObject),					//tp_basicsize
+	sizeof(BPyBoneDictObject),					//tp_basicsize
 	0,												//tp_itemsize
 	(destructor)BonesDict_dealloc,		//tp_dealloc
 	0,												//tp_print
@@ -425,7 +425,7 @@
 //-----------------------PyBonesDict_FromPyArmature
 static PyObject *PyBonesDict_FromPyArmature(BPyArmatureObject *py_armature)
 {
-	BPyBonesDictObject *py_BonesDict = (BPyBonesDictObject *)PyObject_NEW( BPyBonesDictObject, &BPyBonesDict_Type );
+	BPyBoneDictObject *py_BonesDict = (BPyBoneDictObject *)PyObject_NEW( BPyBoneDictObject, &BPyBoneDict_Type );
 	if (!py_BonesDict)
 		goto RuntimeError;
 
@@ -1107,7 +1107,7 @@
 	py_armature->weaklist = NULL; //init the weaklist
 	
 	//create armature.bones
-	py_armature->Bones = (BPyBonesDictObject*)PyBonesDict_FromPyArmature(py_armature);
+	py_armature->Bones = (BPyBoneDictObject*)PyBonesDict_FromPyArmature(py_armature);
 	if (!py_armature->Bones){
 		printf("Oops - creating armature.bones\n");
 		goto RuntimeError;
@@ -1145,12 +1145,10 @@
 	return (PyObject *) &BPyArmature_Type ;
 }
 
-//-------------------MODULE INITIALIZATION--------------------------------
-void Armature_Init(void)
+PyObject *BoneDictType_Init( void )
 {
-	PyType_Ready(&BPyBonesDict_Type);
-	PyType_Ready(&BPyEditBone_Type);
-	PyType_Ready(&BPyBone_Type);
-
-	ArmatureType_Init( );
+	PyType_Ready( &BPyBoneDict_Type );
+	return (PyObject *) &BPyBoneDict_Type;
 }
+
+

Modified: branches/pyapi_devel/source/blender/python/api2_2x/Armature.h
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/Armature.h	2007-07-29 11:37:34 UTC (rev 11415)
+++ branches/pyapi_devel/source/blender/python/api2_2x/Armature.h	2007-07-29 14:30:06 UTC (rev 11416)
@@ -36,13 +36,13 @@
 
 //-------------------TYPE CHECKS---------------------------------
 #define BPyArmature_Check(v) PyObject_TypeCheck(v, &BPyArmature_Type)
-#define BPyBonesDict_Check(v) PyObject_TypeCheck(v, &BPyBonesDict_Type)
+#define BPyBonesDict_Check(v) PyObject_TypeCheck(v, &BPyBoneDict_Type)
 //-------------------MODULE INIT---------------------------------
-void Armature_Init( void );
 PyObject *ArmatureType_Init( void );
+PyObject *BoneDictType_Init( void );
 //-------------------TYPEOBJECT----------------------------------
 extern PyTypeObject BPyArmature_Type;
-extern PyTypeObject BPyBonesDict_Type;
+extern PyTypeObject BPyBoneDict_Type;
 //-------------------STRUCT DEFINITION---------------------------
 typedef struct {
 	PyObject_HEAD 
@@ -51,12 +51,12 @@
 	ListBase *bones;            //pointer to armature->bonebase
 	ListBase editbones;         //allocated list of EditBones 
 	short editmode_flag;       //1 = in , 0 = not in
-} BPyBonesDictObject;
+} BPyBoneDictObject;
 
 typedef struct {
 	PyObject_HEAD 
 	struct bArmature * armature;
-	BPyBonesDictObject *Bones;          //BPyBonesDictObject
+	BPyBoneDictObject *Bones;          //BPyBoneDictObject
 	PyObject *weaklist;
 } BPyArmatureObject;
 

Modified: branches/pyapi_devel/source/blender/python/api2_2x/BGL.c
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/BGL.c	2007-07-29 11:37:34 UTC (rev 11415)
+++ branches/pyapi_devel/source/blender/python/api2_2x/BGL.c	2007-07-29 14:30:06 UTC (rev 11416)
@@ -41,14 +41,14 @@
 #include "gen_utils.h"
 
 static int type_size( int type );
-static Buffer *make_buffer( int type, int ndimensions, int *dimensions );
+static BPyGLBufferObject *make_buffer( int type, int ndimensions, int *dimensions );
 
-static char Method_Buffer_doc[] =
-	"(type, dimensions, [template]) - Create a new Buffer object\n\n\
+static char Method_GLBuffer_doc[] =
+	"(type, dimensions, [template]) - Create a new GLBuffer object\n\n\
 (type) - The format to store data in\n\
 (dimensions) - An int or sequence specifying the dimensions of the buffer\n\
 [template] - A sequence of matching dimensions to the buffer to be created\n\
-  which will be used to initialize the Buffer.\n\n\
+  which will be used to initialize the GLBuffer.\n\n\
 If a template is not passed in all fields will be initialized to 0.\n\n\
 The type should be one of GL_BYTE, GL_SHORT, GL_INT, GL_FLOAT, or GL_DOUBLE.\n\
 If the dimensions are specified as an int a linear buffer will be\n\
@@ -59,47 +59,47 @@
 square buffer. Passing [16, 16, 32] will create a 3 dimensional\n\
 buffer which is twice as deep as it is wide or high.";
 
-static PyObject *Method_Buffer( PyObject * self, PyObject * args );
+static PyObject *Method_GLBuffer( PyObject * self, PyObject * args );
 
 /* Buffer sequence methods */
 
-static int Buffer_len( PyObject * self );
-static PyObject *Buffer_item( PyObject * self, int i );
-static PyObject *Buffer_slice( PyObject * self, int begin, int end );
-static int Buffer_ass_item( PyObject * self, int i, PyObject * v );
-static int Buffer_ass_slice( PyObject * self, int begin, int end,
+static int GLBuffer_len( BPyGLBufferObject * self );
+static PyObject *GLBuffer_item( BPyGLBufferObject * self, int i );
+static PyObject *GLBuffer_slice( BPyGLBufferObject * self, int begin, int end );
+static int GLBuffer_ass_item( BPyGLBufferObject * self, int i, PyObject * v );
+static int GLBuffer_ass_slice( BPyGLBufferObject * self, int begin, int end,
 			     PyObject * seq );
 
-static PySequenceMethods Buffer_SeqMethods = {
-	( inquiry ) Buffer_len,	/*sq_length */
+static PySequenceMethods GLBuffer_SeqMethods = {
+	( inquiry ) GLBuffer_len,	/*sq_length */
 	( binaryfunc ) 0,	/*sq_concat */
 	( intargfunc ) 0,	/*sq_repeat */
-	( intargfunc ) Buffer_item,	/*sq_item */
-	( intintargfunc ) Buffer_slice,	/*sq_slice */

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list