diff options
author | Campbell Barton <ideasman42@gmail.com> | 2007-05-26 08:39:31 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2007-05-26 08:39:31 +0400 |
commit | 30dd4fafd13e84ed7363c0c0f6ab17a384098450 (patch) | |
tree | de0b558fe48f4a25be9d328c9b645a9795d458e4 /source/blender/python/api2_2x/Noise.c | |
parent | ea9b3dc387f5a167cf6b9e53f7be63e9b76de241 (diff) |
More memory leaks fixed - in IDProp, Bone.head, tail, matrix, ob.DupObjects (my fault) and in Effect module as well as a few others.
Also stopped using Py_BuildValue for strings, ints and floats.
Diffstat (limited to 'source/blender/python/api2_2x/Noise.c')
-rw-r--r-- | source/blender/python/api2_2x/Noise.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/source/blender/python/api2_2x/Noise.c b/source/blender/python/api2_2x/Noise.c index 14a254ebcd0..821c541b4ac 100644 --- a/source/blender/python/api2_2x/Noise.c +++ b/source/blender/python/api2_2x/Noise.c @@ -228,8 +228,9 @@ static PyObject *Noise_noise( PyObject * self, PyObject * args ) int nb = 1; if( !PyArg_ParseTuple( args, "(fff)|i", &x, &y, &z, &nb ) ) return NULL; - return Py_BuildValue( "f", - 2.0 * BLI_gNoise( 1.0, x, y, z, 0, nb ) - 1.0 ); + + return PyFloat_FromDouble( + (double)(2.0 * BLI_gNoise( 1.0, x, y, z, 0, nb ) - 1.0) ); } /*-------------------------------------------------------------------------*/ @@ -290,7 +291,7 @@ static PyObject *Noise_turbulence( PyObject * self, PyObject * args ) if( !PyArg_ParseTuple ( args, "(fff)ii|iff", &x, &y, &z, &oct, &hd, &nb, &as, &fs ) ) return NULL; - return Py_BuildValue( "f", turb( x, y, z, oct, hd, nb, as, fs ) ); + return PyFloat_FromDouble( (double)turb( x, y, z, oct, hd, nb, as, fs ) ); } /*--------------------------------------------------------------------------*/ @@ -349,7 +350,7 @@ static PyObject *Noise_fBm( PyObject * self, PyObject * args ) if( !PyArg_ParseTuple ( args, "(fff)fff|i", &x, &y, &z, &H, &lac, &oct, &nb ) ) return NULL; - return Py_BuildValue( "f", mg_fBm( x, y, z, H, lac, oct, nb ) ); + return PyFloat_FromDouble( (double)mg_fBm( x, y, z, H, lac, oct, nb ) ); } /*------------------------------------------------------------------------*/ @@ -361,8 +362,7 @@ static PyObject *Noise_multiFractal( PyObject * self, PyObject * args ) if( !PyArg_ParseTuple ( args, "(fff)fff|i", &x, &y, &z, &H, &lac, &oct, &nb ) ) return NULL; - return Py_BuildValue( "f", - mg_MultiFractal( x, y, z, H, lac, oct, nb ) ); + return PyFloat_FromDouble( (double)mg_MultiFractal( x, y, z, H, lac, oct, nb ) ); } /*------------------------------------------------------------------------*/ @@ -374,7 +374,7 @@ static PyObject *Noise_vlNoise( PyObject * self, PyObject * args ) if( !PyArg_ParseTuple ( args, "(fff)f|ii", &x, &y, &z, &d, &nt1, &nt2 ) ) return NULL; - return Py_BuildValue( "f", mg_VLNoise( x, y, z, d, nt1, nt2 ) ); + return PyFloat_FromDouble( (double)mg_VLNoise( x, y, z, d, nt1, nt2 ) ); } /*-------------------------------------------------------------------------*/ @@ -386,9 +386,9 @@ static PyObject *Noise_heteroTerrain( PyObject * self, PyObject * args ) if( !PyArg_ParseTuple ( args, "(fff)ffff|i", &x, &y, &z, &H, &lac, &oct, &ofs, &nb ) ) return NULL; - return Py_BuildValue( "f", - mg_HeteroTerrain( x, y, z, H, lac, oct, ofs, - nb ) ); + + return PyFloat_FromDouble( + (double)mg_HeteroTerrain( x, y, z, H, lac, oct, ofs, nb ) ); } /*-------------------------------------------------------------------------*/ @@ -401,9 +401,9 @@ static PyObject *Noise_hybridMFractal( PyObject * self, PyObject * args ) ( args, "(fff)fffff|i", &x, &y, &z, &H, &lac, &oct, &ofs, &gn, &nb ) ) return NULL; - return Py_BuildValue( "f", - mg_HybridMultiFractal( x, y, z, H, lac, oct, ofs, - gn, nb ) ); + + return PyFloat_FromDouble( + (double)mg_HybridMultiFractal( x, y, z, H, lac, oct, ofs, gn, nb) ); } /*------------------------------------------------------------------------*/ @@ -416,9 +416,8 @@ static PyObject *Noise_ridgedMFractal( PyObject * self, PyObject * args ) ( args, "(fff)fffff|i", &x, &y, &z, &H, &lac, &oct, &ofs, &gn, &nb ) ) return NULL; - return Py_BuildValue( "f", - mg_RidgedMultiFractal( x, y, z, H, lac, oct, ofs, - gn, nb ) ); + return PyFloat_FromDouble( + (double)mg_RidgedMultiFractal( x, y, z, H, lac, oct, ofs, gn, nb) ); } /*-------------------------------------------------------------------------*/ |