Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Hughes <khughes@pacific.edu>2007-05-24 19:00:10 +0400
committerKen Hughes <khughes@pacific.edu>2007-05-24 19:00:10 +0400
commit617200a01a727944bc19837143c57bfcab073c70 (patch)
tree7b4a1ad96cd62f2681b6167893bc68645a9fdf5a /source/blender
parent390526f5082c6ca80b8c8d9f185db3ab8dcd1e6f (diff)
Python API
========== Bugfix #6682: some Mesh.Primitive default values didn't match UI values.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/python/api2_2x/doc/MeshPrimitives.py26
-rw-r--r--source/blender/python/api2_2x/meshPrimitive.c27
2 files changed, 25 insertions, 28 deletions
diff --git a/source/blender/python/api2_2x/doc/MeshPrimitives.py b/source/blender/python/api2_2x/doc/MeshPrimitives.py
index 82b1395b93e..4fb53ab4536 100644
--- a/source/blender/python/api2_2x/doc/MeshPrimitives.py
+++ b/source/blender/python/api2_2x/doc/MeshPrimitives.py
@@ -42,10 +42,10 @@ def Cube(size=2.0):
@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 @@ def Circle(verts=32,diameter=2.8284):
@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 @@ def Cylinder(verts=32, diameter=2.8284, length=1.0):
@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 @@ def Tube(verts=32, diameter=2.8284, length=1.0):
@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 @@ def Grid(xres=32, yres=32, size=2.0):
@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 @@ def UVsphere(segments=32, rings=32, diameter=2.8284):
@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].
diff --git a/source/blender/python/api2_2x/meshPrimitive.c b/source/blender/python/api2_2x/meshPrimitive.c
index 614a44422b6..098d5f7d5f6 100644
--- a/source/blender/python/api2_2x/meshPrimitive.c
+++ b/source/blender/python/api2_2x/meshPrimitive.c
@@ -129,7 +129,7 @@ static PyObject *M_MeshPrim_Cube( PyObject *self_unused, PyObject *args )
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_Circle( PyObject *self_unused, PyObject *args )
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 @@ static PyObject *M_MeshPrim_Cylinder( PyObject *self_unused, PyObject *args )
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 @@ static PyObject *M_MeshPrim_Tube( PyObject *self_unused, PyObject *args )
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 @@ static PyObject *M_MeshPrim_Cone( PyObject *self_unused, PyObject *args )
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 @@ static PyObject *M_MeshPrim_UVsphere( PyObject *self_unused, PyObject *args )
{
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_UVsphere( PyObject *self_unused, PyObject *args )
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,