private bool HotkeyCancelChange() { if (!AwaitingRedoSave) { return(false); } //Undo transformations, make sure to reset keyframes if (VertexLoc.HasValue && _currentUndo is VertexState) { VertexState v = _currentUndo as VertexState; for (int i = 0; i < v._vertices.Count; i++) { v._vertices[i].WeightedPosition = v._weightedPositions[i]; } _vertexSelection.ResetActions(); CancelChangeState(); UpdateModel(); } else if (_boneSelection.IsMoving()) { if (_boneSelection._rotating) { CHR0Editor.numRotX.Value = _boneSelection._oldAngles._x; CHR0Editor.numRotY.Value = _boneSelection._oldAngles._y; CHR0Editor.numRotZ.Value = _boneSelection._oldAngles._z; CHR0Editor.BoxChanged(CHR0Editor.numRotX, null); CHR0Editor.BoxChanged(CHR0Editor.numRotY, null); CHR0Editor.BoxChanged(CHR0Editor.numRotZ, null); } if (_boneSelection._translating) { CHR0Editor.numTransX.Value = _boneSelection._oldPosition._x; CHR0Editor.numTransY.Value = _boneSelection._oldPosition._y; CHR0Editor.numTransZ.Value = _boneSelection._oldPosition._z; CHR0Editor.BoxChanged(CHR0Editor.numTransX, null); CHR0Editor.BoxChanged(CHR0Editor.numTransY, null); CHR0Editor.BoxChanged(CHR0Editor.numTransZ, null); } if (_boneSelection._scaling) { CHR0Editor.numScaleX.Value = _boneSelection._oldScale._x; CHR0Editor.numScaleY.Value = _boneSelection._oldScale._y; CHR0Editor.numScaleZ.Value = _boneSelection._oldScale._z; CHR0Editor.BoxChanged(CHR0Editor.numScaleX, null); CHR0Editor.BoxChanged(CHR0Editor.numScaleY, null); CHR0Editor.BoxChanged(CHR0Editor.numScaleZ, null); } _boneSelection.ResetActions(); CancelChangeState(); } ModelPanel.CurrentViewport.AllowSelection = true; return(false); }
/// <param name="index">0 = X, 1 = Y, 2 = Z</param> /// <param name="offset">The multiplier for the current scale displayed in the CHR0 editor box.</param> protected unsafe void ApplyScale(int index, float scale) { if (scale == 0.0f || scale == 1.0f) { return; } NumericInputBox box = CHR0Editor._transBoxes[index.Clamp(0, 2)]; float newVal = (float)Math.Round(box.Value * scale, 3); if (box.Value != newVal && newVal != 0.0f) { box.Value = newVal; CHR0Editor.BoxChanged(box, null); } }
/// <param name="index">0 = X, 1 = Y, 2 = Z</param> /// <param name="offset">The amount to add to the current translation displayed in the CHR0 editor box.</param> protected unsafe void ApplyTranslation(int index, float offset) { if (offset == 0.0f) { return; } NumericInputBox box = CHR0Editor._transBoxes[index.Clamp(0, 2) + 6]; float newVal = (float)Math.Round(box.Value + offset, 3); if (box.Value != newVal) { box.Value = newVal; CHR0Editor.BoxChanged(box, null); } }