-
Notifications
You must be signed in to change notification settings - Fork 430
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1086 from ousttrue/feature10/zip_extract
Feature10/zip extract
- Loading branch information
Showing
12 changed files
with
105 additions
and
31 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
2 changes: 1 addition & 1 deletion
2
...ptedImporter/ScriptedImporterImpl.cs.meta → ...mporter/GlbScriptedImporterEditor.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
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
2 changes: 1 addition & 1 deletion
2
...rter/GlbScriptedImporterEditorGUI.cs.meta → ...Importer/GltfScriptedImporterBase.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
2 changes: 1 addition & 1 deletion
2
...ter/GltfScriptedImporterEditorGUI.cs.meta → ...porter/GltfScriptedImporterEditor.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
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
71 changes: 71 additions & 0 deletions
71
Assets/UniGLTF/Editor/UniGLTF/ScriptedImporter/ZipArchivedGltfScriptedImporterEditor.cs
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,71 @@ | ||
using UnityEditor; | ||
using UnityEngine; | ||
using System.IO; | ||
using System.Linq; | ||
#if UNITY_2020_2_OR_NEWER | ||
using UnityEditor.AssetImporters; | ||
#else | ||
using UnityEditor.Experimental.AssetImporters; | ||
#endif | ||
|
||
|
||
namespace UniGLTF | ||
{ | ||
[CustomEditor(typeof(ZipArchivedGltfScriptedImporter))] | ||
public class ZipArchivedGltfScriptedImporterEditor : RemapScriptedImporterEditorBase | ||
{ | ||
ZipArchivedGltfScriptedImporter m_importer; | ||
GltfData m_data; | ||
|
||
RemapEditorMaterial m_materialEditor; | ||
RemapEditorAnimation m_animationEditor; | ||
|
||
public override void OnEnable() | ||
{ | ||
base.OnEnable(); | ||
|
||
m_importer = target as ZipArchivedGltfScriptedImporter; | ||
m_data = new AmbiguousGltfFileParser(m_importer.assetPath).Parse(); | ||
|
||
var materialGenerator = new GltfMaterialDescriptorGenerator(); | ||
var materialKeys = m_data.GLTF.materials.Select((_, i) => materialGenerator.Get(m_data, i).SubAssetKey); | ||
var textureKeys = new GltfTextureDescriptorGenerator(m_data).Get().GetEnumerable().Select(x => x.SubAssetKey); | ||
m_materialEditor = new RemapEditorMaterial(materialKeys.Concat(textureKeys), GetEditorMap, SetEditorMap); | ||
m_animationEditor = new RemapEditorAnimation(AnimationImporterUtil.EnumerateSubAssetKeys(m_data.GLTF), GetEditorMap, SetEditorMap); | ||
} | ||
|
||
enum Tabs | ||
{ | ||
Model, | ||
Animation, | ||
Materials, | ||
} | ||
static Tabs s_currentTab; | ||
|
||
public override void OnInspectorGUI() | ||
{ | ||
s_currentTab = MeshUtility.TabBar.OnGUI(s_currentTab); | ||
GUILayout.Space(10); | ||
|
||
switch (s_currentTab) | ||
{ | ||
case Tabs.Model: | ||
base.OnInspectorGUI(); | ||
break; | ||
|
||
case Tabs.Animation: | ||
m_animationEditor.OnGUI(m_importer, m_data); | ||
RevertApplyRemapGUI(m_importer); | ||
break; | ||
|
||
case Tabs.Materials: | ||
m_materialEditor.OnGUI(m_importer, m_data, | ||
new GltfTextureDescriptorGenerator(m_data), | ||
assetPath => $"{Path.GetFileNameWithoutExtension(assetPath)}.Textures", | ||
assetPath => $"{Path.GetFileNameWithoutExtension(assetPath)}.Materials"); | ||
RevertApplyRemapGUI(m_importer); | ||
break; | ||
} | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Assets/UniGLTF/Editor/UniGLTF/ScriptedImporter/ZipArchivedGltfScriptedImporterEditor.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.