mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-08-22 02:24:57 -05:00
rotation もしくは scaling だけを freeze するのは難しかった。
両方やるかやらないかに修正。
This commit is contained in:
@@ -301,9 +301,8 @@ namespace UniGLTF.MeshUtility
|
||||
bool MeshFreezeGui()
|
||||
{
|
||||
var blendShape = ToggleIsModified("BlendShape", ref MeshUtility.FreezeBlendShape);
|
||||
var scale = ToggleIsModified("Scale", ref MeshUtility.FreezeScaling);
|
||||
var rotation = ToggleIsModified("Rotation", ref MeshUtility.FreezeRotation);
|
||||
return blendShape || scale || rotation;
|
||||
var rotationAndScaling = ToggleIsModified("RotationAndScaling", ref MeshUtility.FreezeRotationAndScaling);
|
||||
return blendShape || rotationAndScaling;
|
||||
}
|
||||
|
||||
protected virtual bool MeshIntegrateGui()
|
||||
|
||||
@@ -31,15 +31,7 @@ namespace UniGLTF.MeshUtility
|
||||
/// - Node
|
||||
/// - InverseBindMatrices
|
||||
/// </summary>
|
||||
public bool FreezeScaling = true;
|
||||
|
||||
/// <summary>
|
||||
/// Same as VRM-0 normalization
|
||||
/// - Mesh
|
||||
/// - Node
|
||||
/// - InverseBindMatrices
|
||||
/// </summary>
|
||||
public bool FreezeRotation = false;
|
||||
public bool FreezeRotationAndScaling = false;
|
||||
|
||||
public List<MeshIntegrationGroup> MeshIntegrationGroups = new List<MeshIntegrationGroup>();
|
||||
|
||||
@@ -172,15 +164,15 @@ namespace UniGLTF.MeshUtility
|
||||
public virtual (List<MeshIntegrationResult>, List<GameObject>) Process(
|
||||
GameObject target, IEnumerable<MeshIntegrationGroup> groupCopy)
|
||||
{
|
||||
if (FreezeBlendShape || FreezeRotation || FreezeScaling)
|
||||
if (FreezeBlendShape || FreezeRotationAndScaling)
|
||||
{
|
||||
// MeshをBakeする
|
||||
var meshMap = BoneNormalizer.NormalizeHierarchyFreezeMesh(target, FreezeRotation);
|
||||
var meshMap = BoneNormalizer.NormalizeHierarchyFreezeMesh(target, FreezeRotationAndScaling);
|
||||
|
||||
// - ヒエラルキーから回転・拡縮を除去する
|
||||
// - BakeされたMeshで置き換える
|
||||
// - bindPoses を再計算する
|
||||
BoneNormalizer.Replace(target, meshMap, FreezeRotation, FreezeScaling);
|
||||
BoneNormalizer.Replace(target, meshMap, FreezeRotationAndScaling, FreezeRotationAndScaling);
|
||||
}
|
||||
|
||||
var newList = new List<GameObject>();
|
||||
|
||||
@@ -108,7 +108,7 @@ namespace VRM
|
||||
// TODO: update: firstPerson offset
|
||||
var (list, newList) = base.Process(target, copyGroup);
|
||||
|
||||
if (FreezeBlendShape || FreezeRotation || FreezeScaling)
|
||||
if (FreezeBlendShape || FreezeRotationAndScaling)
|
||||
{
|
||||
var animator = target.GetComponent<Animator>();
|
||||
var newAvatar = AvatarDescription.RecreateAvatar(animator);
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace UniVRM10
|
||||
{
|
||||
public Vrm10MeshUtility()
|
||||
{
|
||||
FreezeRotation = true;
|
||||
FreezeRotationAndScaling = true;
|
||||
}
|
||||
|
||||
bool _generateFirstPerson = false;
|
||||
@@ -115,7 +115,7 @@ namespace UniVRM10
|
||||
// TODO: update: firstPerson offset
|
||||
var (list, newList) = base.Process(target, groupCopy);
|
||||
|
||||
if (FreezeBlendShape || FreezeRotation || FreezeScaling)
|
||||
if (FreezeBlendShape || FreezeRotationAndScaling)
|
||||
{
|
||||
var animator = target.GetComponent<Animator>();
|
||||
var newAvatar = AvatarDescription.RecreateAvatar(animator);
|
||||
|
||||
Reference in New Issue
Block a user