diff --git a/Assets/Scripts/Studio/AssetTool/RenderObjectHandler.cs b/Assets/Scripts/Studio/AssetTool/RenderObjectHandler.cs index 91110d15..0be4570f 100644 --- a/Assets/Scripts/Studio/AssetTool/RenderObjectHandler.cs +++ b/Assets/Scripts/Studio/AssetTool/RenderObjectHandler.cs @@ -29,6 +29,7 @@ namespace Studio.AssetTool int uiLayer; int selectIndex; bool lockHandler = false; + bool inputLockhandler = false; public override void Init() { @@ -413,10 +414,12 @@ namespace Studio.AssetTool downKeyActions.Add(KeyCode.Mouse0, OnMousePointerDown); upKeyActions.Add(KeyCode.Mouse0, OnMousePointerUp); - downKeyActions.Add(KeyCode.Q, () => CommandInvoker.instance.Invoke(new ActivateMoveGizmoCommand())); - downKeyActions.Add(KeyCode.W, () => CommandInvoker.instance.Invoke(new ActivateRotateGizmoCommand())); - downKeyActions.Add(KeyCode.E, () => CommandInvoker.instance.Invoke(new ActivateScaleGizmoCommand())); - downKeyActions.Add(KeyCode.R, () => CommandInvoker.instance.Invoke(new ResetGizmoCommand())); + downKeyActions.Add(KeyCode.Mouse1, OnMouseRightPointerDown); + upKeyActions.Add(KeyCode.Mouse1, OnMouseRightPointerUp); + downKeyActions.Add(KeyCode.Q, () => SetGizmoChangedCommand(new ActivateMoveGizmoCommand())); + downKeyActions.Add(KeyCode.W, () => SetGizmoChangedCommand(new ActivateRotateGizmoCommand())); + downKeyActions.Add(KeyCode.E, () => SetGizmoChangedCommand(new ActivateScaleGizmoCommand())); + downKeyActions.Add(KeyCode.R, () => SetGizmoChangedCommand(new ResetGizmoCommand())); downKeyActions.Add(KeyCode.Delete, () => CommandInvoker.instance.Invoke(new RemoveSelectObjectCommand())); getKeyActions.Add(KeyCode.V, VertexSnap); @@ -436,5 +439,20 @@ namespace Studio.AssetTool var handler = new InputHandler(getKeyActions, downKeyActions, upKeyActions, shortcutTable); return handler; } + private void OnMouseRightPointerDown() + { + inputLockhandler = true; + } + private void OnMouseRightPointerUp() + { + inputLockhandler = false; + } + private void SetGizmoChangedCommand(IIrreversibleCommand command) + { + if (!inputLockhandler) + { + CommandInvoker.instance.Invoke(command); + } + } } }