Merge pull request #1658 from ousttrue/version/v0_99_0

UniVRM-0.99
This commit is contained in:
ousttrue 2022-05-26 15:20:19 +09:00 committed by GitHub
commit d19e5c77be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 393 additions and 686 deletions

View File

@ -4,8 +4,8 @@ namespace UniGLTF
public static partial class UniGLTFVersion
{
public const int MAJOR = 2;
public const int MINOR = 34;
public const int PATCH = 1;
public const string VERSION = "2.34.1";
public const int MINOR = 35;
public const int PATCH = 0;
public const string VERSION = "2.35.0";
}
}

View File

@ -1,6 +1,6 @@
{
"name": "com.vrmc.gltf",
"version": "0.98.1",
"version": "0.99.0",
"displayName": "UniGLTF",
"description": "GLTF importer and exporter",
"unity": "2019.4",
@ -11,6 +11,6 @@
"name": "VRM Consortium"
},
"dependencies": {
"com.vrmc.vrmshaders": "0.98.1"
"com.vrmc.vrmshaders": "0.99.0"
}
}

View File

@ -4,8 +4,8 @@ namespace VRM
public static partial class VRMVersion
{
public const int MAJOR = 0;
public const int MINOR = 98;
public const int PATCH = 1;
public const string VERSION = "0.98.1";
public const int MINOR = 99;
public const int PATCH = 0;
public const string VERSION = "0.99.0";
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2da5e77dc9a21b643ab911c711e319bc
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,180 @@
using System.IO;
using System.Text;
using UnityEditor;
using UnityEngine;
namespace VRM.Sample.BlendShapeMenu
{
public static class BlendShapeMenu
{
static string[] NAMES = new string[]
{
"BrowInnerUp",
"BrowDownLeft",
"BrowDownRight",
"BrowOuterUpLeft",
"BrowOuterUpRight",
"EyeLookUpLeft",
"EyeLookUpRight",
"EyeLookDownLeft",
"EyeLookDownRight",
"EyeLookInLeft",
"EyeLookInRight",
"EyeLookOutLeft",
"EyeLookOutRight",
"EyeBlinkLeft",
"EyeBlinkRight",
"EyeSquintRight",
"EyeSquintLeft",
"EyeWideLeft",
"EyeWideRight",
"CheekPuff",
"CheekSquintLeft",
"CheekSquintRight",
"NoseSneerLeft",
"NoseSneerRight",
"JawOpen",
"JawForward",
"JawLeft",
"JawRight",
"MouthFunnel",
"MouthPucker",
"MouthLeft",
"MouthRight",
"MouthRollUpper",
"MouthRollLower",
"MouthShrugUpper",
"MouthShrugLower",
"MouthClose",
"MouthSmileLeft",
"MouthSmileRight",
"MouthFrownLeft",
"MouthFrownRight",
"MouthDimpleLeft",
"MouthDimpleRight",
"MouthUpperUpLeft",
"MouthUpperUpRight",
"MouthLowerDownLeft",
"MouthLowerDownRight",
"MouthPressLeft",
"MouthPressRight",
"MouthStretchLeft",
"MouthStretchRight",
"TongueOut",
};
/// <summary>
/// fullpath C:/path/to/project/Assets/some.preset to Assets/some.preset
/// </summary>
/// <param name="src"></param>
static string ToUnityPath(string src)
{
if (!src.StartsWith(Application.dataPath))
{
// not in Assets
throw new System.Exception("not in Assets");
}
return "Assets" + src.Substring(Application.dataPath.Length);
}
[MenuItem("CONTEXT/BlendShapeAvatar/Add ARKit FaceTracking BlendShapes")]
public static void AddARKitFaceTrackingBlendShapes(MenuCommand command)
{
// Debug.Log(command.context);
var avatar = command.context as BlendShapeAvatar;
if (avatar == null)
{
Debug.LogError("no context");
return;
}
var assetPath = AssetDatabase.GetAssetPath(avatar);
var dir = EditorUtility.SaveFolderPanel("blendshape folder", assetPath, "");
if (string.IsNullOrEmpty(dir))
{
// cancel
return;
}
var assetDir = ToUnityPath(dir);
var sb = new StringBuilder();
foreach (var name in NAMES)
{
if (avatar.Clips.Find(x => x.Preset == BlendShapePreset.Unknown && x.BlendShapeName == name))
{
// already exists
continue;
}
// new blendshape clip
var clip = ScriptableObject.CreateInstance<BlendShapeClip>();
clip.Preset = BlendShapePreset.Unknown;
clip.name = name;
clip.BlendShapeName = name;
// write blendshape clip
var clipPath = $"{assetDir}/{name}.asset";
sb.AppendLine($"{clipPath}");
AssetDatabase.CreateAsset(clip, clipPath);
// add to avatar
avatar.Clips.Add(clip);
}
Debug.Log("Create\n" + sb.ToString());
}
[MenuItem("CONTEXT/BlendShapeAvatar/Assign all BlendShapes in a folder")]
static void AssginAllBlendShapesInAFolder(MenuCommand command)
{
// Debug.Log(command.context);
var avatar = command.context as BlendShapeAvatar;
if (avatar == null)
{
Debug.LogError("no context");
return;
}
var assetPath = AssetDatabase.GetAssetPath(avatar);
var dir = EditorUtility.SaveFolderPanel("blendshape folder", assetPath, "");
if (string.IsNullOrEmpty(dir))
{
// cancel
return;
}
var assetDir = ToUnityPath(dir);
var sb = new StringBuilder();
foreach (var f in Directory.EnumerateFiles(dir))
{
var extension = Path.GetExtension(f).ToLower();
if (extension != ".asset")
{
// not asset
continue;
}
var clipPath = ToUnityPath(f);
if (clipPath == null)
{
// not BlendShapeClip
continue;
}
var clip = AssetDatabase.LoadAssetAtPath<BlendShapeClip>(clipPath);
if (avatar.Clips.Contains(clip))
{
// already exists
continue;
}
sb.AppendLine(clipPath);
avatar.Clips.Add(clip);
}
Debug.Log($"Assign\n" + sb.ToString());
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9de25cae84f592447b30688da0d6c687
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -44,7 +44,7 @@ RenderSettings:
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 11
m_GIWorkflowMode: 0
m_GIWorkflowMode: 1
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
@ -52,7 +52,7 @@ LightmapSettings:
m_AlbedoBoost: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 1
m_EnableRealtimeLightmaps: 0
m_LightmapEditorSettings:
serializedVersion: 12
m_Resolution: 2
@ -72,21 +72,21 @@ LightmapSettings:
m_FinalGatherRayCount: 256
m_ReflectionCompression: 2
m_MixedBakeMode: 2
m_BakeBackend: 0
m_BakeBackend: 1
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 500
m_PVRSampleCount: 512
m_PVRBounces: 2
m_PVREnvironmentSampleCount: 500
m_PVREnvironmentSampleCount: 256
m_PVREnvironmentReferencePointCount: 2048
m_PVRFilteringMode: 2
m_PVRDenoiserTypeDirect: 0
m_PVRDenoiserTypeIndirect: 0
m_PVRDenoiserTypeAO: 0
m_PVRFilteringMode: 1
m_PVRDenoiserTypeDirect: 1
m_PVRDenoiserTypeIndirect: 1
m_PVRDenoiserTypeAO: 1
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVREnvironmentMIS: 0
m_PVREnvironmentMIS: 1
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
@ -121,7 +121,7 @@ NavMeshSettings:
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &23707192
--- !u!1 &1186819954
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
@ -129,234 +129,43 @@ GameObject:
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 23707193}
- component: {fileID: 23707196}
- component: {fileID: 23707195}
- component: {fileID: 23707194}
m_Layer: 5
m_Name: Export
- component: {fileID: 1186819956}
- component: {fileID: 1186819955}
m_Layer: 0
m_Name: VRMRuntimeExporter
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &23707193
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 23707192}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 1219439930}
m_Father: {fileID: 92488667}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 80, y: -62}
m_SizeDelta: {x: 160, y: 30}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &23707194
--- !u!114 &1186819955
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 23707192}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Highlighted
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 23707195}
m_OnClick:
m_PersistentCalls:
m_Calls: []
--- !u!114 &23707195
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 23707192}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &23707196
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 23707192}
m_CullTransparentMesh: 0
--- !u!1 &92488662
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 92488667}
- component: {fileID: 92488666}
- component: {fileID: 92488665}
- component: {fileID: 92488664}
- component: {fileID: 92488663}
m_Layer: 5
m_Name: Canvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &92488663
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 92488662}
m_GameObject: {fileID: 1186819954}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2228c0f2d73b1c54b82488d4f2504222, type: 3}
m_Name:
m_EditorClassIdentifier:
m_loadButton: {fileID: 1132913042}
m_exportButton: {fileID: 23707194}
UseNormalize: 1
--- !u!114 &92488664
MonoBehaviour:
--- !u!4 &1186819956
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 92488662}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!114 &92488665
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 92488662}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
--- !u!223 &92488666
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 92488662}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 0
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!224 &92488667
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 92488662}
m_GameObject: {fileID: 1186819954}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 1132913041}
- {fileID: 23707193}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!1 &258802523
--- !u!1 &1538405295
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
@ -364,10 +173,10 @@ GameObject:
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 258802527}
- component: {fileID: 258802526}
- component: {fileID: 258802525}
- component: {fileID: 258802524}
- component: {fileID: 1538405299}
- component: {fileID: 1538405298}
- component: {fileID: 1538405297}
- component: {fileID: 1538405296}
m_Layer: 0
m_Name: Plane
m_TagString: Untagged
@ -375,13 +184,27 @@ GameObject:
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!23 &258802524
--- !u!64 &1538405296
MeshCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1538405295}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 4
m_Convex: 0
m_CookingOptions: 30
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &1538405297
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 258802523}
m_GameObject: {fileID: 1538405295}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
@ -402,7 +225,7 @@ MeshRenderer:
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
@ -414,35 +237,21 @@ MeshRenderer:
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!64 &258802525
MeshCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 258802523}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 4
m_Convex: 0
m_CookingOptions: 30
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!33 &258802526
--- !u!33 &1538405298
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 258802523}
m_GameObject: {fileID: 1538405295}
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &258802527
--- !u!4 &1538405299
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 258802523}
m_GameObject: {fileID: 1538405295}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
@ -450,7 +259,7 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1109443755
--- !u!1 &1760773430
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
@ -458,210 +267,8 @@ GameObject:
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1109443760}
- component: {fileID: 1109443759}
- component: {fileID: 1109443756}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!81 &1109443756
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1109443755}
m_Enabled: 1
--- !u!20 &1109443759
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1109443755}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 10
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &1109443760
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1109443755}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1, z: -2}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1132913040
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1132913041}
- component: {fileID: 1132913044}
- component: {fileID: 1132913043}
- component: {fileID: 1132913042}
m_Layer: 5
m_Name: Load
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1132913041
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1132913040}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 1543803958}
m_Father: {fileID: 92488667}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 80, y: -15}
m_SizeDelta: {x: 160, y: 30}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1132913042
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1132913040}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Highlighted
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 1132913043}
m_OnClick:
m_PersistentCalls:
m_Calls: []
--- !u!114 &1132913043
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1132913040}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &1132913044
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1132913040}
m_CullTransparentMesh: 0
--- !u!1 &1207079224
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1207079226}
- component: {fileID: 1207079225}
- component: {fileID: 1760773432}
- component: {fileID: 1760773431}
m_Layer: 0
m_Name: Directional Light
m_TagString: Untagged
@ -669,13 +276,13 @@ GameObject:
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!108 &1207079225
--- !u!108 &1760773431
Light:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1207079224}
m_GameObject: {fileID: 1760773430}
m_Enabled: 1
serializedVersion: 10
m_Type: 1
@ -730,13 +337,13 @@ Light:
m_UseBoundingSphereOverride: 0
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!4 &1207079226
--- !u!4 &1760773432
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1207079224}
m_GameObject: {fileID: 1760773430}
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
m_LocalPosition: {x: 0, y: 3, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
@ -744,7 +351,7 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1 &1219439929
--- !u!1 &2092896552
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
@ -752,217 +359,78 @@ GameObject:
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1219439930}
- component: {fileID: 1219439932}
- component: {fileID: 1219439931}
m_Layer: 5
m_Name: Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1219439930
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1219439929}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 23707193}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1219439931
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1219439929}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: Export
--- !u!222 &1219439932
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1219439929}
m_CullTransparentMesh: 0
--- !u!1 &1474386474
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1474386477}
- component: {fileID: 1474386476}
- component: {fileID: 1474386475}
- component: {fileID: 2092896555}
- component: {fileID: 2092896554}
- component: {fileID: 2092896553}
m_Layer: 0
m_Name: EventSystem
m_TagString: Untagged
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1474386475
MonoBehaviour:
--- !u!81 &2092896553
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1474386474}
m_GameObject: {fileID: 2092896552}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalAxis: Horizontal
m_VerticalAxis: Vertical
m_SubmitButton: Submit
m_CancelButton: Cancel
m_InputActionsPerSecond: 10
m_RepeatDelay: 0.5
m_ForceModuleActive: 0
--- !u!114 &1474386476
MonoBehaviour:
--- !u!20 &2092896554
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1474386474}
m_GameObject: {fileID: 2092896552}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3}
m_Name:
m_EditorClassIdentifier:
m_FirstSelected: {fileID: 0}
m_sendNavigationEvents: 1
m_DragThreshold: 5
--- !u!4 &1474386477
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &2092896555
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1474386474}
m_GameObject: {fileID: 2092896552}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalPosition: {x: 0, y: 1, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1543803957
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1543803958}
- component: {fileID: 1543803960}
- component: {fileID: 1543803959}
m_Layer: 5
m_Name: Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1543803958
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1543803957}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1132913041}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1543803959
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1543803957}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: Load
--- !u!222 &1543803960
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1543803957}
m_CullTransparentMesh: 0

