rna/py api function for removing ID blocks, id.unused_clear()

(revision 27409 from render25 branch)
This commit is contained in:
Brecht Van Lommel 2010-03-11 17:18:06 +00:00
parent bb3168afbe
commit d82e88d265

@ -246,6 +246,12 @@ ID *rna_ID_copy(ID *id)
return NULL; return NULL;
} }
void rna_ID_user_clear(ID *id)
{
id->us= 0; /* dont save */
id->flag &= ~LIB_FAKEUSER;
}
#else #else
static void rna_def_ID_properties(BlenderRNA *brna) static void rna_def_ID_properties(BlenderRNA *brna)
@ -372,6 +378,9 @@ static void rna_def_ID(BlenderRNA *brna)
parm= RNA_def_pointer(func, "id", "ID", "", "New copy of the ID."); parm= RNA_def_pointer(func, "id", "ID", "", "New copy of the ID.");
RNA_def_function_return(func, parm); 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"); 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."); 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."); parm= RNA_def_pointer(func, "anim_data", "AnimData", "", "New animation data or NULL.");