선택된 객체 Undo 이후 대상이 없는 상태에서 복사 시 오류, Undo, Redo 연속 실행 #219
@@ -45,7 +45,7 @@ namespace Studio.Command
|
|||||||
|
|
||||||
var renderObjectHandler = ManagerHub.instance.Get<RenderObjectHandler>();
|
var renderObjectHandler = ManagerHub.instance.Get<RenderObjectHandler>();
|
||||||
renderObjectHandler.rtgController.SetGizmoTargetObjects(new List<GameObject>());
|
renderObjectHandler.rtgController.SetGizmoTargetObjects(new List<GameObject>());
|
||||||
|
renderObjectHandler.DeselectAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -143,6 +143,8 @@ namespace Studio.Command
|
|||||||
canvas.panel_dynamicobjectinfo.ResetObjectInfo();
|
canvas.panel_dynamicobjectinfo.ResetObjectInfo();
|
||||||
//connector.onRemoveObjects?.Invoke();
|
//connector.onRemoveObjects?.Invoke();
|
||||||
connector.componentScrollView.DeselectAll();
|
connector.componentScrollView.DeselectAll();
|
||||||
|
var renderObjectHandler = ManagerHub.instance.Get<RenderObjectHandler>();
|
||||||
|
renderObjectHandler.DeselectAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using System;
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
|
using UnityEditor.ShortcutManagement;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.EventSystems;
|
using UnityEngine.EventSystems;
|
||||||
using XRLib;
|
using XRLib;
|
||||||
@@ -13,10 +14,21 @@ namespace Studio.Manage
|
|||||||
Dictionary<KeyCode, Action> getKeyActionTable = new Dictionary<KeyCode, Action>();
|
Dictionary<KeyCode, Action> getKeyActionTable = new Dictionary<KeyCode, Action>();
|
||||||
Dictionary<KeyCode, Action> upKeyActionTable = new Dictionary<KeyCode, Action>();
|
Dictionary<KeyCode, Action> upKeyActionTable = new Dictionary<KeyCode, Action>();
|
||||||
Dictionary<KeyCode, Action> downKeyActionTable = new Dictionary<KeyCode, Action>();
|
Dictionary<KeyCode, Action> downKeyActionTable = new Dictionary<KeyCode, Action>();
|
||||||
Dictionary<KeyCode, Dictionary<KeyCode, Action>> shortCutActionTable = new ();
|
Dictionary<KeyCode, Dictionary<KeyCode, Action>> shortCutActionTable = new();
|
||||||
|
Dictionary<string, ShortcutState> shortcutStateTable = new Dictionary<string, ShortcutState>();
|
||||||
|
|
||||||
|
float shortCutInitialDelay = 0.5f;
|
||||||
|
float shortCutRepeatDelay = 0.1f;
|
||||||
|
|
||||||
Stack<InputHandler> handlerStack = new();
|
Stack<InputHandler> handlerStack = new();
|
||||||
Action updateLoop;
|
Action updateLoop;
|
||||||
|
|
||||||
|
private class ShortcutState
|
||||||
|
{
|
||||||
|
public float pressStartTime = -1f;
|
||||||
|
public float lastActionTime = -1f;
|
||||||
|
}
|
||||||
|
|
||||||
public void SetHandler(InputHandler handler)
|
public void SetHandler(InputHandler handler)
|
||||||
{
|
{
|
||||||
SetKeyboardPreset(handler);
|
SetKeyboardPreset(handler);
|
||||||
@@ -34,11 +46,11 @@ namespace Studio.Manage
|
|||||||
RemoveKeyActionPreset(currentHandler);
|
RemoveKeyActionPreset(currentHandler);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
tempStack.Push(currentHandler);
|
tempStack.Push(currentHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
while(tempStack.Count > 0)
|
while (tempStack.Count > 0)
|
||||||
{
|
{
|
||||||
var tempHandler = tempStack.Pop();
|
var tempHandler = tempStack.Pop();
|
||||||
SetKeyboardPreset(tempHandler);
|
SetKeyboardPreset(tempHandler);
|
||||||
@@ -47,24 +59,24 @@ namespace Studio.Manage
|
|||||||
|
|
||||||
void RemoveKeyActionPreset(InputHandler handler)
|
void RemoveKeyActionPreset(InputHandler handler)
|
||||||
{
|
{
|
||||||
foreach(var k in handler.getKeyActions)
|
foreach (var k in handler.getKeyActions)
|
||||||
{
|
{
|
||||||
getKeyActionTable.Remove(k.Key);
|
getKeyActionTable.Remove(k.Key);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(var k in handler.upKeyActions)
|
foreach (var k in handler.upKeyActions)
|
||||||
{
|
{
|
||||||
upKeyActionTable.Remove(k.Key);
|
upKeyActionTable.Remove(k.Key);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(var k in handler.downKeyActions)
|
foreach (var k in handler.downKeyActions)
|
||||||
{
|
{
|
||||||
downKeyActionTable.Remove(k.Key);
|
downKeyActionTable.Remove(k.Key);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(var k in handler.shortCutActions)
|
foreach (var k in handler.shortCutActions)
|
||||||
{
|
{
|
||||||
foreach(var kk in k.Value)
|
foreach (var kk in k.Value)
|
||||||
{
|
{
|
||||||
shortCutActionTable[k.Key].Remove(kk.Key);
|
shortCutActionTable[k.Key].Remove(kk.Key);
|
||||||
}
|
}
|
||||||
@@ -79,14 +91,14 @@ namespace Studio.Manage
|
|||||||
getKeyActionTable[k.Key] = k.Value;
|
getKeyActionTable[k.Key] = k.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(var k in handler.upKeyActions)
|
foreach (var k in handler.upKeyActions)
|
||||||
{
|
{
|
||||||
upKeyActionTable[k.Key]= k.Value;
|
upKeyActionTable[k.Key] = k.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(var k in handler.downKeyActions)
|
foreach (var k in handler.downKeyActions)
|
||||||
{
|
{
|
||||||
downKeyActionTable[k.Key]= k.Value;
|
downKeyActionTable[k.Key] = k.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var k in handler.shortCutActions)
|
foreach (var k in handler.shortCutActions)
|
||||||
@@ -143,18 +155,53 @@ namespace Studio.Manage
|
|||||||
{
|
{
|
||||||
foreach (var k in kk)
|
foreach (var k in kk)
|
||||||
{
|
{
|
||||||
if (Input.GetKeyDown(k.Key))
|
string inputKeystring = key + "+" + k.Key;
|
||||||
|
bool bothKeyPressed = Input.GetKey(k.Key);
|
||||||
|
|
||||||
|
if (!shortcutStateTable.TryGetValue(inputKeystring, out var state))
|
||||||
{
|
{
|
||||||
k.Value?.Invoke();
|
state = new ShortcutState();
|
||||||
|
shortcutStateTable[inputKeystring] = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bothKeyPressed)
|
||||||
|
{
|
||||||
|
float curTime = Time.time;
|
||||||
|
|
||||||
|
if (state.pressStartTime < 0f)
|
||||||
|
{
|
||||||
|
state.pressStartTime = curTime;
|
||||||
|
state.lastActionTime = -1f;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state.lastActionTime < 0f)
|
||||||
|
{
|
||||||
|
k.Value?.Invoke();
|
||||||
|
state.lastActionTime = curTime;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
float holdTime = curTime - state.pressStartTime;
|
||||||
|
float sinceLastAction = curTime - state.lastActionTime;
|
||||||
|
|
||||||
|
if (holdTime >= shortCutInitialDelay && sinceLastAction >= shortCutRepeatDelay)
|
||||||
|
{
|
||||||
|
k.Value?.Invoke();
|
||||||
|
state.lastActionTime = curTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
state.pressStartTime = -1f;
|
||||||
|
state.lastActionTime = -1f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateLoop?.Invoke();
|
updateLoop?.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsEditInputField()
|
bool IsEditInputField()
|
||||||
{
|
{
|
||||||
GameObject selectedObj = EventSystem.current.currentSelectedGameObject;
|
GameObject selectedObj = EventSystem.current.currentSelectedGameObject;
|
||||||
@@ -165,4 +212,5 @@ namespace Studio.Manage
|
|||||||
return selectedObj.GetComponent<TMP_InputField>() != null;
|
return selectedObj.GetComponent<TMP_InputField>() != null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user