Exporting models support
This commit is contained in:
@@ -7301,7 +7301,7 @@ GameObject:
|
|||||||
- component: {fileID: 305581831}
|
- component: {fileID: 305581831}
|
||||||
- component: {fileID: 305581830}
|
- component: {fileID: 305581830}
|
||||||
m_Layer: 5
|
m_Layer: 5
|
||||||
m_Name: ExportTextures
|
m_Name: ExportModel
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
@@ -7373,7 +7373,7 @@ MonoBehaviour:
|
|||||||
m_Calls:
|
m_Calls:
|
||||||
- m_Target: {fileID: 1564959567}
|
- m_Target: {fileID: 1564959567}
|
||||||
m_TargetAssemblyTypeName: UmaViewerUI, umamusume
|
m_TargetAssemblyTypeName: UmaViewerUI, umamusume
|
||||||
m_MethodName: ExportTextures
|
m_MethodName: ExportModel
|
||||||
m_Mode: 1
|
m_Mode: 1
|
||||||
m_Arguments:
|
m_Arguments:
|
||||||
m_ObjectArgument: {fileID: 0}
|
m_ObjectArgument: {fileID: 0}
|
||||||
@@ -13708,7 +13708,7 @@ MonoBehaviour:
|
|||||||
m_OnCullStateChanged:
|
m_OnCullStateChanged:
|
||||||
m_PersistentCalls:
|
m_PersistentCalls:
|
||||||
m_Calls: []
|
m_Calls: []
|
||||||
m_text: Export Textures
|
m_text: Export Model
|
||||||
m_isRightToLeft: 0
|
m_isRightToLeft: 0
|
||||||
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
|
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
|
||||||
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
|
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Runtime.Serialization;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityGLTF;
|
||||||
|
|
||||||
|
|
||||||
|
public class ModelExporter
|
||||||
|
{
|
||||||
|
public static string RetrieveTexturePath(UnityEngine.Texture texture)
|
||||||
|
{
|
||||||
|
string m_Path = Application.dataPath;
|
||||||
|
var path = m_Path + "/../unknown/" + texture.name; ;
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Export(Transform[] transforms, string sceneName)
|
||||||
|
{
|
||||||
|
var exportOptions = new UnityGLTF.ExportOptions { TexturePathRetriever = RetrieveTexturePath };
|
||||||
|
var exporter = new GLTFSceneExporter(transforms, exportOptions);
|
||||||
|
|
||||||
|
string m_Path = Application.dataPath;
|
||||||
|
|
||||||
|
string path = m_Path + "/../Exported/" + sceneName;
|
||||||
|
|
||||||
|
var resultFile = GLTFSceneExporter.GetFileName(path, sceneName, ".gltf");
|
||||||
|
|
||||||
|
exporter.SaveGLTFandBin(path, sceneName);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void exportModel(GameObject gameobj)
|
||||||
|
{
|
||||||
|
string sceneName = gameobj.name;
|
||||||
|
Transform[] rootTransforms = new Transform[] { gameobj.transform };
|
||||||
|
|
||||||
|
Export(rootTransforms, sceneName);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: bf3b5b616874ba1479b187dd881b2ebb
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -31,7 +31,7 @@ public class TextureExporter
|
|||||||
{
|
{
|
||||||
string m_Path = Application.dataPath;
|
string m_Path = Application.dataPath;
|
||||||
|
|
||||||
string savePath = m_Path + "/../Texture2D/" + gameobj.name + "/";
|
string savePath = m_Path + "/../Exported/" + gameobj.name + "/Texture2D/";
|
||||||
|
|
||||||
if (!Directory.Exists(savePath))
|
if (!Directory.Exists(savePath))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1310,10 +1310,12 @@ public class UmaViewerUI : MonoBehaviour
|
|||||||
MessageScrollRect.verticalNormalizedPosition = 0;
|
MessageScrollRect.verticalNormalizedPosition = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ExportTextures()
|
public void ExportModel()
|
||||||
{
|
{
|
||||||
if (Builder.CurrentUMAContainer)
|
if (Builder.CurrentUMAContainer)
|
||||||
{
|
{
|
||||||
|
//TextureExporter.exportAllTexture(Builder.CurrentUMAContainer.gameObject);
|
||||||
|
ModelExporter.exportModel(Builder.CurrentUMAContainer.gameObject);
|
||||||
TextureExporter.exportAllTexture(Builder.CurrentUMAContainer.gameObject);
|
TextureExporter.exportAllTexture(Builder.CurrentUMAContainer.gameObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,8 @@
|
|||||||
"GUID:800597811bcc5d848b15e12807d6de45",
|
"GUID:800597811bcc5d848b15e12807d6de45",
|
||||||
"GUID:d60799ab2a985554ea1a39cd38695018",
|
"GUID:d60799ab2a985554ea1a39cd38695018",
|
||||||
"GUID:fd1d627189c561043911a07470238b9c",
|
"GUID:fd1d627189c561043911a07470238b9c",
|
||||||
"GUID:145e2572884581c48a08acf566c1a1d6"
|
"GUID:145e2572884581c48a08acf566c1a1d6",
|
||||||
|
"GUID:18d18f811ba286c49814567a3cfba688"
|
||||||
],
|
],
|
||||||
"includePlatforms": [],
|
"includePlatforms": [],
|
||||||
"excludePlatforms": [],
|
"excludePlatforms": [],
|
||||||
|
|||||||
Reference in New Issue
Block a user