Skip to content

Commit

Permalink
Merge pull request #1336 from anatawa12/fix-animation-warning
Browse files Browse the repository at this point in the history
chore: add warning for animation and limit rotation fix
  • Loading branch information
anatawa12 authored Nov 8, 2024
2 parents 366f5ef + d097cdb commit d028bf4
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG-PRERELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ The format is based on [Keep a Changelog].
### Added

### Changed
- Added animation validation warning for MergePhysBone limit rotation mode Fix `#1336`

### Deprecated

Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ The format is based on [Keep a Changelog].
- AAO 1.8.0 introduced BlendShape support for Merge Skinned Mesh, but new default mode "Rename to avoid conflicts" would increase number of BlendShape.
- This feature is added to relax this problem by automatically merging multiple BlendShapes of one Mesh.
- With this feature, you can use rename mode without performance loss.
- Fix mode for PhysBone Limits in Merge PhysBone `#665`
- Fix mode for PhysBone Limits in Merge PhysBone `#665` `#1336`
- In addition to existing `Copy` and `Override`, we added `Fix` mode.
- This mode will try to correct roll axis by rotating bone.
- This feature allows you to configure the mode for PhysBone Limits in Merge PhysBone.
Expand Down
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 d028bf4

Please sign in to comment.