From 5ac483cb14ae6f7d2c1844221248f07ebc799535 Mon Sep 17 00:00:00 2001 From: NaoyaKohda Date: Wed, 30 Oct 2024 03:26:50 +0900 Subject: [PATCH] =?UTF-8?q?Setting=20=E3=81=AB=E3=83=AA=E3=83=8D=E3=83=BC?= =?UTF-8?q?=E3=83=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Editor/DmxRecorder/DmxRecordWindow.cs | 2 +- Assets/ArtNet/Editor/DmxRecorder/Recorder.cs | 8 ++-- ...RecorderConfigs.cs => RecorderSettings.cs} | 48 +++++++++---------- ...nfigs.cs.meta => RecorderSettings.cs.meta} | 0 .../Editor/DmxRecorder/RecorderWindow.cs | 38 +++++++-------- Assets/ArtNet/Editor/DmxRecorder/Sender.cs | 12 ++--- .../{SenderConfigs.cs => SenderSettings.cs} | 30 ++++++------ ...Configs.cs.meta => SenderSettings.cs.meta} | 0 .../ArtNet/Editor/DmxRecorder/SenderWindow.cs | 20 ++++---- 9 files changed, 79 insertions(+), 79 deletions(-) rename Assets/ArtNet/Editor/DmxRecorder/{RecorderConfigs.cs => RecorderSettings.cs} (66%) rename Assets/ArtNet/Editor/DmxRecorder/{RecorderConfigs.cs.meta => RecorderSettings.cs.meta} (100%) rename Assets/ArtNet/Editor/DmxRecorder/{SenderConfigs.cs => SenderSettings.cs} (69%) rename Assets/ArtNet/Editor/DmxRecorder/{SenderConfigs.cs.meta => SenderSettings.cs.meta} (100%) diff --git a/Assets/ArtNet/Editor/DmxRecorder/DmxRecordWindow.cs b/Assets/ArtNet/Editor/DmxRecorder/DmxRecordWindow.cs index 754ee18..b614615 100644 --- a/Assets/ArtNet/Editor/DmxRecorder/DmxRecordWindow.cs +++ b/Assets/ArtNet/Editor/DmxRecorder/DmxRecordWindow.cs @@ -49,7 +49,7 @@ public static void ShowDmxRecorder() private void Initialize(VisualElement root) { - _recorder.RecorderConfigs = RecorderConfigs.GetOrNewGlobalConfigs(); + _recorder.RecorderSettings = RecorderSettings.GetOrNewGlobalSettings(); var tabContent = new VisualElement { name = "tabContent" }; root.Add(tabContent); diff --git a/Assets/ArtNet/Editor/DmxRecorder/Recorder.cs b/Assets/ArtNet/Editor/DmxRecorder/Recorder.cs index 0ea0b50..6669217 100644 --- a/Assets/ArtNet/Editor/DmxRecorder/Recorder.cs +++ b/Assets/ArtNet/Editor/DmxRecorder/Recorder.cs @@ -29,7 +29,7 @@ public Recorder() _receiver.OnReceivedPacket = OnReceivedPacket; } public RecordingStatus Status { get; private set; } = RecordingStatus.None; - public RecorderConfigs RecorderConfigs { get; set; } + public RecorderSettings RecorderSettings { get; set; } public int GetRecordedCount() => _recordedDmx.Count; @@ -124,7 +124,7 @@ private void StoreDmxPacket() return; } - switch (RecorderConfigs.RecordFormat) + switch (RecorderSettings.RecordFormat) { case RecodeFormat.Binary: StoreBinary(); @@ -139,7 +139,7 @@ private void StoreDmxPacket() private void StoreBinary() { - var binaryConfig = RecorderConfigs.BinaryConfig; + var binaryConfig = RecorderSettings.BinarySetting; if (!Directory.Exists(binaryConfig.Directory)) { @@ -157,7 +157,7 @@ private void StoreBinary() private void StoreAnimationClip() { - var animationClipConfig = RecorderConfigs.AnimationClipConfig; + var animationClipConfig = RecorderSettings.AnimationClipSetting; var timelineConverter = new TimelineConverter(_recordedDmx); timelineConverter.SaveDmxTimelineClips(animationClipConfig.OutputAnimationClipAssetPath); } diff --git a/Assets/ArtNet/Editor/DmxRecorder/RecorderConfigs.cs b/Assets/ArtNet/Editor/DmxRecorder/RecorderSettings.cs similarity index 66% rename from Assets/ArtNet/Editor/DmxRecorder/RecorderConfigs.cs rename to Assets/ArtNet/Editor/DmxRecorder/RecorderSettings.cs index 96cdf61..d36c438 100644 --- a/Assets/ArtNet/Editor/DmxRecorder/RecorderConfigs.cs +++ b/Assets/ArtNet/Editor/DmxRecorder/RecorderSettings.cs @@ -15,7 +15,7 @@ public enum RecodeFormat AnimationClip = 1, } - public class RecorderConfigs : ScriptableObject + public class RecorderSettings : ScriptableObject { [SerializeField] private RecodeFormat _recordFormat; @@ -23,38 +23,38 @@ public class RecorderConfigs : ScriptableObject public RecodeFormat RecordFormat => _recordFormat; - public BinaryRecordConfig BinaryConfig { get; } = new(); - public AnimationClipRecordConfig AnimationClipConfig { get; } = new(); + public BinaryRecordSetting BinarySetting { get; } = new(); + public AnimationClipRecordSetting AnimationClipSetting { get; } = new(); - public static RecorderConfigs GetOrNewGlobalConfigs() + public static RecorderSettings GetOrNewGlobalSettings() { - var globalPath = Path.Combine(Application.dataPath, "..", "Library", "ArtNet", "DmxRecorderConfigs.asset"); + var globalPath = Path.Combine(Application.dataPath, "..", "Library", "ArtNet", "DmxRecorderSettings.asset"); return Load(globalPath); } - private static RecorderConfigs Load(string path) + private static RecorderSettings Load(string path) { - RecorderConfigs configs; + RecorderSettings settings; try { var objs = InternalEditorUtility.LoadSerializedFileAndForget(path); - configs = objs.FirstOrDefault(o => o is RecorderConfigs) as RecorderConfigs; + settings = objs.FirstOrDefault(o => o is RecorderSettings) as RecorderSettings; } catch (Exception e) { - Debug.LogError($"Failed to load RecorderConfigs: {e.Message}"); - configs = null; + Debug.LogError($"Failed to load RecorderSettings: {e.Message}"); + settings = null; } - if (configs == null) + if (settings == null) { - configs = CreateInstance(); - // configs.hideFlags = HideFlags.HideAndDontSave; - configs.name = "DmxRecorderConfigs"; + settings = CreateInstance(); + // Settings.hideFlags = HideFlags.HideAndDontSave; + settings.name = "DmxRecorderSettings"; } - configs._savePath = path; - return configs; + settings._savePath = path; + return settings; } public void Save() @@ -72,7 +72,7 @@ public void Save() } catch (Exception e) { - Debug.LogError($"Failed to save RecorderConfigs: {e.Message}"); + Debug.LogError($"Failed to save RecorderSettings: {e.Message}"); } } @@ -86,18 +86,18 @@ public void ChangeRecordFormat(RecodeFormat format) Save(); } - private IRecordConfig Config => RecordFormat switch + private IRecordSetting Setting => RecordFormat switch { - RecodeFormat.Binary => BinaryConfig, - RecodeFormat.AnimationClip => AnimationClipConfig, + RecodeFormat.Binary => BinarySetting, + RecodeFormat.AnimationClip => AnimationClipSetting, _ => throw new System.NotImplementedException() }; public bool Validate() => ValidateErrors().Count == 0; - public List ValidateErrors() => Config.ValidateErrors(); + public List ValidateErrors() => Setting.ValidateErrors(); } - public class BinaryRecordConfig : IRecordConfig + public class BinaryRecordSetting : IRecordSetting { private const string Extension = ".dmx"; @@ -119,7 +119,7 @@ public List ValidateErrors() private bool ValidateFileName() => !string.IsNullOrEmpty(FileName); } - public class AnimationClipRecordConfig : IRecordConfig + public class AnimationClipRecordSetting : IRecordSetting { public string OutputAnimationClipAssetPath { get; set; } = "Assets/Recording"; @@ -129,7 +129,7 @@ public List ValidateErrors() } } - public interface IRecordConfig + public interface IRecordSetting { public List ValidateErrors(); } diff --git a/Assets/ArtNet/Editor/DmxRecorder/RecorderConfigs.cs.meta b/Assets/ArtNet/Editor/DmxRecorder/RecorderSettings.cs.meta similarity index 100% rename from Assets/ArtNet/Editor/DmxRecorder/RecorderConfigs.cs.meta rename to Assets/ArtNet/Editor/DmxRecorder/RecorderSettings.cs.meta diff --git a/Assets/ArtNet/Editor/DmxRecorder/RecorderWindow.cs b/Assets/ArtNet/Editor/DmxRecorder/RecorderWindow.cs index b0566ed..ad96b4a 100644 --- a/Assets/ArtNet/Editor/DmxRecorder/RecorderWindow.cs +++ b/Assets/ArtNet/Editor/DmxRecorder/RecorderWindow.cs @@ -71,7 +71,7 @@ private void InitializeControlPanel(VisualElement root) playButton.Add(stopButtonImage); playButton.clicked += () => { - if (!_recorder.RecorderConfigs.Validate()) return; + if (!_recorder.RecorderSettings.Validate()) return; if (_recorder.Status == RecordingStatus.None) { SetEnabledTextField(false); @@ -130,8 +130,8 @@ private void InitializeRecordingConfig(VisualElement root) // 出力ファイルのフォーマット選択 var outputFormatGroup = root.Q("outputFormatGroup"); outputFormatGroup.choices = new[] { "Binary", "AnimationClip" }; - outputFormatGroup.value = (int) _recorder.RecorderConfigs.RecordFormat; - ChangeOutputFormat(_recorder.RecorderConfigs.RecordFormat); + outputFormatGroup.value = (int) _recorder.RecorderSettings.RecordFormat; + ChangeOutputFormat(_recorder.RecorderSettings.RecordFormat); outputFormatGroup.RegisterValueChangedCallback(evt => { @@ -145,21 +145,21 @@ private void InitializeRecordingConfig(VisualElement root) // 出力ファイル名の設定 _outputFileNameField = root.Q("outputFileNameField"); - _outputFileNameField.value = _recorder.RecorderConfigs.BinaryConfig.FileName; + _outputFileNameField.value = _recorder.RecorderSettings.BinarySetting.FileName; _outputFileNameField.RegisterValueChangedCallback(evt => { var fileName = evt.newValue; - _recorder.RecorderConfigs.BinaryConfig.FileName = fileName; + _recorder.RecorderSettings.BinarySetting.FileName = fileName; UpdateOutputFilePath(); }); // 出力ディレクトリの設定 _outputDirectoryField = root.Q("outputDirectoryField"); - _outputDirectoryField.value = _recorder.RecorderConfigs.BinaryConfig.Directory; + _outputDirectoryField.value = _recorder.RecorderSettings.BinarySetting.Directory; _outputDirectoryField.RegisterValueChangedCallback(evt => { var directory = evt.newValue; - _recorder.RecorderConfigs.BinaryConfig.Directory = directory; + _recorder.RecorderSettings.BinarySetting.Directory = directory; UpdateOutputFilePath(); }); _selectDirectoryButton = root.Q