Exemplo n.º 1
0
 public override bool Merge(BaseCommand other)
 {
     return(false);
 }
Exemplo n.º 2
0
        public MoveConstrainedKnotCommand(CameraPath path, KnotDescriptor knotDesc, Quaternion rot_GS,
                                          bool mergesWithCreateCommand = false, bool final = false, BaseCommand parent = null)
            : base(knotDesc.knot, mergesWithCreateCommand, parent)
        {
            m_Path           = path;
            m_EndRotation_CS = Quaternion.Inverse(App.Scene.Pose.rotation) * rot_GS;
            m_EndT           = knotDesc.pathT.Value;
            m_Final          = final;

            m_StartRotation_CS = Knot.transform.localRotation;
            m_StartT           = Knot.PathT;
        }
Exemplo n.º 3
0
        public override bool Merge(BaseCommand other)
        {
            if (base.Merge(other))
            {
                return(true);
            }
            if (m_Final)
            {
                return(false);
            }
            MoveWidgetCommand move = other as MoveWidgetCommand;

            if (move != null && m_Widget == move.m_Widget)
            {
                m_EndTransform             = move.m_EndTransform;
                m_CustomDimension.endState = move.m_CustomDimension.endState;
                // Not used if (m_Type != Type.Selection)
                m_EndSelectionTransform = move.m_EndSelectionTransform;
                m_Final = move.m_Final;
                return(true);
            }
            HideWidgetCommand hide = other as HideWidgetCommand;

            if (hide != null && m_Widget == hide.Widget)
            {
                m_Children.Add(hide);
                m_Final = true;
                return(true);
            }
            PinWidgetCommand pin = other as PinWidgetCommand;

            if (pin != null && m_Widget == pin.Widget)
            {
                m_Children.Add(pin);
                if (pin.IsPinning)
                {
                    m_Final = true;
                }
                return(true);
            }
            // Strokes are deleted right after a move if the SelectionWidget is tossed.
            DeleteSelectionCommand delete = other as DeleteSelectionCommand;

            if (delete != null && m_Type == Type.Selection)
            {
                m_Children.Add(delete);
                m_Final = true;
                return(true);
            }
            // If a widget has been tossed but the animation is not yet complete, finish it here.
            if (m_Widget.IsTossed() || m_Widget.IsHiding())
            {
                if (m_Type == Type.Selection)
                {
                    // Additional "hide now" logic if the there is a selection that needs to be deleted
                    // when the selection widget hides.
                    DeleteSelectionCommand del = SelectionManager.m_Instance.CurrentDeleteSelectionCommand();
                    del.Redo();
                    m_Children.Add(del);
                    SelectionManager.m_Instance.ResolveChanges();
                }

                m_Widget.HideNow();
                HideWidgetCommand hideComm = new HideWidgetCommand(m_Widget);
                hideComm.Redo();
                m_Children.Add(hideComm);

                if (m_Type == Type.Selection)
                {
                    // If a selection is made while the selection widget is animating out, the transform
                    // passed into the SelectCommand constructor is incorrect. It should always be the identity
                    // because it is the transform of a new selection since the previous selection was deleted.
                    SelectCommand select = other as SelectCommand;
                    if (select != null)
                    {
                        select.ResetInitialTransform();
                    }
                }
            }
            // Mark as final if a merge is failed, because a non-compatible command was pushed on top.
            // This will prevent future move commands from merging if the non-compatible command is undone.
            m_Final = true;
            return(false);
        }
Exemplo n.º 4
0
 public DeleteStrokeCommand(Stroke stroke, BaseCommand parent = null)
     : base(parent) {
   m_TargetStroke = stroke;
   m_SilenceFirstAudio = true;
 }
Exemplo n.º 5
0
 /// API is only for undo/redo stack.
 /// Override to define how a command can merge with another.
 /// Returns true upon successful merge, otherwise false.
 /// This command is redone before other and undone after other.
 ///
 /// The base implementation discards no-op commands and should
 /// and should always be called by subclasses.
 public virtual bool Merge(BaseCommand other)
 {
     return(other.IsNoop);
 }