예제 #1
0
int id_unlink(ID *id, int test)
{
	Main *mainlib= G.main;
	ListBase *lb;

	switch(GS(id->name)) {
		case ID_TXT:
			if(test) return 1;
			unlink_text(mainlib, (Text*)id);
			break;
		case ID_GR:
			if(test) return 1;
			unlink_group((Group*)id);
			break;
		case ID_OB:
			if(test) return 1;
			unlink_object((Object*)id);
			break;
	}

	if(id->us == 0) {
		if(test) return 1;

		lb= which_libbase(mainlib, GS(id->name));
		free_libblock(lb, id);

		return 1;
	}

	return 0;
}
예제 #2
0
void rna_Main_texts_remove(Main *bmain, Text *text)
{
	unlink_text(bmain, text);
	free_libblock(&bmain->text, text);
	/* XXX python now has invalid pointer? */
}