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:
authorStephen Swaney <sswaney@centurytel.net>2004-10-14 21:35:16 +0400
committerStephen Swaney <sswaney@centurytel.net>2004-10-14 21:35:16 +0400
commit7dda27fcd7266befeb9c8f191726154831438b59 (patch)
tree79e00f3b1cece2fd594ba7b3a4b87c0cfb962445 /source/blender/python/api2_2x/NMesh.h
parent6fbd4e3e1f5169aed15856f7b1c412176035b236 (diff)
followup to vector memory leak fixes:
fix for problems with NMesh vertices. plug some more leaks in matrix module. new vector method newVectorProxy(). In BPy-Land, we have overloaded the meaning of our Vector type. One use is for vectors in the traditional mathmatical sense. The other legacy use is as a proxy for Blender data. The recent memory leak fixed have lead to the Vector type behaving as mathematical vectors. However, the NMesh module is still using Vector types as a proxy to manipulate NMVert data. To support this usage, in the vector module there is a new factory method newVectorProxy(). This creates a Vector that references memory outside the Vector. Vectors created by newVectorProxy() do NOT free their referenced memory. The newVectorProxy() is used only in bpy code and is not exposed thru the scripting interface. Anyone using newVectorProxy() must be aware of object lifetime and scoping issues because the returned Vector holds a pointer to memory it does not own. This works in the NMVert case since we are referencing memory belonging to the NMVert object via an NMVert method.
Diffstat (limited to 'source/blender/python/api2_2x/NMesh.h')
-rw-r--r--source/blender/python/api2_2x/NMesh.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/source/blender/python/api2_2x/NMesh.h b/source/blender/python/api2_2x/NMesh.h
index a9c21ac23b2..3742ef72e07 100644
--- a/source/blender/python/api2_2x/NMesh.h
+++ b/source/blender/python/api2_2x/NMesh.h
@@ -75,12 +75,14 @@ void remove_vert_def_nr( Object * ob, int def_nr, int vertnum );
/* Typedefs for the new types */
typedef struct {
- PyObject_HEAD unsigned char r, g, b, a;
+ PyObject_HEAD /* required python macro */
+ unsigned char r, g, b, a;
} BPy_NMCol; /* an NMesh color: [r,g,b,a] */
typedef struct {
- PyObject_VAR_HEAD float co[3];
+ PyObject_VAR_HEAD /* required python macro */
+ float co[3];
float no[3];
float uvco[3];
int index;
@@ -89,7 +91,8 @@ typedef struct {
} BPy_NMVert; /* an NMesh vertex */
typedef struct {
- PyObject_HEAD PyObject * v;
+ PyObject_HEAD /* required python macro */
+ PyObject * v;
PyObject *uv;
PyObject *col;
short mode;
@@ -101,7 +104,8 @@ typedef struct {
} BPy_NMFace; /* an NMesh face */
typedef struct {
- PyObject_HEAD Mesh * mesh;
+ PyObject_HEAD /* required python macro */
+ Mesh * mesh;
Object *object; /* for vertex grouping info, since it's stored on the object */
PyObject *name;
PyObject *materials;