Exemple #1
0
 /// <summary>
 /// This method is called to respond to a gizmo transform operation undone message.
 /// </summary>
 private void RespondToMessage(GizmoTransformOperationWasUndoneMessage message)
 {
     // When the transform operation is undone, it means the objects position/rotation/scale
     // has changed, so we have to recalculate the position and orientation of the active gizmo.
     EstablishActiveGizmoPosition();
     UpdateActiveGizmoRotation();
 }
        /// <summary>
        /// This method can be called to undo the action.
        /// </summary>
        public void Undo()
        {
            // In order to undo this kind of action, we will loop through all pre transform object snapshots
            // and apply them to the corresponding objects.
            foreach (ObjectTransformSnapshot snapshot in _preTransformObjectSnapshots)
            {
                snapshot.ApplySnapshot();
            }

            // Send a gizmo transform operation undone message
            GizmoTransformOperationWasUndoneMessage.SendToInterestedListeners(_gizmoWhichTransformedObjects);
        }
        /// <summary>
        /// Convenience function for sending a gizmo transform operation undone message to
        /// all interested listeners.
        /// </summary>
        /// <param name="gizmoInvolvedInTransformOperation">
        /// This is the gizmo which is involved in the transform operation which was undone.
        /// </param>
        public static void SendToInterestedListeners(Gizmo gizmoInvolvedInTransformOperation)
        {
            var message = new GizmoTransformOperationWasUndoneMessage(gizmoInvolvedInTransformOperation);

            MessageListenerDatabase.Instance.SendMessageToInterestedListeners(message);
        }