mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2024-12-29 18:55:06 +08:00
parent
9a974f5f09
commit
3d3aefd4f9
6
.github/ProjectRoot/vpm-manifest-2022.json
vendored
6
.github/ProjectRoot/vpm-manifest-2022.json
vendored
@ -9,13 +9,13 @@
|
|||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"com.vrchat.avatars": {
|
"com.vrchat.avatars": {
|
||||||
"version": "3.5.0",
|
"version": "3.6.1",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"com.vrchat.base": "3.5.0"
|
"com.vrchat.base": "3.6.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"com.vrchat.base": {
|
"com.vrchat.base": {
|
||||||
"version": "3.5.0",
|
"version": "3.6.1",
|
||||||
"dependencies": {}
|
"dependencies": {}
|
||||||
},
|
},
|
||||||
"nadena.dev.ndmf": {
|
"nadena.dev.ndmf": {
|
||||||
|
@ -6,7 +6,7 @@ using System.Collections.Immutable;
|
|||||||
using nadena.dev.modular_avatar.editor.ErrorReporting;
|
using nadena.dev.modular_avatar.editor.ErrorReporting;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Animations;
|
using VRC.SDK3.Avatars.Components;
|
||||||
using Object = UnityEngine.Object;
|
using Object = UnityEngine.Object;
|
||||||
|
|
||||||
#if MA_VRCSDK3_AVATARS
|
#if MA_VRCSDK3_AVATARS
|
||||||
@ -226,9 +226,9 @@ namespace nadena.dev.modular_avatar.core.editor
|
|||||||
if (_proxyHead != null) return _proxyHead;
|
if (_proxyHead != null) return _proxyHead;
|
||||||
|
|
||||||
var src = _headBone;
|
var src = _headBone;
|
||||||
GameObject obj = new GameObject(src.name + " (FirstPersonVisible)");
|
var obj = new GameObject(src.name + " (HeadChop)");
|
||||||
|
|
||||||
Transform parent = _headBone.parent;
|
var parent = _headBone;
|
||||||
|
|
||||||
obj.transform.SetParent(parent, false);
|
obj.transform.SetParent(parent, false);
|
||||||
obj.transform.localPosition = src.localPosition;
|
obj.transform.localPosition = src.localPosition;
|
||||||
@ -236,16 +236,17 @@ namespace nadena.dev.modular_avatar.core.editor
|
|||||||
obj.transform.localScale = src.localScale;
|
obj.transform.localScale = src.localScale;
|
||||||
Debug.Log($"src.localScale = {src.localScale} obj.transform.localScale = {obj.transform.localScale}");
|
Debug.Log($"src.localScale = {src.localScale} obj.transform.localScale = {obj.transform.localScale}");
|
||||||
|
|
||||||
var constraint = obj.AddComponent<ParentConstraint>();
|
var headChop = obj.AddComponent<VRCHeadChop>();
|
||||||
constraint.AddSource(new ConstraintSource()
|
headChop.targetBones = new[]
|
||||||
{
|
{
|
||||||
weight = 1.0f,
|
new VRCHeadChop.HeadChopBone
|
||||||
sourceTransform = src
|
{
|
||||||
});
|
transform = obj.transform,
|
||||||
constraint.constraintActive = true;
|
applyCondition = VRCHeadChop.HeadChopBone.ApplyCondition.AlwaysApply,
|
||||||
constraint.locked = true;
|
scaleFactor = 1
|
||||||
constraint.rotationOffsets = new[] {Vector3.zero};
|
}
|
||||||
constraint.translationOffsets = new[] {Vector3.zero};
|
};
|
||||||
|
headChop.globalScaleFactor = 1;
|
||||||
|
|
||||||
_proxyHead = obj.transform;
|
_proxyHead = obj.transform;
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ using NUnit.Framework;
|
|||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Animations;
|
using UnityEngine.Animations;
|
||||||
|
using VRC.SDK3.Avatars.Components;
|
||||||
|
|
||||||
namespace UnitTests.VisibleHeadAccessoryTest
|
namespace UnitTests.VisibleHeadAccessoryTest
|
||||||
{
|
{
|
||||||
@ -36,9 +37,9 @@ namespace UnitTests.VisibleHeadAccessoryTest
|
|||||||
{
|
{
|
||||||
"Armature/Hips/Spine/Chest/Neck/Head/O1",
|
"Armature/Hips/Spine/Chest/Neck/Head/O1",
|
||||||
"Armature/Hips/Spine/Chest/Neck/Head/O1/O2",
|
"Armature/Hips/Spine/Chest/Neck/Head/O1/O2",
|
||||||
"Armature/Hips/Spine/Chest/Neck/Head (FirstPersonVisible)/O1",
|
"Armature/Hips/Spine/Chest/Neck/Head/Head (HeadChop)/O1",
|
||||||
"Armature/Hips/Spine/Chest/Neck/Head (FirstPersonVisible)/O1/O2",
|
"Armature/Hips/Spine/Chest/Neck/Head/Head (HeadChop)/O1/O2",
|
||||||
"Armature/Hips/Spine/Chest/Neck/Head (FirstPersonVisible)/O1/O2/Cube",
|
"Armature/Hips/Spine/Chest/Neck/Head/Head (HeadChop)/O1/O2/Cube",
|
||||||
}.ToImmutableSortedSet();
|
}.ToImmutableSortedSet();
|
||||||
|
|
||||||
var bindings = AnimationUtility.GetCurveBindings(fx_anim).Select(binding => binding.path)
|
var bindings = AnimationUtility.GetCurveBindings(fx_anim).Select(binding => binding.path)
|
||||||
@ -46,13 +47,14 @@ namespace UnitTests.VisibleHeadAccessoryTest
|
|||||||
Assert.AreEqual(expectedBindings, bindings);
|
Assert.AreEqual(expectedBindings, bindings);
|
||||||
|
|
||||||
var head = prefab.transform.Find("Armature/Hips/Spine/Chest/Neck/Head");
|
var head = prefab.transform.Find("Armature/Hips/Spine/Chest/Neck/Head");
|
||||||
var constraint = prefab.transform.Find("Armature/Hips/Spine/Chest/Neck/Head (FirstPersonVisible)")
|
var chop = head.Find("Head (HeadChop)");
|
||||||
.GetComponent<ParentConstraint>();
|
var headchop = chop.GetComponent<VRCHeadChop>();
|
||||||
|
|
||||||
Assert.AreEqual(head, constraint.GetSource(0).sourceTransform);
|
Assert.AreEqual(headchop.targetBones.Length, 1);
|
||||||
Assert.AreEqual(1, constraint.GetSource(0).weight);
|
Assert.AreEqual(headchop.targetBones[0].transform, chop);
|
||||||
Assert.AreEqual(new Vector3(0, 0, 0), constraint.translationOffsets[0]);
|
Assert.AreEqual(headchop.targetBones[0].scaleFactor, 1);
|
||||||
Assert.AreEqual(new Vector3(0, 0, 0), constraint.rotationOffsets[0]);
|
Assert.AreEqual(headchop.targetBones[0].applyCondition, VRCHeadChop.HeadChopBone.ApplyCondition.AlwaysApply);
|
||||||
|
Assert.AreEqual(headchop.globalScaleFactor, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -15,7 +15,7 @@
|
|||||||
"com.unity.nuget.newtonsoft-json": "2.0.0"
|
"com.unity.nuget.newtonsoft-json": "2.0.0"
|
||||||
},
|
},
|
||||||
"vpmDependencies": {
|
"vpmDependencies": {
|
||||||
"com.vrchat.avatars": ">=3.4.0",
|
"com.vrchat.avatars": ">=3.6.1",
|
||||||
"nadena.dev.ndmf": ">=1.5.0-beta.3 <2.0.0-a"
|
"nadena.dev.ndmf": ">=1.5.0-beta.3 <2.0.0-a"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user