Esempio n. 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;
}
Esempio n. 2
0
static void unlink_group_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeElement *UNUSED(te), TreeStoreElem *tsep, TreeStoreElem *tselem)
{
	Group *group= (Group *)tselem->id;
	
	if (tsep) {
		if ( GS(tsep->id->name)==ID_OB) {
			Object *ob= (Object *)tsep->id;
			ob->dup_group= NULL;
		}
	}
	else {
		unlink_group(group);
	}
}
Esempio n. 3
0
void rna_Main_groups_remove(Main *bmain, Group *group)
{
	unlink_group(group);
	free_libblock(&bmain->group, group);
	/* XXX python now has invalid pointer? */
}