From bdfa07cddb4aaec98e761d2b06730fdf49a8365d Mon Sep 17 00:00:00 2001 From: Ken Hughes Date: Thu, 28 May 2009 14:24:16 +0000 Subject: Python API ---------- Bugfix: make bpy.data.meshes.new() work the same way as Blender.Mesh.New(). --- source/blender/python/api2_2x/bpy_data.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'source/blender') diff --git a/source/blender/python/api2_2x/bpy_data.c b/source/blender/python/api2_2x/bpy_data.c index d3499a79874..d2e80bc3611 100644 --- a/source/blender/python/api2_2x/bpy_data.c +++ b/source/blender/python/api2_2x/bpy_data.c @@ -404,6 +404,7 @@ PyObject *LibBlockSeq_new(BPy_LibBlockSeq *self, PyObject * args, PyObject *kwd) float color[] = {0, 0, 0, 1}; short data_code = 0; int user_count = 0; + PyObject *newOb = NULL; /* Load from file */ if ( ( self->type==ID_IM || self->type==ID_VF || @@ -594,7 +595,13 @@ PyObject *LibBlockSeq_new(BPy_LibBlockSeq *self, PyObject * args, PyObject *kwd) /* set some types user count to 1, otherwise zero */ id->us = user_count; - return GetPyObjectFromID(id); + newOb = GetPyObjectFromID(id); + /* if object is a mesh, set the new flag so memory can be deallocated + * later if the mesh is not linked to an object (consistent with the + * Blender.Mesh.New() method */ + if (self->type == ID_ME) + ((BPy_Mesh *)newOb)->new = 1; + return newOb; } -- cgit v1.2.3