객체 삭제 Undo, Redo 안되는 버그 수정 #184

Merged
UVCXR merged 2 commits from pgd/20250626_3 into main 2025-06-27 12:40:40 +09:00
14 changed files with 153 additions and 45 deletions
Showing only changes of commit 9ddf268722 - Show all commits

View File

@@ -27,6 +27,38 @@ MonoBehaviour:
m_Key: Scale Gizmo
m_Metadata:
m_Items: []
- m_Id: 2904508764098560
m_Key: Reset Gizmo
m_Metadata:
m_Items: []
- m_Id: 2917846080393216
m_Key: Copy Object
m_Metadata:
m_Items: []
- m_Id: 2917920218910720
m_Key: New Project
m_Metadata:
m_Items: []
- m_Id: 2918019179319296
m_Key: Open Project
m_Metadata:
m_Items: []
- m_Id: 2918166198063104
m_Key: Save And New Project
m_Metadata:
m_Items: []
- m_Id: 2925542997331968
m_Key: Save And Open Proejct
m_Metadata:
m_Items: []
- m_Id: 2925648920285184
m_Key: Save Project
m_Metadata:
m_Items: []
- m_Id: 2928491886645248
m_Key: Exit Program
m_Metadata:
m_Items: []
m_Metadata:
m_Items: []
m_KeyGenerator:

View File

@@ -30,6 +30,38 @@ MonoBehaviour:
m_Localized: Scale Gizmo
m_Metadata:
m_Items: []
- m_Id: 2904508764098560
m_Localized: Reset Gizmo
m_Metadata:
m_Items: []
- m_Id: 2917846080393216
m_Localized: Copy Object
m_Metadata:
m_Items: []
- m_Id: 2917920218910720
m_Localized: New Project
m_Metadata:
m_Items: []
- m_Id: 2918019179319296
m_Localized: Open Project
m_Metadata:
m_Items: []
- m_Id: 2918166198063104
m_Localized: Save And New Project
m_Metadata:
m_Items: []
- m_Id: 2925542997331968
m_Localized: Save And Open Proejct
m_Metadata:
m_Items: []
- m_Id: 2925648920285184
m_Localized: Save Project
m_Metadata:
m_Items: []
- m_Id: 2928491886645248
m_Localized: Exit Program
m_Metadata:
m_Items: []
references:
version: 2
RefIds: []

View File

@@ -30,6 +30,38 @@ MonoBehaviour:
m_Localized: "\uC2A4\uCF00\uC77C \uAE30\uC9C0\uBAA8"
m_Metadata:
m_Items: []
- m_Id: 2904508764098560
m_Localized: "\uB9AC\uC14B \uAE30\uC9C0\uBAA8"
m_Metadata:
m_Items: []
- m_Id: 2917846080393216
m_Localized: "\uAC1D\uCCB4 \uBCF5\uC0AC"
m_Metadata:
m_Items: []
- m_Id: 2917920218910720
m_Localized: "\uC0C8 \uD504\uB85C\uC81D\uD2B8"
m_Metadata:
m_Items: []
- m_Id: 2918019179319296
m_Localized: "\uD504\uB85C\uC81D\uD2B8 \uC5F4\uAE30"
m_Metadata:
m_Items: []
- m_Id: 2918166198063104
m_Localized: "\uC800\uC7A5 \uBC0F \uC0C8 \uD504\uB85C\uC81D\uD2B8"
m_Metadata:
m_Items: []
- m_Id: 2925542997331968
m_Localized: "\uC800\uC7A5 \uBC0F \uD504\uB85C\uC81D\uD2B8 \uC5F4\uAE30"
m_Metadata:
m_Items: []
- m_Id: 2925648920285184
m_Localized: "\uD504\uB85C\uC81D\uD2B8 \uC800\uC7A5"
m_Metadata:
m_Items: []
- m_Id: 2928491886645248
m_Localized: "\uD504\uB85C\uADF8\uB7A8 \uC885\uB8CC"
m_Metadata:
m_Items: []
references:
version: 2
RefIds: []

View File

