Skip to content

Commit

Permalink
com.rest.blockadelabs 1.3.2 (#17)
Browse files Browse the repository at this point in the history
- updated com.utilities.rest -> 2.5.0
- updated unity editor version 2022.3.16f1 LTS
  • Loading branch information
StephenHodgson committed Jan 26, 2024
1 parent 39ebe70 commit 0218c7d
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 42 deletions.
12 changes: 3 additions & 9 deletions .github/workflows/upm-subtree-split.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,13 @@ on:
push:
branches:
- main

jobs:
upm-subtree-split:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: upm subtree split
run: |
$packageDir = Get-Item -Path "**/Packages/com.*" | Select-Object -ExpandProperty FullName
$packageDir = $packageDir.replace('${{ github.workspace }}/','')
Write-Host $packageDir
git subtree split --prefix="$packageDir" -b upm
git push -u origin upm --force
working-directory: ${{ github.workspace }}
shell: pwsh

- uses: RageAgainstThePixel/upm-subtree-split@v1
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,29 @@ public sealed class BlockadeLabsDashboard : EditorWindow
private const float WideColumnWidth = 128f;
private const float SettingsLabelWidth = 1.56f;

private static readonly GUIContent guiTitleContent = new GUIContent("BlockadeLabs Dashboard");
private static readonly GUIContent guiTitleContent = new GUIContent($"{nameof(BlockadeLabs)} Dashboard");
private static readonly GUIContent saveDirectoryContent = new GUIContent("Save Directory");
private static readonly GUIContent downloadContent = new GUIContent("Download");
private static readonly GUIContent deleteContent = new GUIContent("Delete");
private static readonly GUIContent refreshContent = new GUIContent("Refresh");

private static readonly string[] tabTitles = { "Skybox Generation", "History" };

private static readonly GUILayoutOption[] defaultColumnWidthOption =
{
GUILayout.Width(DefaultColumnWidth)
};

private static readonly GUILayoutOption[] wideColumnWidthOption =
{
GUILayout.Width(WideColumnWidth)
};

private static readonly GUILayoutOption[] expandWidthOption =
{
GUILayout.ExpandWidth(true)
};

private static GUIStyle boldCenteredHeaderStyle;

private static GUIStyle BoldCenteredHeaderStyle
Expand All @@ -61,25 +76,10 @@ private static GUIStyle BoldCenteredHeaderStyle
}
}

private static string DefaultSaveDirectoryKey => $"{Application.productName}_BlockadeLabs_EditorDownloadDirectory";
private static string DefaultSaveDirectoryKey => $"{Application.productName}_{nameof(BlockadeLabs)}_EditorDownloadDirectory";

private static string DefaultSaveDirectory => Application.dataPath;

private static readonly GUILayoutOption[] defaultColumnWidthOption =
{
GUILayout.Width(DefaultColumnWidth)
};

private static readonly GUILayoutOption[] wideColumnWidthOption =
{
GUILayout.Width(WideColumnWidth)
};

private static readonly GUILayoutOption[] expandWidthOption =
{
GUILayout.ExpandWidth(true)
};

#region static content

private static BlockadeLabsClient api;
Expand Down Expand Up @@ -117,6 +117,9 @@ private static GUIStyle BoldCenteredHeaderStyle

#endregion static content

[SerializeField]
private BlockadeLabsConfiguration configuration;

[SerializeField]
private int tab;

Expand All @@ -126,6 +129,10 @@ private static GUIStyle BoldCenteredHeaderStyle
[SerializeField]
private int currentSkyboxExportId = 1;

private BlockadeLabsAuthentication auth;

private BlockadeLabsSettings settings;

private Vector2 scrollPosition = Vector2.zero;

private string promptText;
Expand All @@ -138,7 +145,7 @@ private static GUIStyle BoldCenteredHeaderStyle

private Texture2D controlImage;

