new materials and cameras had incorrect usercounts when added from python
authorCampbell Barton <ideasman42@gmail.com>
Sat, 11 Sep 2010 06:27:38 +0000 (06:27 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 11 Sep 2010 06:27:38 +0000 (06:27 +0000)
source/blender/makesrna/intern/rna_main_api.c

index 72ed625e5aa34f179968f2f7b9e3a63a95617f20..b58ed4aab6ae7694f8547139d50409b9a31af246 100644 (file)
@@ -86,7 +86,9 @@ Tex *rna_Main_add_texture(Main *bmain, char *name)
 
 Camera *rna_Main_cameras_new(Main *bmain, char* name)
 {
-       return add_camera(name);
+       ID *id= add_camera(name);
+       id->us--;
+       return (Camera *)id;
 }
 void rna_Main_cameras_remove(Main *bmain, ReportList *reports, struct Camera *camera)
 {
@@ -193,7 +195,9 @@ void rna_Main_objects_remove(Main *bmain, ReportList *reports, struct Object *ob
 
 struct Material *rna_Main_materials_new(Main *bmain, char* name)
 {
-       return add_material(name);
+       ID *id= (ID *)add_material(name);
+       id->us--;
+       return (Material *)id;
 }
 void rna_Main_materials_remove(Main *bmain, ReportList *reports, struct Material *material)
 {