mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-08-20 01:25:45 -05:00
generate Format/ExpressionsNodeTransform
This commit is contained in:
@@ -36,6 +36,7 @@ namespace UniVRM10
|
||||
|
||||
private const string Vrm10SpecDir = "vrm-specification/specification";
|
||||
private const string Vrm10FormatGeneratedDir = "Packages/VRM10/Runtime/Format";
|
||||
private const string UniGltfFormatGeneratedDir = "Packages/UniGLTF/Runtime/UniGLTF/Format";
|
||||
|
||||
public static void Run(bool debug)
|
||||
{
|
||||
@@ -48,7 +49,7 @@ namespace UniVRM10
|
||||
// VRMC_hdr_emissiveMultiplier
|
||||
new GenerateInfo(
|
||||
$"{Vrm10SpecDir}/VRMC_materials_hdr_emissiveMultiplier-1.0/schema/VRMC_materials_hdr_emissiveMultiplier.json",
|
||||
"Assets/UniGLTF/Runtime/UniGLTF/Format/ExtensionsAndExtras/EmissiveMultiplier"
|
||||
$"{UniGltfFormatGeneratedDir}/ExtensionsAndExtras/EmissiveMultiplier"
|
||||
),
|
||||
|
||||
// VRMC_vrm
|
||||
@@ -94,6 +95,14 @@ namespace UniVRM10
|
||||
$"{Vrm10SpecDir}/VRMC_springBone_limit-1.0/schema/VRMC_springBone_limit.schema.json",
|
||||
$"{Vrm10FormatGeneratedDir}/SpringBoneLimit"
|
||||
),
|
||||
|
||||
// VRMC_vrm_expressions_node_transform-1.0
|
||||
// (experimental)
|
||||
// https://github.com/ousttrue/vrm-specification/tree/VRMC_vrm_expression_joint
|
||||
new GenerateInfo(
|
||||
$"{Vrm10SpecDir}/VRMC_vrm_expressions_node_transform-1.0/schema/VRMC_vrm_expressions_node_transform.schema.json",
|
||||
$"{Vrm10FormatGeneratedDir}/ExpressionsNodeTransform"
|
||||
),
|
||||
};
|
||||
|
||||
foreach (var arg in args)
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d80842db26fe76645bf195c10b9c6bf7
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,145 @@
|
||||
// This file is generated from JsonSchema. Don't modify this source code.
|
||||
using UniJSON;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UniGLTF.Extensions.VRMC_vrm_expressions_node_transform {
|
||||
|
||||
public static class GltfDeserializer
|
||||
{
|
||||
public static readonly Utf8String ExtensionNameUtf8 = Utf8String.From(VRMC_vrm_expressions_node_transform.ExtensionName);
|
||||
|
||||
public static bool TryGet(UniGLTF.glTFExtension src, out VRMC_vrm_expressions_node_transform extension)
|
||||
{
|
||||
if(src is UniGLTF.glTFExtensionImport extensions)
|
||||
{
|
||||
foreach(var kv in extensions.ObjectItems())
|
||||
{
|
||||
if(kv.Key.GetUtf8String() == ExtensionNameUtf8)
|
||||
{
|
||||
extension = Deserialize(kv.Value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public static VRMC_vrm_expressions_node_transform Deserialize(JsonNode parsed)
|
||||
{
|
||||
var value = new VRMC_vrm_expressions_node_transform();
|
||||
|
||||
foreach(var kv in parsed.ObjectItems())
|
||||
{
|
||||
var key = kv.Key.GetString();
|
||||
|
||||
if(key=="extensions"){
|
||||
value.Extensions = new glTFExtensionImport(kv.Value);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(key=="extras"){
|
||||
value.Extras = new glTFExtensionImport(kv.Value);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(key=="nodeTransformBinds"){
|
||||
value.NodeTransformBinds = Deserialize_NodeTransformBinds(kv.Value);
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public static List<NodeTransformBind> Deserialize_NodeTransformBinds(JsonNode parsed)
|
||||
{
|
||||
var value = new List<NodeTransformBind>();
|
||||
foreach(var x in parsed.ArrayItems())
|
||||
{
|
||||
value.Add(Deserialize_NodeTransformBinds_ITEM(x));
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public static NodeTransformBind Deserialize_NodeTransformBinds_ITEM(JsonNode parsed)
|
||||
{
|
||||
var value = new NodeTransformBind();
|
||||
|
||||
foreach(var kv in parsed.ObjectItems())
|
||||
{
|
||||
var key = kv.Key.GetString();
|
||||
|
||||
if(key=="extensions"){
|
||||
value.Extensions = new glTFExtensionImport(kv.Value);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(key=="extras"){
|
||||
value.Extras = new glTFExtensionImport(kv.Value);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(key=="node"){
|
||||
value.Node = kv.Value.GetInt32();
|
||||
continue;
|
||||
}
|
||||
|
||||
if(key=="rotation"){
|
||||
value.Rotation = __nodeTransformBinds_ITEM_Deserialize_Rotation(kv.Value);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(key=="scale"){
|
||||
value.Scale = __nodeTransformBinds_ITEM_Deserialize_Scale(kv.Value);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(key=="translation"){
|
||||
value.Translation = __nodeTransformBinds_ITEM_Deserialize_Translation(kv.Value);
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public static float[] __nodeTransformBinds_ITEM_Deserialize_Rotation(JsonNode parsed)
|
||||
{
|
||||
var value = new float[parsed.GetArrayCount()];
|
||||
int i=0;
|
||||
foreach(var x in parsed.ArrayItems())
|
||||
{
|
||||
value[i++] = x.GetSingle();
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public static float[] __nodeTransformBinds_ITEM_Deserialize_Scale(JsonNode parsed)
|
||||
{
|
||||
var value = new float[parsed.GetArrayCount()];
|
||||
int i=0;
|
||||
foreach(var x in parsed.ArrayItems())
|
||||
{
|
||||
value[i++] = x.GetSingle();
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public static float[] __nodeTransformBinds_ITEM_Deserialize_Translation(JsonNode parsed)
|
||||
{
|
||||
var value = new float[parsed.GetArrayCount()];
|
||||
int i=0;
|
||||
foreach(var x in parsed.ArrayItems())
|
||||
{
|
||||
value[i++] = x.GetSingle();
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
} // GltfDeserializer
|
||||
} // UniGLTF
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0a0544899292fe54e961d98e2f7d755c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,43 @@
|
||||
// This file is generated from JsonSchema. Don't modify this source code.
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
|
||||
namespace UniGLTF.Extensions.VRMC_vrm_expressions_node_transform
|
||||
{
|
||||
|
||||
public class NodeTransformBind
|
||||
{
|
||||
// Dictionary object with extension-specific objects.
|
||||
public object Extensions;
|
||||
|
||||
// Application-specific data.
|
||||
public object Extras;
|
||||
|
||||
// The node index.
|
||||
public int? Node;
|
||||
|
||||
// The node's unit quaternion rotation in the order (x, y, z, w), where w is the scalar.
|
||||
public float[] Rotation;
|
||||
|
||||
// The node's non-uniform scale, given as the scaling factors along the x, y, and z axes.
|
||||
public float[] Scale;
|
||||
|
||||
// The node's translation along the x, y, and z axes.
|
||||
public float[] Translation;
|
||||
}
|
||||
|
||||
public class VRMC_vrm_expressions_node_transform
|
||||
{
|
||||
public const string ExtensionName = "VRMC_vrm_expressions_node_transform";
|
||||
|
||||
// Dictionary object with extension-specific objects.
|
||||
public object Extensions;
|
||||
|
||||
// Application-specific data.
|
||||
public object Extras;
|
||||
|
||||
// Specify a node transform
|
||||
public List<NodeTransformBind> NodeTransformBinds;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3f6d0369358084249b383bea969b16a6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,141 @@
|
||||
// This file is generated from JsonSchema. Don't modify this source code.
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UniJSON;
|
||||
|
||||
namespace UniGLTF.Extensions.VRMC_vrm_expressions_node_transform {
|
||||
|
||||
static public class GltfSerializer
|
||||
{
|
||||
|
||||
public static void SerializeTo(ref UniGLTF.glTFExtension dst, VRMC_vrm_expressions_node_transform extension)
|
||||
{
|
||||
if (dst is glTFExtensionImport)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
if (!(dst is glTFExtensionExport extensions))
|
||||
{
|
||||
extensions = new glTFExtensionExport();
|
||||
dst = extensions;
|
||||
}
|
||||
|
||||
var f = new JsonFormatter();
|
||||
Serialize(f, extension);
|
||||
extensions.Add(VRMC_vrm_expressions_node_transform.ExtensionName, f.GetStoreBytes());
|
||||
}
|
||||
|
||||
|
||||
public static void Serialize(JsonFormatter f, VRMC_vrm_expressions_node_transform value)
|
||||
{
|
||||
f.BeginMap();
|
||||
|
||||
|
||||
if(value.Extensions!=null){
|
||||
f.Key("extensions");
|
||||
(value.Extensions as glTFExtension).Serialize(f);
|
||||
}
|
||||
|
||||
if(value.Extras!=null){
|
||||
f.Key("extras");
|
||||
(value.Extras as glTFExtension).Serialize(f);
|
||||
}
|
||||
|
||||
if(value.NodeTransformBinds!=null&&value.NodeTransformBinds.Count()>=1){
|
||||
f.Key("nodeTransformBinds");
|
||||
Serialize_NodeTransformBinds(f, value.NodeTransformBinds);
|
||||
}
|
||||
|
||||
f.EndMap();
|
||||
}
|
||||
|
||||
public static void Serialize_NodeTransformBinds(JsonFormatter f, List<NodeTransformBind> value)
|
||||
{
|
||||
f.BeginList();
|
||||
|
||||
foreach(var item in value)
|
||||
{
|
||||
Serialize_NodeTransformBinds_ITEM(f, item);
|
||||
|
||||
}
|
||||
f.EndList();
|
||||
}
|
||||
|
||||
public static void Serialize_NodeTransformBinds_ITEM(JsonFormatter f, NodeTransformBind value)
|
||||
{
|
||||
f.BeginMap();
|
||||
|
||||
|
||||
if(value.Extensions!=null){
|
||||
f.Key("extensions");
|
||||
(value.Extensions as glTFExtension).Serialize(f);
|
||||
}
|
||||
|
||||
if(value.Extras!=null){
|
||||
f.Key("extras");
|
||||
(value.Extras as glTFExtension).Serialize(f);
|
||||
}
|
||||
|
||||
if(value.Node.HasValue){
|
||||
f.Key("node");
|
||||
f.Value(value.Node.GetValueOrDefault());
|
||||
}
|
||||
|
||||
if(value.Rotation!=null&&value.Rotation.Count()>=4){
|
||||
f.Key("rotation");
|
||||
__nodeTransformBinds_ITEM_Serialize_Rotation(f, value.Rotation);
|
||||
}
|
||||
|
||||
if(value.Scale!=null&&value.Scale.Count()>=3){
|
||||
f.Key("scale");
|
||||
__nodeTransformBinds_ITEM_Serialize_Scale(f, value.Scale);
|
||||
}
|
||||
|
||||
if(value.Translation!=null&&value.Translation.Count()>=3){
|
||||
f.Key("translation");
|
||||
__nodeTransformBinds_ITEM_Serialize_Translation(f, value.Translation);
|
||||
}
|
||||
|
||||
f.EndMap();
|
||||
}
|
||||
|
||||
public static void __nodeTransformBinds_ITEM_Serialize_Rotation(JsonFormatter f, float[] value)
|
||||
{
|
||||
f.BeginList();
|
||||
|
||||
foreach(var item in value)
|
||||
{
|
||||
f.Value(item);
|
||||
|
||||
}
|
||||
f.EndList();
|
||||
}
|
||||
|
||||
public static void __nodeTransformBinds_ITEM_Serialize_Scale(JsonFormatter f, float[] value)
|
||||
{
|
||||
f.BeginList();
|
||||
|
||||
foreach(var item in value)
|
||||
{
|
||||
f.Value(item);
|
||||
|
||||
}
|
||||
f.EndList();
|
||||
}
|
||||
|
||||
public static void __nodeTransformBinds_ITEM_Serialize_Translation(JsonFormatter f, float[] value)
|
||||
{
|
||||
f.BeginList();
|
||||
|
||||
foreach(var item in value)
|
||||
{
|
||||
f.Value(item);
|
||||
|
||||
}
|
||||
f.EndList();
|
||||
}
|
||||
|
||||
} // class
|
||||
} // namespace
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 16a49328d069d9f47840c104597af4a4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -44,10 +44,10 @@ namespace UniGLTF.Extensions.VRMC_springBone_limit
|
||||
// Application-specific data.
|
||||
public object Extras;
|
||||
|
||||
// The phi angle of the spherical limit in radians. If the phi angle is set to π or greater, the angle will be interpreted as π by the implementation.
|
||||
// The pitch angle of the spherical limit in radians. If the pitch angle is set to π or greater, the angle will be interpreted as π by the implementation.
|
||||
public float? Pitch;
|
||||
|
||||
// The theta angle of the spherical limit in radians. If the theta angle is set to π/2 or greater, the angle will be interpreted as π/2 by the implementation.
|
||||
// The yaw angle of the spherical limit in radians. If the yaw angle is set to π/2 or greater, the angle will be interpreted as π/2 by the implementation.
|
||||
public float? Yaw;
|
||||
|
||||
// The rotation from the default orientation of the spherical limit. The rotation is represented as a quaternion (x, y, z, w), where w is the scalar.
|
||||
|
||||
Reference in New Issue
Block a user