@@ -11,12 +11,12 @@ namespace RTG
{
private static readonly float _minMoveSpeed = 1e-1f;
[SerializeField]
private float _moveSpeed = 6.0f;
[SerializeField]
private float _accelerationRate = 15.0f;
private float _moveSpeed = 30.0f;
private float _moveFastSpeed = 60.0f;
private float _accelerationRate = 0f;
public float MoveSpeed { get { return _moveSpeed; } set { _moveSpeed = Mathf.Max(_minMoveSpeed, value); } }
public float MoveFastSpeed { get { return _moveFastSpeed; } set { _moveFastSpeed = Mathf.Max(_minMoveSpeed, value); } }
public float AccelerationRate { get { return _accelerationRate; } set { _accelerationRate = Mathf.Max(0.0f, value); } }

View File

@@ -22,6 +22,10 @@ namespace RTG
[SerializeField]
private float _perspStandardZoomSensitivity = 10.0f;
[SerializeField]
private float _orthoFastZoomSensitivity = 30.0f;
[SerializeField]
private float _perspFastZoomSensitivity = 30.0f;
[SerializeField]
private float _orthoSmoothZoomSensitivity = 5.0f;
[SerializeField]
private float _perspSmoothZoomSensitivity = 5.0f;
@@ -37,6 +41,8 @@ namespace RTG
public CameraZoomMode ZoomMode { get { return _zoomMode; } set { _zoomMode = value; } }
public float OrthoStandardZoomSensitivity { get { return _orthoStandardZoomSensitivity; } set { _orthoStandardZoomSensitivity = Mathf.Max(value, 1e-3f); } }
public float PerspStandardZoomSensitivity { get { return _perspStandardZoomSensitivity; } set { _perspStandardZoomSensitivity = Mathf.Max(value, 1e-3f); } }
public float OrthoFastZoomSensitivity { get { return _orthoFastZoomSensitivity; } set { _orthoFastZoomSensitivity = Mathf.Max(value, 1e-3f); } }
public float PerspFastZoomSensitivity { get { return _perspFastZoomSensitivity; } set { _perspFastZoomSensitivity = Mathf.Max(value, 1e-3f); } }
public float OrthoSmoothZoomSensitivity { get { return _orthoSmoothZoomSensitivity; } set { _orthoSmoothZoomSensitivity = Mathf.Max(value, 1e-3f); } }
public float PerspSmoothZoomSensitivity { get { return _perspSmoothZoomSensitivity; } set { _perspSmoothZoomSensitivity = Mathf.Max(value, 1e-3f); } }
public float OrthoZoomSmoothValue { get { return _orthoZoomSmoothValue; } set { _orthoZoomSmoothValue = Mathf.Max(value, 1e-3f); } }
@@ -49,16 +55,19 @@ namespace RTG
return camera.orthographic ? OrthoZoomSmoothValue : PerspZoomSmoothValue;
}
public float GetZoomSensitivity(Camera camera)
public float GetZoomSensitivity(Camera camera, bool isFast)
{
if (_zoomMode == CameraZoomMode.Standard) return camera.orthographic ? OrthoStandardZoomSensitivity : PerspStandardZoomSensitivity;
else
if (_zoomMode == CameraZoomMode.Smooth) return camera.orthographic ? OrthoSmoothZoomSensitivity : PerspSmoothZoomSensitivity;
if (_zoomMode == CameraZoomMode.Standard)
{
if(camera.orthographic)
return isFast ? OrthoFastZoomSensitivity : OrthoStandardZoomSensitivity;
else
return isFast ? PerspFastZoomSensitivity : PerspStandardZoomSensitivity;
}
//if (_zoomMode == CameraZoomMode.Smooth) return camera.orthographic ? OrthoSmoothZoomSensitivity : PerspSmoothZoomSensitivity;
return 0.0f;
}
protected override void RenderContent(UnityEngine.Object undoRecordObject)
{

View File

@@ -349,8 +349,10 @@ namespace RTG
void GetInput()
{
float moveAmount = (_moveSettings.MoveSpeed + _currentAcceleration) * Time.deltaTime;
float moveSpeed = RTInput.GetKey(KeyCode.LeftShift) ? _moveSettings.MoveFastSpeed : _moveSettings.MoveSpeed;
float moveAmount = (moveSpeed + _currentAcceleration) * Time.deltaTime;
Debug.Log("moveSpeed " + moveAmount);
Vector3 moveVector = Vector3.zero;
_moveDirFlags[(int)MoveDirection.Forward] = Hotkeys.MoveForward.IsActive();
_moveDirFlags[(int)MoveDirection.Backwards] = !_moveDirFlags[(int)MoveDirection.Forward] && Hotkeys.MoveBack.IsActive();
@@ -465,19 +467,20 @@ namespace RTG
return;
float mouseScroll = RTInput.MouseScroll();
bool isFast = RTInput.GetKey(KeyCode.LeftShift);
if (Mathf.Approximately(mouseScroll, 0.0f))
return;
if (_zoomSettings.ZoomMode == CameraZoomMode.Standard)
{
Zoom(CalculateScrollZoomAmount(mouseScroll));
Zoom(CalculateScrollZoomAmount(mouseScroll, isFast));
//마우스 포인터위치로
}
else
{
StopCamTransform();
StartCoroutine(_genricCamTransformCrtn = DoSmoothZoom(mouseScroll));
}
//else
//{
// StopCamTransform();
// StartCoroutine(_genricCamTransformCrtn = DoSmoothZoom(mouseScroll));
//}
}
public void SliderZoomInOut(int value)
@@ -558,9 +561,9 @@ namespace RTG
return _targetTransform.position + _targetTransform.forward * _focusPointOffset;
}
private float CalculateScrollZoomAmount(float deviceScroll)
private float CalculateScrollZoomAmount(float deviceScroll, bool isFast)
{
float zoomAmount = deviceScroll * _zoomSettings.GetZoomSensitivity(TargetCamera);
float zoomAmount = deviceScroll * _zoomSettings.GetZoomSensitivity(TargetCamera, isFast);
if (_zoomSettings.InvertZoomAxis)
zoomAmount *= -1.0f;
@@ -722,18 +725,18 @@ namespace RTG
}
}
private IEnumerator DoSmoothZoom(float deviceScroll)
{
float zoomAmount = CalculateScrollZoomAmount(deviceScroll);
//private IEnumerator DoSmoothZoom(float deviceScroll)
//{
// float zoomAmount = CalculateScrollZoomAmount(deviceScroll);
while(!Mathf.Approximately(zoomAmount, 0.0f))
{
Zoom(zoomAmount);
zoomAmount = Mathf.Lerp(zoomAmount, 0.0f, _zoomSettings.GetZoomSmoothValue(TargetCamera) * Time.deltaTime);
// while(!Mathf.Approximately(zoomAmount, 0.0f))
// {
// Zoom(zoomAmount);
// zoomAmount = Mathf.Lerp(zoomAmount, 0.0f, _zoomSettings.GetZoomSmoothValue(TargetCamera) * Time.deltaTime);
yield return null;
}
}
// yield return null;
// }
//}
private IEnumerator DoConstantRotationSwitch(Quaternion targetRotation)
{

View File

@@ -9,7 +9,7 @@ namespace Studio.Command
}
public string id { get => throw new System.NotImplementedException(); set => throw new System.NotImplementedException(); }
public string id { get => "Exit Program"; set => throw new System.NotImplementedException(); }
public bool CanExecute()
{

View File

@@ -12,7 +12,7 @@ namespace Studio.Command
}
public string id { get => throw new System.NotImplementedException(); set => throw new System.NotImplementedException(); }
public string id { get => "Reset Gizmo"; set => throw new System.NotImplementedException(); }
public bool CanExecute()
{

View File

@@ -4,7 +4,7 @@ namespace Studio.Command
{
public class NewProjectCommand : IIrreversibleCommand
{
public string id { get => throw new System.NotImplementedException(); set => throw new System.NotImplementedException(); }
public string id { get => "New Project"; set => throw new System.NotImplementedException(); }
public bool CanExecute()
{

View File

@@ -4,7 +4,7 @@ namespace Studio.Command
{
public class OpenProjectCommand : IIrreversibleCommand
{
public string id { get => throw new System.NotImplementedException(); set => throw new System.NotImplementedException(); }
public string id { get => "Open Project"; set => throw new System.NotImplementedException(); }
public bool CanExecute()
{

View File

@@ -5,7 +5,7 @@ namespace Studio.Command
{
public class SaveAndNewProjectCommand : IIrreversibleCommand
{
public string id { get => throw new System.NotImplementedException(); set => throw new System.NotImplementedException(); }
public string id { get => "Save And New Project"; set => throw new System.NotImplementedException(); }
public bool CanExecute()
{

View File

@@ -5,7 +5,7 @@ namespace Studio.Command
{
public class SaveAndOpenProjectCommand : IIrreversibleCommand
{
public string id { get => throw new System.NotImplementedException(); set => throw new System.NotImplementedException(); }
public string id { get => "Save And Open Project"; set => throw new System.NotImplementedException(); }
public bool CanExecute()
{

View File

@@ -17,7 +17,7 @@ namespace Studio
}
public string id { get => throw new System.NotImplementedException(); set => throw new System.NotImplementedException(); }
public string id { get => "Save Project"; set => throw new System.NotImplementedException(); }
public bool CanExecute()
{

View File

@@ -22,17 +22,17 @@ namespace Studio.Manage
AddCommand(new ActivateMoveGizmoCommand());
AddCommand(new ActivateRotateGizmoCommand());
AddCommand(new ActivateScaleGizmoCommand());
//AddCommand(new ResetGizmoCommand());
AddCommand(new ResetGizmoCommand());
//AddCommand(new CopyObjectCommand());
//AddCommand(new RemoveAllObjectCommand());
//AddCommand(new RemoveSelectObjectCommand());
//AddCommand(new NewProjectCommand());
//AddCommand(new OpenProjectCommand());
//AddCommand(new SaveAndNewProjectCommand());
//AddCommand(new SaveAndOpenProjectCommand());
//AddCommand(new SaveProjectCommand());
AddCommand(new NewProjectCommand());
AddCommand(new OpenProjectCommand());
AddCommand(new SaveAndNewProjectCommand());
AddCommand(new SaveAndOpenProjectCommand());
AddCommand(new SaveProjectCommand());
//AddCommand(new CreateConnectedAssetCommand());
//AddCommand(new ExitProgramCommand());
AddCommand(new ExitProgramCommand());
}
private async Task AddCommand(string id, Action action)