fix: Sidekick 에디터 자동 실행 방지
- Sidekick Character Tool과 Downloader가 메뉴 실행 시에만 열리도록 수동 실행 플래그를 추가 - 데이터베이스 초기화 실패 및 로딩 상태 null 참조 방어 처리 추가 - TMP 한글 폰트 에셋의 글리프/문자 테이블 갱신
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 936b212f6c1cb68aaab2cbd3180f4d7a
|
guid: 272ca4c45d498854a9723b5a933c89ff
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
userData:
|
userData:
|
||||||
|
|||||||
@@ -47,8 +47,9 @@ namespace Synty.SidekickCharacters
|
|||||||
private const string _BLEND_MUSCLE_NAME = "defaultBuff";
|
private const string _BLEND_MUSCLE_NAME = "defaultBuff";
|
||||||
private const string _BLEND_SHAPE_HEAVY_NAME = "defaultHeavy";
|
private const string _BLEND_SHAPE_HEAVY_NAME = "defaultHeavy";
|
||||||
private const string _BLEND_SHAPE_SKINNY_NAME = "defaultSkinny";
|
private const string _BLEND_SHAPE_SKINNY_NAME = "defaultSkinny";
|
||||||
private const string _AUTO_OPEN_STATE = "syntySkAutoOpenState";
|
private const string _AUTO_OPEN_STATE = "syntySkAutoOpenState";
|
||||||
private const string _OUTPUT_MODEL_NAME = "Combined Character";
|
private const string _MANUAL_OPEN_SESSION_KEY = "syntySkManualOpenRequested";
|
||||||
|
private const string _OUTPUT_MODEL_NAME = "Combined Character";
|
||||||
private const string _PART_COUNT_BODY = " parts in library";
|
private const string _PART_COUNT_BODY = " parts in library";
|
||||||
private const string _TEXTURE_COLOR_NAME = "ColorMap.png";
|
private const string _TEXTURE_COLOR_NAME = "ColorMap.png";
|
||||||
private const string _TEXTURE_METALLIC_NAME = "MetallicMap.png";
|
private const string _TEXTURE_METALLIC_NAME = "MetallicMap.png";
|
||||||
@@ -181,27 +182,34 @@ namespace Synty.SidekickCharacters
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc cref="OnDestroy" />
|
/// <inheritdoc cref="OnDestroy" />
|
||||||
private void OnDestroy()
|
private void OnDestroy()
|
||||||
{
|
{
|
||||||
if (_useAutoSaveAndLoad)
|
if (_useAutoSaveAndLoad && _currentSpecies != null && _currentCharacter != null)
|
||||||
{
|
{
|
||||||
SerializedCharacter savedCharacter = CreateSerializedCharacter(_OUTPUT_MODEL_NAME);
|
SerializedCharacter savedCharacter = CreateSerializedCharacter(_OUTPUT_MODEL_NAME);
|
||||||
Serializer serializer = new Serializer();
|
Serializer serializer = new Serializer();
|
||||||
string serializedCharacter = serializer.Serialize(savedCharacter);
|
string serializedCharacter = serializer.Serialize(savedCharacter);
|
||||||
EditorPrefs.SetString(_AUTOSAVE_KEY, serializedCharacter);
|
EditorPrefs.SetString(_AUTOSAVE_KEY, serializedCharacter);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ensures we release the file lock on the database
|
// ensures we release the file lock on the database
|
||||||
_dbManager.CloseConnection();
|
_dbManager?.CloseConnection();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
/// <inheritdoc cref="OnEnable" />
|
/// <inheritdoc cref="OnEnable" />
|
||||||
private void OnEnable()
|
private void OnEnable()
|
||||||
{
|
{
|
||||||
EditorApplication.playModeStateChanged += StateChange;
|
if (!SessionState.GetBool(_MANUAL_OPEN_SESSION_KEY, false))
|
||||||
EditorApplication.update += AnimationUpdate;
|
{
|
||||||
}
|
_useAutoSaveAndLoad = false;
|
||||||
|
Close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
EditorApplication.playModeStateChanged += StateChange;
|
||||||
|
EditorApplication.update += AnimationUpdate;
|
||||||
|
}
|
||||||
|
|
||||||
private void OnDisable()
|
private void OnDisable()
|
||||||
{
|
{
|
||||||
@@ -211,7 +219,7 @@ namespace Synty.SidekickCharacters
|
|||||||
/// <inheritdoc cref="Update" />
|
/// <inheritdoc cref="Update" />
|
||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
if (_loadingContent)
|
if (_loadingContent && _loadingImage != null)
|
||||||
{
|
{
|
||||||
Vector3 rotation = _loadingImage.transform.rotation.eulerAngles;
|
Vector3 rotation = _loadingImage.transform.rotation.eulerAngles;
|
||||||
rotation += new Vector3(0, 0, 0.5f * Time.deltaTime);
|
rotation += new Vector3(0, 0, 0.5f * Time.deltaTime);
|
||||||
@@ -461,6 +469,7 @@ namespace Synty.SidekickCharacters
|
|||||||
public async void CreateGUI()
|
public async void CreateGUI()
|
||||||
{
|
{
|
||||||
_loadingContent = true;
|
_loadingContent = true;
|
||||||
|
_loadingImage = null;
|
||||||
InitializeEditorWindow();
|
InitializeEditorWindow();
|
||||||
_root = rootVisualElement;
|
_root = rootVisualElement;
|
||||||
_root.Clear();
|
_root.Clear();
|
||||||
@@ -469,10 +478,23 @@ namespace Synty.SidekickCharacters
|
|||||||
_root.styleSheets.Add(_editorStyle);
|
_root.styleSheets.Add(_editorStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
InitializeDatabase();
|
try
|
||||||
|
{
|
||||||
|
InitializeDatabase();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_loadingContent = false;
|
||||||
|
_dbManager?.CloseConnection();
|
||||||
|
_dbManager = null;
|
||||||
|
Debug.LogWarning($"Failed to initialize Sidekick database. Please check the database file.\n{ex.Message}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// if we still can't connect, something's gone wrong, don't keep building the GUI
|
// if we still can't connect, something's gone wrong, don't keep building the GUI
|
||||||
if (_dbManager?.GetCurrentDbConnection() == null)
|
if (_dbManager?.GetCurrentDbConnection() == null)
|
||||||
{
|
{
|
||||||
|
_loadingContent = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -804,6 +826,7 @@ namespace Synty.SidekickCharacters
|
|||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
_loadingContent = false;
|
||||||
Debug.LogWarning("Failed to load tool data. Please try again.\nPlease note that data loading may take some time.");
|
Debug.LogWarning("Failed to load tool data. Please try again.\nPlease note that data loading may take some time.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,38 +12,11 @@ using UnityEngine;
|
|||||||
|
|
||||||
namespace Synty.SidekickCharacters.UI
|
namespace Synty.SidekickCharacters.UI
|
||||||
{
|
{
|
||||||
[InitializeOnLoad]
|
|
||||||
public static class MenuBootstrapController
|
public static class MenuBootstrapController
|
||||||
{
|
{
|
||||||
private const string _AUTO_OPEN_STATE = "syntySkAutoOpenState";
|
private const string _MANUAL_OPEN_SESSION_KEY = "syntySkManualOpenRequested";
|
||||||
private const string _PREFS_CHECK_NAME = "syntySKCheckDependencies";
|
|
||||||
|
|
||||||
private static ModularCharacterWindow _sidekickCharacterWindow;
|
private static ModularCharacterWindow _sidekickCharacterWindow;
|
||||||
private static bool _openWindowOnStart = true;
|
|
||||||
|
|
||||||
static MenuBootstrapController()
|
|
||||||
{
|
|
||||||
EditorApplication.update += OpenWindowOnStartup;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Opens the Character Creator window when Unity starts or the plugin is added to a project.
|
|
||||||
/// </summary>
|
|
||||||
private static void OpenWindowOnStartup()
|
|
||||||
{
|
|
||||||
_openWindowOnStart = EditorPrefs.GetBool(_AUTO_OPEN_STATE, true);
|
|
||||||
EditorApplication.update -= OpenWindowOnStartup;
|
|
||||||
if (_openWindowOnStart)
|
|
||||||
{
|
|
||||||
if (!SessionState.GetBool("FirstInitDone", false))
|
|
||||||
{
|
|
||||||
ShowSidekickCharacterWindow();
|
|
||||||
|
|
||||||
SessionState.SetBool("FirstInitDone", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates the Sidekick Character Creator window and adds it to the toolbar.
|
/// Creates the Sidekick Character Creator window and adds it to the toolbar.
|
||||||
@@ -51,6 +24,7 @@ namespace Synty.SidekickCharacters.UI
|
|||||||
[MenuItem("Synty/Sidekick Character Tool")]
|
[MenuItem("Synty/Sidekick Character Tool")]
|
||||||
public static void ShowSidekickCharacterWindow()
|
public static void ShowSidekickCharacterWindow()
|
||||||
{
|
{
|
||||||
|
SessionState.SetBool(_MANUAL_OPEN_SESSION_KEY, true);
|
||||||
FindSidekickCharacterWindow();
|
FindSidekickCharacterWindow();
|
||||||
_sidekickCharacterWindow.Show();
|
_sidekickCharacterWindow.Show();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,17 +25,24 @@ namespace Synty.SidekickCharacters
|
|||||||
private const string _PACKAGE_CACHE = "Assets/DownloadCache/Sidekicks.unitypackage";
|
private const string _PACKAGE_CACHE = "Assets/DownloadCache/Sidekicks.unitypackage";
|
||||||
private const string _DB_PACKAGE_CACHE = "Assets/DownloadCache/SidekicksDatabase.unitypackage";
|
private const string _DB_PACKAGE_CACHE = "Assets/DownloadCache/SidekicksDatabase.unitypackage";
|
||||||
private const string _VERSION_FILE = "Assets/External/Models/SidekickCharacters/Scripts/Editor/version.txt";
|
private const string _VERSION_FILE = "Assets/External/Models/SidekickCharacters/Scripts/Editor/version.txt";
|
||||||
private const string _VERSION_TAG = "\"tag_name\":";
|
private const string _VERSION_TAG = "\"tag_name\":";
|
||||||
private const string _VERSION_KEY = "sk_current_tool_version";
|
private const string _VERSION_KEY = "sk_current_tool_version";
|
||||||
private const string _SIDEKICK_TOOL_MENU_ITEM = "Synty/Sidekick Character Tool";
|
private const string _SIDEKICK_TOOL_MENU_ITEM = "Synty/Sidekick Character Tool";
|
||||||
|
private const string _MANUAL_OPEN_SESSION_KEY = "syntySkDownloaderManualOpenRequested";
|
||||||
|
|
||||||
private string _version = "-";
|
private string _version = "-";
|
||||||
private Label _latestVersion;
|
private Label _latestVersion;
|
||||||
|
|
||||||
public void Awake()
|
public void Awake()
|
||||||
{
|
{
|
||||||
BackgroundUpdateCheck();
|
if (!SessionState.GetBool(_MANUAL_OPEN_SESSION_KEY, false))
|
||||||
}
|
{
|
||||||
|
Close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BackgroundUpdateCheck();
|
||||||
|
}
|
||||||
|
|
||||||
public void CreateGUI()
|
public void CreateGUI()
|
||||||
{
|
{
|
||||||
@@ -287,23 +294,18 @@ namespace Synty.SidekickCharacters
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates an instance of the Downloader Tool, to allow checks for new versions on editor startup.
|
/// 메뉴에서 요청한 경우에만 다운로더 도구를 생성하고 연다.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[InitializeOnLoad]
|
public static class DownloaderBackgroundService
|
||||||
public static class DownloaderBackgroundService
|
{
|
||||||
{
|
private const string _MANUAL_OPEN_SESSION_KEY = "syntySkDownloaderManualOpenRequested";
|
||||||
private static ToolDownloader _instance;
|
|
||||||
|
private static ToolDownloader _instance;
|
||||||
static DownloaderBackgroundService()
|
|
||||||
{
|
static void CreateToolInstance()
|
||||||
EditorApplication.update += CreateToolInstance;
|
{
|
||||||
}
|
EditorWindow[] allWindows = Resources.FindObjectsOfTypeAll<EditorWindow>();
|
||||||
|
|
||||||
static void CreateToolInstance()
|
|
||||||
{
|
|
||||||
EditorApplication.update -= CreateToolInstance;
|
|
||||||
EditorWindow[] allWindows = Resources.FindObjectsOfTypeAll<EditorWindow>();
|
|
||||||
|
|
||||||
// Filter the windows to find the one with the desired type name
|
// Filter the windows to find the one with the desired type name
|
||||||
EditorWindow foundWindow = allWindows.FirstOrDefault(window => window.GetType().Name == "ToolDownloader");
|
EditorWindow foundWindow = allWindows.FirstOrDefault(window => window.GetType().Name == "ToolDownloader");
|
||||||
@@ -340,12 +342,13 @@ namespace Synty.SidekickCharacters
|
|||||||
_instance.Show();
|
_instance.Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
[MenuItem("Synty/Sidekick Tool Downloader")]
|
[MenuItem("Synty/Sidekick Tool Downloader")]
|
||||||
public static void ShowToolDownloaderWindow()
|
public static void ShowToolDownloaderWindow()
|
||||||
{
|
{
|
||||||
if (_instance == null)
|
SessionState.SetBool(_MANUAL_OPEN_SESSION_KEY, true);
|
||||||
{
|
if (_instance == null)
|
||||||
CreateToolInstance();
|
{
|
||||||
|
CreateToolInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
_instance.Show();
|
_instance.Show();
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user