예제 #1
0
        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);
            }
        }
예제 #3
0
        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);
        }
예제 #4
0
        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();
            }
        }
예제 #5
0
 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;
     }
 }
예제 #6
0
 public void CopyFrom(PBAutoUnwrapSettings settings)
 {
     m_settings = settings.m_settings;
 }