mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-09-12 13:59:21 -05:00
ScriptedImporterImpl to GltfScriptedImporterBase
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
#if UNITY_2020_2_OR_NEWER
|
||||
using UnityEditor.AssetImporters;
|
||||
#else
|
||||
@@ -10,14 +8,11 @@ using UnityEditor.Experimental.AssetImporters;
|
||||
namespace UniGLTF
|
||||
{
|
||||
[ScriptedImporter(1, "glb")]
|
||||
public class GlbScriptedImporter : ScriptedImporter
|
||||
public class GlbScriptedImporter : GltfScriptedImporterBase
|
||||
{
|
||||
[SerializeField]
|
||||
public ScriptedImporterAxes m_reverseAxis;
|
||||
|
||||
public override void OnImportAsset(AssetImportContext ctx)
|
||||
{
|
||||
ScriptedImporterImpl.Import(this, ctx, m_reverseAxis.ToAxes());
|
||||
Import(this, ctx, m_reverseAxis.ToAxes());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
#if UNITY_2020_2_OR_NEWER
|
||||
using UnityEditor.AssetImporters;
|
||||
#else
|
||||
@@ -10,14 +8,11 @@ using UnityEditor.Experimental.AssetImporters;
|
||||
namespace UniGLTF
|
||||
{
|
||||
[ScriptedImporter(1, "gltf")]
|
||||
public class GltfScriptedImporter : ScriptedImporter
|
||||
public class GltfScriptedImporter : GltfScriptedImporterBase
|
||||
{
|
||||
[SerializeField]
|
||||
public ScriptedImporterAxes m_reverseAxis = default;
|
||||
|
||||
public override void OnImportAsset(AssetImportContext ctx)
|
||||
{
|
||||
ScriptedImporterImpl.Import(this, ctx, m_reverseAxis.ToAxes());
|
||||
Import(this, ctx, m_reverseAxis.ToAxes());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System.Linq;
|
||||
using VRMShaders;
|
||||
#if UNITY_2020_2_OR_NEWER
|
||||
using UnityEditor.AssetImporters;
|
||||
@@ -10,15 +11,21 @@ using UnityEditor.Experimental.AssetImporters;
|
||||
|
||||
namespace UniGLTF
|
||||
{
|
||||
public static class ScriptedImporterImpl
|
||||
/// <summary>
|
||||
/// ScriptedImporterImpl から改め
|
||||
/// </summary>
|
||||
public abstract class GltfScriptedImporterBase : ScriptedImporter
|
||||
{
|
||||
[SerializeField]
|
||||
public ScriptedImporterAxes m_reverseAxis = default;
|
||||
|
||||
/// <summary>
|
||||
/// glb をパースして、UnityObject化、さらにAsset化する
|
||||
/// </summary>
|
||||
/// <param name="scriptedImporter"></param>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="reverseAxis"></param>
|
||||
public static void Import(ScriptedImporter scriptedImporter, AssetImportContext context, Axes reverseAxis)
|
||||
protected static void Import(ScriptedImporter scriptedImporter, AssetImportContext context, Axes reverseAxis)
|
||||
{
|
||||
#if VRM_DEVELOP
|
||||
Debug.Log("OnImportAsset to " + scriptedImporter.assetPath);
|
||||
@@ -28,7 +35,7 @@ namespace UniGLTF
|
||||
// Parse(parse glb, parser gltf json)
|
||||
//
|
||||
var data = new AmbiguousGltfFileParser(scriptedImporter.assetPath).Parse();
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Import(create unity objects)
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 85bf14b48ed135743828ee49a830b1c6
|
||||
guid: ae1df0d1926e49f489c74bdf6ca369b5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -1,5 +1,3 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
#if UNITY_2020_2_OR_NEWER
|
||||
using UnityEditor.AssetImporters;
|
||||
#else
|
||||
@@ -12,14 +10,11 @@ namespace UniGLTF
|
||||
#if UNIGLTF_ENABLE_ZIPARCHVIE_IMPORTER
|
||||
[ScriptedImporter(1, "zip")]
|
||||
#endif
|
||||
public class ZipArchivedGltfScriptedImporter : ScriptedImporter
|
||||
public class ZipArchivedGltfScriptedImporter : GltfScriptedImporterBase
|
||||
{
|
||||
[SerializeField]
|
||||
public ScriptedImporterAxes m_reverseAxis = default;
|
||||
|
||||
public override void OnImportAsset(AssetImportContext ctx)
|
||||
{
|
||||
ScriptedImporterImpl.Import(this, ctx, m_reverseAxis.ToAxes());
|
||||
Import(this, ctx, m_reverseAxis.ToAxes());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user