Ejemplo n.º 1
0
        public override void MouseDown(Vector2D mouseDownPos, EnumMouseButton button)
        {
            if (mesh == null)
            {
                return;
            }
            base.MouseDown(mouseDownPos, button);

            if (StartMoving() == false)
            {
                return;
            }
            Vector2D p = mouseDownPos - new Vector2D(projectedCenter.x, projectedCenter.y);

            p.x += 100;
            p.y += 100;

            switch (button)
            {
            case EnumMouseButton.Middle: movingBall.Click(p, ArcBall.MotionType.Rotation); break;

            case EnumMouseButton.Left: movingBall.Click(p / this.ScaleRatio, ArcBall.MotionType.Pan); break;

            case EnumMouseButton.Right: movingBall.Click(p, ArcBall.MotionType.Scale); break;
            }

            TriMeshUtil.GroupVertice(mesh);
            OnChanged(EventArgs.Empty);
        }
Ejemplo n.º 2
0
        public void UpdateMeshSelection(TriMesh mesh)
        {
            var selected = MGlobal.activeSelectionList;
            var it       = new MItSelectionList(selected, MFn.Type.kMeshVertComponent);

            MObject vertice = new MObject();

            for (; !it.isDone; it.next())
            {
                var path = new MDagPath();
                it.getDagPath(path, vertice);
                MGlobal.displayInfo(path.fullPathName);

                if (!vertice.isNull)
                {
                    MItMeshVertex itvertex = new MItMeshVertex(path, vertice);

                    for (; !itvertex.isDone; itvertex.next())
                    {
                        int index = itvertex.index();

                        mesh.Vertices[index].Traits.SelectedFlag = 1;
                    }
                }
            }

            TriMeshUtil.GroupVertice(mesh);
        }
Ejemplo n.º 3
0
        public List <TriMesh> AddSelectionVertex(TriMesh mesh)
        {
            List <TriMesh> meshes = new List <TriMesh>();
            int            count  = TriMeshUtil.GroupVertice(mesh);

            for (int i = 1; i <= count + 1; i++)
            {
                meshes.Add(AddSelectionVertex(mesh, i));
            }

            return(meshes);
        }
Ejemplo n.º 4
0
        public override void MouseMove(Vector2D mouseMovePos, EnumMouseButton button)
        {
            if (mesh == null)
            {
                return;
            }

            base.MouseMove(mouseMovePos, button);
            SelectByCircle();
            TriMeshUtil.GroupVertice(mesh);
            OnChanged(EventArgs.Empty);
        }
Ejemplo n.º 5
0
        public static List <TriMesh.Vertex> RetrieveVertexGroup(TriMesh mesh, int groupIndex)
        {
            TriMeshUtil.GroupVertice(mesh);
            List <TriMesh.Vertex> group = new List <TriMesh.Vertex>();

            for (int i = 0; i < mesh.Vertices.Count; i++)
            {
                if (mesh.Vertices[i].Traits.SelectedFlag == groupIndex)
                {
                    group.Add(mesh.Vertices[i]);
                }
            }
            return(group);
        }
Ejemplo n.º 6
0
        public override void MouseUp(Vector2D mouseUpPos, EnumMouseButton button)
        {
            if (mesh == null)
            {
                return;
            }

            base.MouseUp(mouseUpPos, button);
            if (button == EnumMouseButton.Left)
            {
                selectedEdge = SelectByPoint();
            }

            TriMeshUtil.GroupVertice(mesh);
            OnChanged(EventArgs.Empty);
        }
Ejemplo n.º 7
0
        public override void MouseDown(Vector2D mouseDownPos, EnumMouseButton button)
        {
            if (mesh == null)
            {
                return;
            }
            base.MouseDown(mouseDownPos, button);

            bool haveSelected = false;

            for (int i = 0; i < mesh.Vertices.Count; i++)
            {
                if (mesh.Vertices[i].Traits.SelectedFlag == (byte)1)
                {
                    haveSelected = true;
                }
            }


            if (button == EnumMouseButton.Left && !haveSelected)
            {
                selectedPoint = SelectByPoint();
            }


            if (StartMoving() == false)
            {
                return;
            }
            Vector2D p = mouseDownPos - new Vector2D(projectedCenter.x, projectedCenter.y);

            p.x += 100;
            p.y += 100;

            switch (button)
            {
            case EnumMouseButton.Middle: movingBall.Click(p, ArcBall.MotionType.Rotation); break;

            case EnumMouseButton.Left: movingBall.Click(p / this.ScaleRatio, ArcBall.MotionType.Pan); break;

            case EnumMouseButton.Right: movingBall.Click(p, ArcBall.MotionType.Scale); break;
            }

            TriMeshUtil.GroupVertice(mesh);
            OnChanged(EventArgs.Empty);
        }
Ejemplo n.º 8
0
 private void reverseToolStripMenuItem_Click(object sender, EventArgs e)
 {
     TriMeshUtil.SelectedVertexReverse(Mesh);
     TriMeshUtil.GroupVertice(Mesh);
     OnChanged(EventArgs.Empty);
 }