[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [27409] branches/render25/source/blender/ makesrna/intern/rna_ID.c: rna/py api function for removing ID blocks, id. unused_clear()

Campbell Barton ideasman42 at gmail.com
Thu Mar 11 14:56:53 CET 2010


Revision: 27409
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=27409
Author:   campbellbarton
Date:     2010-03-11 14:56:48 +0100 (Thu, 11 Mar 2010)

Log Message:
-----------
rna/py api function for removing  ID blocks, id.unused_clear()

Modified Paths:
--------------
    branches/render25/source/blender/makesrna/intern/rna_ID.c

Modified: branches/render25/source/blender/makesrna/intern/rna_ID.c
===================================================================
--- branches/render25/source/blender/makesrna/intern/rna_ID.c	2010-03-11 11:15:25 UTC (rev 27408)
+++ branches/render25/source/blender/makesrna/intern/rna_ID.c	2010-03-11 13:56:48 UTC (rev 27409)
@@ -246,6 +246,12 @@
 	return NULL;
 }
 
+void rna_ID_user_clear(ID *id)
+{
+	id->us= 0; /* dont save */
+	id->flag &= LIB_FAKEUSER;
+}
+
 #else
 
 static void rna_def_ID_properties(BlenderRNA *brna)
@@ -372,6 +378,9 @@
 	parm= RNA_def_pointer(func, "id", "ID", "", "New copy of the ID.");
 	RNA_def_function_return(func, parm);
 
+	func= RNA_def_function(srna, "user_clear", "rna_ID_user_clear");
+	RNA_def_function_ui_description(func, "Clears the user count of a datablock so its not saved, on reload the data will be removed.");
+
 	func= RNA_def_function(srna, "animation_data_create", "BKE_id_add_animdata");
 	RNA_def_function_ui_description(func, "Create animation data to this ID, note that not all ID types support this.");
 	parm= RNA_def_pointer(func, "anim_data", "AnimData", "", "New animation data or NULL.");





More information about the Bf-blender-cvs mailing list