forked from bartvdbraak/blender
Further fix for memory leaks in Freestyle Python API components:
- StrokeAttribute thickness setter - BezierCurve (used from within BezierCurveShader) - Smoother (used from within SmoothingShader)
This commit is contained in:
parent
628bde206f
commit
50c46fb9b3
@ -106,6 +106,11 @@ BezierCurve::BezierCurve(vector<Vec2d>& iPoints, double error)
|
||||
|
||||
BezierCurve::~BezierCurve()
|
||||
{
|
||||
if (!_Segments.empty()) {
|
||||
vector<BezierCurveSegment*>::iterator v, vend;
|
||||
for (v = _Segments.begin(), vend = _Segments.end(); v != vend; ++v)
|
||||
delete *v;
|
||||
}
|
||||
if (_currentSegment)
|
||||
delete _currentSegment;
|
||||
}
|
||||
|
@ -526,13 +526,12 @@ static PyObject *StrokeAttribute_color_get(BPy_StrokeAttribute *self, void *UNUS
|
||||
|
||||
static int StrokeAttribute_color_set(BPy_StrokeAttribute *self, PyObject *value, void *UNUSED(closure))
|
||||
{
|
||||
Vec3f *v = Vec3f_ptr_from_PyObject(value);
|
||||
if (!v) {
|
||||
float v[3];
|
||||
if (!float_array_from_PyObject(value, v, 3)) {
|
||||
PyErr_SetString(PyExc_ValueError, "value must be a 3-dimensional vector");
|
||||
return -1;
|
||||
}
|
||||
self->sa->setColor(v->x(), v->y(), v->z());
|
||||
delete v;
|
||||
self->sa->setColor(v[0], v[1], v[2]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -551,12 +550,12 @@ static PyObject *StrokeAttribute_thickness_get(BPy_StrokeAttribute *self, void *
|
||||
|
||||
static int StrokeAttribute_thickness_set(BPy_StrokeAttribute *self, PyObject *value, void *UNUSED(closure))
|
||||
{
|
||||
Vec2f *v = Vec2f_ptr_from_PyObject(value);
|
||||
if (!v) {
|
||||
float v[2];
|
||||
if (!float_array_from_PyObject(value, v, 2)) {
|
||||
PyErr_SetString(PyExc_ValueError, "value must be a 2-dimensional vector");
|
||||
return -1;
|
||||
}
|
||||
self->sa->setThickness(v->x(), v->y());
|
||||
self->sa->setThickness(v[0], v[1]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -214,6 +214,13 @@ Smoother::Smoother(Stroke &ioStroke)
|
||||
_safeTest = (_nbVertices > 4);
|
||||
}
|
||||
|
||||
Smoother::~Smoother()
|
||||
{
|
||||
delete[] _vertex;
|
||||
delete[] _curvature;
|
||||
delete[] _normal;
|
||||
}
|
||||
|
||||
void Smoother::smooth(int nbIteration, real iFactorPoint, real ifactorCurvature, real iFactorCurvatureDifference,
|
||||
real iAnisoPoint, real iAnisoNormal, real iAnisoCurvature, real iCarricatureFactor)
|
||||
{
|
||||
|
@ -154,7 +154,7 @@ class LIB_STROKE_EXPORT Smoother
|
||||
public:
|
||||
Smoother(Stroke &ioStroke);
|
||||
|
||||
virtual ~Smoother() {}
|
||||
virtual ~Smoother();
|
||||
|
||||
void smooth(int nbIterations, real iFactorPoint, real ifactorCurvature, real iFactorCurvatureDifference,
|
||||
real iAnisoPoint, real iAnisoNormal, real iAnisoCurvature, real icarricatureFactor);
|
||||
|
Loading…
Reference in New Issue
Block a user