rotation もしくは scaling だけを freeze するのは難しかった。

両方やるかやらないかに修正。
This commit is contained in:
ousttrue
2024-02-05 16:21:30 +09:00
parent 226df1626a
commit 12db3507be
4 changed files with 9 additions and 18 deletions

View File

@@ -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()

View File

@@ -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>();

View File

@@ -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);

View File

@@ -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);