Exemple #1
0
        private void menuObjectClick(object sender, EventArgs e)
        {
            ToolStripMenuItem mi = (ToolStripMenuItem)sender;

            int boneIndex    = SceneManager.Current.SelectedBoneIndex;
            int modelIndex   = SceneManager.Current.SelectedModelIndex;
            int modelBoneKey = ModelBone.GetModelBoneKey(modelIndex, boneIndex);

            switch (mi.Text)
            {
            case "New...":
                var addNew = new frmNewObject();
                addNew.SetParentNode(modelIndex, boneIndex);

                if (addNew.ShowDialog(this) == DialogResult.OK)
                {
                    SceneManager.Current.Change(ChangeType.Add, addNew.NewBoneKey, modelBoneKey);
                }
                break;

            case "Remove...":
                var removeObject = new frmRemoveObject();
                removeObject.SetParentNode(modelIndex, boneIndex);

                if (removeObject.ShowDialog(this) == DialogResult.OK)
                {
                    SceneManager.Current.Change(ChangeType.Delete, modelBoneKey, removeObject.RemovedBone);
                }
                break;

            case "Modify geometry...":
                var geometry = new frmModifyModel();
                geometry.SetParentNode(modelIndex, boneIndex);

                if (geometry.ShowDialog(this) == DialogResult.OK)
                {
                    SceneManager.Current.Change(ChangeType.Transform, modelBoneKey);
                }
                break;

            case "Modify actor...":
                var transform = new frmModifyActor();
                transform.SetParentNode(modelIndex, boneIndex);

                if (transform.ShowDialog(this) == DialogResult.OK)
                {
                    SceneManager.Current.Change(ChangeType.Transform, modelBoneKey);
                }
                break;

            case "Rename":
                var rename = new frmRename();
                rename.SetParentNode(modelIndex, boneIndex);

                if (rename.ShowDialog(this) == DialogResult.OK)
                {
                    SceneManager.Current.Change(ChangeType.Rename, modelBoneKey, rename.NewName);
                }
                break;

            case "Add/Change Type...":
                var changeType = new frmChangeNodeType();
                changeType.SetParentNode(modelIndex, boneIndex);

                if (changeType.ShowDialog(this) == DialogResult.OK)
                {
                    SceneManager.Current.Change(ChangeType.ChangeType, modelBoneKey);
                }
                break;

            case "Remove":
                break;

            case "Optimise":
                foreach (ModelMesh mesh in SceneManager.Current.SelectedModel.Meshes)
                {
                    foreach (ModelMeshPart part in mesh.MeshParts)
                    {
                        part.Optimise();
                    }
                }
                break;

            case "Flatten hierarchy...":
                SceneManager.Current.UpdateProgress("TODO: Code \"Flatten hierarchy...\"");
                break;

            case "Invert texture 'v' coordinates":
                ModelManipulator.FlipUVs(SceneManager.Current.SelectedModel.Bones[SceneManager.Current.SelectedBoneIndex].Mesh);
                break;
            }
        }
Exemple #2
0
        private void menuObjectClick(object sender, EventArgs e)
        {
            ToolStripMenuItem mi = (ToolStripMenuItem)sender;

            int boneIndex = SceneManager.Current.SelectedBoneIndex;
            int modelIndex = SceneManager.Current.SelectedModelIndex;
            int modelBoneKey = ModelBone.GetModelBoneKey(modelIndex, boneIndex);

            switch (mi.Text)
            {
                case "New...":
                    var addNew = new frmNewObject();
                    addNew.SetParentNode(modelIndex, boneIndex);

                    if (addNew.ShowDialog(this) == DialogResult.OK)
                    {
                        SceneManager.Current.Change(ChangeType.Add, addNew.NewBoneKey, modelBoneKey);
                    }
                    break;

                case "Remove...":
                    var removeObject = new frmRemoveObject();
                    removeObject.SetParentNode(modelIndex, boneIndex);

                    if (removeObject.ShowDialog(this) == DialogResult.OK)
                    {
                        SceneManager.Current.Change(ChangeType.Delete, modelBoneKey, removeObject.RemovedBone);
                    }
                    break;

                case "Modify geometry...":
                    var geometry = new frmModifyModel();
                    geometry.SetParentNode(modelIndex, boneIndex);

                    if (geometry.ShowDialog(this) == DialogResult.OK)
                    {
                        SceneManager.Current.Change(ChangeType.Transform, modelBoneKey);
                    }
                    break;

                case "Modify actor...":
                    var transform = new frmModifyActor();
                    transform.SetParentNode(modelIndex, boneIndex);

                    if (transform.ShowDialog(this) == DialogResult.OK)
                    {
                        SceneManager.Current.Change(ChangeType.Transform, modelBoneKey);
                    }
                    break;

                case "Rename":
                    var rename = new frmRename();
                    rename.SetParentNode(modelIndex, boneIndex);

                    if (rename.ShowDialog(this) == DialogResult.OK)
                    {
                        SceneManager.Current.Change(ChangeType.Rename, modelBoneKey, rename.NewName);
                    }
                    break;

                case "Add/Change Type...":
                    var changeType = new frmChangeNodeType();
                    changeType.SetParentNode(modelIndex, boneIndex);

                    if (changeType.ShowDialog(this) == DialogResult.OK)
                    {
                        SceneManager.Current.Change(ChangeType.ChangeType, modelBoneKey);
                    }
                    break;

                case "Remove":
                    break;

                case "Optimise":
                    foreach (ModelMesh mesh in SceneManager.Current.SelectedModel.Meshes)
                    {
                        foreach (ModelMeshPart part in mesh.MeshParts)
                        {
                            part.Optimise();
                        }
                    }
                    break;

                case "Flatten hierarchy...":
                    SceneManager.Current.UpdateProgress("TODO: Code \"Flatten hierarchy...\"");
                    break;

                case "Invert texture 'v' coordinates":
                    ModelManipulator.FlipUVs(SceneManager.Current.SelectedModel.Bones[SceneManager.Current.SelectedBoneIndex].Mesh);
                    break;
            }
        }