mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-08-28 05:44:48 -05:00
Merge pull request #1812 from ousttrue/fix10/remove_migration_file_write
Fix10/remove migration file write
This commit is contained in:
@@ -1,56 +0,0 @@
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UniVRM10
|
||||
{
|
||||
public static class MigrationMenu
|
||||
{
|
||||
static VRMShaders.PathObject s_lastPath = VRMShaders.PathObject.UnityAssets;
|
||||
|
||||
const string CONTEXT_MENU = "Assets/Migration: Vrm1";
|
||||
|
||||
[MenuItem(CONTEXT_MENU, true)]
|
||||
static bool Enable()
|
||||
{
|
||||
if (!VRMShaders.PathObject.TryGetFromAsset(Selection.activeObject, out VRMShaders.PathObject path))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
var isVrm = path.Extension.ToLower() == ".vrm";
|
||||
return isVrm;
|
||||
}
|
||||
|
||||
[MenuItem(CONTEXT_MENU, false)]
|
||||
static void Exec()
|
||||
{
|
||||
if (!VRMShaders.PathObject.TryGetFromAsset(Selection.activeObject, out VRMShaders.PathObject path))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// migrate
|
||||
var vrm1Bytes = MigrationVrm.Migrate(path.ReadAllBytes());
|
||||
|
||||
if (!s_lastPath.TrySaveDialog("Save vrm1 file", $"{path.Stem}_vrm1", out VRMShaders.PathObject dst))
|
||||
{
|
||||
return;
|
||||
}
|
||||
s_lastPath = dst.Parent;
|
||||
|
||||
// write result
|
||||
dst.WriteAllBytes(vrm1Bytes);
|
||||
|
||||
if (dst.IsUnderAsset)
|
||||
{
|
||||
// immediately import for GUI update
|
||||
Debug.Log($"import: {dst}");
|
||||
dst.ImportAsset();
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log($"write: {dst}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c0be718f3aba6ad4282a4b74eae9045b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -7,7 +7,7 @@ namespace UniVRM10
|
||||
/// <summary>
|
||||
/// for UnitTest
|
||||
/// </summary>
|
||||
public static class MigrationCheck
|
||||
internal static class MigrationCheck
|
||||
{
|
||||
#region for UnitTest
|
||||
public class MigrationException : Exception
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace UniVRM10
|
||||
{
|
||||
public class MigrationException : Exception
|
||||
internal class MigrationException : Exception
|
||||
{
|
||||
public MigrationException(string key, string value) : base($"{key}: {value}")
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace UniVRM10
|
||||
/// VRM 拡張に含まれる Material 情報を用いて、マイグレーションを行う.
|
||||
/// 前提として、glTF の仕様の範囲で glTFMaterial は既に読み込み済みであると仮定する.
|
||||
/// </summary>
|
||||
public static class MigrationMaterials
|
||||
internal static class MigrationMaterials
|
||||
{
|
||||
private const string DontUseExtensionShaderName = "VRM_USE_GLTFSHADER";
|
||||
private const string MaterialPropertiesKey = "materialProperties";
|
||||
|
||||
@@ -2,7 +2,7 @@ using UniJSON;
|
||||
|
||||
namespace UniVRM10
|
||||
{
|
||||
public static class MigrateVector3
|
||||
internal static class MigrateVector3
|
||||
{
|
||||
/// <summary>
|
||||
/// VRM0は本来 (x, y, -z) と座標変換するべきところをしていない。
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UniGLTF;
|
||||
using UniJSON;
|
||||
using Unity.Collections;
|
||||
|
||||
[assembly: InternalsVisibleTo("VRM10.Tests")]
|
||||
[assembly: InternalsVisibleTo("VRM10.Tests.PlayMode")]
|
||||
|
||||
namespace UniVRM10
|
||||
{
|
||||
/// <summary>
|
||||
/// Convert vrm0 binary to vrm1 binary. Json processing
|
||||
/// </summary>
|
||||
public static class MigrationVrm
|
||||
static internal class MigrationVrm
|
||||
{
|
||||
public static byte[] Migrate(byte[] src)
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@ using UnityEngine;
|
||||
|
||||
namespace UniVRM10
|
||||
{
|
||||
public static class MigrationVrmExpression
|
||||
internal static class MigrationVrmExpression
|
||||
{
|
||||
/// <summary>
|
||||
/// preset 名の文字列から ExpressionPreset を確定させる。
|
||||
|
||||
Reference in New Issue
Block a user