diff --git a/CHANGELOG.md b/CHANGELOG.md index 472370b..51fa95b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ # Changelog ## [0.1.0] Initial Release + +## [0.1.1] Add timeout option \ No newline at end of file diff --git a/Editor/API/HDAProcessor.cs b/Editor/API/HDAProcessor.cs index 3fa4e3c..c525fa8 100644 --- a/Editor/API/HDAProcessor.cs +++ b/Editor/API/HDAProcessor.cs @@ -60,13 +60,13 @@ public static IEnumerator GetHDAHeaderRoutine(string hdaName, Action co } } - public static void ProcessHDAAsync(this HDAProcessorPreset preset, Action completed, Action failed = null, int timeout = 120) + public static void ProcessHDAAsync(this HDAProcessorPreset preset, Action completed, Action failed = null, int timeout = 300) { ProcessHDAAsync(preset.hda, preset.parms, completed, failed, timeout); } public static void ProcessHDAAsync(string hda, IEnumerable parms, Action completed, - Action failed = null, int timeout = 120) + Action failed = null, int timeout = 300) { Uri uri = GetUri(hda); List formData = new List(); diff --git a/Editor/ScriptableObject/HDAProcessorPreset.cs b/Editor/ScriptableObject/HDAProcessorPreset.cs index 9baae48..e73e8de 100644 --- a/Editor/ScriptableObject/HDAProcessorPreset.cs +++ b/Editor/ScriptableObject/HDAProcessorPreset.cs @@ -11,6 +11,7 @@ public class HDAProcessorPreset : ScriptableObject public IntParm[] intParms; public FloatParm[] floatParms; public StringParm[] stringParms; + public int timeout = 300; public IEnumerable parms { diff --git a/Editor/ScriptableObject/HDAProcessorPresetEditor.cs b/Editor/ScriptableObject/HDAProcessorPresetEditor.cs index 27ee393..6bc520d 100644 --- a/Editor/ScriptableObject/HDAProcessorPresetEditor.cs +++ b/Editor/ScriptableObject/HDAProcessorPresetEditor.cs @@ -19,6 +19,8 @@ public override void OnInspectorGUI() parm.GUILayout(); } + target.timeout = EditorGUILayout.IntField("Timeout(s)", target.timeout); + if (GUILayout.Button("Cook")) { HDAProcessor.ProcessHDAAsync(target, @@ -26,7 +28,7 @@ public override void OnInspectorGUI() { string outputDir = EditorUtility.SaveFolderPanel("Output Dir", Application.dataPath, "Output"); zip.ExtractToDirectory(outputDir, true); - }); + }, timeout: target.timeout); } } } diff --git a/Editor/Window/HDAProcessorWindow.cs b/Editor/Window/HDAProcessorWindow.cs index df4bc9b..e841694 100644 --- a/Editor/Window/HDAProcessorWindow.cs +++ b/Editor/Window/HDAProcessorWindow.cs @@ -21,6 +21,7 @@ public class HDAProcessorWindow : EditorWindow private string[] hdaNames = new string[0]; private HouParm[] parms; private float progress = 1.0f; + private static int timeout = 300; private string hda => hdas[hdaIdx]; @@ -72,6 +73,8 @@ private void OnGUI() parm.GUILayout(); } } + + timeout = Mathf.Max(30, EditorGUILayout.IntField("Timeout(s)", timeout)); if (GUILayout.Button("Save As Preset")) { @@ -84,9 +87,9 @@ private void OnGUI() EditorGUI.ProgressBar(rect, progress, "Cooking"); } else if (GUILayout.Button("Cook")) - { - Cook(); - } + { + Cook(); + } } void CreateHDAProcessorPreset() @@ -121,7 +124,7 @@ void Cook() AssetDatabase.Refresh(); } progress = 1.0f; - }); + }, timeout: timeout); } } } \ No newline at end of file diff --git a/package.json b/package.json index efd3fb4..09c8560 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "com.pum4ch3n.harpoon", - "version": "0.1.0", + "version": "0.1.1", "displayName": "Harpoon", "description": "Harpoon Unity Plugin", "unity": "2018.1",