[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [27032] trunk/blender/source/blender/ makesrna/intern/rna_main_api.c: allow removing datablocks in the rare case of <0 users.

Campbell Barton ideasman42 at gmail.com
Sat Feb 20 21:59:30 CET 2010


Revision: 27032
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=27032
Author:   campbellbarton
Date:     2010-02-20 21:59:30 +0100 (Sat, 20 Feb 2010)

Log Message:
-----------
allow removing datablocks in the rare case of <0 users.

Modified Paths:
--------------
    trunk/blender/source/blender/makesrna/intern/rna_main_api.c

Modified: trunk/blender/source/blender/makesrna/intern/rna_main_api.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_main_api.c	2010-02-20 20:51:31 UTC (rev 27031)
+++ trunk/blender/source/blender/makesrna/intern/rna_main_api.c	2010-02-20 20:59:30 UTC (rev 27032)
@@ -78,7 +78,7 @@
 }
 void rna_Main_cameras_remove(Main *bmain, ReportList *reports, struct Camera *camera)
 {
-	if(ID_REAL_USERS(camera) == 0)
+	if(ID_REAL_USERS(camera) <= 0)
 		free_libblock(&bmain->camera, camera);
 	else
 		BKE_reportf(reports, RPT_ERROR, "Camera \"%s\" must have zero users to be removed, found %d.", camera->id.name+2, ID_REAL_USERS(camera));
@@ -129,7 +129,7 @@
 	  # don't do this since ob is already freed!
 	  bpy.data.remove_object(ob)
 	*/
-	if(ID_REAL_USERS(object) == 0)
+	if(ID_REAL_USERS(object) <= 0)
 		free_libblock(&bmain->object, object);
 	else
 		BKE_reportf(reports, RPT_ERROR, "Object \"%s\" must have zero users to be removed, found %d.", object->id.name+2, ID_REAL_USERS(object));
@@ -141,7 +141,7 @@
 }
 void rna_Main_materials_remove(Main *bmain, ReportList *reports, struct Material *material)
 {
-	if(ID_REAL_USERS(material) == 0)
+	if(ID_REAL_USERS(material) <= 0)
 		free_libblock(&bmain->mat, material);
 	else
 		BKE_reportf(reports, RPT_ERROR, "Material \"%s\" must have zero users to be removed, found %d.", material->id.name+2, ID_REAL_USERS(material));
@@ -157,7 +157,7 @@
 }
 void rna_Main_meshes_remove(Main *bmain, ReportList *reports, Mesh *mesh)
 {
-	if(ID_REAL_USERS(mesh) == 0)
+	if(ID_REAL_USERS(mesh) <= 0)
 		free_libblock(&bmain->mesh, mesh);
 	else
 		BKE_reportf(reports, RPT_ERROR, "Mesh \"%s\" must have zero users to be removed, found %d.", mesh->id.name+2, ID_REAL_USERS(mesh));
@@ -173,7 +173,7 @@
 }
 void rna_Main_lamps_remove(Main *bmain, ReportList *reports, Lamp *lamp)
 {
-	if(ID_REAL_USERS(lamp) == 0)
+	if(ID_REAL_USERS(lamp) <= 0)
 		free_libblock(&bmain->lamp, lamp);
 	else
 		BKE_reportf(reports, RPT_ERROR, "Lamp \"%s\" must have zero users to be removed, found %d.", lamp->id.name+2, ID_REAL_USERS(lamp));
@@ -189,7 +189,7 @@
 }
 void rna_Main_textures_remove(Main *bmain, ReportList *reports, struct Tex *tex)
 {
-	if(ID_REAL_USERS(tex) == 0)
+	if(ID_REAL_USERS(tex) <= 0)
 		free_libblock(&bmain->tex, tex);
 	else
 		BKE_reportf(reports, RPT_ERROR, "Texture \"%s\" must have zero users to be removed, found %d.", tex->id.name+2, ID_REAL_USERS(tex));
@@ -234,7 +234,7 @@
 }
 void rna_Main_armatures_remove(Main *bmain, ReportList *reports, bArmature *arm)
 {
-	if(ID_REAL_USERS(arm) == 0)
+	if(ID_REAL_USERS(arm) <= 0)
 		free_libblock(&bmain->armature, arm);
 	else
 		BKE_reportf(reports, RPT_ERROR, "Armature \"%s\" must have zero users to be removed, found %d.", arm->id.name+2, ID_REAL_USERS(arm));
@@ -251,7 +251,7 @@
 }
 void rna_Main_actions_remove(Main *bmain, ReportList *reports, bAction *act)
 {
-	if(ID_REAL_USERS(act) == 0)
+	if(ID_REAL_USERS(act) <= 0)
 		free_libblock(&bmain->action, act);
 	else
 		BKE_reportf(reports, RPT_ERROR, "Action \"%s\" must have zero users to be removed, found %d.", act->id.name+2, ID_REAL_USERS(act));





More information about the Bf-blender-cvs mailing list