Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge 1.5.9 #654

Merged
merged 9 commits into from
Oct 29, 2023
10 changes: 9 additions & 1 deletion CHANGELOG-PRERELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,15 @@ The format is based on [Keep a Changelog].

### Fixed
- Prefab blinks when we see editor of PrefabSafeSet of prefab asset `#645`
- Fixes in 1.5.9 `#654`

### Security

## [1.5.9] - 2023-10-29
## [1.5.9-rc.1] - 2023-10-28
### Fixed
- Animation clip length can be changed [`#647`](https://github.com/anatawa12/AvatarOptimizer/pull/647)

## [1.6.0-beta.1] - 2023-10-25
### Added
- Public API for registering component information [`#623`](https://github.com/anatawa12/AvatarOptimizer/pull/623)
Expand Down Expand Up @@ -952,7 +958,9 @@ This release is mistake.
- Clear Endpoint Position

[Unreleased]: https://github.com/anatawa12/AvatarOptimizer/compare/v1.6.0-beta.1...HEAD
[1.6.0-beta.1]: https://github.com/anatawa12/AvatarOptimizer/compare/v1.5.8...v1.6.0-beta.1
[1.6.0-beta.1]: https://github.com/anatawa12/AvatarOptimizer/compare/v1.5.9...v1.6.0-beta.1
[1.5.9]: https://github.com/anatawa12/AvatarOptimizer/compare/v1.5.9-rc.1...v1.5.9
[1.5.9-rc.1]: https://github.com/anatawa12/AvatarOptimizer/compare/v1.5.8...v1.5.9-rc.1
[1.5.8]: https://github.com/anatawa12/AvatarOptimizer/compare/v1.5.8-rc.1...v1.5.8
[1.5.8-rc.1]: https://github.com/anatawa12/AvatarOptimizer/compare/v1.5.7...v1.5.8-rc.1
[1.5.7]: https://github.com/anatawa12/AvatarOptimizer/compare/v1.5.7-beta.1...v1.5.7
Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ The format is based on [Keep a Changelog].

### Security

## [1.5.9] - 2023-10-29
### Fixed
- Animation clip length can be changed [`#647`](https://github.com/anatawa12/AvatarOptimizer/pull/647)

## [1.5.8] - 2023-10-20
### Fixed
- warning about VRCTestMarker when Build & Test [`#628`](https://github.com/anatawa12/AvatarOptimizer/pull/628)
Expand Down Expand Up @@ -629,7 +633,8 @@ The format is based on [Keep a Changelog].
- Merge Bone
- Clear Endpoint Position

[Unreleased]: https://github.com/anatawa12/AvatarOptimizer/compare/v1.5.8...HEAD
[Unreleased]: https://github.com/anatawa12/AvatarOptimizer/compare/v1.5.9...HEAD
[1.5.9]: https://github.com/anatawa12/AvatarOptimizer/compare/v1.5.8...v1.5.9
[1.5.8]: https://github.com/anatawa12/AvatarOptimizer/compare/v1.5.7...v1.5.8
[1.5.7]: https://github.com/anatawa12/AvatarOptimizer/compare/v1.5.6...v1.5.7
[1.5.6]: https://github.com/anatawa12/AvatarOptimizer/compare/v1.5.5...v1.5.6
Expand Down
19 changes: 19 additions & 0 deletions Editor/ObjectMapping/ObjectMappingContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,15 @@ private Object CustomClone(Object o)
var newClip = new AnimationClip();
newClip.name = "rebased " + clip.name;

// copy m_UseHighQualityCurve with SerializedObject since m_UseHighQualityCurve doesn't have public API
using (var serializedClip = new SerializedObject(clip))
using (var serializedNewClip = new SerializedObject(newClip))
{
serializedNewClip.FindProperty("m_UseHighQualityCurve")
.boolValue = serializedClip.FindProperty("m_UseHighQualityCurve").boolValue;
serializedNewClip.ApplyModifiedPropertiesWithoutUndo();
}

foreach (var binding in AnimationUtility.GetCurveBindings(clip))
{
var newBindings = _mapping.MapBinding(binding);
Expand Down Expand Up @@ -169,6 +178,16 @@ private Object CustomClone(Object o)
}
}

// ReSharper disable once CompareOfFloatsByEqualityOperator
if (newClip.length != clip.length)
{
// if newClip has less properties than original clip (especially for no properties),
// length of newClip can be changed which is bad.
newClip.SetCurve(
"$AvatarOptimizerClipLengthDummy$", typeof(GameObject), "m_IsActive",
AnimationCurve.Constant(clip.length, clip.length, 1f));
}

newClip.wrapMode = clip.wrapMode;
newClip.legacy = clip.legacy;
newClip.frameRate = clip.frameRate;
Expand Down