From ffcb8bc5bc519a21113e1f33faf94473b99a5e43 Mon Sep 17 00:00:00 2001 From: Alejandro Alvarez Melucci <163010988+AlejandroAlvarezMelucciDCL@users.noreply.github.com> Date: Fri, 6 Dec 2024 11:36:31 +0100 Subject: [PATCH] chore: update gltf plugin (#180) Updated Rider package. Updated gltfFast plugin --- .../Default/GltFastFileProvider.cs | 21 +++++++++---------- .../Assets/git-submodules/glTFast | 2 +- asset-bundle-converter/Packages/manifest.json | 2 +- .../Packages/packages-lock.json | 6 +++--- 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/asset-bundle-converter/Assets/AssetBundleConverter/Wrappers/Implementations/Default/GltFastFileProvider.cs b/asset-bundle-converter/Assets/AssetBundleConverter/Wrappers/Implementations/Default/GltFastFileProvider.cs index 17744d44..d3e428c8 100644 --- a/asset-bundle-converter/Assets/AssetBundleConverter/Wrappers/Implementations/Default/GltFastFileProvider.cs +++ b/asset-bundle-converter/Assets/AssetBundleConverter/Wrappers/Implementations/Default/GltFastFileProvider.cs @@ -6,7 +6,6 @@ using System.Threading.Tasks; using GLTFast.Loading; using System.Collections.Generic; -using System.Linq; using UnityEditor; using UnityEngine; @@ -14,7 +13,7 @@ namespace AssetBundleConverter.Wrappers.Implementations.Default { #pragma warning disable 1998 - class SyncFileLoader : IDownload + internal class SyncFileLoader : IDownload { public SyncFileLoader(Uri url) { @@ -44,13 +43,13 @@ public bool? IsBinary public void Dispose() { } } - static class GltfGlobals + internal static class GltfGlobals { /// <summary> /// First four bytes of a glTF-Binary file are made up of this signature /// Represents glTF in ASCII /// </summary> - internal const uint GLB_MAGIC = 0x46546c67; + private const uint GLB_MAGIC = 0x46546c67; /// <summary> /// Figures out if a byte array contains data of a glTF-Binary @@ -67,7 +66,7 @@ public static bool IsGltfBinary(byte[] data) } } - class SyncTextureLoader : SyncFileLoader, ITextureDownload + internal class SyncTextureLoader : SyncFileLoader, ITextureDownload { public Texture2D Texture { get; } @@ -92,10 +91,10 @@ public class GltFastFileProvider : IEditorDownloadProvider, IDisposable private readonly Dictionary<string, string> contentTable; // Note (Kinerius): Since we can get multiple dependencies with the same name ( mostly textures ) we have to use the glb original root to determine which of them to use - // for example 'models/Genesis_TX.png' and 'models/core_building/Genesis_TX.png', the importer is going to ask for Genesis_TX.png since its path is relative + // for example 'models/Genesis_TX.png' and 'models/core_building/Genesis_TX.png', the importer is going to ask for Genesis_TX.png since its path is relative, // so we have to create a new path using the original root path that is already mapped by the asset bundle converter. - private string fileRootPath; - private string hash; + private readonly string fileRootPath; + private readonly string hash; private readonly List<GltfAssetDependency> gltfAssetDependencies = new (); public GltFastFileProvider(string fileRootPath, string hash, Dictionary<string, string> contentTable) @@ -105,7 +104,7 @@ public GltFastFileProvider(string fileRootPath, string hash, Dictionary<string, this.contentTable = contentTable; } - public async Task<IDownload> Request(Uri url) + public async Task<IDownload> RequestAsync(Uri url) { Uri newUrl = GetDependenciesPaths(RebuildUrl(url)); @@ -119,7 +118,7 @@ public async Task<IDownload> Request(Uri url) return new SyncFileLoader(newUrl); } - public async Task<ITextureDownload> RequestTexture(Uri url, bool nonReadable, bool forceLinear) + public async Task<ITextureDownload> RequestTextureAsync(Uri url, bool nonReadable, bool forceLinear) { Uri newUrl = GetDependenciesPaths(RebuildUrl(url)); @@ -136,7 +135,7 @@ public async Task<ITextureDownload> RequestTexture(Uri url, bool nonReadable, bo private Uri RebuildUrl(Uri url) { var absolutePath = url.OriginalString; - string relativePath = $"{fileRootPath}{absolutePath.Substring(absolutePath.IndexOf(hash) + hash.Length + 1)}"; + string relativePath = $"{fileRootPath}{absolutePath.Substring(absolutePath.IndexOf(hash, StringComparison.Ordinal) + hash.Length + 1)}"; relativePath = relativePath.Replace("\\", "/"); return new Uri(relativePath, UriKind.Relative); } diff --git a/asset-bundle-converter/Assets/git-submodules/glTFast b/asset-bundle-converter/Assets/git-submodules/glTFast index f7902fbc..e4587451 160000 --- a/asset-bundle-converter/Assets/git-submodules/glTFast +++ b/asset-bundle-converter/Assets/git-submodules/glTFast @@ -1 +1 @@ -Subproject commit f7902fbc0670d90427a43d54cdd625e9d0641483 +Subproject commit e4587451389b6cf93b084ae434d0cc3d32a45076 diff --git a/asset-bundle-converter/Packages/manifest.json b/asset-bundle-converter/Packages/manifest.json index 36fa767c..def231e8 100644 --- a/asset-bundle-converter/Packages/manifest.json +++ b/asset-bundle-converter/Packages/manifest.json @@ -6,7 +6,7 @@ "com.unity.ai.navigation": "1.1.5", "com.unity.assetbundlebrowser": "https://github.com/Unity-Technologies/AssetBundles-Browser.git", "com.unity.collab-proxy": "2.2.0", - "com.unity.ide.rider": "3.0.25", + "com.unity.ide.rider": "3.0.34", "com.unity.ide.visualstudio": "2.0.21", "com.unity.ide.vscode": "1.2.5", "com.unity.meshopt.decompress": "0.1.0-preview.5", diff --git a/asset-bundle-converter/Packages/packages-lock.json b/asset-bundle-converter/Packages/packages-lock.json index f6f12b10..b660116d 100644 --- a/asset-bundle-converter/Packages/packages-lock.json +++ b/asset-bundle-converter/Packages/packages-lock.json @@ -65,7 +65,7 @@ "url": "https://packages.unity.com" }, "com.unity.ide.rider": { - "version": "3.0.25", + "version": "3.0.34", "depth": 0, "source": "registry", "dependencies": { @@ -101,8 +101,8 @@ "depth": 0, "source": "registry", "dependencies": { - "com.unity.mathematics": "1.2.1", - "com.unity.burst": "1.4.11" + "com.unity.burst": "1.4.11", + "com.unity.mathematics": "1.2.1" }, "url": "https://packages.unity.com" },