Merge from trunk.

Bugfix #6682: some Mesh.Primitive default values didn't match UI values.
Revision: 10734
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=10734
Author:   khughes
This commit is contained in:
Ken Hughes 2007-06-23 21:12:14 +00:00
parent 102e9d0430
commit 3f0ea9b148
1 changed files with 18 additions and 19 deletions

View File

@ -114,20 +114,22 @@ static PyObject *M_MeshPrim_Plane( PyObject *self_unused, PyObject *args )
static PyObject *M_MeshPrim_Cube( PyObject *self_unused, PyObject *args )
{
float size = 2.0;
float height = 2.0;
float dia;
if( !PyArg_ParseTuple( args, "|f", &size ) )
if( !PyArg_ParseTuple( args, "|f", &height ) )
return EXPP_ReturnPyObjError( PyExc_TypeError,
"expected optional float arg" );
size *= (float)(sqrt(2.0)/2.0);
return make_mesh( 1, "Cube", 4, 0, 0, size, -size, 1, 1 );
height /= 2.0;
dia = height * (float)sqrt(2.0);
return make_mesh( 1, "Cube", 4, 32, 2, dia, -height, 1, 1 );
}
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,
@ -143,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,
@ -153,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,
@ -170,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,
@ -187,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 )
@ -212,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,
@ -228,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,