/// There is no reasonable way for a caller to know what to pass for "endCustomDimension", /// because moving or scaling the widget (with some change in endXf) may cause the widget's /// CustomDimension values to change, too. /// /// Typically, a caller will pass widget.CustomDimension and assume that this /// is the correct value. Or, callers will go through some custom API on the widget /// (see CubeStencil.RecordAndApplyScaleToAxis) which has knowledge of its own internals /// and can compute the proper endCustomDimension to pass. public MoveWidgetCommand(GrabWidget widget, TrTransform endXf, Vector3 endCustomDimension, bool final = false, BaseCommand parent = null) : base(parent) { m_Widget = widget; m_Final = final; m_StartTransform = widget.LocalTransform; if (widget is StencilWidget) { m_Type = Type.Guide; } else if (widget is MediaWidget) { m_Type = Type.Media; m_StartTransform.scale = widget.GetSignedWidgetSize(); } else if (widget is SymmetryWidget) { m_Type = Type.Symmetry; } else if (widget is SelectionWidget) { m_Type = Type.Selection; m_StartSelectionTransform = SelectionManager.m_Instance.SelectionTransform; m_EndSelectionTransform = SelectionManager.m_Instance.SelectionTransform; } m_CustomDimension.startState = widget.CustomDimension; m_EndTransform = endXf; m_CustomDimension.endState = endCustomDimension; }
public HideWidgetCommand(GrabWidget widget, BaseCommand parent = null) : base(parent) { m_Widget = widget; if (widget is StencilWidget) { m_WidgetTransform = TrTransform.FromLocalTransform(widget.transform); } else if (widget is MediaWidget) { m_WidgetTransform = TrTransform.FromLocalTransform(widget.transform); m_WidgetTransform.scale = widget.GetSignedWidgetSize(); } m_TiltMeterCost = m_Widget.GetTiltMeterCost(); TiltMeterScript.m_Instance.AdjustMeterWithWidget(m_TiltMeterCost, up: false); }