-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## [6.7.0] - 2024-06-25 ### Added - (Import) Support for [materials variants extension](https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_variants). - Serialization support for material extensions IOR, Sheen and Specular. - (Import) Ability to load a glTF from a generic `Stream` (`GltfImport.LoadStream`; thanks [sandr01d][sandr01d] for [#10](Unity-Technologies/com.unity.cloud.gltfast#10)). ### Changed - (Import) Prefabs imported from glTF assets (at design-time) don't have the glTF logo icon assigned to them anymore. This makes it more consistent with other file types (like FBX; fixes [#557](atteneder/glTFast#557)). ### Deprecated - `MetaMaterialExport`. Always use `MaterialExport.GetDefaultMaterialExport` to get the correct material export. ### Fixed - (Export) glTFast shader based materials and textures are exported correctly when using the default render pipeline. - Added missing entries to the API documentation. - (Export) Base colors are now in correct, linear color space. - Alpha mode blend now works as expected in HDRP 11 and newer as well (fixes [#699](atteneder/glTFast#699)). - (Export) Fixed mesh min/max when using Draco compression.
- Loading branch information
Unity Technologies
committed
Jun 25, 2024
1 parent
0155961
commit 1674ff3
Showing
60 changed files
with
1,411 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"DefineConstants": "DRACO_UNITY;KTX_UNITY;KTX_UNITY_1_3_OR_NEWER;KTX_UNITY_2_2_OR_NEWER;USING_URP;USING_HDRP;USING_HDRP_10_OR_NEWER;UNITY_PHYSICS;UNITY_IMAGECONVERSION;UNITY_WEBREQUEST_TEXTURE;MESHOPT;USING_URP_12_OR_NEWER;UNITY_SHADER_GRAPH_12_OR_NEWER;UNITY_ANIMATION;UNITY_ENTITIES_GRAPHICS;NEWTONSOFT_JSON" | ||
"DefineConstants": "DRACO_UNITY;KTX_UNITY;KTX_UNITY_1_3_OR_NEWER;KTX_UNITY_2_2_OR_NEWER;USING_URP;USING_HDRP;USING_HDRP_10_OR_NEWER;UNITY_PHYSICS;UNITY_IMAGECONVERSION;UNITY_WEBREQUEST_TEXTURE;MESHOPT;USING_URP_12_OR_NEWER;UNITY_SHADER_GRAPH;UNITY_SHADER_GRAPH_12_OR_NEWER;UNITY_ANIMATION;UNITY_ENTITIES_GRAPHICS;NEWTONSOFT_JSON" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
// SPDX-FileCopyrightText: 2024 Unity Technologies and the glTFast authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
using System.Collections.Generic; | ||
using UnityEditor; | ||
using UnityEngine; | ||
using UnityEngine.UIElements; | ||
|
||
namespace GLTFast.Editor | ||
{ | ||
[CustomEditor(typeof(MaterialsVariantsComponent))] | ||
class MaterialsVariantsComponentInspector : UnityEditor.Editor | ||
{ | ||
[SerializeField] VisualTreeAsset m_MainMarkup; | ||
|
||
List<string> m_VariantNames; | ||
#if UNITY_2021_2_OR_NEWER | ||
DropdownField m_Dropdown; | ||
#endif | ||
|
||
public override VisualElement CreateInspectorGUI() | ||
{ | ||
if (m_VariantNames == null) | ||
{ | ||
var control = (target as MaterialsVariantsComponent)?.Control; | ||
if (control != null) | ||
{ | ||
var count = control.MaterialsVariantsCount; | ||
m_VariantNames = new List<string>(count + 1) | ||
{ | ||
"<no variant>" | ||
}; | ||
for (var variantIndex = 0; variantIndex < count; variantIndex++) | ||
{ | ||
m_VariantNames.Add(control.GetMaterialsVariantName(variantIndex)); | ||
} | ||
} | ||
} | ||
var myInspector = new VisualElement(); | ||
#if UNITY_2021_2_OR_NEWER | ||
m_MainMarkup.CloneTree(myInspector); | ||
m_Dropdown = myInspector.Query<DropdownField>().First(); | ||
|
||
if (m_VariantNames == null) | ||
{ | ||
myInspector.SetEnabled(false); | ||
} | ||
else | ||
{ | ||
m_Dropdown.choices = m_VariantNames; | ||
m_Dropdown.index = 0; | ||
m_Dropdown.RegisterValueChangedCallback(OnMaterialsVariantChanged); | ||
myInspector.Add(m_Dropdown); | ||
} | ||
#else | ||
if (m_VariantNames == null) | ||
{ | ||
myInspector.SetEnabled(false); | ||
} | ||
else | ||
{ | ||
for (var i = 0; i < m_VariantNames.Count; i++) | ||
{ | ||
var button = new Button | ||
{ | ||
text = m_VariantNames[i] | ||
}; | ||
|
||
button.RegisterCallback<ClickEvent, int>(OnVariantButtonClicked, i - 1); // asset is the root visual element that will be closed | ||
myInspector.Add(button); | ||
} | ||
} | ||
#endif | ||
return myInspector; | ||
} | ||
|
||
#if UNITY_2021_2_OR_NEWER | ||
void OnMaterialsVariantChanged(ChangeEvent<string> evt) | ||
{ | ||
var control = (target as MaterialsVariantsComponent)?.Control; | ||
if (control != null) | ||
{ | ||
_ = control.ApplyMaterialsVariantAsync(m_Dropdown.index - 1); | ||
} | ||
} | ||
#else | ||
void OnVariantButtonClicked(ClickEvent evt, int variantIndex) | ||
{ | ||
var control = (target as MaterialsVariantsComponent)?.Control; | ||
if (control != null) | ||
{ | ||
_ = control.ApplyMaterialsVariantAsync(variantIndex); | ||
} | ||
} | ||
#endif | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
Editor/Scripts/MaterialsVariantsComponentInspector.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" editor-extension-mode="False"> | ||
<ui:DropdownField label="Materials Variant" /> | ||
</ui:UXML> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.