View File

@ -1,41 +1,39 @@
using System;
using System.IO;
using System.Linq;
using UniGLTF;
using System.IO;
using UnityEngine;
using UnityEngine.UI;
using VRM;
using VRMShaders;
namespace VRM.RuntimeExporterSample
{
public class VRMRuntimeExporter : MonoBehaviour
{
[SerializeField] Button m_loadButton = default;
[SerializeField] Button m_exportButton = default;
[SerializeField]
public bool UseNormalize = true;
GameObject m_model;
private void Awake()
void OnGUI()
{
m_loadButton.onClick.AddListener(OnLoadClicked);
if (GUILayout.Button("Load"))
{
Load();
}
m_exportButton.onClick.AddListener(OnExportClicked);
GUI.enabled = m_model != null;
if (GUILayout.Button("Add custom blend shape"))
{
AddBlendShapeClip(m_model);
}
if (GUILayout.Button("Export"))
{
Export(m_model, UseNormalize);
}
}
private void Update()
{
m_exportButton.interactable = (m_model != null);
}
#region Load
async void OnLoadClicked()
async void Load()
{
#if UNITY_STANDALONE_WIN
var path = FileDialogForWindows.FileDialog("open VRM", ".vrm");
@ -50,27 +48,71 @@ namespace VRM.RuntimeExporterSample
}
var loaded = await VrmUtility.LoadAsync(path);
loaded.ShowMeshes();
loaded.EnableUpdateWhenOffscreen();
OnLoaded(loaded.gameObject);
}
void OnLoaded(GameObject go)
{
if (m_model != null)
{
GameObject.Destroy(m_model.gameObject);
}
m_model = go;
m_model.transform.rotation = Quaternion.Euler(0, 180, 0);
m_model = loaded.gameObject;
}
#endregion
#region Export
static void AddBlendShapeClip(GameObject go)
{
// get or create blendshape proxy
var proxy = go.GetComponent<VRMBlendShapeProxy>();
if (proxy == null)
{
proxy = go.AddComponent<VRMBlendShapeProxy>();
}
void OnExportClicked()
// get or create blendshapeavatar
var avatar = proxy.BlendShapeAvatar;
if (avatar == null)
{
avatar = ScriptableObject.CreateInstance<BlendShapeAvatar>();
proxy.BlendShapeAvatar = avatar;
}
// add blendshape clip to avatar.Clips
var clip = ScriptableObject.CreateInstance<BlendShapeClip>();
var name = $"custom#{avatar.Clips.Count}";
Debug.Log($"Add {name}");
// unity asset name
clip.name = name;
// vrm export name
clip.BlendShapeName = name;
clip.Preset = BlendShapePreset.Unknown;
clip.IsBinary = false;
clip.Values = new BlendShapeBinding[]
{
new BlendShapeBinding
{
RelativePath = "mesh/face", // target Renderer relative path from root
Index = 0, // BlendShapeIndex in SkinnedMeshRenderer
Weight = 75f // BlendShape weight, range is [0-100]
},
};
clip.MaterialValues = new MaterialValueBinding[]
{
new MaterialValueBinding
{
MaterialName = "Alicia_body", // target_material_name
ValueName = "_Color", // target_material_property_name,
BaseValue = new Vector4(1, 1, 1, 1), // Target value when the Weight value of BlendShapeClip is 0
TargetValue = new Vector4(0, 0, 0, 1), // Target value when the Weight value of BlendShapeClip is 1
},
};
avatar.Clips.Add(clip);
// done
}
static void Export(GameObject model, bool useNormalize)
{
//#if UNITY_STANDALONE_WIN
#if false
@ -83,7 +125,7 @@ namespace VRM.RuntimeExporterSample
return;
}
var bytes = UseNormalize ? ExportCustom(m_model) : ExportSimple(m_model);
var bytes = useNormalize ? ExportCustom(model) : ExportSimple(model);
File.WriteAllBytes(path, bytes);
Debug.LogFormat("export to {0}", path);
@ -116,7 +158,5 @@ namespace VRM.RuntimeExporterSample
{
Debug.LogFormat("exported");
}
#endregion
}
}

