From 3ef12503850b1e47afd338c8f99b1b21a0b9369b Mon Sep 17 00:00:00 2001 From: Aurora Huang Date: Thu, 12 Oct 2023 09:22:09 -0400 Subject: [PATCH 01/14] Post Release 6.0.1 (#64) --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e480002..5efe6bac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + ## [6.0.1] - 2023-10-11 ### Fixed From 55a11fadfc24ff139cb39a72e965b51d60f56bec Mon Sep 17 00:00:00 2001 From: Andreas Atteneder Date: Thu, 12 Oct 2023 15:56:28 +0200 Subject: [PATCH 02/14] doc: Updated link to a version that actually contains the right upgrade guide for *KTX for Unity* (#65) --- Documentation~/UpgradeGuides.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation~/UpgradeGuides.md b/Documentation~/UpgradeGuides.md index 9f924e8d..18bf83f2 100644 --- a/Documentation~/UpgradeGuides.md +++ b/Documentation~/UpgradeGuides.md @@ -30,7 +30,7 @@ Unity forks have been created for *KtxUnity* and *DracoUnity* as well. If you've See their respective upgrade guides -- Upgrade to [*KTX for Unity*](https://docs.unity3d.com/Packages/com.unity.cloud.ktx@3.0/manual/upgrade-guide.html) +- Upgrade to [*KTX for Unity*](https://docs.unity3d.com/Packages/com.unity.cloud.ktx@3.2/manual/upgrade-guide.html) - Upgrade to *Draco for Unity* (coming soon) ### Keep using the original glTFast From 3d54b6b7ab92d21c15d850b578e6b4c7fd79d5d2 Mon Sep 17 00:00:00 2001 From: Andreas Atteneder Date: Fri, 20 Oct 2023 15:02:09 +0200 Subject: [PATCH 03/14] Doc/installation (#68) * doc: Removed system requirements and prerequisites from installation instructions System requirements falsely imply that glTFast only works on those platforms. While not extensively tested on all platforms, it should work everywhere. Minimum version definition in prerequisites is redundant to package manifest and prone to be outdated in the future. Removed unused trademark note * doc: Included installation instructions in table of content and upgrade guide Partially applied template ToC layout * doc: Correct 2 space indent (markdownlint) * doc: Fixed listing installation items * doc: Removed redundant installation instructions from `README.md` and merged it into `installation.md`. * doc: Added registered trademark char to first appearance of Unity. * doc: Added missing changelog entry about minimum required Unity version. * doc: Fixed changelog entry --- CHANGELOG.md | 6 ++-- Documentation~/TableOfContents.md | 19 ++++++------ Documentation~/UpgradeGuides.md | 2 +- Documentation~/installation.md | 49 +++++++++++++++---------------- README.md | 32 ++------------------ 5 files changed, 41 insertions(+), 67 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5efe6bac..676493a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [6.0.0] - 2023-10-04 ### Added -- Custom Extension API (`GLTFast.Extensions` namespace) +- Custom Add-On API (`GLTFast.Addons` namespace) - Support for alternative JSON parsing via Newtonsoft JSON - `Accessor.ElementByteSize`: Byte size of one element of that accessor - `Accessor.ByteSize`: Overall byte size @@ -29,6 +29,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - (Export) Clearcoat material export support for HDRP Lit shader ### Changed +- Bumped minimum Unity version to 2020.3.48f1 - Renamed `GltfAnimation` to `Animation` for consistent naming. - Bumped Burst dependency version to 1.8.4 - Bumped Mathematics dependency version to 1.3.1 @@ -43,10 +44,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Runtime tests - (Export) Setting for deterministic export (limits concurrency to ensure consistent output) - (DOTS) Support for [Entities 1.0][Entities1.0] + ### Changed - Optimized `Accessor.GetAccessorAttributeType` - Optimized `GltfEntityAsset.ClearScenes` via Burst -- Bump minimum unity version from 2019.4.7f1 to 2019.4.40f1 +- Bump minimum Unity version from 2019.4.7f1 to 2019.4.40f1 ### Fixed - Compiler errors and warnings on Unity 2023.2 (and newer) due to using obsolete types. diff --git a/Documentation~/TableOfContents.md b/Documentation~/TableOfContents.md index fb4894e3..32420c33 100644 --- a/Documentation~/TableOfContents.md +++ b/Documentation~/TableOfContents.md @@ -1,14 +1,15 @@ -* [Overview](index.md) +* [Unity glTFast](index.md) + * [Installation](installation.md) + * [Upgrade guides](UpgradeGuides.md) * [Features](features.md) * Runtime - * [Import](ImportRuntime.md) - * [Export](ExportRuntime.md) + * [Import](ImportRuntime.md) + * [Export](ExportRuntime.md) * Editor - * [Import](ImportEditor.md) - * [Export](ExportEditor.md) + * [Import](ImportEditor.md) + * [Export](ExportEditor.md) * [Project Setup](ProjectSetup.md) * More Information - * [Upgrade Guides](UpgradeGuides.md) - * [Known Issues](KnownIssues.md) - * [Physical Light Units in glTF](LightUnits.md) - * [Implementation Details](ImplementationDetails.md) + * [Known Issues](KnownIssues.md) + * [Physical Light Units in glTF](LightUnits.md) + * [Implementation Details](ImplementationDetails.md) diff --git a/Documentation~/UpgradeGuides.md b/Documentation~/UpgradeGuides.md index 18bf83f2..3314528e 100644 --- a/Documentation~/UpgradeGuides.md +++ b/Documentation~/UpgradeGuides.md @@ -20,7 +20,7 @@ For now, both the Unity variant and the original version will receive updates. The C# namespaces are identical between the variants, so all you need to do is: - Removed original *glTFast* (with package identifier `com.atteneder.gltfast`). -- Add *Unity glTFast* (`com.unity.cloud.gltfast`). +- [Install *Unity glTFast*](installation.html) (`com.unity.cloud.gltfast`). - Update assembly definition references (if your project had any). - Update any dependencies in your packages manifest (if your package had any) diff --git a/Documentation~/installation.md b/Documentation~/installation.md index 7a2b55dc..b4f486fc 100644 --- a/Documentation~/installation.md +++ b/Documentation~/installation.md @@ -1,42 +1,41 @@ # Installation -Before you install the package, make sure you meet the [system requirement](#system-requirement) and [prerequisites](#prerequisites). - ## Install the *Unity glTFast* package using the Unity Package Manager To install the *Unity glTFast* package, follow these steps: -In your Unity project, go to Windows > Package Manager. -On the status bar, select the Add (+) button. -From the Add menu, select Add + package by name. Name and Version fields appear. -In the Name field, enter `com.unity.cloud.gltfast`. -Select Add. -The Editor installs the latest available version of the package and any dependent packages. - -## System Requirement +- In your Unity project, go to Windows > Package Manager. +- On the status bar, select the Add (+) button. +- From the Add menu, select Add + package by name. Name and Version fields appear. +- In the Name field, enter `com.unity.cloud.gltfast`. +- Select Add. +- The Editor installs the latest available version of the package and any dependent packages. -*Unity glTFast* supports the following platforms: +## Optional Packages -- WebGL -- iOS (arm64 and armv7a) -- Android (arm64 and armv7a) -- Windows (64 bit) -- Universal Windows Platform (x64, x86, ARM, ARM64) -- MacOS Universal (Apple Silicon and Intel) -- Linux (64 bit) -- Lumin / Magic Leap +There are some related package that improve *Unity glTFast* by extending its feature set. -## Prerequisites +- [Draco™ 3D Data Compression Unity Package][DracoUnity] (provides support for [KHR_draco_mesh_compression][ExtDraco]) +- [KTX™ for Unity][KtxUnity] (provides support for [KHR_texture_basisu][ExtBasisU]) +- [*meshoptimizer decompression for Unity*][Meshopt] (provides support for [EXT_meshopt_compression][ExtMeshopt]) -To use the package, you require the following: +## Trademarks -- A Unity version of 2020.1 or later. In the Unity Hub, go to **Installs** > **Official releases** to find the latest Long Term Support version. +*Unity®* is a registered trademark of [Unity Technologies][unity]. -## Trademarks +*Khronos®* is a registered trademark and [glTF™][gltf] is a trademark of [The Khronos Group Inc][khronos]. -*Unity* is a registered trademark of [Unity Technologies][unity]. +*KTX™* and the KTX logo are trademarks of the [The Khronos Group Inc][khronos]. -*Khronos®* is a registered trademark and *glTF™* is a trademark of [The Khronos Group Inc][khronos]. +*Draco™* is a trademark of [*Google LLC*][GoogleLLC]. +[DracoUnity]: https://github.com/atteneder/DracoUnity +[ExtBasisU]: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_texture_basisu +[ExtDraco]: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression +[ExtMeshopt]: https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Vendor/EXT_meshopt_compression +[gltf]: https://www.khronos.org/gltf +[GoogleLLC]: https://about.google/ [khronos]: https://www.khronos.org +[KtxUnity]: https://docs.unity3d.com/Packages/com.unity.cloud.ktx@latest/ +[Meshopt]: https://docs.unity3d.com/Packages/com.unity.meshopt.decompress@latest/ [unity]: https://unity.com diff --git a/README.md b/README.md index afd3347b..a7ea9ea5 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Unity and glTF logos side by side

-*Unity glTFast* enables use of [glTF™ (GL Transmission Format)][gltf] asset files in [Unity][unity]. +*Unity glTFast* enables use of [glTF™ (GL Transmission Format)][gltf] asset files in [Unity®][unity]. It focuses on speed, memory efficiency and a small build footprint while also providing: @@ -36,27 +36,10 @@ Read more about the workflows in the [documentation][workflows]. ## Installing -To install the *Unity glTFast* package, follow these steps: - -In your Unity project, go to Windows > Package Manager. -On the status bar, select the Add (+) button. -From the Add menu, select Add + package by name. Name and Version fields appear. -In the Name field, enter `com.unity.cloud.gltfast`. -Select Add. -The Editor installs the latest available version of the package and any dependent packages. +[Installation instructions](./Documentation~/installation.md) > **NOTE:** This package originally had the identifier `com.atteneder.gltfast`. Consult the [upgrade guide](./Documentation~/UpgradeGuides.md#unity-fork) to learn how to switch to the Unity version (`com.unity.cloud.gltfast`) or [install the original package](./Documentation~/Original.md). -### Optional Packages - -There are some related package that improve *Unity glTFast* by extending its feature set. - -- [Draco™ 3D Data Compression Unity Package][DracoUnity] (provides support for [KHR_draco_mesh_compression][ExtDraco]) -- [KTX™ for Unity][KtxUnity] (provides support for [KHR_texture_basisu][ExtBasisU]) -- [*meshoptimizer decompression for Unity*][Meshopt] (provides support for [EXT_meshopt_compression][ExtMeshopt]) - -*Unity glTFast* 5.x requires Unity 2020.1 or newer. - ## Usage You can load a glTF asset from an URL or a file path. @@ -127,21 +110,10 @@ limitations under the License. *Khronos®* is a registered trademark and [glTF™][gltf] is a trademark of [The Khronos Group Inc][khronos]. -*KTX™* and the KTX logo are trademarks of the [The Khronos Group Inc][khronos]. - -*Draco™* is a trademark of [*Google LLC*][GoogleLLC]. - -[DracoUnity]: https://github.com/atteneder/DracoUnity -[ExtBasisU]: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_texture_basisu -[ExtDraco]: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression -[ExtMeshopt]: https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Vendor/EXT_meshopt_compression [gltf-spec]: https://www.khronos.org/registry/glTF/specs/2.0/glTF-2.0.html [gltf]: https://www.khronos.org/gltf [gltfasset_component]: ./Documentation~/Images/gltfasset_component.png "Inspector showing a GltfAsset component added to a GameObject" -[GoogleLLC]: https://about.google/ [import-gif]: ./Documentation~/Images/import.gif "Video showing glTF files being copied into the Assets folder and imported" [khronos]: https://www.khronos.org -[KtxUnity]: https://docs.unity3d.com/Packages/com.unity.cloud.ktx@latest -[Meshopt]: https://docs.unity3d.com/Packages/com.unity.meshopt.decompress@0.1/manual/index.html [unity]: https://unity.com [workflows]: ./Documentation~/index.md#workflows From 1e85cf730c714fbe9badc1e370753f4fa4dcfe52 Mon Sep 17 00:00:00 2001 From: Andreas Atteneder Date: Wed, 1 Nov 2023 11:58:35 +0100 Subject: [PATCH 04/14] Fix/docs contribution (#69) * doc: Changelog entry * doc: Updated contributing documentation. --- CHANGELOG.md | 3 +++ CONTRIBUTING.md | 49 ++++++++++++++++++++++++++++++++++--------------- README.md | 2 +- 3 files changed, 38 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 676493a3..c4cb42f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed +- Documentation improvements + ## [6.0.1] - 2023-10-11 ### Fixed diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3a78fa01..e204da6b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,36 +7,55 @@ of guidelines to ensure that your extensions can be easily integrated. ## Communication -First, please read through our [code of conduct](CODE_OF_CONDUCT.md), as we +Please read through our [code of conduct][COC], as we expect all our contributors to follow it. -Second, before starting on a project that you intend to contribute in any form, we -**strongly** recommend posting on our -[Issues page](https://github.com/atteneder/glTFast/issues) and -briefly outline the changes you plan to make. This will enable us to provide -some context that may be helpful for you. This could range from advice and -feedback on how to optimally perform your changes or reasons for not doing it. +For inquiries of all sorts, feel free to raise an issue by going to the +[issues page][issues] and click the *New issue* button. -Lastly, if you're looking for input on what to contribute browse the GitHub -issues, especially ones with the `help wanted` or `good first issue` label. +If you're looking for ideas on ways to contribute browse the [issues][issues], +especially ones with the `help wanted` or `good first issue` label. -## Git Branches +## Preparation -The main branch corresponds to the most recent version of the project. Note -that this branch may be unstable and may be newer that the latest release. +Before starting to work on a contribution we recommend searching within the +existing [issues][issues] and [pull requests][pulls] for similar topics to +avoid redundant efforts and make sure you got all contextual information. -When contributing to the project, please make sure that your Pull Request (PR) -contains the following: +Feel free to propose ideas upfront via an [issue][issues] that briefly outlines +your intended changes. We'll then try to give you advice and feedback on how to +optimally implement those changes or, if justifiable, reasons to abandon an +idea. This pre-evaluation can raise the chances of getting a contribution +accepted. + +## Version Control + +*glTFast* uses [Git][Git] and [GitHub][repo] for version control. + +## Submission via Pull Request + +Changes can be proposed via [pull requests (PR)][GithubDocPR] on the [pull requests][pulls] page. + +Please make sure that your PR contains the following: - Detailed description of the changes performed - Corresponding changes to documentation, changelog and unit tests - Summary of the tests performed to validate your changes - Issue numbers that the PR resolves (if any) +PRs will be transferred to an internal, mirrored repository to undergo review and (automated) tests that use Unity's internal tools and infrastructure. If those tests and reviews are not successful, we'll help you resolve remaining issues and merge your work, once it passes all tests. The merge will happen on the mirrored repository and the original pull requests will get closed with a proper notification about expected release version and date. + ## Contributor License Agreements When you open a pull request, you will be asked to acknowledge our Contributor License Agreement. You will have to confirm that your Contributions are your original creation and that you have complete right and authority to make your -Contributions. We allow both individual contributions and contributions made on +contributions. We allow both individual contributions and contributions made on behalf of companies. + +[COC]: (CODE_OF_CONDUCT.md) +[Git]: https://git-scm.com/ +[repo]: https://github.com/Unity-Technologies/com.unity.cloud.gltfast +[issues]: https://github.com/Unity-Technologies/com.unity.cloud.gltfast/issues +[pulls]: https://github.com/Unity-Technologies/com.unity.cloud.gltfast/pulls +[GithubDocPR]: https://docs.github.com/pull-requests diff --git a/README.md b/README.md index a7ea9ea5..861d68a1 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,7 @@ Read the section *Materials and Shader Variants* in the [Documentation](./Docume ## Contribution -Contributions in the form of ideas, comments, critique, bug reports, pull requests are highly appreciated. Feel free to get in contact if you consider using or improving *Unity glTFast*. +See [CONTRIBUTING.md](CONTRIBUTING.md). ## License From 835417c6d6258391a83c22060b3866cf6332aa5b Mon Sep 17 00:00:00 2001 From: Aurora Huang Date: Thu, 9 Nov 2023 11:04:36 -0500 Subject: [PATCH 05/14] Documentation for glTFast add-on API (#73) * Documentation for glTFast add-on API * Add assembly definitions for samples * Update CHANGELOG.md --- CHANGELOG.md | 3 + Documentation~/Images/gltf-extra-data.PNG | 3 + Documentation~/TableOfContents.md | 2 + Documentation~/UseCaseCustomExtras.md | 104 ++++++++++++++++++ Documentation~/features.md | 6 + Samples.meta | 8 ++ Samples/Documentation.meta | 8 ++ Samples/Documentation/Manual.meta | 8 ++ .../Documentation/Manual/CustomGltfImport.cs | 102 +++++++++++++++++ .../Manual/CustomGltfImport.cs.meta | 11 ++ Samples/Documentation/Manual/ExtraData.cs | 13 +++ .../Documentation/Manual/ExtraData.cs.meta | 11 ++ .../Unity.Cloud.Gltfast.Documentation.asmdef | 17 +++ ...ty.Cloud.Gltfast.Documentation.asmdef.meta | 7 ++ 14 files changed, 303 insertions(+) create mode 100644 Documentation~/Images/gltf-extra-data.PNG create mode 100644 Documentation~/UseCaseCustomExtras.md create mode 100644 Samples.meta create mode 100644 Samples/Documentation.meta create mode 100644 Samples/Documentation/Manual.meta create mode 100644 Samples/Documentation/Manual/CustomGltfImport.cs create mode 100644 Samples/Documentation/Manual/CustomGltfImport.cs.meta create mode 100644 Samples/Documentation/Manual/ExtraData.cs create mode 100644 Samples/Documentation/Manual/ExtraData.cs.meta create mode 100644 Samples/Documentation/Unity.Cloud.Gltfast.Documentation.asmdef create mode 100644 Samples/Documentation/Unity.Cloud.Gltfast.Documentation.asmdef.meta diff --git a/CHANGELOG.md b/CHANGELOG.md index c4cb42f1..cd9640c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added +- (Documentation) Explanation and user case for the add-on API + ### Changed - Documentation improvements diff --git a/Documentation~/Images/gltf-extra-data.PNG b/Documentation~/Images/gltf-extra-data.PNG new file mode 100644 index 00000000..bd60625d --- /dev/null +++ b/Documentation~/Images/gltf-extra-data.PNG @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:57f7aced9ce2532edcddcf1966b739313f604854463e658916d990b58d84bbe9 +size 24697 diff --git a/Documentation~/TableOfContents.md b/Documentation~/TableOfContents.md index 32420c33..945ac149 100644 --- a/Documentation~/TableOfContents.md +++ b/Documentation~/TableOfContents.md @@ -9,6 +9,8 @@ * [Import](ImportEditor.md) * [Export](ExportEditor.md) * [Project Setup](ProjectSetup.md) +* Use Cases + * [Use glTFast Add-on API to import custom data](UseCaseCustomExtras.md) * More Information * [Known Issues](KnownIssues.md) * [Physical Light Units in glTF](LightUnits.md) diff --git a/Documentation~/UseCaseCustomExtras.md b/Documentation~/UseCaseCustomExtras.md new file mode 100644 index 00000000..68e7e563 --- /dev/null +++ b/Documentation~/UseCaseCustomExtras.md @@ -0,0 +1,104 @@ +# Use case: Use glTFast Add-on API + +This use case describes the step to use glTFast Add-on API to import custom data in the `extras` property of a glTF™ JSON object. This example uses Newtonsoft JSON parser to deserialize data. + +To accomplish this use case, do the following: + +1. Add custom data in a gltf asset +2. Create a custom gltf import behavior +3. Add assembly definitions +4. Set up a new scene +5. Import the gltf asset in runtime + +## Before you start + +Before you start, you must add the following package dependencies to your project. + +* In the `manifest.json` file, add the following dependencies: + +```json + { + "dependencies": { + // Add these lines: + // Replace "" with the version you wish to install + "com.unity.cloud.gltfast": "", + "com.unity.nuget.newtonsoft-json": "" + // Other dependencies... + } + } +``` + +## How do I...? + +### Add custom data in a gltf asset + +Add some custom data in the `extras` property of a glTF JSON object: + +```json + "nodes": [ + { + // Example of mesh data in a glTF + "mesh": 0, + "name": "Cube", + + // Add these lines: + "extras": { + "some-extra-key": "some-extra-value" + } + } + ] +``` + +### Create a custom gltf import behavior + +To create a custom gltf import behavior, follow these steps: + +1. Open your Unity® Project. +2. Go to the **Assets** folder in the Project window. +3. Select and hold **Create**. +4. Select **C# Script**. +5. Rename the new script as `CustomGltfImport`. +6. Open the `CustomGltfImport` script and replace the content with the following: + [!code-cs [custom-gltf-import](../Samples/Documentation/Manual/CustomGltfImport.cs#CustomGltfImport)] +7. Repeat step 2-4 to create another new script +8. Rename the new script as `ExtraData`. +9. Open the `ExtraData` script and replace the content with the following: + [!code-cs [extra-data](../Samples/Documentation/Manual/ExtraData.cs#ExtraData)] + +### Add assembly definitions + +In your [assembly definition](https://docs.unity3d.com/Manual/ScriptCompilationAssemblyDefinitionFiles.html) file (`.asmdef` file), add the following references: + +```json + "references": [ + // Add these lines: + "glTFast", + "glTFast.Newtonsoft" + // Other references... + ] +``` + +### Set up a new scene + +To set up a new scene, follow these steps: + +1. Create a new scene. +2. Create a GameObject called **GltfImport**. +3. Select **Add Component** in the Inspector window and add the **Custom Gltf Import** component. +4. In the **Uri** field, set the path to point to where the gltf asset is stored. + +### Import the gltf asset in runtime + +Select **Play**, the gltf asset should be loaded and displayed at runtime. + +You can verify that the custom data in the `extras` property of the glTF is imported correctly by inspecting the loaded gltf asset: +![Screen capture that displays the extra data in the imported gltf asset](Images/gltf-extra-data.PNG) + +## Trademarks + +*Unity®* is a registered trademark of [Unity Technologies][Unity]. + +*glTF™* is a trademark of [The Khronos Group Inc][Khronos]. + +[Khronos]: https://www.khronos.org +[Unity]: https://unity.com diff --git a/Documentation~/features.md b/Documentation~/features.md index b4607671..b6e27e05 100644 --- a/Documentation~/features.md +++ b/Documentation~/features.md @@ -138,6 +138,12 @@ Not investigated yet: - FB_geometry_metadata (prefer KTX_xmp) - MSFT_texture_dds (prefer KTX/basisu) +### Custom extras and extensions + +Optional `extras` and `extensions` object properties are supported. glTFast uses Newtonsoft JSON parser to access these additional properties. + +See [glTFast Add-on API](UseCaseCustomExtras.md) for an example to import the `extras` property in a gltf asset. + ## Materials Details ### Material Import diff --git a/Samples.meta b/Samples.meta new file mode 100644 index 00000000..0c6eff69 --- /dev/null +++ b/Samples.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 80a9660688f788a4b90e36414fcb5fb6 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Samples/Documentation.meta b/Samples/Documentation.meta new file mode 100644 index 00000000..bbe32df9 --- /dev/null +++ b/Samples/Documentation.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c31dca948fd8a9c45b6a13732c190c2e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Samples/Documentation/Manual.meta b/Samples/Documentation/Manual.meta new file mode 100644 index 00000000..66d89b5e --- /dev/null +++ b/Samples/Documentation/Manual.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 19e2269416001a74bb7886e4e56b9b05 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Samples/Documentation/Manual/CustomGltfImport.cs b/Samples/Documentation/Manual/CustomGltfImport.cs new file mode 100644 index 00000000..b6586350 --- /dev/null +++ b/Samples/Documentation/Manual/CustomGltfImport.cs @@ -0,0 +1,102 @@ +namespace Samples.Documentation.Manual +{ + +#region CustomGltfImport +using GLTFast; +using GLTFast.Addons; +using System; +using System.Threading.Tasks; +using UnityEngine; +using GltfImport = GLTFast.Newtonsoft.GltfImport; + +public class CustomGltfImport : MonoBehaviour +{ + // Path to the gltf asset to be imported + public string Uri; + + async Task Start() + { + try + { + ImportAddonRegistry.RegisterImportAddon(new MyAddon()); + var gltfImport = new GltfImport(); + await gltfImport.Load(Uri); + await gltfImport.InstantiateMainSceneAsync(transform); + } + catch (Exception e) + { + Debug.LogException(e); + } + } + + public class MyAddon : ImportAddon { } + public class MyAddonInstance : ImportAddonInstance + { + GltfImport m_GltfImport; + + public override void Dispose() { } + + public override void Inject(GltfImportBase gltfImport) + { + var newtonsoftGltfImport = gltfImport as GltfImport; + if (newtonsoftGltfImport == null) + return; + + m_GltfImport = newtonsoftGltfImport; + newtonsoftGltfImport.AddImportAddonInstance(this); + } + + public override void Inject(IInstantiator instantiator) + { + var goInstantiator = instantiator as GameObjectInstantiator; + if (goInstantiator == null) + return; + var _ = new MyInstantiatorAddon(m_GltfImport, goInstantiator); + } + + public override bool SupportsGltfExtension(string extensionName) + { + return false; + } + } +} + +public class MyInstantiatorAddon +{ + GltfImport m_GltfImport; + GameObjectInstantiator m_Instantiator; + + public MyInstantiatorAddon(GltfImport gltfImport, GameObjectInstantiator instantiator) + { + m_GltfImport = gltfImport; + m_Instantiator = instantiator; + m_Instantiator.NodeCreated += OnNodeCreated; + m_Instantiator.EndSceneCompleted += () => + { + m_Instantiator.NodeCreated -= OnNodeCreated; + }; + } + + void OnNodeCreated(uint nodeIndex, GameObject gameObject) + { + // De-serialize glTF JSON + var gltf = m_GltfImport.GetSourceRoot(); + + var node = gltf.Nodes[(int)nodeIndex] as GLTFast.Newtonsoft.Schema.Node; + var extras = node.extras; + + if (extras == null) + return; + + // Access values in the extras property + if (extras.TryGetValue("some-extra-key", out string extraValue)) + { + var component = gameObject.AddComponent(); + component.someExtraKey = extraValue; + } + } +} +#endregion + +} + diff --git a/Samples/Documentation/Manual/CustomGltfImport.cs.meta b/Samples/Documentation/Manual/CustomGltfImport.cs.meta new file mode 100644 index 00000000..ae8e8613 --- /dev/null +++ b/Samples/Documentation/Manual/CustomGltfImport.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ed7eb2828185cf54896d0bc4e34c7d24 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Samples/Documentation/Manual/ExtraData.cs b/Samples/Documentation/Manual/ExtraData.cs new file mode 100644 index 00000000..993efcd5 --- /dev/null +++ b/Samples/Documentation/Manual/ExtraData.cs @@ -0,0 +1,13 @@ +namespace Samples.Documentation.Manual +{ + +#region ExtraData +using UnityEngine; + +public class ExtraData : MonoBehaviour +{ + public string someExtraKey; +} + +#endregion +} \ No newline at end of file diff --git a/Samples/Documentation/Manual/ExtraData.cs.meta b/Samples/Documentation/Manual/ExtraData.cs.meta new file mode 100644 index 00000000..41909859 --- /dev/null +++ b/Samples/Documentation/Manual/ExtraData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c228dd24f481eca4d8b951a9b54398b1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Samples/Documentation/Unity.Cloud.Gltfast.Documentation.asmdef b/Samples/Documentation/Unity.Cloud.Gltfast.Documentation.asmdef new file mode 100644 index 00000000..1b779752 --- /dev/null +++ b/Samples/Documentation/Unity.Cloud.Gltfast.Documentation.asmdef @@ -0,0 +1,17 @@ +{ + "name": "Unity.Cloud.Gltfast.Documentation", + "rootNamespace": "", + "references": [ + "glTFast", + "glTFast.Newtonsoft" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Samples/Documentation/Unity.Cloud.Gltfast.Documentation.asmdef.meta b/Samples/Documentation/Unity.Cloud.Gltfast.Documentation.asmdef.meta new file mode 100644 index 00000000..0bb8b661 --- /dev/null +++ b/Samples/Documentation/Unity.Cloud.Gltfast.Documentation.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 8f5c1be42eb774f4e8372825ac2e4d50 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: From 53a8ccefc3575127d4c592667607c1f8add1810f Mon Sep 17 00:00:00 2001 From: Andreas Atteneder Date: Mon, 13 Nov 2023 20:33:53 +0100 Subject: [PATCH 06/14] doc: addon-api fixes (#74) * chore: Auto-formatted code * doc: Consistent case on glTF. * doc: typo --- Documentation~/UseCaseCustomExtras.md | 24 +-- .../Documentation/Manual/CustomGltfImport.cs | 157 +++++++++--------- Samples/Documentation/Manual/ExtraData.cs | 16 +- 3 files changed, 98 insertions(+), 99 deletions(-) diff --git a/Documentation~/UseCaseCustomExtras.md b/Documentation~/UseCaseCustomExtras.md index 68e7e563..22caef0d 100644 --- a/Documentation~/UseCaseCustomExtras.md +++ b/Documentation~/UseCaseCustomExtras.md @@ -1,14 +1,14 @@ # Use case: Use glTFast Add-on API -This use case describes the step to use glTFast Add-on API to import custom data in the `extras` property of a glTF™ JSON object. This example uses Newtonsoft JSON parser to deserialize data. +This use case describes the steps to use glTFast Add-on API to import custom data from the `extras` property of a glTF™ JSON object. This example uses Newtonsoft JSON parser to deserialize data. To accomplish this use case, do the following: -1. Add custom data in a gltf asset -2. Create a custom gltf import behavior +1. Add custom data in a glTF asset +2. Create a custom glTF import behavior 3. Add assembly definitions 4. Set up a new scene -5. Import the gltf asset in runtime +5. Import the glTF asset in runtime ## Before you start @@ -30,7 +30,7 @@ Before you start, you must add the following package dependencies to your projec ## How do I...? -### Add custom data in a gltf asset +### Add custom data in a glTF asset Add some custom data in the `extras` property of a glTF JSON object: @@ -49,9 +49,9 @@ Add some custom data in the `extras` property of a glTF JSON object: ] ``` -### Create a custom gltf import behavior +### Create a custom glTF import behavior -To create a custom gltf import behavior, follow these steps: +To create a custom glTF import behavior, follow these steps: 1. Open your Unity® Project. 2. Go to the **Assets** folder in the Project window. @@ -85,14 +85,14 @@ To set up a new scene, follow these steps: 1. Create a new scene. 2. Create a GameObject called **GltfImport**. 3. Select **Add Component** in the Inspector window and add the **Custom Gltf Import** component. -4. In the **Uri** field, set the path to point to where the gltf asset is stored. +4. In the **Uri** field, set the path to point to where the glTF asset is stored. -### Import the gltf asset in runtime +### Import the glTF asset in runtime -Select **Play**, the gltf asset should be loaded and displayed at runtime. +Select **Play**, the glTF asset should be loaded and displayed at runtime. -You can verify that the custom data in the `extras` property of the glTF is imported correctly by inspecting the loaded gltf asset: -![Screen capture that displays the extra data in the imported gltf asset](Images/gltf-extra-data.PNG) +You can verify that the custom data in the `extras` property of the glTF is imported correctly by inspecting the loaded glTF asset: +![Screen capture that displays the extra data in the imported glTF asset](Images/gltf-extra-data.PNG) ## Trademarks diff --git a/Samples/Documentation/Manual/CustomGltfImport.cs b/Samples/Documentation/Manual/CustomGltfImport.cs index b6586350..ea617af1 100644 --- a/Samples/Documentation/Manual/CustomGltfImport.cs +++ b/Samples/Documentation/Manual/CustomGltfImport.cs @@ -1,102 +1,101 @@ namespace Samples.Documentation.Manual { -#region CustomGltfImport -using GLTFast; -using GLTFast.Addons; -using System; -using System.Threading.Tasks; -using UnityEngine; -using GltfImport = GLTFast.Newtonsoft.GltfImport; - -public class CustomGltfImport : MonoBehaviour -{ - // Path to the gltf asset to be imported - public string Uri; + #region CustomGltfImport + using GLTFast; + using GLTFast.Addons; + using System; + using System.Threading.Tasks; + using UnityEngine; + using GltfImport = GLTFast.Newtonsoft.GltfImport; - async Task Start() + public class CustomGltfImport : MonoBehaviour { - try + // Path to the gltf asset to be imported + public string Uri; + + async Task Start() { - ImportAddonRegistry.RegisterImportAddon(new MyAddon()); - var gltfImport = new GltfImport(); - await gltfImport.Load(Uri); - await gltfImport.InstantiateMainSceneAsync(transform); + try + { + ImportAddonRegistry.RegisterImportAddon(new MyAddon()); + var gltfImport = new GltfImport(); + await gltfImport.Load(Uri); + await gltfImport.InstantiateMainSceneAsync(transform); + } + catch (Exception e) + { + Debug.LogException(e); + } } - catch (Exception e) + + public class MyAddon : ImportAddon { } + public class MyAddonInstance : ImportAddonInstance { - Debug.LogException(e); + GltfImport m_GltfImport; + + public override void Dispose() { } + + public override void Inject(GltfImportBase gltfImport) + { + var newtonsoftGltfImport = gltfImport as GltfImport; + if (newtonsoftGltfImport == null) + return; + + m_GltfImport = newtonsoftGltfImport; + newtonsoftGltfImport.AddImportAddonInstance(this); + } + + public override void Inject(IInstantiator instantiator) + { + var goInstantiator = instantiator as GameObjectInstantiator; + if (goInstantiator == null) + return; + var _ = new MyInstantiatorAddon(m_GltfImport, goInstantiator); + } + + public override bool SupportsGltfExtension(string extensionName) + { + return false; + } } } - - public class MyAddon : ImportAddon { } - public class MyAddonInstance : ImportAddonInstance + + public class MyInstantiatorAddon { GltfImport m_GltfImport; - - public override void Dispose() { } - - public override void Inject(GltfImportBase gltfImport) - { - var newtonsoftGltfImport = gltfImport as GltfImport; - if (newtonsoftGltfImport == null) - return; - - m_GltfImport = newtonsoftGltfImport; - newtonsoftGltfImport.AddImportAddonInstance(this); - } - - public override void Inject(IInstantiator instantiator) - { - var goInstantiator = instantiator as GameObjectInstantiator; - if (goInstantiator == null) - return; - var _ = new MyInstantiatorAddon(m_GltfImport, goInstantiator); - } - - public override bool SupportsGltfExtension(string extensionName) + GameObjectInstantiator m_Instantiator; + + public MyInstantiatorAddon(GltfImport gltfImport, GameObjectInstantiator instantiator) { - return false; + m_GltfImport = gltfImport; + m_Instantiator = instantiator; + m_Instantiator.NodeCreated += OnNodeCreated; + m_Instantiator.EndSceneCompleted += () => + { + m_Instantiator.NodeCreated -= OnNodeCreated; + }; } - } -} -public class MyInstantiatorAddon -{ - GltfImport m_GltfImport; - GameObjectInstantiator m_Instantiator; - - public MyInstantiatorAddon(GltfImport gltfImport, GameObjectInstantiator instantiator) - { - m_GltfImport = gltfImport; - m_Instantiator = instantiator; - m_Instantiator.NodeCreated += OnNodeCreated; - m_Instantiator.EndSceneCompleted += () => + void OnNodeCreated(uint nodeIndex, GameObject gameObject) { - m_Instantiator.NodeCreated -= OnNodeCreated; - }; - } + // De-serialize glTF JSON + var gltf = m_GltfImport.GetSourceRoot(); - void OnNodeCreated(uint nodeIndex, GameObject gameObject) - { - // De-serialize glTF JSON - var gltf = m_GltfImport.GetSourceRoot(); + var node = gltf.Nodes[(int)nodeIndex] as GLTFast.Newtonsoft.Schema.Node; + var extras = node.extras; - var node = gltf.Nodes[(int)nodeIndex] as GLTFast.Newtonsoft.Schema.Node; - var extras = node.extras; - - if (extras == null) - return; + if (extras == null) + return; - // Access values in the extras property - if (extras.TryGetValue("some-extra-key", out string extraValue)) - { - var component = gameObject.AddComponent(); - component.someExtraKey = extraValue; + // Access values in the extras property + if (extras.TryGetValue("some-extra-key", out string extraValue)) + { + var component = gameObject.AddComponent(); + component.someExtraKey = extraValue; + } } } -} -#endregion + #endregion } - diff --git a/Samples/Documentation/Manual/ExtraData.cs b/Samples/Documentation/Manual/ExtraData.cs index 993efcd5..43028ddd 100644 --- a/Samples/Documentation/Manual/ExtraData.cs +++ b/Samples/Documentation/Manual/ExtraData.cs @@ -1,13 +1,13 @@ namespace Samples.Documentation.Manual { -#region ExtraData -using UnityEngine; + #region ExtraData + using UnityEngine; -public class ExtraData : MonoBehaviour -{ - public string someExtraKey; -} + public class ExtraData : MonoBehaviour + { + public string someExtraKey; + } -#endregion -} \ No newline at end of file + #endregion +} From aa47a027e696d26a98ccc4926de0395b6048e52d Mon Sep 17 00:00:00 2001 From: Andreas Atteneder Date: Thu, 16 Nov 2023 13:35:11 +0100 Subject: [PATCH 07/14] fix: Made code compatible with 2020 LTS. (#75) --- CHANGELOG.md | 1 + Runtime/Scripts/Export/GltfWriter.cs | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cd9640c7..8a1b5d00 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Compilation error when Animation module is disabled and Newtonsoft JSON package installed. +- Compilation on Unity 2020 LTS ## [6.0.0] - 2023-10-04 diff --git a/Runtime/Scripts/Export/GltfWriter.cs b/Runtime/Scripts/Export/GltfWriter.cs index d85e3a35..77c741e7 100644 --- a/Runtime/Scripts/Export/GltfWriter.cs +++ b/Runtime/Scripts/Export/GltfWriter.cs @@ -1314,8 +1314,10 @@ async Task BakeMeshDraco(int meshId, UnityEngine.Mesh.MeshData meshData) var attributes = new Attributes(); var dracoAttributes = new Attributes(); - foreach (var (vertexAttribute, attribute) in encodeResult.vertexAttributes) + foreach ( var vertexAttributeTuple in encodeResult.vertexAttributes) { + var vertexAttribute = vertexAttributeTuple.Key; + var attribute = vertexAttributeTuple.Value; var accessor = new Accessor { componentType = GltfComponentType.Float, count = (int)encodeResult.vertexCount From 2415b300aad52700284a348270d979f8750353aa Mon Sep 17 00:00:00 2001 From: Andreas Atteneder Date: Thu, 16 Nov 2023 13:35:23 +0100 Subject: [PATCH 08/14] chore: Auto-formatted all markdown, USS, UXML and shader code (#76) --- CHANGELOG.md | 5 +- Documentation~/ExportRuntime.md | 6 +- Documentation~/ImportRuntime.md | 14 +- Documentation~/UpgradeGuides.md | 2 +- Documentation~/UseCaseCustomExtras.md | 2 +- Editor/UI/Dependency-style.uss | 16 +-- Editor/UI/Dependency.uxml | 14 +- Editor/UI/GltfImporter-style.uss | 84 ++++++------ Editor/UI/GltfImporter.uxml | 58 ++++----- Editor/UI/ReportItem-style.uss | 62 ++++----- Editor/UI/ReportItem.uxml | 14 +- LICENSE.md | 2 +- .../Shader/Built-In/glTFIncludes/glTF.cginc | 2 +- .../glTFIncludes/glTFUnityStandardCore.cginc | 14 +- .../glTFUnityStandardCoreForwardSimple.cginc | 6 +- .../glTFIncludes/glTFUnityStandardMeta.cginc | 6 +- .../Built-In/glTFPbrMetallicRoughness.shader | 6 +- .../Built-In/glTFPbrSpecularGlossiness.shader | 2 +- Runtime/Shader/Built-In/glTFUnlit.shader | 2 +- Runtime/Shader/Export/glTFExportColor.shader | 94 +++++++------- .../Shader/Export/glTFExportMaskMap.shader | 96 +++++++------- .../Shader/Export/glTFExportMetalGloss.shader | 122 +++++++++--------- Runtime/Shader/Export/glTFExportNormal.shader | 108 ++++++++-------- .../Shader/Export/glTFExportOcclusion.shader | 92 ++++++------- .../Shader/Export/glTFExportSmoothness.shader | 92 ++++++------- Runtime/Shader/Includes/Emission.cginc | 2 +- 26 files changed, 462 insertions(+), 461 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a1b5d00..184a41c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Documentation improvements +- Auto-formatted all markdown, USS, UXML and shader code ## [6.0.1] - 2023-10-11 @@ -500,7 +501,7 @@ This release contains multiple breaking changes. Please read the [upgrade guide] ## [4.3.4] - 2021-10-26 ### Added -- Option to turn off Editor import by adding `GLTFAST_EDITOR_IMPORT_OFF` to the project's *Scripting Define Symbols* in the *Player Settings* (#256) +- Option to turn off Editor import by adding `GLTFAST_EDITOR_IMPORT_OFF` to the project's *Scripting Define Symbols* in the *Player Settings* (#256) ### Fixed - Import of glTFs with no meshes (#257) @@ -686,7 +687,7 @@ This release contains multiple breaking changes. Please read the [upgrade guide] - Support for unsigned byte joint indices ### Changed -- Accelerated loading meshes by obtaining and setting bounds from accessors min/max values instead of recalculating them +- Accelerated loading meshes by obtaining and setting bounds from accessors min/max values instead of recalculating them - Improved log message when DracoUnity/KtxUnity packages are missing - Restored/simplified `GLTFast.LoadGltfBinary`, allowing users to load glTF binary files from byte arrays directly (also added documentation; fixes #148) diff --git a/Documentation~/ExportRuntime.md b/Documentation~/ExportRuntime.md index 442bf5ec..f767f208 100644 --- a/Documentation~/ExportRuntime.md +++ b/Documentation~/ExportRuntime.md @@ -35,7 +35,7 @@ public class TestExport : MonoBehaviour { // Example of gathering GameObjects to be exported (recursively) var rootLevelNodes = GameObject.FindGameObjectsWithTag("ExportMe"); - + // GameObjectExport lets you create glTFs from GameObject hierarchies var export = new GameObjectExport(); @@ -76,14 +76,14 @@ public class TestExport : MonoBehaviour { // ExportSettings and GameObjectExportSettings allow you to configure the export // Check their respective source for details - + // ExportSettings provides generic export settings var exportSettings = new ExportSettings { Format = GltfFormat.Binary, FileConflictResolution = FileConflictResolution.Overwrite, // Export everything except cameras or animation ComponentMask = ~(ComponentType.Camera | ComponentType.Animation), - // Boost light intensities + // Boost light intensities LightIntensityFactor = 100f, }; diff --git a/Documentation~/ImportRuntime.md b/Documentation~/ImportRuntime.md index abb76ed9..b922ff84 100644 --- a/Documentation~/ImportRuntime.md +++ b/Documentation~/ImportRuntime.md @@ -27,7 +27,7 @@ async void LoadGltfBinaryFromMemory() { byte[] data = File.ReadAllBytes(filePath); var gltf = new GltfImport(); bool success = await gltf.LoadGltfBinary( - data, + data, // The URI of the original data is important for resolving relative URIs within the glTF new Uri(filePath) ); @@ -92,7 +92,7 @@ async void Start() { if (success) { // Here you can customize the post-loading behavior - + // Get the first material var material = gltf.GetMaterial(); Debug.LogFormat("The first material is called {0}", material.name); @@ -186,7 +186,7 @@ async void Start() var instantiator = new GameObjectInstantiator(gltfImport,transform); var success = await gltfImport.InstantiateMainSceneAsync(instantiator); if (success) { - + // Get the SceneInstance to access the instance's properties var sceneInstance = instantiator.SceneInstance; @@ -194,14 +194,14 @@ async void Start() if (sceneInstance.Cameras is { Count: > 0 }) { sceneInstance.Cameras[0].enabled = true; } - + // Decrease lights' ranges if (sceneInstance.Lights != null) { foreach (var glTFLight in sceneInstance.Lights) { glTFLight.range *= 0.1f; } } - + // Play the default (i.e. the first) animation clip var legacyAnimation = instantiator.SceneInstance.LegacyAnimation; if (legacyAnimation != null) { @@ -219,7 +219,7 @@ When loading a glTF file, *Unity glTFast* logs messages of varying severity (err - Feed the information into an analytics framework - Display details to the users -The provided component `GltfAsset` logs all of those messages to the console by default. +The provided component `GltfAsset` logs all of those messages to the console by default. You can customize logging by providing an implementation of [`ICodeLogger`][ICodeLogger] to methods like `GltfImport.Load` or `GltfImport.InstantiateMainScene`. @@ -258,7 +258,7 @@ async Task CustomDeferAgentPerGltfImport() { deferAgent = new UninterruptedDeferAgent(); var tasks = new List(); - + foreach( var url in manyUrls) { var gltf = new GLTFast.GltfImport(null,deferAgent); var task = gltf.Load(url).ContinueWith( diff --git a/Documentation~/UpgradeGuides.md b/Documentation~/UpgradeGuides.md index 3314528e..27a18ce9 100644 --- a/Documentation~/UpgradeGuides.md +++ b/Documentation~/UpgradeGuides.md @@ -153,7 +153,7 @@ async void Start() { var instantiator = new GameObjectInstantiator(gltfImport,transform); var success = gltfImport.InstantiateMainScene(instantiator); if (success) { - + // Get the SceneInstance to access the instance's properties var sceneInstance = instantiator.SceneInstance; diff --git a/Documentation~/UseCaseCustomExtras.md b/Documentation~/UseCaseCustomExtras.md index 22caef0d..23c53507 100644 --- a/Documentation~/UseCaseCustomExtras.md +++ b/Documentation~/UseCaseCustomExtras.md @@ -37,7 +37,7 @@ Add some custom data in the `extras` property of a glTF JSON object: ```json "nodes": [ { - // Example of mesh data in a glTF + // Example of mesh data in a glTF "mesh": 0, "name": "Cube", diff --git a/Editor/UI/Dependency-style.uss b/Editor/UI/Dependency-style.uss index a092bf04..cd3bed23 100644 --- a/Editor/UI/Dependency-style.uss +++ b/Editor/UI/Dependency-style.uss @@ -1,8 +1,8 @@ -.dependency { - flex-direction: row; - align-items: center; -} - -.fix-button { - margin-left: auto; -} +.dependency { + flex-direction: row; + align-items: center; +} + +.fix-button { + margin-left: auto; +} diff --git a/Editor/UI/Dependency.uxml b/Editor/UI/Dependency.uxml index fe270601..ddac9241 100644 --- a/Editor/UI/Dependency.uxml +++ b/Editor/UI/Dependency.uxml @@ -1,7 +1,7 @@ - - -