Skip to content

Commit

Permalink
Change generated animations to use EditorCurveBinding.FloatCurve i…
Browse files Browse the repository at this point in the history
…nstead of `EditorCurveBinding.DiscreteCurve` #98 #99
  • Loading branch information
d4rkc0d3r committed May 14, 2024
1 parent acc8caf commit 1cc259b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
### Bug Fixes
* Automatically add `_VirtualLens_Root` to exclusions so it doesn't break when running the optimizer.
* Fix shader optimizer breaking on shaders that have no `Properties` block.
* Change generated animations to use ` EditorCurveBinding.FloatCurve` instead of `EditorCurveBinding.DiscreteCurve`. [(more)](https://github.com/d4rkc0d3r/d4rkAvatarOptimizer/issues/98)
* This fixes issues with GoGoLoco & NaNimation keep default enabled state in unity 2022.3.22f1.

## v3.6.1
### Bug Fixes
Expand Down
6 changes: 3 additions & 3 deletions Editor/d4rkAvatarOptimizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1395,7 +1395,7 @@ void SetObjectReferenceCurve(AnimationClip clipToSet, EditorCurveBinding binding
}
if (lastUnusedKeyframeTime > lastUsedKeyframeTime && lastUnusedKeyframeTime > -1) {
// add dummy curve referencing nothing to make sure the clip still has the same length as before
var dummyBinding = EditorCurveBinding.DiscreteCurve("ThisHopefullyDoesntExist", typeof(GameObject), "m_IsActive");
var dummyBinding = EditorCurveBinding.FloatCurve("ThisHopefullyDoesntExist", typeof(GameObject), "m_IsActive");
var dummyCurve = AnimationCurve.Constant(0, lastUnusedKeyframeTime, 1);
AnimationUtility.SetEditorCurve(newClip, dummyBinding, dummyCurve);
changed = true;
Expand Down Expand Up @@ -4205,7 +4205,7 @@ private void CombineSkinnedMeshes()
(GetPathToRoot(NaNimationBone), key, typeof(Transform)));
AddAnimationPathChange((currentMeshPath, "m_Enabled", typeof(SkinnedMeshRenderer)),
(GetPathToRoot(NaNimationBone), key, typeof(Transform)));
var curveBinding = EditorCurveBinding.DiscreteCurve(newPath, typeof(SkinnedMeshRenderer), "m_UpdateWhenOffscreen");
var curveBinding = EditorCurveBinding.FloatCurve(newPath, typeof(SkinnedMeshRenderer), "m_UpdateWhenOffscreen");
constantAnimatedValuesToAdd[curveBinding] = 0f;
targetBounds.Encapsulate(toLocal.MultiplyPoint3x4(avDescriptor.ViewPosition + Vector3.forward * 0.3f + Vector3.up * 0.2f));
targetBounds.Encapsulate(toLocal.MultiplyPoint3x4(avDescriptor.ViewPosition + Vector3.forward * 0.3f - Vector3.up * 0.2f));
Expand Down Expand Up @@ -4631,7 +4631,7 @@ string CalculateNewBlendShapeName(string blendShapeName) {
{
meshRenderer.gameObject.SetActive(true);
meshRenderer.enabled = false;
var curveBinding = EditorCurveBinding.DiscreteCurve(GetPathToRoot(meshRenderer), typeof(SkinnedMeshRenderer), "m_Enabled");
var curveBinding = EditorCurveBinding.FloatCurve(GetPathToRoot(meshRenderer), typeof(SkinnedMeshRenderer), "m_Enabled");
constantAnimatedValuesToAdd[curveBinding] = 1f;
}
else
Expand Down

0 comments on commit 1cc259b

Please sign in to comment.