コード例 #1
0
ファイル: FSKL.cs プロジェクト: jakeroo123/Switch-Toolbox
        public void Delete()
        {
            //For these to work
            //Shift bone node array in skeleton
            //Shift all indices in each shape's bone list
            //Shift every index in all the vertices indices from the changed node array
            //Shift every bone index in the shape
            //Shift each smooth index in each bone
            //Shift each rigid index in each bone
            //Remove the existing inverse matrix from the list

            string MappedNames = "";
            var    model       = ((FSKL)skeletonParent).GetModelParent();

            int CurrentIndex = GetIndex();

            if (model.Skeleton.bones.Count == 1)
            {
                MessageBox.Show("A single bone must exist in every model!", "Bone Delete",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            foreach (var shape in model.shapes)
            {
                if (shape.BoneIndex == CurrentIndex)
                {
                    MappedNames += $"{shape.Text}\n";
                }

                if (shape.BoneIndices.Contains((ushort)CurrentIndex))
                {
                    MappedNames += $"{shape.Text}\n";
                }
            }
            if (MappedNames != "")
            {
                var result = STOptionsDialog.Show("Shapes are mapped to this bone. Are you sure you want to remove this? (Will default to first bone)",
                                                  "Bone Delete", MappedNames);

                if (result == DialogResult.Yes)
                {
                    RemoveBone(model, CurrentIndex);
                }
            }
            else
            {
                RemoveBone(model, CurrentIndex);
            }
        }
コード例 #2
0
ファイル: FMAT.cs プロジェクト: lanvas2008/Switch-Toolbox
        public void Delete()
        {
            string MappedNames = "";
            var    model       = GetParentModel();

            int CurrentIndex = Parent.Nodes.IndexOf(this);

            if (model.materials.Count == 1 && model.shapes.Count > 0)
            {
                MessageBox.Show("A single material must exist if any objects exist!", "Material Delete",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            foreach (var shape in model.shapes)
            {
                if (shape.GetMaterial() == this)
                {
                    MappedNames += $"{shape.Text}\n";
                }
            }
            if (MappedNames != "")
            {
                var result = STOptionsDialog.Show("Shapes are mapped to this material. Are you sure you want to remove this? (Will default to first material)",
                                                  "Material Delete", MappedNames);

                if (result == DialogResult.Yes)
                {
                    RemoveMaterial(model, CurrentIndex);
                }
            }
            else
            {
                RemoveMaterial(model, CurrentIndex);
            }
        }