Example #1
0
 public override OpStatus Apply()
 {
     Target.EditAndUpdateMesh(
         (mesh) => { MeshChange.Apply(mesh); },
         GeometryEditTypes.VertexDeformation
         );
     return(OpStatus.Success);
 }
Example #2
0
 public override OpStatus Apply()
 {
     Target.EditAndUpdateMesh(
         (mesh) => { MeshChange.Apply(mesh); },
         GeometryEditTypes.ArbitraryEdit
         );
     return(OpStatus.Success);
 }
Example #3
0
 public override OpStatus Apply()
 {
     Target.EditAndUpdateMesh(
         (mesh) => {
         MeshTransforms.Scale(mesh, LocalScale.x, LocalScale.y, LocalScale.z);
         Target.SetLocalScale(Vector3f.One);
     },
         GeometryEditTypes.VertexDeformation
         );
     return(OpStatus.Success);
 }
Example #4
0
 public void ApplyInitialize(IEnumerable <int> triangles)
 {
     if (MeshChange != null)
     {
         throw new Exception("RemoveTrianglesChange.ApplyInitialize: change is already initialized!");
     }
     MeshChange = new RemoveTrianglesMeshChange();
     Target.EditAndUpdateMesh(
         (mesh) => { MeshChange.InitializeFromApply(mesh, triangles); },
         GeometryEditTypes.ArbitraryEdit
         );
 }
Example #5
0
        public static void AppendMeshSO(DMeshSO appendTo, DMeshSO append)
        {
            FScene scene = appendTo.GetScene();

            if (scene.IsSelected(appendTo))
            {
                scene.Deselect(appendTo);
            }
            if (scene.IsSelected(append))
            {
                scene.Deselect(append);
            }

            Frame3f  f1     = appendTo.GetLocalFrame(CoordSpace.ObjectCoords);
            Vector3f scale1 = appendTo.GetLocalScale();
            Frame3f  f2     = append.GetLocalFrame(CoordSpace.ObjectCoords);
            Vector3f scale2 = append.GetLocalScale();

            bool mesh1HasVtxNormals = appendTo.Mesh.HasVertexNormals;

            DMesh3 mesh2 = append.Mesh;

            foreach (int vid in mesh2.VertexIndices())
            {
                // convert point in mesh2 to scene coords
                Vector3f v2 = (Vector3f)mesh2.GetVertex(vid);
                v2 *= scale2;
                Vector3f v2s = f2.FromFrameP(v2);

                // transfer that scene coord into local coords of mesh1
                Vector3f v2in1 = f1.ToFrameP(v2s);
                v2in1 /= scale1;
                mesh2.SetVertex(vid, v2in1);

                if (mesh1HasVtxNormals && mesh2.HasVertexNormals)
                {
                    Vector3f n   = mesh2.GetVertexNormal(vid);
                    Vector3f ns  = f2.FromFrameV(n);
                    Vector3f ns2 = f1.ToFrameV(ns);
                    mesh2.SetVertexNormal(vid, ns2);
                }
            }

            appendTo.EditAndUpdateMesh((mesh1) => {
                MeshEditor editor = new MeshEditor(mesh1);
                editor.AppendMesh(mesh2);
            }, GeometryEditTypes.ArbitraryEdit);

            // [TODO] change record!

            scene.RemoveSceneObject(append, false);
        }