Esempio n. 1
0
        private void btnRemove_Click(object sender, EventArgs e)
        {
            var result = MessageBox.Show("Removing a vertex buffer could potentially break the object. This cannot be undone. Are you sure you want to remove this?",
                                         "", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                var attriubte = attributeListView.SelectedItems[0];
                if (attriubte.Text == "_p0")
                {
                    MessageBox.Show("Cannot remove position attribute! You should remove a mesh instead or hide by materials.");
                    return;
                }

                for (int att = 0; att < activeShape.vertexAttributes.Count; att++)
                {
                    var CurrentAttribute = activeShape.vertexAttributes[att];

                    if (CurrentAttribute.Name == attriubte.Text)
                    {
                        var buffer = CurrentAttribute.BufferIndex;
                        activeShape.vertexAttributes.Remove(CurrentAttribute);

                        //Check if the index is no longer used for any attribute
                        if (!activeShape.vertexAttributes.Any(x => x.BufferIndex == buffer))
                        {
                            foreach (var attr in activeShape.vertexAttributes)
                            {
                                if (attr.BufferIndex > buffer)
                                {
                                    attr.BufferIndex -= 1;
                                }
                            }
                        }

                        attributeListView.Items.Remove(attriubte);
                    }
                }

                activeShape.SaveVertexBuffer(activeShape.GetResFileU() != null);
                activeShape.UpdateVertexData();
            }
        }
Esempio n. 2
0
        private void btnRemove_Click(object sender, EventArgs e)
        {
            var result = MessageBox.Show("Removing a vertex buffer could potentially break the object. This cannot be undone. Are you sure you want to remove this?",
                                         "", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                var attriubte = attributeListView.SelectedItems[0];

                for (int att = 0; att < activeShape.vertexAttributes.Count; att++)
                {
                    var CurrentAttribute = activeShape.vertexAttributes[att];

                    if (CurrentAttribute.Name == attriubte.Text)
                    {
                        activeShape.vertexAttributes.Remove(CurrentAttribute);
                        attributeListView.Items.Remove(attriubte);
                    }
                }

                activeShape.SaveVertexBuffer(activeShape.GetResFileU() != null);
                activeShape.UpdateVertexData();
            }
        }