private WUndoCommand CreateUndoActionForGizmo(bool isDone) { WUndoCommand undoAction = null; WActorNode[] actors = new WActorNode[m_selectionList.Count]; for (int i = 0; i < m_selectionList.Count; i++) { actors[i] = m_selectionList[i]; } switch (m_transformGizmo.Mode) { case FTransformMode.Translation: undoAction = new WTranslateActorAction(actors, this, m_transformGizmo.DeltaTranslation, m_transformGizmo.TransformSpace, isDone); break; case FTransformMode.Rotation: undoAction = new WRotateActorAction(actors, this, m_transformGizmo.DeltaRotation, m_transformGizmo.TransformSpace, isDone); break; case FTransformMode.Scale: undoAction = new WScaleActorAction(actors, this, m_transformGizmo.DeltaScale, isDone); Console.WriteLine(m_transformGizmo.DeltaScale); break; default: break; } return(undoAction); }
public override bool MergeWith(WUndoCommand withAction) { WTranslateActorAction otherAction = withAction as WTranslateActorAction; if (m_isDone || otherAction == null) { return(false); } bool arrayEquals = m_affectedActors.Count == otherAction.m_affectedActors.Count; if (arrayEquals) { for (int i = 0; i < m_affectedActors.Count; i++) { if (!otherAction.m_affectedActors.Contains(m_affectedActors[i])) { arrayEquals = false; break; } } } if (arrayEquals) { m_delta += otherAction.m_delta; m_isDone = otherAction.m_isDone; return(true); } return(false); }
private WUndoCommand CreateUndoActionForGizmo(bool isDone) { WUndoCommand undoAction = null; var actors = EditorSelection.SelectedObjects; switch (m_transformGizmo.Mode) { case FTransformMode.Translation: undoAction = new WTranslateActorAction(actors, this, m_transformGizmo.DeltaTranslation, m_transformGizmo.TransformSpace, isDone); break; case FTransformMode.Rotation: undoAction = new WRotateActorAction(actors, this, m_transformGizmo.DeltaRotation, m_transformGizmo.TransformSpace, isDone); break; case FTransformMode.Scale: undoAction = new WScaleActorAction(actors, this, m_transformGizmo.DeltaScale, isDone); Console.WriteLine(m_transformGizmo.DeltaScale); break; default: break; } return(undoAction); }