Пример #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;
        BKE_text_unlink(mainlib, (Text *)id);
        break;
    case ID_GR:
        if (test) return 1;
        BKE_group_unlink((Group *)id);
        break;
    case ID_OB:
        if (test) return 1;
        BKE_object_unlink((Object *)id);
        break;
    }

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

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

        return 1;
    }

    return 0;
}
Пример #2
0
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;
}