Ejemplo n.º 1
0
        // Pass the options, then call ShowDialog
        public TrimOptions Display(TrimOptions options)
        {
            _options                = options;
            keepVertices.Checked    = !(removeVertices.Checked = _options.HasFlag(TrimOptions.Vertex));
            keepTriangles.Checked   = !(removeTriangles.Checked = _options.HasFlag(TrimOptions.Triangle));
            keepBones.Checked       = !(removeBones.Checked = _options.HasFlag(TrimOptions.Bone));
            keepRigidbodies.Checked = !(removeRigidbodies.Checked = _options.HasFlag(TrimOptions.Rigidbody));
            keepJoints.Checked      = !(removeJoints.Checked = _options.HasFlag(TrimOptions.Joint));

            ShowDialog();
            // This thread should be blocked at this point.
            // Control returns here when the form is closed.
            return(_options);
        }
Ejemplo n.º 2
0
        private void trimButton_Click(object sender, EventArgs e)
        {
            if (_trimForm == null)
            {
                _trimForm = new TrimForm();
            }
            TrimOptions options = TrimOptions.None;

            if (!selectiveVertexCheck.Checked)
            {
                options |= TrimOptions.Vertex;
            }
            if (!selectiveTriangleCheck.Checked)
            {
                options |= TrimOptions.Triangle;
            }
            if (!selectiveBoneCheck.Checked)
            {
                options |= TrimOptions.Bone;
            }
            if (!selectiveRigidbodyCheck.Checked)
            {
                options |= TrimOptions.Rigidbody;
            }
            if (!selectiveJointCheck.Checked)
            {
                options |= TrimOptions.Joint;
            }

            TrimOptions result = _trimForm.Display(options);

            if (result.HasFlag(TrimOptions.Cancel))
            {
                return;
            }

            foreach (ListViewItem item in storedList.SelectedItems)
            {
                Selection sel;
                if (result.HasFlag(TrimOptions.Clone))
                {
                    sel       = (Selection)((Selection)item.Tag).Clone();
                    sel.Name += " trim";
                }
                else
                {
                    sel = (Selection)item.Tag;
                }

                if (result.HasFlag(TrimOptions.Vertex))
                {
                    sel.Vertex            = new int[0];
                    item.SubItems[1].Text = "0";
                }
                if (result.HasFlag(TrimOptions.Triangle))
                {
                    sel.Triangle          = new int[0];
                    item.SubItems[2].Text = "0";
                }
                if (result.HasFlag(TrimOptions.Bone))
                {
                    sel.Bone = new int[0];
                    item.SubItems[3].Text = "0";
                }
                if (result.HasFlag(TrimOptions.Rigidbody))
                {
                    sel.Rigidbody         = new int[0];
                    item.SubItems[4].Text = "0";
                }
                if (result.HasFlag(TrimOptions.Joint))
                {
                    sel.Joint             = new int[0];
                    item.SubItems[5].Text = "0";
                }

                if (result.HasFlag(TrimOptions.Clone))
                {
                    AddSelection(sel);
                }
            }
        }