Exemplo n.º 1
0
struct bNodeTree *node_group_edit_set(bNode *node, int edit)
{
	if (edit) {
		bNodeTree *ngroup= (bNodeTree*)node->id;
		if (ngroup) {
			if (ngroup->id.lib)
				ntreeMakeLocal(ngroup);
			
			node->flag |= NODE_GROUP_EDIT;
		}
		return ngroup;
	}
	else {
		node->flag &= ~NODE_GROUP_EDIT;
		return NULL;
	}
}
Exemplo n.º 2
0
/* calls the appropriate make_local method for the block, unless test. Returns true
 * if the block can be made local. */
bool id_make_local(ID *id, bool test)
{
	if (id->flag & LIB_INDIRECT)
		return false;

	switch (GS(id->name)) {
		case ID_SCE:
			return false; /* not implemented */
		case ID_LI:
			return false; /* can't be linked */
		case ID_OB:
			if (!test) BKE_object_make_local((Object *)id);
			return true;
		case ID_ME:
			if (!test) {
				BKE_mesh_make_local((Mesh *)id);
				BKE_key_make_local(((Mesh *)id)->key);
			}
			return true;
		case ID_CU:
			if (!test) {
				BKE_curve_make_local((Curve *)id);
				BKE_key_make_local(((Curve *)id)->key);
			}
			return true;
		case ID_MB:
			if (!test) BKE_mball_make_local((MetaBall *)id);
			return true;
		case ID_MA:
			if (!test) BKE_material_make_local((Material *)id);
			return true;
		case ID_TE:
			if (!test) BKE_texture_make_local((Tex *)id);
			return true;
		case ID_IM:
			if (!test) BKE_image_make_local((Image *)id);
			return true;
		case ID_LT:
			if (!test) {
				BKE_lattice_make_local((Lattice *)id);
				BKE_key_make_local(((Lattice *)id)->key);
			}
			return true;
		case ID_LA:
			if (!test) BKE_lamp_make_local((Lamp *)id);
			return true;
		case ID_CA:
			if (!test) BKE_camera_make_local((Camera *)id);
			return true;
		case ID_SPK:
			if (!test) BKE_speaker_make_local((Speaker *)id);
			return true;
		case ID_IP:
			return false; /* deprecated */
		case ID_KE:
			if (!test) BKE_key_make_local((Key *)id);
			return true;
		case ID_WO:
			if (!test) BKE_world_make_local((World *)id);
			return true;
		case ID_SCR:
			return false; /* can't be linked */
		case ID_VF:
			return false; /* not implemented */
		case ID_TXT:
			return false; /* not implemented */
		case ID_SCRIPT:
			return false; /* deprecated */
		case ID_SO:
			return false; /* not implemented */
		case ID_GR:
			return false; /* not implemented */
		case ID_AR:
			if (!test) BKE_armature_make_local((bArmature *)id);
			return true;
		case ID_AC:
			if (!test) BKE_action_make_local((bAction *)id);
			return true;
		case ID_NT:
			if (!test) ntreeMakeLocal((bNodeTree *)id);
			return true;
		case ID_BR:
			if (!test) BKE_brush_make_local((Brush *)id);
			return true;
		case ID_PA:
			if (!test) BKE_particlesettings_make_local((ParticleSettings *)id);
			return true;
		case ID_WM:
			return false; /* can't be linked */
		case ID_GD:
			return false; /* not implemented */
		case ID_LS:
			return false; /* not implemented */
	}

	return false;
}