Streamingle_URP/Assets/Scripts/KindRetargeting/Editor/RetargetingRemoteControllerEditor.cs
user 41270a34f5 Refactor: 전체 에디터 UXML 전환 + 대시보드/런타임 UI + 한글화 + NanumGothic 폰트
- 모든 컨트롤러 에디터를 IMGUI → UI Toolkit(UXML/USS)으로 전환
  (Camera, Item, Event, Avatar, System, StreamDeck, OptiTrack, Facial)
- StreamingleCommon.uss 공통 테마 + 개별 에디터 USS 스타일시트
- SystemController 서브매니저 분리 (OptiTrack, Facial, Recording, Screenshot 등)
- 런타임 컨트롤 패널 (ESC 토글, 좌측 오버레이, 150% 스케일)
- 웹 대시보드 서버 (StreamingleDashboardServer) + 리타게팅 통합
- 설정 도구(StreamingleControllerSetupTool) UXML 재작성 + 원클릭 설정
- SimplePoseTransfer UXML 에디터 추가
- 전체 UXML 한글화 + NanumGothic 폰트 적용
- Streamingle.Debug → Streamingle.Debugging 네임스페이스 변경 (Debug.Log 충돌 해결)
- 불필요 코드 제거 (rawkey.cs, RetargetingHTTPServer, OptitrackSkeletonAnimator 등)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 02:51:43 +09:00

135 lines
4.8 KiB
C#

using UnityEngine;
using UnityEditor;
using KindRetargeting.Remote;
namespace KindRetargeting.Editor
{
[CustomEditor(typeof(RetargetingRemoteController))]
public class RetargetingRemoteControllerEditor : UnityEditor.Editor
{
private SerializedProperty wsPortProp;
private SerializedProperty autoStartProp;
private SerializedProperty registeredCharactersProp;
private void OnEnable()
{
wsPortProp = serializedObject.FindProperty("wsPort");
autoStartProp = serializedObject.FindProperty("autoStart");
registeredCharactersProp = serializedObject.FindProperty("registeredCharacters");
}
public override void OnInspectorGUI()
{
serializedObject.Update();
RetargetingRemoteController controller = (RetargetingRemoteController)target;
// 헤더
EditorGUILayout.Space(5);
EditorGUILayout.LabelField("리타게팅 리모컨 (WebSocket)", EditorStyles.boldLabel);
EditorGUILayout.Space(5);
// 상태 표시
EditorGUILayout.BeginVertical(EditorStyles.helpBox);
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField("상태:", GUILayout.Width(40));
if (Application.isPlaying)
{
if (controller.IsRunning)
{
GUI.color = Color.green;
EditorGUILayout.LabelField("실행 중", EditorStyles.boldLabel);
GUI.color = Color.white;
}
else
{
GUI.color = Color.yellow;
EditorGUILayout.LabelField("중지됨", EditorStyles.boldLabel);
GUI.color = Color.white;
}
}
else
{
GUI.color = Color.gray;
EditorGUILayout.LabelField("대기 중 (플레이 모드 필요)", EditorStyles.boldLabel);
GUI.color = Color.white;
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.EndVertical();
EditorGUILayout.Space(10);
// 서버 설정
EditorGUILayout.LabelField("서버 설정", EditorStyles.boldLabel);
EditorGUILayout.BeginVertical(EditorStyles.helpBox);
EditorGUILayout.PropertyField(wsPortProp, new GUIContent("WebSocket 포트"));
EditorGUILayout.PropertyField(autoStartProp, new GUIContent("자동 시작"));
EditorGUILayout.EndVertical();
EditorGUILayout.Space(5);
EditorGUILayout.HelpBox("리타게팅 UI는 Streamingle Dashboard에 통합되었습니다.\n대시보드의 Retargeting 탭에서 사용하세요.", MessageType.Info);
EditorGUILayout.Space(10);
// 캐릭터 등록
EditorGUILayout.LabelField("등록된 캐릭터", EditorStyles.boldLabel);
EditorGUILayout.PropertyField(registeredCharactersProp, GUIContent.none);
// 자동 등록 버튼
EditorGUILayout.Space(5);
if (GUILayout.Button("씬에서 캐릭터 자동 찾기"))
{
AutoFindCharacters();
}
EditorGUILayout.Space(10);
// 서버 제어 버튼 (플레이 모드에서만)
if (Application.isPlaying)
{
EditorGUILayout.LabelField("서버 제어", EditorStyles.boldLabel);
EditorGUILayout.BeginHorizontal();
if (controller.IsRunning)
{
if (GUILayout.Button("서버 중지", GUILayout.Height(30)))
{
controller.StopServer();
}
}
else
{
if (GUILayout.Button("서버 시작", GUILayout.Height(30)))
{
controller.StartServer();
}
}
EditorGUILayout.EndHorizontal();
}
serializedObject.ApplyModifiedProperties();
}
private void AutoFindCharacters()
{
var characters = FindObjectsByType<CustomRetargetingScript>(FindObjectsSortMode.None);
registeredCharactersProp.ClearArray();
foreach (var character in characters)
{
int index = registeredCharactersProp.arraySize;
registeredCharactersProp.InsertArrayElementAtIndex(index);
registeredCharactersProp.GetArrayElementAtIndex(index).objectReferenceValue = character;
}
serializedObject.ApplyModifiedProperties();
Debug.Log($"[RetargetingRemote] {characters.Length}개의 캐릭터를 찾았습니다.");
}
}
}