[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [10773] trunk/blender/source/blender/ python/api2_2x: Python API

Ken Hughes khughes at pacific.edu
Thu May 24 17:00:10 CEST 2007


Revision: 10773
          https://svn.blender.org//revision/?rev=10773&view=rev
Author:   khughes
Date:     2007-05-24 17:00:10 +0200 (Thu, 24 May 2007)

Log Message:
-----------
Python API
==========
Bugfix #6682: some Mesh.Primitive default values didn't match UI values.

Modified Paths:
--------------
    trunk/blender/source/blender/python/api2_2x/doc/MeshPrimitives.py
    trunk/blender/source/blender/python/api2_2x/meshPrimitive.c

Modified: trunk/blender/source/blender/python/api2_2x/doc/MeshPrimitives.py
===================================================================
--- trunk/blender/source/blender/python/api2_2x/doc/MeshPrimitives.py	2007-05-24 03:36:40 UTC (rev 10772)
+++ trunk/blender/source/blender/python/api2_2x/doc/MeshPrimitives.py	2007-05-24 15:00:10 UTC (rev 10773)
@@ -42,10 +42,10 @@
   @return: returns a mesh object.
   """
 
-def Circle(verts=32,diameter=2.8284):
+def Circle(verts=32,diameter=2.0):
   """
   Construct a circle mesh.  The defaults create a circle with a
-  diameter of 2*sqrt(2) Blender units, identical to the Blender UI.
+  diameter of 2 Blender units, identical to the Blender UI.
   @type verts: int
   @param verts: optional number of vertices for the circle.  
   Value must be in the range [3,100].
@@ -55,10 +55,10 @@
   @return: returns a mesh object.
   """
 
-def Cylinder(verts=32, diameter=2.8284, length=1.0):
+def Cylinder(verts=32, diameter=2.0, length=2.0):
   """
   Construct a cylindrical mesh (ends filled).  The defaults create a
-  cylinder with a diameter of 2*sqrt(2) Blender units and length 1 unit,
+  cylinder with a diameter of 2 Blender units and length 2 units,
   identical to the Blender UI.
   @type verts: int
   @param verts: optional number of vertices in the cylinder's perimeter.
@@ -71,10 +71,10 @@
   @return: returns a mesh object.
   """
 
-def Tube(verts=32, diameter=2.8284, length=1.0):
+def Tube(verts=32, diameter=2.0, length=2.0):
   """
   Construct a cylindrical mesh (ends not filled).  The defaults create a
-  cylinder with a diameter of 2*sqrt(2) Blender units and length 1 unit, identical
+  cylinder with a diameter of 2 Blender units and length 2 units, identical
   to the Blender UI.
   @type verts: int
   @param verts: optional number of vertices in the tube's perimeter.
@@ -87,11 +87,11 @@
   @return: returns a mesh object.
   """
 
-def Cone(verts=32, diameter=2.8284, length=1.0):
+def Cone(verts=32, diameter=2.0, length=2.0):
   """
   Construct a conic mesh (ends filled).  The defaulte create a cone with a
-  base diameter of 2*sqrt(2) Blender units and length 1 unit, identical to the Blender
-  UI.
+  base diameter of 2 Blender units and length 2 units, identical to
+  the Blender UI.
   @type verts: int
   @param verts: optional number of vertices in the cone's perimeter.
   Value must be in the range [3,100].
@@ -119,10 +119,10 @@
   @return: returns a mesh object.
   """
 
-def UVsphere(segments=32, rings=32, diameter=2.8284):
+def UVsphere(segments=32, rings=32, diameter=2.0):
   """
   Construct a UV sphere mesh.  The defaults create a 32 by 32 sphere with
-  a diameter of 2*sqrt(2) Blender units, identical to the Blender UI.
+  a diameter of 2 Blender units, identical to the Blender UI.
   @type segments: int
   @param segments: optional number of longitudinal divisions.
   Value must be in the range [3,100].
@@ -135,10 +135,10 @@
   @return: returns a mesh object.
   """
 
-def Icosphere(subdivisions=2, diameter=2.82824):
+def Icosphere(subdivisions=2, diameter=2.0):
   """
   Construct a Icosphere mesh.  The defaults create sphere with 2 subdivisions
-  and diameter of 2*sqrt(2) Blender units, identical to the Blender UI.
+  and diameter of 2 Blender units, identical to the Blender UI.
   @type subdivisions: int
   @param subdivisions: optional number of subdivisions.
   Value must be in the range [2,5].

Modified: trunk/blender/source/blender/python/api2_2x/meshPrimitive.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/meshPrimitive.c	2007-05-24 03:36:40 UTC (rev 10772)
+++ trunk/blender/source/blender/python/api2_2x/meshPrimitive.c	2007-05-24 15:00:10 UTC (rev 10773)
@@ -129,7 +129,7 @@
 static PyObject *M_MeshPrim_Circle( PyObject *self_unused, PyObject *args )
 {
 	int tot = 32;
-	float size = (float)(2.0*sqrt(2.0));
+	float size = 2;
 
 	if( !PyArg_ParseTuple( args, "|if", &tot, &size ) )
 		return EXPP_ReturnPyObjError( PyExc_TypeError,
@@ -145,8 +145,8 @@
 static PyObject *M_MeshPrim_Cylinder( PyObject *self_unused, PyObject *args )
 {
 	int tot = 32;
-	float size = (float)(2.0*sqrt(2.0));
-	float len = 1.0;
+	float size = 2.0;
+	float len = 2.0;
 
 	if( !PyArg_ParseTuple( args, "|iff", &tot, &size, &len ) )
 		return EXPP_ReturnPyObjError( PyExc_TypeError,
@@ -155,15 +155,14 @@
 		return EXPP_ReturnPyObjError( PyExc_ValueError,
 				"number of vertices must be in the range [3:100]" );
 
-	size /= 2.0;
-	return make_mesh( 5, "Cylinder", tot, 0, 0, size, -len, 1, 1 );
+	return make_mesh( 5, "Cylinder", tot, 0, 0, size/2.0, -len/2.0, 1, 1 );
 }
 
 static PyObject *M_MeshPrim_Tube( PyObject *self_unused, PyObject *args )
 {
 	int tot = 32;
-	float size = (float)(2.0*sqrt(2.0));
-	float len = 1.0;
+	float size = 2.0;
+	float len = 2.0;
 
 	if( !PyArg_ParseTuple( args, "|iff", &tot, &size, &len ) )
 		return EXPP_ReturnPyObjError( PyExc_TypeError,
@@ -172,15 +171,14 @@
 		return EXPP_ReturnPyObjError( PyExc_ValueError,
 				"number of vertices must be in the range [3:100]" );
 
-	size /= 2.0;
-	return make_mesh( 6, "Tube", tot, 0, 0, size, -len, 1, 0 );
+	return make_mesh( 6, "Tube", tot, 0, 0, size/2.0, -len/2.0, 1, 0 );
 }
 
 static PyObject *M_MeshPrim_Cone( PyObject *self_unused, PyObject *args )
 {
 	int tot = 32;
-	float size = (float)(2.0*sqrt(2.0));
-	float len = 1.0;
+	float size = 2.0;
+	float len = 2.0;
 
 	if( !PyArg_ParseTuple( args, "|iff", &tot, &size, &len ) )
 		return EXPP_ReturnPyObjError( PyExc_TypeError,
@@ -189,8 +187,7 @@
 		return EXPP_ReturnPyObjError( PyExc_ValueError,
 				"number of vertices must be in the range [3:100]" );
 
-	size /= 2.0;
-	return make_mesh( 7, "Cone", tot, 0, 0, size, -len, 0, 1 );
+	return make_mesh( 7, "Cone", tot, 0, 0, size/2.0, -len/2.0, 0, 1 );
 }
 
 static PyObject *M_MeshPrim_Grid( PyObject *self_unused, PyObject *args )
@@ -214,7 +211,7 @@
 {
 	int segs = 32;
 	int rings = 32;
-	float size = (float)(2.0*sqrt(2.0));
+	float size = 2.0;
 
 	if( !PyArg_ParseTuple( args, "|iif", &segs, &rings, &size ) )
 		return EXPP_ReturnPyObjError( PyExc_TypeError,
@@ -230,7 +227,7 @@
 static PyObject *M_MeshPrim_Icosphere( PyObject *self_unused, PyObject *args )
 {
 	int subdiv = 2;
-	float size = (float)(2.0*sqrt(2.0));
+	float size = 2.0;
 
 	if( !PyArg_ParseTuple( args, "|if", &subdiv, &size ) )
 		return EXPP_ReturnPyObjError( PyExc_TypeError,





More information about the Bf-blender-cvs mailing list