Esempio n. 1
0
        public override void SetState(MeshEditorState state)
        {
            m_faceSelection.BeginChange();

            ProBuilderMesh[] meshes = state.State.Keys.ToArray();
            foreach (ProBuilderMesh mesh in meshes)
            {
                IList <int> faces = m_faceSelection.GetFaces(mesh).ToArray();
                for (int i = 0; i < faces.Count; ++i)
                {
                    m_faceSelection.Remove(faces[i]);
                }

                MeshState meshState = state.State[mesh];
                mesh.RebuildWithPositionsAndFaces(meshState.Positions, meshState.Faces.Select(f => f.ToFace()));

                mesh.ToMesh();
                mesh.Refresh();

                for (int i = 0; i < faces.Count; ++i)
                {
                    m_faceSelection.Add(mesh, faces[i]);
                }
            }

            m_faceSelection.EndChange();
        }
Esempio n. 2
0
 public void SetState(MeshEditorState state)
 {
     ProBuilderMesh[] meshes = state.State.Keys.ToArray();
     foreach (ProBuilderMesh mesh in meshes)
     {
         MeshState meshState = state.State[mesh];
         mesh.Rebuild(meshState.Positions, meshState.Faces.Select(f => f.ToFace()).ToArray(), meshState.Textures);
     }
 }
        public void SetState(MeshEditorState state)
        {
            ProBuilderMesh[] meshes = state.State.Keys.Select(key => key.GetComponent <ProBuilderMesh>()).ToArray();
            foreach (ProBuilderMesh mesh in meshes)
            {
                MeshState meshState = state.State[mesh.gameObject];
                mesh.Rebuild(meshState.Positions, meshState.Faces.Select(f => f.ToFace()).ToArray(), meshState.Textures);
            }

            m_target.RaiseChanged(false, true);
        }
Esempio n. 4
0
 public void Apply()
 {
     foreach (KeyValuePair <GameObject, MeshState> kvp in State)
     {
         ProBuilderMesh mesh = kvp.Key.GetComponent <ProBuilderMesh>();
         if (mesh == null)
         {
             continue;
         }
         MeshState meshState = kvp.Value;
         mesh.Rebuild(meshState.Positions, meshState.Faces.Select(f => f.ToFace()).ToArray(), meshState.Textures);
     }
 }
Esempio n. 5
0
        public override void SetState(MeshEditorState state)
        {
            ProBuilderMesh[] meshes = state.State.Keys.ToArray();
            foreach (ProBuilderMesh mesh in meshes)
            {
                IList <Edge> edges = m_edgeSelection.GetCoincidentEdges(m_edgeSelection.GetEdges(mesh)).ToArray();
                m_edgeSelection.Remove(mesh, edges);

                MeshState meshState = state.State[mesh];
                mesh.Rebuild(meshState.Positions, meshState.Faces.Select(f => f.ToFace()).ToArray(), meshState.Textures);

                m_edgeSelection.Add(mesh, edges);
            }
        }
        public override void SetState(MeshEditorState state)
        {
            ProBuilderMesh[] meshes = state.State.Keys.Select(k => k.GetComponent <ProBuilderMesh>()).ToArray();
            foreach (ProBuilderMesh mesh in meshes)
            {
                IList <int> vertices = m_vertexSelection.GetVertices(mesh);
                if (vertices != null)
                {
                    vertices = vertices.ToArray();
                    m_vertexSelection.Remove(mesh, vertices);
                }

                MeshState meshState = state.State[mesh.gameObject];
                mesh.Rebuild(meshState.Positions, meshState.Faces.Select(f => f.ToFace()).ToArray(), meshState.Textures);

                if (vertices != null)
                {
                    m_vertexSelection.Add(mesh, vertices);
                }
            }
        }
        public override void SetState(MeshEditorState state)
        {
            m_faceSelection.BeginChange();

            ProBuilderMesh[] meshes = state.State.Keys.Select(k => k.GetComponent <ProBuilderMesh>()).ToArray();
            foreach (ProBuilderMesh mesh in meshes)
            {
                IList <int> faces = m_faceSelection.GetFaces(mesh).ToArray();
                for (int i = 0; i < faces.Count; ++i)
                {
                    m_faceSelection.Remove(mesh, faces[i]);
                }

                MeshState meshState = state.State[mesh.gameObject];
                mesh.Rebuild(meshState.Positions, meshState.Faces.Select(f => f.ToFace()).ToArray(), meshState.Textures);

                for (int i = 0; i < faces.Count; ++i)
                {
                    m_faceSelection.Add(mesh, faces[i]);
                }
            }

            m_faceSelection.EndChange();
        }
Esempio n. 8
0
 public void SetState(MeshState state)
 {
     m_pbMesh.Rebuild(state.Positions, state.Faces.Select(f => f.ToFace()).ToArray(), state.Textures);
     RaiseChanged(false, true);
 }