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": {
|
||||
"com.vrchat.avatars": {
|
||||
"version": "3.5.0",
|
||||
"version": "3.6.1",
|
||||
"dependencies": {
|
||||
"com.vrchat.base": "3.5.0"
|
||||
"com.vrchat.base": "3.6.1"
|
||||
}
|
||||
},
|
||||
"com.vrchat.base": {
|
||||
"version": "3.5.0",
|
||||
"version": "3.6.1",
|
||||
"dependencies": {}
|
||||
},
|
||||
"nadena.dev.ndmf": {
|
||||
|
@ -6,7 +6,7 @@ using System.Collections.Immutable;
|
||||
using nadena.dev.modular_avatar.editor.ErrorReporting;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Animations;
|
||||
using VRC.SDK3.Avatars.Components;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
#if MA_VRCSDK3_AVATARS
|
||||
@ -226,9 +226,9 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
if (_proxyHead != null) return _proxyHead;
|
||||
|
||||
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.localPosition = src.localPosition;
|
||||
@ -236,16 +236,17 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
obj.transform.localScale = src.localScale;
|
||||
Debug.Log($"src.localScale = {src.localScale} obj.transform.localScale = {obj.transform.localScale}");
|
||||
|
||||
var constraint = obj.AddComponent<ParentConstraint>();
|
||||
constraint.AddSource(new ConstraintSource()
|
||||
var headChop = obj.AddComponent<VRCHeadChop>();
|
||||
headChop.targetBones = new[]
|
||||
{
|
||||
weight = 1.0f,
|
||||
sourceTransform = src
|
||||
});
|
||||
constraint.constraintActive = true;
|
||||
constraint.locked = true;
|
||||
constraint.rotationOffsets = new[] {Vector3.zero};
|
||||
constraint.translationOffsets = new[] {Vector3.zero};
|
||||
new VRCHeadChop.HeadChopBone
|
||||
{
|
||||
transform = obj.transform,
|
||||
applyCondition = VRCHeadChop.HeadChopBone.ApplyCondition.AlwaysApply,
|
||||
scaleFactor = 1
|
||||
}
|
||||
};
|
||||
headChop.globalScaleFactor = 1;
|
||||
|
||||
_proxyHead = obj.transform;
|
||||
|
||||
|
@ -8,6 +8,7 @@ using NUnit.Framework;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Animations;
|
||||
using VRC.SDK3.Avatars.Components;
|
||||
|
||||
namespace UnitTests.VisibleHeadAccessoryTest
|
||||
{
|
||||
@ -36,9 +37,9 @@ namespace UnitTests.VisibleHeadAccessoryTest
|
||||
{
|
||||
"Armature/Hips/Spine/Chest/Neck/Head/O1",
|
||||
"Armature/Hips/Spine/Chest/Neck/Head/O1/O2",
|
||||
"Armature/Hips/Spine/Chest/Neck/Head (FirstPersonVisible)/O1",
|
||||
"Armature/Hips/Spine/Chest/Neck/Head (FirstPersonVisible)/O1/O2",
|
||||
"Armature/Hips/Spine/Chest/Neck/Head (FirstPersonVisible)/O1/O2/Cube",
|
||||
"Armature/Hips/Spine/Chest/Neck/Head/Head (HeadChop)/O1",
|
||||
"Armature/Hips/Spine/Chest/Neck/Head/Head (HeadChop)/O1/O2",
|
||||
"Armature/Hips/Spine/Chest/Neck/Head/Head (HeadChop)/O1/O2/Cube",
|
||||
}.ToImmutableSortedSet();
|
||||
|
||||
var bindings = AnimationUtility.GetCurveBindings(fx_anim).Select(binding => binding.path)
|
||||
@ -46,13 +47,14 @@ namespace UnitTests.VisibleHeadAccessoryTest
|
||||
Assert.AreEqual(expectedBindings, bindings);
|
||||
|
||||
var head = prefab.transform.Find("Armature/Hips/Spine/Chest/Neck/Head");
|
||||
var constraint = prefab.transform.Find("Armature/Hips/Spine/Chest/Neck/Head (FirstPersonVisible)")
|
||||
.GetComponent<ParentConstraint>();
|
||||
var chop = head.Find("Head (HeadChop)");
|
||||
var headchop = chop.GetComponent<VRCHeadChop>();
|
||||
|
||||
Assert.AreEqual(head, constraint.GetSource(0).sourceTransform);
|
||||
Assert.AreEqual(1, constraint.GetSource(0).weight);
|
||||
Assert.AreEqual(new Vector3(0, 0, 0), constraint.translationOffsets[0]);
|
||||
Assert.AreEqual(new Vector3(0, 0, 0), constraint.rotationOffsets[0]);
|
||||
Assert.AreEqual(headchop.targetBones.Length, 1);
|
||||
Assert.AreEqual(headchop.targetBones[0].transform, chop);
|
||||
Assert.AreEqual(headchop.targetBones[0].scaleFactor, 1);
|
||||
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"
|
||||
},
|
||||
"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"
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user