[MenuItem("Window/Dashboards/Bloackade Labs", false, priority: 999)]
[MenuItem("Window/Dashboards/" + nameof(BlockadeLabs), false, priority: 999)]
private static void OpenWindow()
{
// Dock it next to the Scene View.
Expand All @@ -155,7 +162,19 @@ private void OnEnable()

private void OnFocus()
{
api ??= new BlockadeLabsClient();
if (configuration == null)
{
configuration = Resources.Load<BlockadeLabsConfiguration>($"{nameof(BlockadeLabsConfiguration)}.asset");
}

auth ??= configuration == null
? new BlockadeLabsAuthentication().LoadDefaultsReversed()
: new BlockadeLabsAuthentication(configuration);
settings ??= configuration == null
? new BlockadeLabsSettings()
: new BlockadeLabsSettings(configuration);

api ??= new BlockadeLabsClient(auth, settings);

if (!hasFetchedSkyboxStyles)
{
Expand Down Expand Up @@ -184,12 +203,15 @@ private void OnGUI()
EditorGUILayout.BeginVertical();
{ // Begin Header
EditorGUILayout.Space();
EditorGUILayout.LabelField("BlockadeLabs Dashboard", BoldCenteredHeaderStyle);
EditorGUILayout.LabelField(guiTitleContent, BoldCenteredHeaderStyle);
EditorGUILayout.Space();

if (api is not { HasValidAuthentication: true })
{
EditorGUILayout.HelpBox($"No valid {nameof(BlockadeLabsConfiguration)} was found. This tool requires that you set your API key.", MessageType.Error);
EditorGUILayout.EndVertical();
EditorGUILayout.EndHorizontal();
EditorGUILayout.EndHorizontal();
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ protected override void SetupDefaultRequestHeaders()
DefaultRequestHeaders = new Dictionary<string, string>
{
#if !UNITY_WEBGL
{"User-Agent", "com.rest.blockadelabs" },
{ "User-Agent", "com.rest.blockadelabs" },
#endif
{"x-api-key", Authentication.Info.ApiKey }
{ "x-api-key", Authentication.Info.ApiKey }
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ async Task DownloadThumbnail()
{
await Awaiters.UnityMainThread;
Rest.TryGetFileNameFromUrl(ThumbUrl, out var filename);
Thumbnail = await Rest.DownloadTextureAsync(ThumbUrl, fileName: $"{ObfuscatedId}-thumb{Path.GetExtension(filename)}", null, debug, cancellationToken);
Thumbnail = await Rest.DownloadTextureAsync(ThumbUrl, fileName: $"{ObfuscatedId}-thumb{Path.GetExtension(filename)}", parameters: new RestParameters(debug: debug), cancellationToken: cancellationToken);
}
}

Expand All @@ -209,18 +209,18 @@ async Task DownloadExport(KeyValuePair<string, string> export)
case SkyboxExportOption.DepthMap_PNG:
case SkyboxExportOption.Equirectangular_PNG:
case SkyboxExportOption.Equirectangular_JPG:
var texture = await Rest.DownloadTextureAsync(exportUrl, path, null, debug, cancellationToken);
var texture = await Rest.DownloadTextureAsync(exportUrl, path, parameters: new RestParameters(debug: debug), cancellationToken: cancellationToken);
exportedAssets[export.Key] = texture;
break;
case SkyboxExportOption.CubeMap_PNG:
case SkyboxExportOption.CubeMap_Roblox_PNG:
var zipPath = await Rest.DownloadFileAsync(exportUrl, path, null, debug, cancellationToken);
var zipPath = await Rest.DownloadFileAsync(exportUrl, path, parameters: new RestParameters(debug: debug), cancellationToken: cancellationToken);
var files = await ExportUtilities.UnZipAsync(zipPath, cancellationToken);
var textures = new List<Texture2D>();

foreach (var file in files)
{
var face = await Rest.DownloadTextureAsync($"file:https://{file}", null, null, debug, cancellationToken);
var face = await Rest.DownloadTextureAsync($"file:https://{file}", parameters: new RestParameters(debug: debug), cancellationToken: cancellationToken);
textures.Add(face);
}

Expand All @@ -232,7 +232,7 @@ async Task DownloadExport(KeyValuePair<string, string> export)
case SkyboxExportOption.Video_LandScape_MP4:
case SkyboxExportOption.Video_Portrait_MP4:
case SkyboxExportOption.Video_Square_MP4:
await Rest.DownloadFileAsync(exportUrl, path, null, debug, cancellationToken);
await Rest.DownloadFileAsync(exportUrl, path, parameters: new RestParameters(debug: debug), cancellationToken: cancellationToken);
break;
default:
Debug.LogWarning($"No download task defined for {export.Key}!");
Expand Down
4 changes: 2 additions & 2 deletions BlockadeLabs/Packages/com.rest.blockadelabs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "BlockadeLabs",
"description": "A Non-Official Blockade Labs Rest Client for Unity (UPM)",
"keywords": [],
"version": "1.3.1",
"version": "1.3.2",
"unity": "2021.3",
"documentationUrl": "https://github.com/RageAgainstThePixel/com.rest.blockadelabs#documentation",
"changelogUrl": "https://github.com/RageAgainstThePixel/com.rest.blockadelabs/releases",
Expand All @@ -19,7 +19,7 @@
"dependencies": {
"com.unity.modules.video": "1.0.0",
"com.unity.sharp-zip-lib": "1.3.4-preview",
"com.utilities.rest": "2.4.0"
"com.utilities.rest": "2.5.0"
},
"samples": [
{
Expand Down
4 changes: 2 additions & 2 deletions BlockadeLabs/Packages/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"com.unity.ide.rider": "3.0.27",
"com.unity.ide.visualstudio": "2.0.22",
"com.unity.test-framework": "1.1.33",
"com.unity.textmeshpro": "3.0.6",
"com.utilities.buildpipeline": "1.1.9"
"com.unity.textmeshpro": "3.0.7",
"com.utilities.buildpipeline": "1.2.1"
},
"scopedRegistries": [
{
Expand Down
4 changes: 2 additions & 2 deletions BlockadeLabs/ProjectSettings/ProjectVersion.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
m_EditorVersion: 2022.3.15f1
m_EditorVersionWithRevision: 2022.3.15f1 (b58023a2b463)
m_EditorVersion: 2022.3.16f1
m_EditorVersionWithRevision: 2022.3.16f1 (d2c21f0ef2f1)

0 comments on commit 0218c7d

Please sign in to comment.