Esempio n. 1
0
        private void renameTextureToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (RenameDialog dlg = new RenameDialog())
                dlg.ShowDialog(this.ParentForm, (_selectedTexture.Source as TEX0Node));

            _selectedTexture.Name = (_selectedTexture.Source as TEX0Node).Name;
        }
        public void MergeWith(CHR0Node external)
        {
            if (external.FrameCount != FrameCount && MessageBox.Show(null, "Frame counts are not equal; the shorter animation will end early. Do you still wish to continue?", "", MessageBoxButtons.YesNo) == DialogResult.No)
                return;

            if (external.FrameCount > FrameCount)
                FrameCount = external.FrameCount;

            foreach (CHR0EntryNode _extTarget in external.Children)
            {
                CHR0EntryNode node = null;
                KeyframeEntry kfe = null;

                CHR0EntryNode entry = new CHR0EntryNode() { Name = _extTarget.Name };
                entry._numFrames = _extTarget.FrameCount;

                //Apply all external keyframes to current entry.
                for (int x = 0; x < _extTarget.FrameCount; x++)
                    for (int i = 0x10; i < 0x19; i++)
                        if ((kfe = _extTarget.GetKeyframe((KeyFrameMode)i, x)) != null)
                            entry.Keyframes.SetFrameValue((KeyFrameMode)i, x, kfe._value)._tangent = kfe._tangent;

                if ((node = FindChild(_extTarget.Name, false) as CHR0EntryNode) == null)
                    AddChild(entry, true);
                else
                {
                    DialogResult result = MessageBox.Show(null, "A bone entry with the name " + _extTarget.Name + " already exists.\nDo you want to rename this entry?\nOtherwise, you will have the option to merge the keyframes.", "Rename Entry?", MessageBoxButtons.YesNoCancel);
                    if (result == DialogResult.Yes)
                    {
                    Top:
                        RenameDialog d = new RenameDialog();
                        if (d.ShowDialog(null, entry) == DialogResult.OK)
                        {
                            if (entry.Name != _extTarget.Name)
                                AddChild(entry, true);
                            else
                            {
                                MessageBox.Show("The name wasn't changed!");
                                goto Top;
                            }
                        }
                    }
                    else if (result == DialogResult.No)
                    {
                        result = MessageBox.Show(null, "Do you want to merge the keyframes of the entries?", "Merge Keyframes?", MessageBoxButtons.YesNoCancel);
                        if (result == DialogResult.Yes)
                        {
                            KeyframeEntry kfe2 = null;

                            if (_extTarget.FrameCount > node.FrameCount)
                                node._numFrames = _extTarget.FrameCount;

                            //Merge all external keyframes with the current entry.
                            for (int x = 0; x < _extTarget.FrameCount; x++)
                                for (int i = 0x10; i < 0x19; i++)
                                    if ((kfe = _extTarget.GetKeyframe((KeyFrameMode)i, x)) != null)
                                        if ((kfe2 = node.GetKeyframe((KeyFrameMode)i, x)) == null)
                                            node.SetKeyframe((KeyFrameMode)i, x, kfe._value);
                                        else
                                        {
                                            result = MessageBox.Show(null, "A keyframe at frame " + x + " already exists.\nOld value: " + kfe2._value + "\nNew value:" + kfe._value + "\nReplace the old value with the new one?", "Replace Keyframe?", MessageBoxButtons.YesNoCancel);
                                            if (result == DialogResult.Yes)
                                                node.SetKeyframe((KeyFrameMode)i, x, kfe._value);
                                            else if (result == DialogResult.Cancel)
                                            {
                                                Restore();
                                                return;
                                            }
                                        }
                        }
                        else if (result == DialogResult.Cancel)
                        {
                            Restore();
                            return;
                        }
                    }
                    else if (result == DialogResult.Cancel)
                    {
                        Restore();
                        return;
                    }
                }
            }
        }
        public void Rename()
        {
            if (_modelViewerOpen)
                return;

            using (RenameDialog dlg = new RenameDialog()) { dlg.ShowDialog(MainForm.Instance, _resource); }
        }
Esempio n. 4
0
 private void renameBoneToolStripMenuItem_Click(object sender, EventArgs e)
 {
     using (RenameDialog dlg = new RenameDialog())
         dlg.ShowDialog(this.ParentForm, _selectedBone);
 }
 public void EditDictionarySyntax()
 {
     DialogResult res;
     MoveDefEventNode e = _resource as MoveDefEventNode;
     long ev = e._event;
     MoveDefEntryNode temp = new MoveDefEntryNode();
     if (MoveDefNode.EventDictionary.ContainsKey(ev))
         temp.Name = MoveDefNode.EventDictionary[ev]._syntax;
     else
         temp.Name = "";
     using (RenameDialog dlg = new RenameDialog()) { res = dlg.ShowDialog(MainForm.Instance, temp); }
     if (res == DialogResult.OK)
     {
         if (MoveDefNode.EventDictionary.ContainsKey(ev))
             MoveDefNode.EventDictionary[ev]._syntax = temp.Name;
         else
             MoveDefNode.EventDictionary.Add(ev, new ActionEventInfo() { Params = new string[_resource.Children.Count], pDescs = new string[_resource.Children.Count], _syntax = temp.Name, idNumber = ev });
         MoveDefNode._dictionaryChanged = true;
     }
     temp.Dispose();
     temp = null;
 }
 public void EditDictionaryName()
 {
     DialogResult res;
     MoveDefEventParameterNode e = _resource as MoveDefEventParameterNode;
     uint ev = (e.Parent as MoveDefEventNode)._event;
     MoveDefEntryNode temp = new MoveDefEntryNode();
     if (MoveDefNode.EventDictionary.ContainsKey(ev))
         temp.Name = MoveDefNode.EventDictionary[ev].Params[_resource.Index];
     else
         temp.Name = "";
     using (RenameDialog dlg = new RenameDialog()) { res = dlg.ShowDialog(MainForm.Instance, temp); }
     if (res == DialogResult.OK)
     {
         if (!MoveDefNode.EventDictionary.ContainsKey(ev))
             MoveDefNode.EventDictionary.Add(ev, new ActionEventInfo() { Params = new string[_resource.Parent.Children.Count], pDescs = new string[_resource.Parent.Children.Count], idNumber = ev });
         MoveDefNode.EventDictionary[ev].Params[_resource.Index] = temp.Name;
         MoveDefNode._dictionaryChanged = true;
         foreach (MoveDefEventNode n in e.Root._events[ev])
         {
             n.Children[_resource.Index].Name = temp.Name;
             n.Children[_resource.Index].HasChanged = false;
         }
     }
     temp.Dispose();
     temp = null;
 }
 private void renameToolStripMenuItem_Click(object sender, EventArgs e)
 {
     using (RenameDialog dlg = new RenameDialog())
         dlg.ShowDialog(this.ParentForm, _mainWindow.TargetAnimation);
 }
        private void renameTextureToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (RenameDialog dlg = new RenameDialog())
                dlg.ShowDialog(this.ParentForm, (_selectedTexture.Source as TEX0Node));

            _selectedTexture.Name = (_selectedTexture.Source as TEX0Node).Name;
        }