private bool HotkeyRefreshReferences() { if (ModelPanel.Focused) { ModelPanel.RefreshReferences(); return(true); } return(false); }
public virtual void LoadModels(ResourceNode node) { if (_targetModels == null) { _targetModels = new List <IModel>(); } List <IModel> modelList = ModelPanel.CollectModels(node); foreach (IModel m in modelList) { AppendTarget(m); } ModelPanel.RefreshReferences(); if (TargetModel == null && _targetModels.Count > 0) { TargetModel = _targetModels[0]; } }
protected override bool ProcessKeyPreview(ref Message m) { if (m.Msg == 0x100) { bool focused = ModelPanel.ContainsFocus; Keys key = (Keys)m.WParam; if (key == Keys.PageUp) { if (Ctrl) { pnlPlayback.btnLast_Click(this, null); } else { pnlPlayback.btnNextFrame_Click(this, null); } return(true); } else if (key == Keys.PageDown) { if (Ctrl) { pnlPlayback.btnFirst_Click(this, null); } else { pnlPlayback.btnPrevFrame_Click(this, null); } return(true); } else if (key == Keys.U) { if (Ctrl) { ModelPanel.ResetCamera(); return(true); } } else if (key == Keys.A) { if (Ctrl) { ResetVertexColors(); if (_targetModels != null) { foreach (MDL0Node mdl in _targetModels) { if (mdl._objList != null) { if (mdl._polyIndex != -1 && mdl._polyIndex >= 0 && mdl._polyIndex < mdl._objList.Count) { foreach (Vertex3 v in ((MDL0ObjectNode)mdl._objList[mdl._polyIndex])._manager._vertices) { _selectedVertices.Add(v); v._selected = true; v._highlightColor = Color.Orange; } } else { foreach (MDL0ObjectNode o in mdl._objList) { foreach (Vertex3 v in o._manager._vertices) { _selectedVertices.Add(v); v._selected = true; v._highlightColor = Color.Orange; } } } } } } weightEditor.TargetVertices = _selectedVertices; vertexEditor.TargetVertices = _selectedVertices; ModelPanel.Invalidate(); } else if (focused) { btnLeftToggle_Click(null, null); return(true); } } else if (key == Keys.D) { if (focused) { if (Control.ModifierKeys == (Keys.Control | Keys.Alt)) { if (leftPanel.Visible || rightPanel.Visible || animEditors.Visible || controlPanel.Visible) { showBottom.Checked = showRight.Checked = showLeft.Checked = showTop.Checked = false; } else { showBottom.Checked = showRight.Checked = showLeft.Checked = showTop.Checked = true; } } else { btnRightToggle_Click(null, null); } return(true); } } else if (key == Keys.W) { if (focused) { btnTopToggle_Click(null, null); return(true); } } else if (key == Keys.S) { btnBottomToggle_Click(null, null); return(true); } else if (key == Keys.E) { if (focused) { scaleToolStripMenuItem.PerformClick(); return(true); } } else if (key == Keys.R) { if (focused) { rotationToolStripMenuItem.PerformClick(); return(true); } } else if (key == Keys.G) { if (focused) { ModelPanel.RefreshReferences(); return(true); } } else if (key == Keys.T) { if (focused) { translationToolStripMenuItem.PerformClick(); return(true); } } else if (key == Keys.C) { if (focused) { //Copy frame if (Ctrl) { if ((ModifierKeys & Keys.Shift) == Keys.Shift) { //We're copying the whole frame if (_currentControl is CHR0Editor) { chr0Editor.btnCopyAll.PerformClick(); return(true); } } else { //We're copying the entry frame if (_currentControl is CHR0Editor) { chr0Editor.btnCopy.PerformClick(); return(true); } } } } } else if (key == Keys.V) { if (focused) { //Paste frame if (Ctrl) { if (Shift) { if (Alt) { //We're pasting only keyframes of the whole frame if (_currentControl is CHR0Editor) { chr0Editor._onlyKeys = true; chr0Editor.btnPasteAll.PerformClick(); return(true); } } else { //We're pasting the whole frame if (_currentControl is CHR0Editor) { chr0Editor._onlyKeys = false; chr0Editor.btnPasteAll.PerformClick(); return(true); } } } else if (Alt) { //We're pasting only keyframes of the entry frame if (_currentControl is CHR0Editor) { chr0Editor._onlyKeys = true; chr0Editor.btnPaste.PerformClick(); return(true); } } else { //We're pasting the entry frame if (_currentControl is CHR0Editor) { chr0Editor._onlyKeys = false; chr0Editor.btnPaste.PerformClick(); return(true); } } } else { chkVertices.PerformClick(); return(true); } } } else if (key == Keys.Back) { if (focused) { if (Ctrl) { //Clear all keyframes from frame if ((ModifierKeys & Keys.Shift) == Keys.Shift) { //We're removing the whole frame if (_currentControl is CHR0Editor) { chr0Editor.btnClearAll.PerformClick(); return(true); } } else { //We're removing the entry frame if (_currentControl is CHR0Editor) { chr0Editor.ClearEntry(); return(true); } } } else if (ModifierKeys == Keys.Shift) { //Delete frame if (_currentControl is CHR0Editor) { chr0Editor.btnDelete.PerformClick(); return(true); } } } } else if (key == Keys.P) { if (focused) { chkPolygons.PerformClick(); return(true); } } else if (key == Keys.B) { if (focused) { chkBones.PerformClick(); return(true); } } else if (key == Keys.F) { if (focused) { chkFloor.PerformClick(); return(true); } } else if (key == Keys.I) { if ((ModifierKeys & (Keys.Alt | Keys.Control)) == (Keys.Alt | Keys.Control)) { btnExportToImgWithTransparency_Click(null, null); return(true); } else if ((ModifierKeys & (Keys.Shift | Keys.Control)) == (Keys.Shift | Keys.Control)) { btnExportToImgNoTransparency_Click(null, null); return(true); } } if (key == Keys.Z) { if (Ctrl) { if (btnUndo.Enabled) { btnUndo_Click(null, null); } return(true); } } else if (key == Keys.Y) { if (Ctrl) { if (btnRedo.Enabled) { btnRedo_Click(null, null); } return(true); } } else if (key == Keys.Escape) { //Undo transformations, make sure to reset keyframes if (_rotating) { _rotating = false; chr0Editor.numRotX.Value = _oldAngles._x; chr0Editor.numRotY.Value = _oldAngles._y; chr0Editor.numRotZ.Value = _oldAngles._z; chr0Editor.BoxChanged(chr0Editor.numRotX, null); chr0Editor.BoxChanged(chr0Editor.numRotY, null); chr0Editor.BoxChanged(chr0Editor.numRotZ, null); ModelPanel._forceNoSelection = false; } if (_translating) { _translating = false; chr0Editor.numTransX.Value = _oldPosition._x; chr0Editor.numTransY.Value = _oldPosition._y; chr0Editor.numTransZ.Value = _oldPosition._z; chr0Editor.BoxChanged(chr0Editor.numTransX, null); chr0Editor.BoxChanged(chr0Editor.numTransY, null); chr0Editor.BoxChanged(chr0Editor.numTransZ, null); ModelPanel._forceNoSelection = false; } if (_scaling) { _scaling = false; chr0Editor.numScaleX.Value = _oldScale._x; chr0Editor.numScaleY.Value = _oldScale._y; chr0Editor.numScaleZ.Value = _oldScale._z; chr0Editor.BoxChanged(chr0Editor.numScaleX, null); chr0Editor.BoxChanged(chr0Editor.numScaleY, null); chr0Editor.BoxChanged(chr0Editor.numScaleZ, null); ModelPanel._forceNoSelection = false; } } else if (key == Keys.Space) { if (focused) { btnPlay_Click(null, null); return(true); } } //Weight editor has been disabled due to the necessity of re-encoding objects //after making influence changes. Each primitive must be regrouped if their influences have //changed, and this will get confusing with tristrips and other types of primitives. //else if (key == Keys.H) //{ // ToggleWeightEditor(); // return true; //} else if (key == Keys.J) { if (focused) { ToggleVertexEditor(); return(true); } } } return(base.ProcessKeyPreview(ref m)); }
private void EnableLiveTextureFolder_Click(object sender, EventArgs e) { EnableLiveTextureFolder.Checked = (MDL0TextureNode._folderWatcher.EnableRaisingEvents = !MDL0TextureNode._folderWatcher.EnableRaisingEvents); ModelPanel.RefreshReferences(); }