Revision: 20476
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20476
Author:   khughes
Date:     2009-05-28 16:24:16 +0200 (Thu, 28 May 2009)

Log Message:
-----------
Python API
----------
Bugfix: make bpy.data.meshes.new() work the same way as Blender.Mesh.New().

Modified Paths:
--------------
    trunk/blender/source/blender/python/api2_2x/bpy_data.c

Modified: trunk/blender/source/blender/python/api2_2x/bpy_data.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/bpy_data.c      2009-05-28 
14:01:10 UTC (rev 20475)
+++ trunk/blender/source/blender/python/api2_2x/bpy_data.c      2009-05-28 
14:24:16 UTC (rev 20476)
@@ -404,6 +404,7 @@
        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 @@
        /* 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;
 }
 
 


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to