public PBAutoUnwrapSettings GetSettings(MeshSelection selection) { if (selection == null) { return PBAutoUnwrapSettings.defaultAutoUnwrapSettings; } if (selection.HasVertices) { selection.VerticesToFaces(false); } else if (selection.HasEdges) { selection.EdgesToFaces(false); } PBAutoUnwrapSettings unwrapSettings = PBAutoUnwrapSettings.defaultAutoUnwrapSettings; IList<Face> faces = new List<Face>(); foreach (KeyValuePair<ProBuilderMesh, IList<int>> kvp in selection.SelectedFaces) { ProBuilderMesh mesh = kvp.Key; faces.Clear(); mesh.GetFaces(kvp.Value, faces); for (int i = 0; i < faces.Count;) { Face face = faces[i]; unwrapSettings = face.uv; break; } } return unwrapSettings; }
public void ApplySettings(PBAutoUnwrapSettings settings, MeshSelection selection) { if (selection == null) { return; } if (selection.HasVertices) { selection.VerticesToFaces(false); } else if (selection.HasEdges) { selection.EdgesToFaces(false); } AutoUnwrapSettings unwrapSettings = settings; foreach (KeyValuePair <ProBuilderMesh, IList <Face> > kvp in selection.SelectedFaces) { ProBuilderMesh mesh = kvp.Key; IList <Face> faces = kvp.Value; for (int i = 0; i < faces.Count; ++i) { Face face = faces[i]; face.uv = unwrapSettings; } mesh.RefreshUV(faces); } }
public PBAutoUnwrapSettings GetSettings(MeshSelection selection) { if (selection == null) { return(PBAutoUnwrapSettings.defaultAutoUnwrapSettings); } selection = selection.ToFaces(false, false); PBAutoUnwrapSettings unwrapSettings = PBAutoUnwrapSettings.defaultAutoUnwrapSettings; IList <Face> faces = new List <Face>(); foreach (KeyValuePair <GameObject, IList <int> > kvp in selection.SelectedFaces) { ProBuilderMesh mesh = kvp.Key.GetComponent <ProBuilderMesh>(); faces.Clear(); mesh.GetFaces(kvp.Value, faces); for (int i = 0; i < faces.Count;) { Face face = faces[i]; unwrapSettings = face.uv; break; } } return(unwrapSettings); }
public void ApplySettings(PBAutoUnwrapSettings settings, MeshSelection selection) { if (selection == null) { return; } selection = selection.ToFaces(false, false); AutoUnwrapSettings unwrapSettings = settings; IList <Face> faces = new List <Face>(); foreach (KeyValuePair <GameObject, IList <int> > kvp in selection.SelectedFaces) { ProBuilderMesh mesh = kvp.Key.GetComponent <ProBuilderMesh>(); faces.Clear(); mesh.GetFaces(kvp.Value, faces); for (int i = 0; i < faces.Count; ++i) { Face face = faces[i]; face.uv = unwrapSettings; } mesh.RefreshUV(faces); mesh.ToMesh(); mesh.Refresh(); } }
public PBFace(Face face, bool recordUV) { Indexes = face.indexes.ToArray(); SubmeshIndex = face.submeshIndex; TextureGroup = face.textureGroup; if (recordUV) { IsManualUV = face.manualUV; UnwrapSettings = face.uv; } else { IsManualUV = face.manualUV; UnwrapSettings = null; } }
public void CopyFrom(PBAutoUnwrapSettings settings) { m_settings = settings.m_settings; }