Exemplo n.º 1
0
        private void comboBoxNode_SelectedIndexChanged(object sender, EventArgs e)
        {
            int index = comboBoxNode.SelectedIndex;

            if (index == -1)
            {
                return;
            }
            NJS_OBJECT[] objs = editedHierarchy.GetObjects();
            // Apply changes
            if (!freeze)
            {
                objs[previousNodeIndex].Name = textBoxObjectName.Text;
            }
            textBoxObjectName.Text = objs[index].Name;
            if (objs[previousNodeIndex].Attach != null && editedModel != null)
            {
                objs[previousNodeIndex].Attach = editedModel.Clone();
            }
            // Load new stuff
            if (objs[index].Attach != null)
            {
                editedModel                = objs[index].Attach.Clone();
                originalModel              = objs[index].Attach.Clone();
                textBoxModelName.Enabled   = true;
                textBoxModelName.Text      = editedModel.Name;
                textBoxModelRadius.Enabled = true;
                textBoxModelRadius.Text    = editedModel.Bounds.Radius.ToString("0.#######");
                textBoxModelX.Enabled      = true;
                textBoxModelX.Text         = editedModel.Bounds.Center.X.ToString("0.#######");
                textBoxModelY.Enabled      = true;
                textBoxModelY.Text         = editedModel.Bounds.Center.Y.ToString("0.#######");
                textBoxModelZ.Enabled      = true;
                textBoxModelZ.Text         = editedModel.Bounds.Center.Z.ToString("0.#######");
                if (objs[index].Attach is BasicAttach batt)
                {
                    textBoxMaterialName.Enabled = true;
                    textBoxMaterialName.Text    = batt.MaterialName;
                    textBoxMeshsetName.Enabled  = true;
                    textBoxMeshsetName.Text     = batt.MeshName;
                    textBoxVertexName.Enabled   = true;
                    textBoxVertexName.Text      = batt.VertexName;
                    textBoxNormalName.Enabled   = true;
                    textBoxNormalName.Text      = batt.NormalName;
                    groupBoxMeshList.Enabled    = true;
                    BuildMeshsetList();
                }
                else if (objs[index].Attach is ChunkAttach catt)
                {
                    textBoxMeshsetName.Enabled = true;
                    textBoxMeshsetName.Text    = catt.PolyName;
                    textBoxVertexName.Enabled  = true;
                    textBoxVertexName.Text     = catt.VertexName;
                    groupBoxMeshList.Enabled   = textBoxMaterialName.Enabled = textBoxNormalName.Enabled = false;
                    textBoxMaterialName.Text   = textBoxNormalName.Text = "";
                }
            }
            else
            {
                textBoxMaterialName.Enabled = textBoxMeshsetName.Enabled = textBoxNormalName.Enabled = textBoxVertexName.Enabled = textBoxModelName.Enabled = textBoxModelRadius.Enabled = textBoxModelX.Enabled = textBoxModelY.Enabled = textBoxModelZ.Enabled = false;
                textBoxModelName.Text       = textBoxMaterialName.Text = textBoxMeshsetName.Text = textBoxNormalName.Text = textBoxVertexName.Text = textBoxModelName.Text = textBoxModelRadius.Text = textBoxModelX.Text = textBoxModelY.Text = textBoxModelZ.Text = "";
                editedModel = null;
            }
            previousNodeIndex = comboBoxNode.SelectedIndex;
            BuildMeshsetList();
        }