bool id_unlink(ID *id, int test) { Main *mainlib = G.main; ListBase *lb; switch (GS(id->name)) { case ID_TXT: if (test) return true; BKE_text_unlink(mainlib, (Text *)id); break; case ID_GR: if (test) return true; BKE_group_unlink((Group *)id); break; case ID_OB: if (test) return true; BKE_object_unlink((Object *)id); break; } if (id->us == 0) { if (test) return true; lb = which_libbase(mainlib, GS(id->name)); BKE_libblock_free(lb, id); return true; } return false; }
bool id_unlink(ID *id, int test) { Main *mainlib = G.main; short type = GS(id->name); switch (type) { case ID_TXT: if (test) return true; BKE_text_unlink(mainlib, (Text *)id); break; case ID_GR: if (test) return true; BKE_group_unlink((Group *)id); break; case ID_OB: if (test) return true; BKE_object_unlink((Object *)id); break; } if (id->us == 0) { if (test) return true; BKE_libblock_free(mainlib, id); return true; } return false; }
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 { BKE_group_unlink(group); } }