-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.idea |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Changelog | ||
|
||
## [0.1.0] Initial Release |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using System; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using Harpoon.Utils; | ||
using Newtonsoft.Json; | ||
using UnityEditor; | ||
using UnityEngine; | ||
using UnityEngine.Networking; | ||
|
||
namespace Harpoon | ||
{ | ||
public static class HDALibrary | ||
{ | ||
public struct HDAMeta | ||
{ | ||
public string hda; | ||
public string name; | ||
} | ||
public static void GetHDALibraryAsync(Action<HDAMeta[]> completed, Action failed = null) | ||
{ | ||
Uri uri = new Uri(HarpoonUriBuilder.Root, "api/hdalibrary"); | ||
UnityWebRequest request = UnityWebRequest.Get(uri); | ||
request.SendWebRequest((request) => | ||
{ | ||
if (request.result == UnityWebRequest.Result.Success) | ||
{ | ||
dynamic hdaLibrary = JsonConvert.DeserializeObject(request.downloadHandler.text); | ||
Dictionary<string, string> tops = hdaLibrary.Top.ToObject<Dictionary<string, string>>(); | ||
HDAMeta[] hdaMeta = new HDAMeta[tops.Count]; | ||
int i = 0; | ||
foreach (var top in tops) | ||
{ | ||
hdaMeta[i++] = new HDAMeta() | ||
{ | ||
hda = top.Key, | ||
name = top.Value | ||
}; | ||
} | ||
|
||
completed?.Invoke(hdaMeta); | ||
} | ||
else | ||
{ | ||
Debug.Log(request.error); | ||
failed?.Invoke(); | ||
} | ||
}); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
using System; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
using System.IO; | ||
using System.IO.Compression; | ||
using Newtonsoft.Json; | ||
using Unity.EditorCoroutines.Editor; | ||
using UnityEditor; | ||
using UnityEditor.PackageManager.Requests; | ||
using UnityEngine; | ||
using UnityEngine.Networking; | ||
using Harpoon.Utils; | ||
using UnityEditor.PackageManager; | ||
|
||
namespace Harpoon | ||
{ | ||
public static class HDAProcessor | ||
{ | ||
private static Uri GetUri(string hdaName) | ||
{ | ||
return new Uri(HarpoonUriBuilder.Root, $"api/hdaprocessor/{hdaName}"); | ||
} | ||
|
||
public static void GetHDAHeaderAsync(string hdaName, Action<dynamic> completed, Action failed = null) | ||
{ | ||
Uri uri = GetUri(hdaName); | ||
UnityWebRequest request = UnityWebRequest.Get(uri); | ||
request.SendWebRequest((request) => | ||
{ | ||
if (request.result == UnityWebRequest.Result.Success) | ||
{ | ||
completed?.Invoke(JsonConvert.DeserializeObject(request.downloadHandler.text)); | ||
} | ||
else | ||
{ | ||
Debug.LogError(request.error); | ||
failed?.Invoke(); | ||
} | ||
}); | ||
} | ||
|
||
public static void ProcessHDAAsync(string hda, List<HouParm> parms, Action<ZipArchive> completed, Action failed = null, int timeout = 60) | ||
{ | ||
Uri uri = GetUri(hda); | ||
List<IMultipartFormSection> formData = new List<IMultipartFormSection>(); | ||
foreach (var parm in parms) | ||
{ | ||
formData.Add(parm.formSection); | ||
} | ||
|
||
string downloadedFile = Path.Combine(Path.GetDirectoryName(Application.dataPath), "Temp", $"Harpoon_Response{DateTime.Now.Ticks}.zip"); | ||
UnityWebRequest post = UnityWebRequest.Post(uri, formData); | ||
post.useHttpContinue = false; | ||
post.timeout = timeout; | ||
post.downloadHandler = new DownloadHandlerFile(downloadedFile); | ||
post.SendWebRequest((request) => | ||
{ | ||
if (request.result == UnityWebRequest.Result.Success) | ||
{ | ||
using (var zipArchive = ZipFile.OpenRead(downloadedFile)) | ||
{ | ||
completed?.Invoke(zipArchive); | ||
} | ||
File.Delete(downloadedFile); | ||
} | ||
else | ||
{ | ||
Debug.LogError(request.error); | ||
failed?.Invoke(); | ||
} | ||
}); | ||
} | ||
|
||
public static void ProcessHDAAsync(this HDAProcessorPreset preset, Action<ZipArchive> completed, Action failed) | ||
{ | ||
Uri uri = GetUri(preset.hda); | ||
List<IMultipartFormSection> formData = new List<IMultipartFormSection>(); | ||
foreach (var parm in preset.parms) | ||
{ | ||
formData.Add(parm.formSection); | ||
} | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
|
||
namespace Harpoon | ||
{ | ||
// https://www.sidefx.com/docs/houdini/hom/hou/parmData.html | ||
public enum ParmData | ||
{ | ||
Int, | ||
Float, | ||
String, | ||
Ramp | ||
} | ||
|
||
// https://www.sidefx.com/docs/houdini/hom/hou/stringParmType.html | ||
public enum StringParmType | ||
{ | ||
Regular, | ||
FileReference, | ||
NodeReference, | ||
NodeReferenceList | ||
} | ||
|
||
// https://www.sidefx.com/docs/houdini/hom/hou/parmLook.html | ||
public enum ParmLook | ||
{ | ||
Regular, | ||
Logarithmic, | ||
Angle, | ||
Vector, | ||
ColorSquare, | ||
HueCircle, | ||
CRGBAPlaneChooser | ||
} | ||
|
||
// https://www.sidefx.com/docs/houdini/hom/hou/fileType.html | ||
public enum FileType | ||
{ | ||
Any, | ||
Image, | ||
Geometry, | ||
Ramp, | ||
Capture, | ||
Clip, | ||
Lut, | ||
Cmd, | ||
Midi, | ||
I3d, | ||
Chan, | ||
Sim, | ||
SimData, | ||
Hip, | ||
Otl, | ||
Dae, | ||
Gallery, | ||
Directory, | ||
Icon, | ||
Ds, | ||
Alembic, | ||
Psd, | ||
LightRig, | ||
Gltf, | ||
Movie, | ||
Fbx, | ||
Usd, | ||
Sqlite, | ||
} | ||
|
||
// https://www.sidefx.com/docs/houdini/hom/hou/folderType.html | ||
public enum FolderType | ||
{ | ||
Collapsible, | ||
Simple, | ||
Tabs, | ||
RadioButtons, | ||
MultiparmBlock, | ||
ScrollingMultiparmBlock, | ||
TabbedMultiparmBlock, | ||
ImportBlock | ||
} | ||
|
||
// https://www.sidefx.com/docs/houdini/hom/hou/parmTemplateType.html | ||
public enum ParmTemplateType | ||
{ | ||
Int, | ||
Float, | ||
String, | ||
Toggle, | ||
Menu, | ||
Button, | ||
FolderSet, | ||
Separator, | ||
Label, | ||
Remap, | ||
Data | ||
} | ||
|
||
// https://www.sidefx.com/docs/houdini/hom/hou/dataParmType.html | ||
public enum DataParmType | ||
{ | ||
Geometry, | ||
KeyValueDictionary | ||
} | ||
|
||
// https://www.sidefx.com/docs/houdini/hom/hou/menuType.html | ||
public enum MenuType | ||
{ | ||
Normal, | ||
Mini, | ||
ControlNextParameter, | ||
StringReplace, | ||
StringToggle | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "Harpoon.Editor", | ||
"rootNamespace": "", | ||
"references": [ | ||
"GUID:343deaaf83e0cee4ca978e7df0b80d21", | ||
"GUID:478a2357cc57436488a56e564b08d223", | ||
"GUID:2bafac87e7f4b9b418d9448d219b01ab" | ||
], | ||
"includePlatforms": [ | ||
"Editor" | ||
], | ||
"excludePlatforms": [], | ||
"allowUnsafeCode": false, | ||
"overrideReferences": false, | ||
"precompiledReferences": [], | ||
"autoReferenced": true, | ||
"defineConstraints": [], | ||
"versionDefines": [], | ||
"noEngineReferences": false | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.