Skip to content

Commit

Permalink
chore: add warning for animation and limit rotation fix
Browse files Browse the repository at this point in the history
  • Loading branch information
anatawa12 committed Nov 7, 2024
1 parent 9b162f8 commit e6cc5c0
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Editor/Processors/MergePhysBoneProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,27 @@ internal static void DoMerge(MergePhysBone merge, BuildContext? context)
// yaw / pitch fix
if (merge.limitRotationConfig.@override == MergePhysBone.CurveVector3Config.CurveOverride.Fix)
{
if (context != null)
{
var animations = new HashSet<ObjectReference>();
foreach (var physBone in sourceComponents)
foreach (var affectedTransform in physBone.GetAffectedTransforms())
{
var component = context.GetAnimationComponent(affectedTransform);
foreach (var property in TransformRotationAndPositionAnimationKeys)
{
var node = component.GetFloatNode(property);
animations.UnionWith(node.ComponentNodes.OfType<AnimatorPropModNode<FloatValueInfo>>()
.SelectMany(x => x.ContextReferences));
}
}

if (animations.Count != 0)
{
BuildLog.LogWarning("MergePhysBone:warning:limit-rotation-fix-animation", animations);
}
}

var newIgnores = new List<Transform>();
// fix rotations
foreach (var physBone in sourceComponents)
Expand Down
6 changes: 6 additions & 0 deletions Localization/en-us.po
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,12 @@ msgstr "Reset When Disabled"
msgid "MergePhysBone:prop:components"
msgstr "Components"

msgid "MergePhysBone:warning:limit-rotation-fix-animation"
msgstr "Limit Rotation mode is Fix but physBone affected transforms are animated."

msgid "MergePhysBone:warning:limit-rotation-fix-animation:description"
msgstr "This is not supported with Limit Rotation mode Fix for now."

# endregion

# region MergeSkinnedMesh
Expand Down

0 comments on commit e6cc5c0

Please sign in to comment.