From ae6e013c1502a8960b3fec676cbea7fa6fa24172 Mon Sep 17 00:00:00 2001 From: Campbell Barton <ideasman42@gmail.com> Date: Sat, 11 Sep 2010 06:27:38 +0000 Subject: [PATCH] new materials and cameras had incorrect usercounts when added from python --- source/blender/makesrna/intern/rna_main_api.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index 72ed625e5aa..b58ed4aab6a 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -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) { -- GitLab