Merge branch 'work_v037'

This commit is contained in:
ousttrue
2018-05-30 16:39:00 +09:00
11 changed files with 100 additions and 58 deletions

View File

@@ -99,6 +99,8 @@ namespace VRM
Undo.PerformUndo();
}
var sw = System.Diagnostics.Stopwatch.StartNew();
VRMExporter.Export(target, path, gltf => {
gltf.extensions.VRM.meta.title = Title;
@@ -106,6 +108,8 @@ namespace VRM
});
Debug.LogFormat("Export elapsed {0}", sw.Elapsed);
if (Target.gameObject!=target)
{
GameObject.DestroyImmediate(target);

View File

@@ -10,7 +10,7 @@ namespace VRM
const string template = @"
namespace VRM
{{
public static class VRMVersion
public static partial class VRMVersion
{{
public const int MAJOR = {0};
public const int MINOR = {1};

View File

@@ -459,9 +459,10 @@ namespace VRM
#region LoadVrmAsync
static IEnumerator LoadTextures(VRMImporterContext context)
{
foreach (var gltfTexture in context.GLTF.textures)
for(int i=0; i<context.GLTF.textures.Count; ++i)
{
var x = UniGLTF.gltfImporter.ImportTexture(context.GLTF, gltfTexture.source);
var x = new TextureItem(context.GLTF, i);
x.Process();
context.Textures.Add(x);
yield return null;
}
@@ -606,7 +607,12 @@ namespace VRM
{
var index = i;
parent.AddTask(Scheduler.MainThread,
() => gltfImporter.ImportTexture(ctx.GLTF, index))
() =>
{
var texture = new TextureItem(ctx.GLTF, index);
texture.Process();
return texture;
})
.ContinueWith(Scheduler.ThreadPool, x => ctx.Textures.Add(x));
}
})

View File

@@ -34,7 +34,7 @@ namespace VRM
ParseGlb<glTF_VRM>(bytes);
}
public VRMMetaObject ReadMeta()
public VRMMetaObject ReadMeta(bool createThumbnail=false)
{
var meta=ScriptableObject.CreateInstance<VRMMetaObject>();
meta.name = "Meta";
@@ -46,10 +46,22 @@ namespace VRM
meta.ContactInformation = gltfMeta.contactInformation;
meta.Reference = gltfMeta.reference;
meta.Title = gltfMeta.title;
if (gltfMeta.texture >=0 && gltfMeta.texture< Textures.Count)
if (gltfMeta.texture >= 0 && gltfMeta.texture < Textures.Count)
{
// ロード済み
meta.Thumbnail = Textures[gltfMeta.texture].Texture;
}
else if (createThumbnail)
{
// 作成する(先行ロード用)
if(gltfMeta.texture >= 0 && gltfMeta.texture < VRM.textures.Count)
{
var t = new TextureItem(VRM, gltfMeta.texture);
t.Process();
meta.Thumbnail=t.Texture;
}
}
meta.AllowedUser = gltfMeta.allowedUser;
meta.ViolentUssage = gltfMeta.violentUssage;

View File

@@ -1,59 +1,14 @@
using System;
namespace VRM
{
public static class VRMVersion
public static partial class VRMVersion
{
public const int MAJOR = 0;
public const int MINOR = 36;
public const int MINOR = 37;
public const string VERSION = "0.36";
public const string VERSION = "0.37";
public const string DecrementMenuName = "VRM/Version(0.36) Decrement";
public const string IncrementMenuName = "VRM/Version(0.36) Increment";
public static bool IsNewer(string version)
{
if (string.IsNullOrEmpty(version))
{
return false;
}
var prefix = "UniVRM-";
if (version.StartsWith(prefix))
{
version = version.Substring(prefix.Length);
}
var splited = version.Split('.');
if (splited.Length < 2)
{
return false;
}
try
{
var major = int.Parse(splited[0]);
var minor = int.Parse(splited[1]);
if (major < MAJOR)
{
return false;
}
else if (major > MAJOR)
{
return true;
}
else
{
return minor > MINOR;
}
}
catch (Exception)
{
return false;
}
}
public const string DecrementMenuName = "VRM/Version(0.37) Decrement";
public const string IncrementMenuName = "VRM/Version(0.37) Increment";
}
}

View File

@@ -0,0 +1,51 @@
using System;
namespace VRM
{
public static partial class VRMVersion
{
public static bool IsNewer(string version)
{
if (string.IsNullOrEmpty(version))
{
return false;
}
var prefix = "UniVRM-";
if (version.StartsWith(prefix))
{
version = version.Substring(prefix.Length);
}
var splited = version.Split('.');
if (splited.Length < 2)
{
return false;
}
try
{
var major = int.Parse(splited[0]);
var minor = int.Parse(splited[1]);
if (major < MAJOR)
{
return false;
}
else if (major > MAJOR)
{
return true;
}
else
{
return minor > MINOR;
}
}
catch (Exception)
{
return false;
}
}
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 4ab9ac9856a4d4c4aa652c07c5b496e6
timeCreated: 1522130257
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -77,7 +77,8 @@ namespace VRM
}
public static HumanBodyBones ToHumanBodyBone(this VRMBone bone)
{
#if UNITY_5_6_OR_NEWER
#if UNITY_5_6_OR_NEWER
#else
if (bone == VRMBone.upperChest)
{
return HumanBodyBones.LastBone;

Submodule UniGLTF updated: 04f8a4cea3...038b9900be