Python API

----------
Bugfix: make bpy.data.meshes.new() work the same way as Blender.Mesh.New().
This commit is contained in:
Ken Hughes 2009-05-28 14:24:16 +00:00
parent 0edb6e89be
commit bdfa07cddb

@ -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;
}