View File

@ -1,6 +1,6 @@
{
"name": "com.vrmc.univrm",
"version": "0.98.1",
"version": "0.99.0",
"displayName": "VRM",
"description": "VRM importer",
"unity": "2019.4",
@ -14,8 +14,8 @@
"name": "VRM Consortium"
},
"dependencies": {
"com.vrmc.vrmshaders": "0.98.1",
"com.vrmc.gltf": "0.98.1"
"com.vrmc.vrmshaders": "0.99.0",
"com.vrmc.gltf": "0.99.0"
},
"samples": [
{

View File

@ -1,6 +1,6 @@
{
"name": "com.vrmc.vrm",
"version": "0.98.1",
"version": "0.99.0",
"displayName": "VRM-1.0β",
"description": "VRM-1.0β importer",
"unity": "2019.4",
@ -14,8 +14,8 @@
"name": "VRM Consortium"
},
"dependencies": {
"com.vrmc.vrmshaders": "0.98.1",
"com.vrmc.gltf": "0.98.1"
"com.vrmc.vrmshaders": "0.99.0",
"com.vrmc.gltf": "0.99.0"
},
"samples": [
{

View File

@ -1,6 +1,6 @@
{
"name": "com.vrmc.vrmshaders",
"version": "0.98.1",
"version": "0.99.0",
"displayName": "VRM Shaders",
"description": "VRM Shaders",
"unity": "2019.4",