mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-08-22 18:45:06 -05:00
Merge branch 'master' into mtoonVisualArtifact
This commit is contained in:
@@ -56,12 +56,12 @@ namespace UniGLTF
|
||||
});
|
||||
|
||||
Profiler.BeginSample("MeshUploader.BuildBlendShapeAsync");
|
||||
if (blendShape.Positions.Count > 0)
|
||||
if (positions.Length > 0)
|
||||
{
|
||||
if (blendShape.Positions.Count == mesh.vertexCount)
|
||||
if (positions.Length == mesh.vertexCount)
|
||||
{
|
||||
mesh.AddBlendShapeFrame(blendShape.Name, FrameWeight,
|
||||
blendShape.Positions.ToArray(),
|
||||
positions,
|
||||
normals.Length == mesh.vertexCount && normals.Length == positions.Length ? normals : null,
|
||||
null
|
||||
);
|
||||
|
||||
@@ -69,9 +69,14 @@ namespace UniGLTF
|
||||
public NativeArray<T> CreateNativeArray<T>(ArraySegment<T> data) where T : struct
|
||||
{
|
||||
var array = CreateNativeArray<T>(data.Count);
|
||||
#if UNITY_2022_2_OR_NEWER
|
||||
var toSpan = array.AsSpan();
|
||||
var fromSpan = data.AsSpan();
|
||||
fromSpan.CopyTo(toSpan);
|
||||
#else
|
||||
for (int i = 0; i < data.Count; i++)
|
||||
array[i] = data.Array[data.Offset + i];
|
||||
#endif
|
||||
return array;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace UniGLTF
|
||||
{
|
||||
public const int MAJOR = 0;
|
||||
public const int MINOR = 129;
|
||||
public const int PATCH = 0;
|
||||
public const string VERSION = "0.129.0";
|
||||
public const int PATCH = 1;
|
||||
public const string VERSION = "0.129.1";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace UniGLTF
|
||||
{
|
||||
public const int MAJOR = 2;
|
||||
public const int MINOR = 65;
|
||||
public const int PATCH = 0;
|
||||
public const string VERSION = "2.65.0";
|
||||
public const int PATCH = 1;
|
||||
public const string VERSION = "2.65.1";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "com.vrmc.gltf",
|
||||
"version": "0.129.0",
|
||||
"version": "0.129.1",
|
||||
"displayName": "UniGLTF",
|
||||
"description": "GLTF importer and exporter",
|
||||
"unity": "2021.3",
|
||||
@@ -11,7 +11,10 @@
|
||||
"name": "VRM Consortium"
|
||||
},
|
||||
"dependencies": {
|
||||
"com.unity.modules.animation": "1.0.0"
|
||||
"com.unity.modules.animation": "1.0.0",
|
||||
"com.unity.modules.imgui": "1.0.0",
|
||||
"com.unity.modules.imageconversion": "1.0.0",
|
||||
"com.unity.test-framework": "1.4.6"
|
||||
},
|
||||
"samples": [
|
||||
{
|
||||
|
||||
@@ -169,7 +169,10 @@ namespace UniGLTF
|
||||
""name"": ""VRM Consortium""
|
||||
}},
|
||||
""dependencies"": {{
|
||||
""com.unity.modules.animation"": ""1.0.0""
|
||||
""com.unity.modules.animation"": ""1.0.0"",
|
||||
""com.unity.modules.imgui"": ""1.0.0"",
|
||||
""com.unity.modules.imageconversion"": ""1.0.0"",
|
||||
""com.unity.test-framework"": ""1.4.6""
|
||||
}},
|
||||
""samples"": [
|
||||
{{
|
||||
|
||||
@@ -16,6 +16,30 @@ namespace VRM
|
||||
m_target = (VRMSpringBoneColliderGroup)target;
|
||||
}
|
||||
|
||||
private void OnSceneGUI()
|
||||
{
|
||||
Undo.RecordObject(m_target, "VRMSpringBoneColliderGroupEditor");
|
||||
|
||||
Handles.matrix = m_target.transform.localToWorldMatrix;
|
||||
Gizmos.color = Color.green;
|
||||
|
||||
bool changed = false;
|
||||
|
||||
foreach (var x in m_target.Colliders)
|
||||
{
|
||||
var offset = Handles.PositionHandle(x.Offset, Quaternion.identity);
|
||||
if (offset != x.Offset)
|
||||
{
|
||||
changed = true;
|
||||
x.Offset = offset;
|
||||
}
|
||||
}
|
||||
|
||||
if (changed)
|
||||
{
|
||||
EditorUtility.SetDirty(m_target);
|
||||
}
|
||||
}
|
||||
|
||||
override public void OnInspectorGUI()
|
||||
{
|
||||
@@ -55,6 +79,28 @@ namespace VRM
|
||||
target.Colliders = target.Colliders.OrderBy(x => -x.Radius).ToArray();
|
||||
}
|
||||
|
||||
[MenuItem("CONTEXT/VRMSpringBoneColliderGroup/Sort Colliders Reversed")]
|
||||
private static void SortReverse(MenuCommand command)
|
||||
{
|
||||
var target = command.context as VRMSpringBoneColliderGroup;
|
||||
if (target == null) return;
|
||||
|
||||
Undo.RecordObject(target, "Sort Colliders Reversed");
|
||||
|
||||
target.Colliders = target.Colliders.Reverse().ToArray();
|
||||
}
|
||||
|
||||
[MenuItem("CONTEXT/VRMSpringBoneColliderGroup/Sort Colliders by Offset X")]
|
||||
private static void SortByOffsetX(MenuCommand command)
|
||||
{
|
||||
var target = command.context as VRMSpringBoneColliderGroup;
|
||||
if (target == null) return;
|
||||
|
||||
Undo.RecordObject(target, "Sort Colliders by Offset X");
|
||||
|
||||
target.Colliders = target.Colliders.OrderBy(x => x.Offset.x).ToArray();
|
||||
}
|
||||
|
||||
[MenuItem("CONTEXT/VRMSpringBoneColliderGroup/Sort Colliders by Offset Y")]
|
||||
private static void SortByOffsetY(MenuCommand command)
|
||||
{
|
||||
@@ -63,7 +109,18 @@ namespace VRM
|
||||
|
||||
Undo.RecordObject(target, "Sort Colliders by Offset Y");
|
||||
|
||||
target.Colliders = target.Colliders.OrderBy(x => -x.Offset.y).ToArray();
|
||||
target.Colliders = target.Colliders.OrderBy(x => x.Offset.y).ToArray();
|
||||
}
|
||||
|
||||
[MenuItem("CONTEXT/VRMSpringBoneColliderGroup/Sort Colliders by Offset Z")]
|
||||
private static void SortByOffsetZ(MenuCommand command)
|
||||
{
|
||||
var target = command.context as VRMSpringBoneColliderGroup;
|
||||
if (target == null) return;
|
||||
|
||||
Undo.RecordObject(target, "Sort Colliders by Offset Z");
|
||||
|
||||
target.Colliders = target.Colliders.OrderBy(x => x.Offset.z).ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "com.vrmc.univrm",
|
||||
"version": "0.129.0",
|
||||
"version": "0.129.1",
|
||||
"displayName": "VRM",
|
||||
"description": "VRM importer",
|
||||
"unity": "2021.3",
|
||||
@@ -14,7 +14,7 @@
|
||||
"name": "VRM Consortium"
|
||||
},
|
||||
"dependencies": {
|
||||
"com.vrmc.gltf": "0.129.0",
|
||||
"com.vrmc.gltf": "0.129.1",
|
||||
"com.unity.ugui": "1.0.0"
|
||||
},
|
||||
"samples": [
|
||||
|
||||
@@ -139,7 +139,18 @@ namespace UniVRM10
|
||||
{
|
||||
// importer 内で InitializeAsync が呼び出し済み
|
||||
}
|
||||
return new Vrm10Runtime(this, useControlRig, m_springBoneRuntime);
|
||||
|
||||
var runtime = GetComponent<RuntimeGltfInstance>();
|
||||
|
||||
// Vrm10Runtimeが使う初期姿勢を固定する。SpringBone や Constraint の初期姿勢になる。
|
||||
var initPose = runtime != null
|
||||
// RuntimeGltfInstance があるとき => RuntimeLoad => 初期姿勢は glTF の node に由来する
|
||||
? runtime.InitialTransformStates.ToDictionary((kv) => kv.Key, (kv) => kv.Value)
|
||||
// RuntimeGltfInstance が無いとき => Scene 配置の prefab など。シーンの現状を代用する。既に T-Pose でないかもしれない。
|
||||
: GetComponentsInChildren<Transform>().ToDictionary(x => x, x => new TransformState(x))
|
||||
;
|
||||
|
||||
return new Vrm10Runtime(this, useControlRig, m_springBoneRuntime, initPose);
|
||||
}
|
||||
|
||||
public Vrm10Runtime Runtime
|
||||
|
||||
@@ -49,25 +49,21 @@ namespace UniVRM10
|
||||
}
|
||||
}
|
||||
|
||||
Dictionary<Transform, TransformState> _initPose;
|
||||
IReadOnlyDictionary<Transform, TransformState> _initPose;
|
||||
|
||||
public Vrm10Runtime(Vrm10Instance instance, bool useControlRig, IVrm10SpringBoneRuntime springBoneRuntime)
|
||||
public Vrm10Runtime(Vrm10Instance instance, bool useControlRig, IVrm10SpringBoneRuntime springBoneRuntime,
|
||||
IReadOnlyDictionary<Transform, TransformState> initPose)
|
||||
{
|
||||
if (!Application.isPlaying)
|
||||
{
|
||||
UniGLTFLogger.Warning($"{nameof(Vrm10Runtime)} expects runtime behaviour.");
|
||||
}
|
||||
if (instance == null)
|
||||
{
|
||||
m_instance = null;
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_instance != instance)
|
||||
_initPose = initPose;
|
||||
m_instance = instance;
|
||||
if (m_instance == null)
|
||||
{
|
||||
m_instance = instance;
|
||||
var runtime = m_instance.GetComponent<RuntimeGltfInstance>();
|
||||
_initPose = runtime.InitialTransformStates.ToDictionary((kv) => kv.Key, (kv) => kv.Value);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!instance.TryGetBoneTransform(HumanBodyBones.Head, out m_head))
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "com.vrmc.vrm",
|
||||
"version": "0.129.0",
|
||||
"version": "0.129.1",
|
||||
"displayName": "VRM-1.0",
|
||||
"description": "VRM-1.0 importer",
|
||||
"unity": "2021.3",
|
||||
@@ -15,7 +15,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"com.unity.timeline": "1.7.6",
|
||||
"com.vrmc.gltf": "0.129.0"
|
||||
"com.vrmc.gltf": "0.129.1"
|
||||
},
|
||||
"samples": [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user