[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11446] branches/pyapi_devel/source/ blender/python/api2_2x: * Updated Themes to use new constants

Campbell Barton cbarton at metavr.com
Tue Jul 31 18:11:33 CEST 2007


Revision: 11446
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11446
Author:   campbellbarton
Date:     2007-07-31 18:11:32 +0200 (Tue, 31 Jul 2007)

Log Message:
-----------
* Updated Themes to use new constants
* a generic repr function for all library data
* removed unused utility functions
* remove Node's for now

* MTex work in progress,
changed the way materials deal with their mtex textures, new PyType (MTexSeq)
* initial support for access to lamp and world textures (no access in 2.4x)
--- example
  mtex = material.textures[0]
  texture = material.textures[0].tex  
  material.textures[9].tex = texture # adds an MTex if its not there.

Modified Paths:
--------------
    branches/pyapi_devel/source/blender/python/api2_2x/Armature.c
    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/Const.c
    branches/pyapi_devel/source/blender/python/api2_2x/Constraint.c
    branches/pyapi_devel/source/blender/python/api2_2x/CurNurb.c
    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/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/Image.c
    branches/pyapi_devel/source/blender/python/api2_2x/Ipo.c
    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/Lattice.c
    branches/pyapi_devel/source/blender/python/api2_2x/Library.c
    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/Mesh.c
    branches/pyapi_devel/source/blender/python/api2_2x/Metaball.c
    branches/pyapi_devel/source/blender/python/api2_2x/Modifier.c
    branches/pyapi_devel/source/blender/python/api2_2x/NLA.c
    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/Pose.c
    branches/pyapi_devel/source/blender/python/api2_2x/Scene.c
    branches/pyapi_devel/source/blender/python/api2_2x/Sound.c
    branches/pyapi_devel/source/blender/python/api2_2x/SurfNurb.c
    branches/pyapi_devel/source/blender/python/api2_2x/Text.c
    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/bpy_config.c
    branches/pyapi_devel/source/blender/python/api2_2x/bpy_data.c
    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/color.c
    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/object_softbody.c
    branches/pyapi_devel/source/blender/python/api2_2x/sceneRender.c
    branches/pyapi_devel/source/blender/python/api2_2x/sceneSequence.c
    branches/pyapi_devel/source/blender/python/api2_2x/windowTheme.c
    branches/pyapi_devel/source/blender/python/api2_2x/windowTheme.h

Added Paths:
-----------
    branches/pyapi_devel/source/blender/python/api2_2x/MTexSeq.c
    branches/pyapi_devel/source/blender/python/api2_2x/MTexSeq.h

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

Modified: branches/pyapi_devel/source/blender/python/api2_2x/Armature.c
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/Armature.c	2007-07-31 16:09:16 UTC (rev 11445)
+++ branches/pyapi_devel/source/blender/python/api2_2x/Armature.c	2007-07-31 16:11:32 UTC (rev 11446)
@@ -981,12 +981,6 @@
 	{NULL}
 };
 
-//------------------------tp_repr
-//This is the string representation of the object
-static PyObject *Armature_repr(BPyArmatureObject *self)
-{
-	return PyString_FromFormat( "[Armature: \"%s\"]", self->armature->id.name + 2 ); //*new*
-}
 //------------------------tp_dealloc
 //This tells how to 'tear-down' our object when ref count hits 0
 ///tp_dealloc
@@ -1031,7 +1025,7 @@
 	0,								//tp_getattr
 	0,								//tp_setattr
 	0,								//tp_compare
-	(reprfunc) Armature_repr,		//tp_repr
+	0,								//tp_repr
 	0,								//tp_as_number
 	0,								//tp_as_sequence
 	0,								//tp_as_mapping

Modified: branches/pyapi_devel/source/blender/python/api2_2x/Blender.c
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/Blender.c	2007-07-31 16:09:16 UTC (rev 11445)
+++ branches/pyapi_devel/source/blender/python/api2_2x/Blender.c	2007-07-31 16:11:32 UTC (rev 11446)
@@ -230,7 +230,7 @@
 	if( !PyArg_ParseTuple( args, "sO", &name, &arg ) )
 		return EXPP_ReturnPyObjError( PyExc_ValueError, "expected 2 args, where the first is always a string" );
 
