diff --git a/Assets/Scripts/Commands/MoveWidgetCommand.cs b/Assets/Scripts/Commands/MoveWidgetCommand.cs index 513a74b835..6d25ddf7b3 100644 --- a/Assets/Scripts/Commands/MoveWidgetCommand.cs +++ b/Assets/Scripts/Commands/MoveWidgetCommand.cs @@ -82,6 +82,7 @@ public MoveWidgetCommand(GrabWidget widget, TrTransform endXf, Vector3 endCustom } public override bool NeedsSave { get { return true; } } + public bool IsFinal => m_Final; protected override void OnRedo() { diff --git a/Assets/Scripts/Multiplayer/Photon/PhotonManager.cs b/Assets/Scripts/Multiplayer/Photon/PhotonManager.cs index 979847a2f7..db1ed2bf17 100644 --- a/Assets/Scripts/Multiplayer/Photon/PhotonManager.cs +++ b/Assets/Scripts/Multiplayer/Photon/PhotonManager.cs @@ -436,6 +436,13 @@ private bool ProcessCommand(BaseCommand command, PlayerRef playerRef = default) case SwitchEnvironmentCommand: success &= CommandSwitchEnvironment(command as SwitchEnvironmentCommand, playerRef); break; + case MoveWidgetCommand: + var cmd = command as MoveWidgetCommand; + if (cmd.IsFinal) + { + success &= CommandBase(command); + } + break; case BaseCommand: success &= CommandBase(command); break; diff --git a/Assets/Scripts/SketchMemoryScript.cs b/Assets/Scripts/SketchMemoryScript.cs index 0710081ea1..5f046ef7c2 100644 --- a/Assets/Scripts/SketchMemoryScript.cs +++ b/Assets/Scripts/SketchMemoryScript.cs @@ -415,22 +415,23 @@ public void PerformAndRecordCommand(BaseCommand command, bool discardIfNotMerged bool discardCommand = discardIfNotMerged; BaseCommand delta = command; ClearRedo(); - while (m_OperationStack.Any()) + while (m_OperationStack.Any()) // Are there any commands on the undo stack? { BaseCommand top = m_OperationStack.Pop(); - if (!top.Merge(command)) + if (!top.Merge(command)) // Have we hit a command we can't merge? { m_OperationStack.Push(top); break; } - discardCommand = false; + discardCommand = false; // We're still merging command = top; } - if (discardCommand) + if (discardCommand) // Something was merged { command.Dispose(); return; } + // Nothing was merged so execute the command delta.Redo(); m_OperationStack.Push(command); OperationStackChanged?.Invoke();