Пример #1
0
 private void CreateBody()
 {
     bodyMesh = new BodyMesh(CharacterSettings.MainShape, transform)
     {
         Material = CharacterSettings.MainMaterial,
     };
     drawables.Add(bodyMesh);
 }
Пример #2
0
        private void UpdateDisplayForItem()
        {
            this.textBoxName.Text       = "";
            this.buttonAddSolid.Enabled = false;
            this.buttonAddAlpha.Enabled = false;
            while (this.tableLayoutPanel1.Controls.Count > 2)
            {
                this.tableLayoutPanel1.Controls.RemoveAt(2);
                this.tableLayoutPanel1.RowStyles.RemoveAt(2);
                this.tableLayoutPanel1.RowCount -= 1;
            }

            Option selectedOption = this.optionsBox.SelectedItem as Option;

            if (selectedOption != null)
            {
                this.textBoxName.Text       = selectedOption.Name;
                this.buttonAddSolid.Enabled = true;
                this.buttonAddAlpha.Enabled = true;

                BodyMesh skinBodyMesh  = null;
                BodyMesh extraBodyMesh = null;

                // Validate to see if missing meshes.
                switch (ModItem.ItemCategory)
                {
                case Category.Panty:
                    EnsureBodyMesh(selectedOption, BodyMeshType.Torso);
                    EnsureBodyMesh(selectedOption, BodyMeshType.Groin);
                    break;

                case Category.Bra:
                    EnsureBodyMesh(selectedOption, BodyMeshType.Breast);
                    break;

                case Category.Gloves:
                    EnsureBodyMesh(selectedOption, BodyMeshType.Arm);
                    EnsureBodyMesh(selectedOption, BodyMeshType.FingerNail);
                    break;

                case Category.Shoes:
                    EnsureBodyMesh(selectedOption, BodyMeshType.Leg);
                    EnsureBodyMesh(selectedOption, BodyMeshType.ToeNail);
                    break;
                }

                foreach (BodyMesh bMesh in selectedOption.BodyMeshes)
                {
                    switch (bMesh.MeshType)
                    {
                    case BodyMeshType.Torso:
                        extraBodyMesh = bMesh;
                        this.resourceNailIB.SetBindingList(ref ModPackGui.chestIBList);
                        this.resourceNailVB.SetBindingList(ref ModPackGui.chestVBList);
                        break;

                    case BodyMeshType.Breast:
                        skinBodyMesh = bMesh;
                        this.resourceSkinIB.SetBindingList(ref ModPackGui.breastIBList);
                        this.resourceSkinVB.SetBindingList(ref ModPackGui.breastVBList);
                        break;

                    case BodyMeshType.Groin:
                        skinBodyMesh = bMesh;
                        this.resourceSkinIB.SetBindingList(ref ModPackGui.groinIBList);
                        this.resourceSkinVB.SetBindingList(ref ModPackGui.groinVBList);
                        break;

                    case BodyMeshType.Arm:
                        skinBodyMesh = bMesh;
                        this.resourceSkinIB.SetBindingList(ref ModPackGui.armIBList);
                        this.resourceSkinVB.SetBindingList(ref ModPackGui.armVBList);
                        break;

                    case BodyMeshType.Leg:
                        skinBodyMesh = bMesh;
                        this.resourceSkinIB.SetBindingList(ref ModPackGui.legIBList);
                        this.resourceSkinVB.SetBindingList(ref ModPackGui.legVBList);
                        break;

                    case BodyMeshType.FingerNail:
                        extraBodyMesh = bMesh;
                        this.resourceNailIB.SetBindingList(ref ModPackGui.fingerNailIBList);
                        this.resourceNailVB.SetBindingList(ref ModPackGui.fingerNailVBList);
                        break;

                    case BodyMeshType.ToeNail:
                        extraBodyMesh = bMesh;
                        this.resourceNailIB.SetBindingList(ref ModPackGui.toeNailIBList);
                        this.resourceNailVB.SetBindingList(ref ModPackGui.toeNailVBList);
                        break;
                    }
                }

                this.SuspendLayout();

                this.resourceNailIB.Clear();
                this.resourceNailVB.Clear();
                this.textBoxNailStride.Text       = "";
                this.comboNailFormat.SelectedItem = "";

                if (extraBodyMesh != null)
                {
                    this.nailLabel.Text = extraBodyMesh.MeshType.ToString();
                    this.nailGroup.Text = extraBodyMesh.MeshType.ToString();

                    if (!extraBodyMesh.IsDefault && !extraBodyMesh.IsNull)
                    {
                        this.radioButtonNailCustom.Select();

                        this.resourceNailIB.Enabled    = true;
                        this.resourceNailVB.Enabled    = true;
                        this.textBoxNailStride.Enabled = true;
                        this.comboNailFormat.Enabled   = true;
                        this.nailSkinButton.Enabled    = true;

                        this.resourceNailIB.SetValue(extraBodyMesh.IndexBuffer);
                        this.resourceNailVB.SetValue(extraBodyMesh.VertexBuffer);
                        this.comboNailFormat.SelectedItem = extraBodyMesh.Format;
                        if (extraBodyMesh.Stride != 0)
                        {
                            this.textBoxNailStride.Text = extraBodyMesh.Stride.ToString();
                        }
                    }
                    else
                    {
                        if (extraBodyMesh.IsNull)
                        {
                            this.radioButtonNailOff.Select();
                        }
                        else
                        {
                            this.radioButtonNailDefault.Select();
                        }

                        this.resourceNailIB.Enabled    = false;
                        this.resourceNailVB.Enabled    = false;
                        this.textBoxNailStride.Enabled = false;
                        this.comboNailFormat.Enabled   = false;
                        this.nailSkinButton.Enabled    = false;
                    }
                }
                else
                {
                    this.nailGroup.Visible = false;
                }

                this.resourceSkinIB.Clear();
                this.resourceSkinVB.Clear();
                this.textBoxBodyStride.Text          = "";
                this.comboBoxBodyFormat.SelectedItem = "";

                if (skinBodyMesh != null)
                {
                    this.bodyGroup.Visible = true;

                    this.labelBody.Text = skinBodyMesh.MeshType.ToString();
                    this.bodyGroup.Text = skinBodyMesh.MeshType.ToString();

                    if (!skinBodyMesh.IsDefault && !skinBodyMesh.IsNull)
                    {
                        this.radioButtonBodyCustom.Select();

                        this.resourceSkinIB.Enabled     = true;
                        this.resourceSkinVB.Enabled     = true;
                        this.textBoxBodyStride.Enabled  = true;
                        this.comboBoxBodyFormat.Enabled = true;
                        this.bodySkinButton.Enabled     = true;

                        this.resourceSkinIB.SetValue(skinBodyMesh.IndexBuffer);
                        this.resourceSkinVB.SetValue(skinBodyMesh.VertexBuffer);
                        this.comboBoxBodyFormat.SelectedItem = skinBodyMesh.Format;
                        if (skinBodyMesh.Stride != 0)
                        {
                            this.textBoxBodyStride.Text = skinBodyMesh.Stride.ToString();
                        }
                    }
                    else
                    {
                        if (skinBodyMesh.IsNull)
                        {
                            this.radioButtonBodyOff.Select();
                        }
                        else
                        {
                            this.radioButtonBodyDefault.Select();
                        }

                        this.resourceSkinIB.Enabled     = false;
                        this.resourceSkinVB.Enabled     = false;
                        this.textBoxBodyStride.Enabled  = false;
                        this.comboBoxBodyFormat.Enabled = false;
                        this.bodySkinButton.Enabled     = false;
                    }
                }
                else
                {
                    this.bodyGroup.Visible = false;
                }

                foreach (MeshSlot solidSlots in selectedOption.SolidMeshes)
                {
                    MeshBuilder meshBuilder = new MeshBuilder();
                    meshBuilder.Dock = DockStyle.Top;
                    meshBuilder.SetMeshSlot(solidSlots);
                    meshBuilder.meshSlotType    = MeshBuilder.MeshSlotType.Solid;
                    meshBuilder.MeshSlotUpdated = this.UpdatedMeshSlot;
                    meshBuilder.RemoveClicked   = this.buttonRemoveMeshSlot;
                    meshBuilder.SetMeshSlotTitle("Solid Slot");

                    this.tableLayoutPanel1.RowCount++;
                    this.tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.AutoSize));
                    this.tableLayoutPanel1.Controls.Add(meshBuilder);
                }
                foreach (MeshSlot alphaSlots in selectedOption.AlphaMeshes)
                {
                    MeshBuilder meshBuilder = new MeshBuilder();
                    meshBuilder.Dock = DockStyle.Top;
                    meshBuilder.SetMeshSlot(alphaSlots);
                    meshBuilder.meshSlotType    = MeshBuilder.MeshSlotType.Alpha;
                    meshBuilder.MeshSlotUpdated = this.UpdatedMeshSlot;
                    meshBuilder.RemoveClicked   = this.buttonRemoveMeshSlot;
                    meshBuilder.SetMeshSlotTitle("Alpha Slot");

                    this.tableLayoutPanel1.RowCount++;
                    this.tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.AutoSize));
                    this.tableLayoutPanel1.Controls.Add(meshBuilder);
                }

                this.ResumeLayout();

                this.selectionDefinitionSplits.Panel2.Enabled = true;
            }
            else
            {
                this.selectionDefinitionSplits.Panel2.Enabled = false;
            }
        }