-	if( StringEqual( name, "curframe" ) ) {
+	if( strcmp( name, "curframe" )==0 ) {
 		if( !PyInt_Check( arg ) )
 			return EXPP_ReturnPyObjError( PyExc_ValueError,
 					"expected an integer" );
@@ -241,39 +241,39 @@
 		 in a scene without worrying about the view layers */
 		scene_update_for_newframe(G.scene, (1<<20) - 1);
 		
-	} else if (StringEqual( name , "uscriptsdir" ) ) {
+	} else if (strcmp( name , "uscriptsdir" )==0 ) {
 		if ( !PyArg_Parse( arg , "s" , &dir ))
 			return EXPP_ReturnPyObjError( PyExc_ValueError, "expected a string" );
 		BLI_strncpy(U.pythondir, dir, FILE_MAXDIR);
-	} else if (StringEqual( name , "yfexportdir" ) ) {
+	} else if (strcmp( name , "yfexportdir" )==0 ) {
 		if ( !PyArg_Parse( arg , "s" , &dir ))
 			return EXPP_ReturnPyObjError( PyExc_ValueError, "expected a string" );
 		BLI_strncpy(U.yfexportdir, dir, FILE_MAXDIR);		
-	} else if (StringEqual( name , "fontsdir" ) ) {
+	} else if (strcmp( name , "fontsdir" )==0 ) {
 		if ( !PyArg_Parse( arg , "s" , &dir ))
 			return EXPP_ReturnPyObjError( PyExc_ValueError, "expected a string" );
 		BLI_strncpy(U.fontdir, dir, FILE_MAXDIR);
-	} else if (StringEqual( name , "texturesdir" ) ) {
+	} else if (strcmp( name , "texturesdir" )==0 ) {
 		if ( !PyArg_Parse( arg , "s" , &dir ))
 			return EXPP_ReturnPyObjError( PyExc_ValueError, "expected a string" );
 		BLI_strncpy(U.textudir, dir, FILE_MAXDIR);
-	} else if (StringEqual( name , "texpluginsdir" ) ) {
+	} else if (strcmp( name , "texpluginsdir" )==0 ) {
 		if ( !PyArg_Parse( arg , "s" , &dir ))
 			return EXPP_ReturnPyObjError( PyExc_ValueError, "expected a string" );
 		BLI_strncpy(U.plugtexdir, dir, FILE_MAXDIR);
-	} else if (StringEqual( name , "seqpluginsdir" ) ) {
+	} else if (strcmp( name , "seqpluginsdir" )==0 ) {
 		if ( !PyArg_Parse( arg , "s" , &dir ))
 			return EXPP_ReturnPyObjError( PyExc_ValueError, "expected a string" );
 		BLI_strncpy(U.plugseqdir, dir, FILE_MAXDIR);
-	} else if (StringEqual( name , "renderdir" ) ) {
+	} else if (strcmp( name , "renderdir" )==0 ) {
 		if ( !PyArg_Parse( arg , "s" , &dir ))
 			return EXPP_ReturnPyObjError( PyExc_ValueError, "expected a string" );
 		BLI_strncpy(U.renderdir, dir, FILE_MAXDIR);
-	} else if (StringEqual( name , "soundsdir" ) ) {
+	} else if (strcmp( name , "soundsdir" )==0 ) {
 		if ( !PyArg_Parse( arg , "s" , &dir ))
 			return EXPP_ReturnPyObjError( PyExc_ValueError, "expected a string" );
 		BLI_strncpy(U.sounddir, dir, FILE_MAXDIR);
-	} else if (StringEqual( name , "tempdir" ) ) {
+	} else if (strcmp( name , "tempdir" )==0 ) {
 		if ( !PyArg_Parse( arg , "s" , &dir ))
 			return EXPP_ReturnPyObjError( PyExc_ValueError, "expected a string" );
 		BLI_strncpy(U.tempdir, dir, FILE_MAXDIR);
@@ -296,30 +296,30 @@
 		return EXPP_ReturnPyObjError (PyExc_TypeError,
 			"expected string argument");
 
-	if( StringEqual( str, "curframe" ) )
+	if( strcmp( str, "curframe" )==0 )
 		ret = PyInt_FromLong( G.scene->r.cfra );
-	else if( StringEqual( str, "curtime" ) )
+	else if( strcmp( str, "curtime" )==0 )
 		ret = PyFloat_FromDouble( frame_to_float( G.scene->r.cfra ) );
-	else if( StringEqual( str, "rt" ) )
+	else if( strcmp( str, "rt" )==0 )
 		ret = PyInt_FromLong( (long)frame_to_float( G.rt ) );
-	else if( StringEqual( str, "staframe" ) )
+	else if( strcmp( str, "staframe" )==0 )
 		ret = PyInt_FromLong( G.scene->r.sfra );
-	else if( StringEqual( str, "endframe" ) )
+	else if( strcmp( str, "endframe" )==0 )
 		ret = PyInt_FromLong( G.scene->r.efra );
-	else if( StringEqual( str, "filename" ) ) {
+	else if( strcmp( str, "filename" )==0 ) {
 		if ( strstr(G.main->name, ".B.blend") != 0)
 			ret = PyString_FromString("");
 		else
 			ret = PyString_FromString(G.main->name);
 	}
-	else if( StringEqual( str, "homedir" ) ) {
+	else if( strcmp( str, "homedir" )==0 ) {
 		char *hdir = bpy_gethome(0);
 		if( hdir && BLI_exists( hdir ))
 			ret = PyString_FromString( hdir );
 		else
 			ret = EXPP_incr_ret( Py_None );
 	}
-	else if( StringEqual( str, "datadir" ) ) {
+	else if( strcmp( str, "datadir" )==0 ) {
 		char datadir[FILE_MAXDIR];
 		char *sdir = bpy_gethome(1);
 
@@ -330,7 +330,7 @@
 		}
 		if (!ret) ret = EXPP_incr_ret( Py_None );
 	}
-	else if(StringEqual(str, "udatadir")) {
+	else if(strcmp(str, "udatadir")==0) {
 		if (U.pythondir[0] != '\0') {
 			char upydir[FILE_MAXDIR];
 
@@ -348,7 +348,7 @@
 		}
 		if (!ret) ret = EXPP_incr_ret(Py_None);
 	}
-	else if( StringEqual( str, "scriptsdir" ) ) {
+	else if( strcmp( str, "scriptsdir" )==0 ) {
 		char *sdir = bpy_gethome(1);
 
 		if (sdir)
@@ -356,7 +356,7 @@
 		else
 			ret = EXPP_incr_ret( Py_None );
 	}
-	else if( StringEqual( str, "uscriptsdir" ) ) {
+	else if( strcmp( str, "uscriptsdir" )==0 ) {
 		if (U.pythondir[0] != '\0') {
 			char upydir[FILE_MAXDIR];
 
@@ -369,7 +369,7 @@
 		if (!ret) ret = EXPP_incr_ret(Py_None);
 	}
 	/* USER PREFS: */
-	else if( StringEqual( str, "yfexportdir" ) ) {
+	else if( strcmp( str, "yfexportdir" )==0 ) {
 		if (U.yfexportdir[0] != '\0') {
 			char yfexportdir[FILE_MAXDIR];
 
@@ -382,7 +382,7 @@
 		if (!ret) ret = EXPP_incr_ret(Py_None);
 	}
 	/* fontsdir */
-	else if( StringEqual( str, "fontsdir" ) ) {
+	else if( strcmp( str, "fontsdir" )==0 ) {
 		if (U.fontdir[0] != '\0') {
 			char fontdir[FILE_MAXDIR];
 
@@ -395,7 +395,7 @@
 		if (!ret) ret = EXPP_incr_ret(Py_None);
 	}	
 	/* texturesdir */
-	else if( StringEqual( str, "texturesdir" ) ) {
+	else if( strcmp( str, "texturesdir" )==0 ) {
 		if (U.textudir[0] != '\0') {
 			char textudir[FILE_MAXDIR];
 
@@ -408,7 +408,7 @@
 		if (!ret) ret = EXPP_incr_ret(Py_None);
 	}		
 	/* texpluginsdir */
-	else if( StringEqual( str, "texpluginsdir" ) ) {
+	else if( strcmp( str, "texpluginsdir" )==0 ) {
 		if (U.plugtexdir[0] != '\0') {
 			char plugtexdir[FILE_MAXDIR];
 
@@ -421,7 +421,7 @@
 		if (!ret) ret = EXPP_incr_ret(Py_None);
 	}			
 	/* seqpluginsdir */
-	else if( StringEqual( str, "seqpluginsdir" ) ) {
+	else if( strcmp( str, "seqpluginsdir" )==0 ) {
 		if (U.plugseqdir[0] != '\0') {
 			char plugseqdir[FILE_MAXDIR];
 
@@ -434,7 +434,7 @@
 		if (!ret) ret = EXPP_incr_ret(Py_None);
 	}			
 	/* renderdir */
-	else if( StringEqual( str, "renderdir" ) ) {
+	else if( strcmp( str, "renderdir" )==0 ) {
 		if (U.renderdir[0] != '\0') {
 			char renderdir[FILE_MAXDIR];
 
@@ -447,7 +447,7 @@
 		if (!ret) ret = EXPP_incr_ret(Py_None);
 	}		
 	/* soundsdir */
-	else if( StringEqual( str, "soundsdir" ) ) {
+	else if( strcmp( str, "soundsdir" )==0 ) {
 		if (U.sounddir[0] != '\0') {
 			char sounddir[FILE_MAXDIR];
 
@@ -460,7 +460,7 @@
 		if (!ret) ret = EXPP_incr_ret(Py_None);
 	}		
 	/* tempdir */
-	else if( StringEqual( str, "tempdir" ) ) {
+	else if( strcmp( str, "tempdir" )==0 ) {
 		if (U.tempdir[0] != '\0') {
 			char tempdir[FILE_MAXDIR];
 
@@ -473,7 +473,7 @@
 		if (!ret) ret = EXPP_incr_ret(Py_None);
 	}
 	/* icondir */
-	else if( StringEqual( str, "icondir" ) ) {
+	else if( strcmp( str, "icondir" )==0 ) {
 		
 		char icondirstr[FILE_MAXDIR];
 
@@ -490,7 +490,7 @@
 	}
 	/* According to the old file (opy_blender.c), the following if
 	   statement is a quick hack and needs some clean up. */
-	else if( StringEqual( str, "vrmloptions" ) ) {
+	else if( strcmp( str, "vrmloptions" )==0 ) {
 		ret = PyDict_New(  );
 
 		EXPP_dict_set_item_str( ret, "twoside",
@@ -503,7 +503,7 @@
 			PyInt_FromLong( U.vrmlflag & USER_VRML_AUTOSCALE ) );
 
 	} /* End 'quick hack' part. */
-	else if(StringEqual( str, "version" ))
+	else if(strcmp( str, "version" )==0)
 		ret = PyInt_FromLong( G.version );
 	else
 		return EXPP_ReturnPyObjError( PyExc_AttributeError, "unknown attribute" );

Modified: branches/pyapi_devel/source/blender/python/api2_2x/Camera.c
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/Camera.c	2007-07-31 16:09:16 UTC (rev 11445)
+++ branches/pyapi_devel/source/blender/python/api2_2x/Camera.c	2007-07-31 16:11:32 UTC (rev 11446)
@@ -183,7 +183,6 @@
 /*****************************************************************************/
 /* Python BPyCamera_Type callback function prototypes:                          */
 /*****************************************************************************/
-static PyObject *Camera_repr( BPyCameraObject * self );
 
 /* Three Python BPyCamera_Type helper functions needed by the Object module: */
 
@@ -518,12 +517,12 @@
 
 	/* Methods to implement standard operations */
 
-	NULL,						/* destructor tp_dealloc; */
+	(destructor)PyObject_Del,	/* tp_dealloc */
 	NULL,                       /* printfunc tp_print; */
 	NULL,                       /* getattrfunc tp_getattr; */
 	NULL,                       /* setattrfunc tp_setattr; */
 	NULL,						/* cmpfunc tp_compare; */
-	( reprfunc ) Camera_repr,   /* reprfunc tp_repr; */
+	NULL,						/* reprfunc tp_repr; */
 
 	/* Method suites for standard classes */
 
@@ -590,12 +589,6 @@
 	NULL
 };
 
-static PyObject *Camera_repr( BPyCameraObject * self )
-{
-	return PyString_FromFormat( "[Camera \"%s\"]",

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list