public void ExtractFromPreviewClip(AnimationClip clip) { AnimationClipSettings animationClipSettings = AnimationUtility.GetAnimationClipSettings(clip); if (this.firstFrame / clip.frameRate != animationClipSettings.startTime) { this.firstFrame = this.FixPrecisionErrors(animationClipSettings.startTime * clip.frameRate); } if (this.lastFrame / clip.frameRate != animationClipSettings.stopTime) { this.lastFrame = this.FixPrecisionErrors(animationClipSettings.stopTime * clip.frameRate); } this.orientationOffsetY = animationClipSettings.orientationOffsetY; this.level = animationClipSettings.level; this.cycleOffset = animationClipSettings.cycleOffset; this.loopTime = animationClipSettings.loopTime; this.loopBlend = animationClipSettings.loopBlend; this.loopBlendOrientation = animationClipSettings.loopBlendOrientation; this.loopBlendPositionY = animationClipSettings.loopBlendPositionY; this.loopBlendPositionXZ = animationClipSettings.loopBlendPositionXZ; this.keepOriginalOrientation = animationClipSettings.keepOriginalOrientation; this.keepOriginalPositionY = animationClipSettings.keepOriginalPositionY; this.keepOriginalPositionXZ = animationClipSettings.keepOriginalPositionXZ; this.heightFromFeet = animationClipSettings.heightFromFeet; this.mirror = animationClipSettings.mirror; this.hasAdditiveReferencePose = animationClipSettings.hasAdditiveReferencePose; if (this.additiveReferencePoseFrame / clip.frameRate != animationClipSettings.additiveReferencePoseTime) { this.additiveReferencePoseFrame = this.FixPrecisionErrors(animationClipSettings.additiveReferencePoseTime * clip.frameRate); } }
public void ExtractFromPreviewClip(AnimationClip clip) { AnimationClipSettings info = AnimationUtility.GetAnimationClipSettings(clip); // Ensure that we don't accidentally dirty settings due to floating point precision in the multiply / divide if (firstFrame / clip.frameRate != info.startTime) { firstFrame = FixPrecisionErrors(info.startTime * clip.frameRate); } if (lastFrame / clip.frameRate != info.stopTime) { lastFrame = FixPrecisionErrors(info.stopTime * clip.frameRate); } orientationOffsetY = info.orientationOffsetY; level = info.level; cycleOffset = info.cycleOffset; loopTime = info.loopTime; loopBlend = info.loopBlend; loopBlendOrientation = info.loopBlendOrientation; loopBlendPositionY = info.loopBlendPositionY; loopBlendPositionXZ = info.loopBlendPositionXZ; keepOriginalOrientation = info.keepOriginalOrientation; keepOriginalPositionY = info.keepOriginalPositionY; keepOriginalPositionXZ = info.keepOriginalPositionXZ; heightFromFeet = info.heightFromFeet; mirror = info.mirror; hasAdditiveReferencePose = info.hasAdditiveReferencePose; if (additiveReferencePoseFrame / clip.frameRate != info.additiveReferencePoseTime) { additiveReferencePoseFrame = FixPrecisionErrors(info.additiveReferencePoseTime * clip.frameRate); } }
internal static AnimationClip AllocateAndSetupClip(bool useAnimator) { AnimationClip animationClip = new AnimationClip(); if (useAnimator) { AnimationClipSettings animationClipSettings = AnimationUtility.GetAnimationClipSettings(animationClip); animationClipSettings.loopTime = true; AnimationUtility.SetAnimationClipSettingsNoDirty(animationClip, animationClipSettings); } return(animationClip); }