public void UpdateMorph() { /* * if (tagarela.mainObject.GetComponent<MeshFilter>()) * { * MeshFilter filter = tagarela.mainObject.GetComponent<MeshFilter>(); * filter.sharedMesh.vertices = tagarela.neutralMesh.vertices; * if (filter.sharedMesh != null) * { * filter.sharedMesh = tagarela.neutralMesh_temp; * } * filter.sharedMesh.name = "Tagarela"; * tagarela.basemesh = filter.sharedMesh as Mesh; * * } * else if (tagarela.mainObject.GetComponent<SkinnedMeshRenderer>()) * { * SkinnedMeshRenderer filter = tagarela.mainObject.GetComponent<SkinnedMeshRenderer>(); * filter.sharedMesh.vertices = tagarela.neutralMesh.vertices; * if (filter.sharedMesh != null) * { * filter.sharedMesh = tagarela.neutralMesh_temp; * } * filter.sharedMesh.name = "Tagarela"; * tagarela.basemesh = filter.sharedMesh as Mesh; * } * * tagarela.PreviewAnimation(updateMorphValue); * updateMorph = false; * */ tagarela.PreviewAnimation(updateMorphValue); updateMorph = false; }
public void UpdateMorph() { if (tagarela.mainObject.GetComponent <MeshFilter>()) { MeshFilter filter = tagarela.mainObject.GetComponent <MeshFilter>(); filter.sharedMesh.vertices = tagarela.neutralMesh.vertices; if (filter.sharedMesh != null) { filter.sharedMesh = tagarela.neutralMesh_temp; } filter.sharedMesh.name = "Tagarela"; tagarela.basemesh = filter.sharedMesh as Mesh; } else if (tagarela.mainObject.GetComponent <SkinnedMeshRenderer>()) { SkinnedMeshRenderer filter = tagarela.mainObject.GetComponent <SkinnedMeshRenderer>(); filter.sharedMesh.vertices = tagarela.neutralMesh.vertices; if (filter.sharedMesh != null) { filter.sharedMesh = tagarela.neutralMesh_temp; } filter.sharedMesh.name = "Tagarela"; tagarela.basemesh = filter.sharedMesh as Mesh; } tagarela.PreviewAnimation(updateMorphValue); updateMorph = false; }