[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11328] branches/2-44-stable/blender/ source/blender/python/api2_2x: bugfix' s from own mistake when modifying the Curve module.

Campbell Barton cbarton at metavr.com
Sat Jul 21 18:35:56 CEST 2007


Revision: 11328
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11328
Author:   campbellbarton
Date:     2007-07-21 18:35:55 +0200 (Sat, 21 Jul 2007)

Log Message:
-----------
bugfix's from own mistake when modifying the Curve module.
other changes are just small typo's etc.

fixes...
https://projects.blender.org/tracker/?func=detail&aid=6962&group_id=9&atid=125
http://projects.blender.org/tracker/index.php?func=detail&aid=6902&group_id=9&atid=125

Modified Paths:
--------------
    branches/2-44-stable/blender/source/blender/python/api2_2x/CurNurb.c
    branches/2-44-stable/blender/source/blender/python/api2_2x/Curve.c
    branches/2-44-stable/blender/source/blender/python/api2_2x/Material.c
    branches/2-44-stable/blender/source/blender/python/api2_2x/Mathutils.c
    branches/2-44-stable/blender/source/blender/python/api2_2x/Object.c
    branches/2-44-stable/blender/source/blender/python/api2_2x/doc/Draw.py

Modified: branches/2-44-stable/blender/source/blender/python/api2_2x/CurNurb.c
===================================================================
--- branches/2-44-stable/blender/source/blender/python/api2_2x/CurNurb.c	2007-07-21 07:26:15 UTC (rev 11327)
+++ branches/2-44-stable/blender/source/blender/python/api2_2x/CurNurb.c	2007-07-21 16:35:55 UTC (rev 11328)
@@ -62,7 +62,7 @@
 static int CurNurb_length( PyInstanceObject * inst );
 static PyObject *CurNurb_getIter( BPy_CurNurb * self );
 static PyObject *CurNurb_iterNext( BPy_CurNurb * self );
-PyObject *CurNurb_append( BPy_CurNurb * self, PyObject * args );
+PyObject *CurNurb_append( BPy_CurNurb * self, PyObject * value );
 
 static PyObject *CurNurb_isNurb( BPy_CurNurb * self );
 static PyObject *CurNurb_isCyclic( BPy_CurNurb * self );
@@ -124,7 +124,7 @@
 	 "( type ) - change the type of the curve (Poly: 0, Bezier: 1, NURBS: 4)"},
 	{"getType", ( PyCFunction ) CurNurb_getType, METH_NOARGS,
 	 "( ) - get the type of the curve (Poly: 0, Bezier: 1, NURBS: 4)"},
