mathutils: refactor instantiation
remove 'type' argument, very few mathutils objects are wrapped, add new function for creating wrapped objects. also fixes unlikely memory leak if the data-array can't be allocated.
This commit is contained in:
@@ -81,7 +81,7 @@ PyObject *Vector_from_Vec2f(Vec2f& vec)
|
||||
float vec_data[2]; // because vec->_coord is protected
|
||||
vec_data[0] = vec.x();
|
||||
vec_data[1] = vec.y();
|
||||
return Vector_CreatePyObject(vec_data, 2, Py_NEW, NULL);
|
||||
return Vector_CreatePyObject(vec_data, 2, NULL);
|
||||
}
|
||||
|
||||
PyObject *Vector_from_Vec3f(Vec3f& vec)
|
||||
@@ -90,7 +90,7 @@ PyObject *Vector_from_Vec3f(Vec3f& vec)
|
||||
vec_data[0] = vec.x();
|
||||
vec_data[1] = vec.y();
|
||||
vec_data[2] = vec.z();
|
||||
return Vector_CreatePyObject(vec_data, 3, Py_NEW, NULL);
|
||||
return Vector_CreatePyObject(vec_data, 3, NULL);
|
||||
}
|
||||
|
||||
PyObject *Vector_from_Vec3r(Vec3r& vec)
|
||||
@@ -99,7 +99,7 @@ PyObject *Vector_from_Vec3r(Vec3r& vec)
|
||||
vec_data[0] = vec.x();
|
||||
vec_data[1] = vec.y();
|
||||
vec_data[2] = vec.z();
|
||||
return Vector_CreatePyObject(vec_data, 3, Py_NEW, NULL);
|
||||
return Vector_CreatePyObject(vec_data, 3, NULL);
|
||||
}
|
||||
|
||||
PyObject *BPy_Id_from_Id(Id& id)
|
||||
|
||||
Reference in New Issue
Block a user