-	{"append", ( PyCFunction ) CurNurb_append, METH_VARARGS,
+	{"append", ( PyCFunction ) CurNurb_append, METH_O,
 	 "( point ) - add a new point.  arg is BezTriple or list of x,y,z,w floats"},
 	{"isNurb", ( PyCFunction ) CurNurb_isNurb, METH_NOARGS,
 	 "( ) - boolean function tests if this spline is type nurb or bezier"},
@@ -435,11 +435,11 @@
  * arg is BezTriple or list of xyzw floats 
  */
 
-PyObject *CurNurb_append( BPy_CurNurb * self, PyObject * args )
+PyObject *CurNurb_append( BPy_CurNurb * self, PyObject * value )
 {
 	Nurb *nurb = self->nurb;
 
-	return CurNurb_appendPointToNurb( nurb, args );
+	return CurNurb_appendPointToNurb( nurb, value );
 }
 
 
@@ -449,29 +449,18 @@
  * notice the first arg is Nurb*.
  */
 
-PyObject *CurNurb_appendPointToNurb( Nurb * nurb, PyObject * args )
+PyObject *CurNurb_appendPointToNurb( Nurb * nurb, PyObject * value )
 {
 
 	int i;
 	int size;
-	PyObject *pyOb;
 	int npoints = nurb->pntsu;
 
-	/*
-	   do we have a list of four floats or a BezTriple?
-	*/
-	if( !PyArg_ParseTuple( args, "O", &pyOb ))
-		return EXPP_ReturnPyObjError
-				( PyExc_RuntimeError,
-				  "Internal error parsing arguments" );
-
-
-
 	/* if curve is empty, adjust type depending on input type */
 	if (nurb->bezt==NULL && nurb->bp==NULL) {
-		if (BPy_BezTriple_Check( pyOb ))
+		if (BPy_BezTriple_Check( value ))
 			nurb->type |= CU_BEZIER;
-		else if (PySequence_Check( pyOb ))
+		else if (PySequence_Check( value ))
 			nurb->type |= CU_NURBS;
 		else
 			return( EXPP_ReturnPyObjError( PyExc_TypeError,
@@ -483,7 +472,7 @@
 	if ((nurb->type & 7)==CU_BEZIER) {
 		BezTriple *tmp;
 
-		if( !BPy_BezTriple_Check( pyOb ) )
+		if( !BPy_BezTriple_Check( value ) )
 			return( EXPP_ReturnPyObjError( PyExc_TypeError,
 					  "Expected a BezTriple\n" ) );
 
@@ -507,11 +496,11 @@
 		nurb->pntsu++;
 		/* add new point to end of list */
 		memcpy( nurb->bezt + npoints,
-			BezTriple_FromPyObject( pyOb ), sizeof( BezTriple ) );
+			BezTriple_FromPyObject( value ), sizeof( BezTriple ) );
 
 	}
-	else if( PySequence_Check( pyOb ) ) {
-		size = PySequence_Size( pyOb );
+	else if( PySequence_Check( value ) ) {
+		size = PySequence_Size( value );
 /*		printf("\ndbg: got a sequence of size %d\n", size );  */
 		if( size == 4 || size == 5 ) {
 			BPoint *tmp;
@@ -537,7 +526,7 @@
 				sizeof( BPoint ) );
 
 			for( i = 0; i < 4; ++i ) {
-				PyObject *item = PySequence_GetItem( pyOb, i );
+				PyObject *item = PySequence_GetItem( value, i );
 
 				if (item == NULL)
 					return NULL;
@@ -548,7 +537,7 @@
 			}
 
 			if (size == 5) {
-				PyObject *item = PySequence_GetItem( pyOb, i );
+				PyObject *item = PySequence_GetItem( value, i );
 
 				if (item == NULL)
 					return NULL;

Modified: branches/2-44-stable/blender/source/blender/python/api2_2x/Curve.c
===================================================================
--- branches/2-44-stable/blender/source/blender/python/api2_2x/Curve.c	2007-07-21 07:26:15 UTC (rev 11327)
+++ branches/2-44-stable/blender/source/blender/python/api2_2x/Curve.c	2007-07-21 16:35:55 UTC (rev 11328)
@@ -846,7 +846,6 @@
 	int i;
 	int nurb_num;		/* index of curve we append to */
 	PyObject *coord_args;	/* coords for new point */
-	PyObject *retval = NULL;
 	Nurb *nurb = self->curve->nurb.first;	/* first nurb in Curve */
 
 /* fixme - need to malloc new Nurb */
@@ -868,14 +867,8 @@
 			return EXPP_ReturnPyObjError( PyExc_ValueError,
 					"curve index out of range" );
 	}
-
-	/* rebuild our arg tuple for appendPointToNurb() */
-	//valtuple = Py_BuildValue( "(O)", coord_args );
 	
-	retval =  CurNurb_appendPointToNurb( nurb, coord_args );
-	// Py_DECREF( valtuple );
-
-	return retval;
+	return CurNurb_appendPointToNurb( nurb, coord_args );
 }
 
 
@@ -885,7 +878,7 @@
   returns a refernce to the newly created nurb.
 *****/
 
-static PyObject *Curve_appendNurb( BPy_Curve * self, PyObject * args )
+static PyObject *Curve_appendNurb( BPy_Curve * self, PyObject * value )
 {
 	Nurb *nurb_ptr = self->curve->nurb.first;
 	Nurb **pptr = ( Nurb ** ) & ( self->curve->nurb.first );
@@ -906,7 +899,7 @@
 		return EXPP_ReturnPyObjError
 			( PyExc_MemoryError, "unable to malloc Nurb" );
 
-	if( CurNurb_appendPointToNurb( new_nurb, args ) ) {
+	if( CurNurb_appendPointToNurb( new_nurb, value ) ) {
 		*pptr = new_nurb;
 		new_nurb->resolu = self->curve->resolu;
 		new_nurb->resolv = self->curve->resolv;
@@ -1493,7 +1486,7 @@
 	 "(nothing or integer) - returns the number of points of the specified curve"},
 	{"appendPoint", ( PyCFunction ) Curve_appendPoint, METH_VARARGS,
 	 "( int numcurve, list of coordinates) - adds a new point to end of curve"},
-	{"appendNurb", ( PyCFunction ) Curve_appendNurb, METH_VARARGS,
+	{"appendNurb", ( PyCFunction ) Curve_appendNurb, METH_O,
 	 "( new_nurb ) - adds a new nurb to the Curve"},
 	{"update", ( PyCFunction ) Curve_update, METH_NOARGS,
 	 "( ) - updates display lists after changes to Curve"},

Modified: branches/2-44-stable/blender/source/blender/python/api2_2x/Material.c
===================================================================
--- branches/2-44-stable/blender/source/blender/python/api2_2x/Material.c	2007-07-21 07:26:15 UTC (rev 11327)
+++ branches/2-44-stable/blender/source/blender/python/api2_2x/Material.c	2007-07-21 16:35:55 UTC (rev 11328)
@@ -1114,11 +1114,11 @@
 	 (void *) EXPP_MAT_COMP_B },
 	{"colorbandDiffuse",
 	 (getter)Material_getColorband, (setter)Material_setColorband,
-	 "Set the light group for this material",
+	 "The diffuse colorband for this material",
 	 (void *) 0},
 	{"colorbandSpecular",
 	 (getter)Material_getColorband, (setter)Material_setColorband,
-	 "Set the light group for this material",
+	 "The specular colorband for this material",
 	 (void *) 1},
 	
 	/* SSS settings */

Modified: branches/2-44-stable/blender/source/blender/python/api2_2x/Mathutils.c
===================================================================
--- branches/2-44-stable/blender/source/blender/python/api2_2x/Mathutils.c	2007-07-21 07:26:15 UTC (rev 11327)
+++ branches/2-44-stable/blender/source/blender/python/api2_2x/Mathutils.c	2007-07-21 16:35:55 UTC (rev 11328)
@@ -59,7 +59,7 @@
 static char M_Mathutils_OrthoProjectionMatrix_doc[] = "() - construct a orthographic projection matrix from a selected plane";
 static char M_Mathutils_ShearMatrix_doc[] = "() - construct a shearing matrix from a plane of shear and a shear factor";
 static char M_Mathutils_CopyMat_doc[] = "() - create a copy of a matrix";
-static char M_Mathutils_TranslationMatrix_doc[] = "() - create a translation matrix from a vector";
+static char M_Mathutils_TranslationMatrix_doc[] = "(vec) - create a translation matrix from a vector";
 static char M_Mathutils_CopyQuat_doc[] = "() - copy quatB to quatA";
 static char M_Mathutils_CopyEuler_doc[] = "() - copy eulB to eultA";
 static char M_Mathutils_CrossQuats_doc[] = "() - return the mutliplication of two quaternions";

Modified: branches/2-44-stable/blender/source/blender/python/api2_2x/Object.c
===================================================================
--- branches/2-44-stable/blender/source/blender/python/api2_2x/Object.c	2007-07-21 07:26:15 UTC (rev 11327)
+++ branches/2-44-stable/blender/source/blender/python/api2_2x/Object.c	2007-07-21 16:35:55 UTC (rev 11328)
@@ -5012,10 +5012,6 @@
 	 (getter)Object_getRBHalfExtents, (setter)NULL, 
 	 "Rigid body physics bounds object type",
 	 NULL},
-	{"type",
-	 (getter)Object_getType, (setter)NULL, 
-	 "String describing Object type",
-	 NULL},
 
 	{"restrictDisplay",
 	 (getter)Object_getRestricted, (setter)Object_setRestricted, 

Modified: branches/2-44-stable/blender/source/blender/python/api2_2x/doc/Draw.py
===================================================================
--- branches/2-44-stable/blender/source/blender/python/api2_2x/doc/Draw.py	2007-07-21 07:26:15 UTC (rev 11327)
+++ branches/2-44-stable/blender/source/blender/python/api2_2x/doc/Draw.py	2007-07-21 16:35:55 UTC (rev 11328)
@@ -237,14 +237,14 @@
 
 def UIBlock(draw):
 	"""
-	This function creates a popup area where buttons, lebels, sliders etc can be dwarn.
+	This function creates a popup area where buttons, labels, sliders etc can be drawn.
 	
 	@type draw: function
 	@param draw: A function to draw to the popup area, taking no arguments: draw().
 	
 	@note: The size of the popup will expand to fit the bounds of the buttons created in the draw function.
 	@note: Be sure to use the mouse coordinates to position the buttons under the mouse,
-		so the popup dosnt exit as soon as it opens.
+		so the popup dosn't exit as soon as it opens.
 		The coordinates for buttons start 0,0 at the bottom left hand side of the screen.
 	@note: Within this popup, Redraw events and the registered button callback will not work.
 		For buttons to run events, use per button callbacks.





More information about the Bf-blender-cvs mailing list