// updates the just the proxied values. This can be called when the asset changes, so the proxy values are properly updated public void UpdateProxyCurves() { if (!m_IsAnimatable || m_ProxyCurves == null || m_ProxyCurves.empty) { return; } AnimatedParameterUtility.UpdateSerializedPlayableAsset(m_OriginalOwner.asset); var parameters = m_OriginalOwner.GetAllAnimatableParameters().ToArray(); using (new RebuildGuard(this)) { if (m_OriginalOwner.hasCurves) { var bindingInfo = AnimationClipCurveCache.Instance.GetCurveInfo(m_OriginalOwner.curves); foreach (var param in parameters) { var binding = AnimatedParameterUtility.GetCurveBinding(m_OriginalOwner.asset, param.propertyPath); if (!bindingInfo.bindings.Contains(binding, AnimationPreviewUtilities.EditorCurveBindingComparer.Instance)) { SetProxyCurve(param, AnimatedParameterUtility.GetCurveBinding(m_OriginalOwner.asset, param.propertyPath)); } } } else { foreach (var param in parameters) { SetProxyCurve(param, AnimatedParameterUtility.GetCurveBinding(m_OriginalOwner.asset, param.propertyPath)); } } } AnimationClipCurveCache.Instance.GetCurveInfo(m_ProxyCurves).dirty = true; }
public void UpdateCurves(IEnumerable <CurveWrapper> updatedCurves) { if (m_ProxyIsRebuilding > 0) { return; } Undo.RegisterCompleteObjectUndo(m_OriginalOwner.asset, L10n.Tr("Edit Clip Curve")); if (m_OriginalOwner.curves != null) { Undo.RegisterCompleteObjectUndo(m_OriginalOwner.curves, L10n.Tr("Edit Clip Curve")); } var requireRebuild = false; foreach (var curve in updatedCurves) { requireRebuild |= curve.curve.length == 0; UpdateCurve(curve.binding, curve.curve); } if (requireRebuild) { m_OriginalOwner.SanitizeCurvesData(); } AnimatedParameterUtility.UpdateSerializedPlayableAsset(m_OriginalOwner.asset); }
public void UpdateCurves(List <CurveWrapper> updatedCurves) { if (m_ProxyIsRebuilding > 0) { return; } Undo.RegisterCompleteObjectUndo(m_OriginalOwner.asset, "Edit Clip Curve"); if (m_OriginalOwner.curves != null) { Undo.RegisterCompleteObjectUndo(m_OriginalOwner.curves, "Edit Clip Curve"); } foreach (var curve in updatedCurves) { UpdateCurve(curve.binding, curve.curve); } AnimatedParameterUtility.UpdateSerializedPlayableAsset(m_OriginalOwner.asset); }
void RebuildProxyCurves() { if (!m_IsAnimatable) { return; } using (new RebuildGuard(this)) { if (m_ProxyCurves == null) { m_ProxyCurves = new AnimationClip { legacy = true, name = "Constant Curves", hideFlags = HideFlags.HideAndDontSave, frameRate = m_OriginalOwner.targetTrack.timelineAsset == null ? TimelineAsset.EditorSettings.kDefaultFps : m_OriginalOwner.targetTrack.timelineAsset.editorSettings.fps }; } else { m_ProxyCurves.ClearCurves(); } m_OriginalOwner.SanitizeCurvesData(); AnimatedParameterUtility.UpdateSerializedPlayableAsset(m_OriginalOwner.asset); var parameters = m_OriginalOwner.GetAllAnimatableParameters().ToArray(); foreach (var param in parameters) { CreateProxyCurve(param, m_ProxyCurves, m_OriginalOwner.asset, param.propertyPath); } AnimationClipCurveCache.Instance.GetCurveInfo(m_ProxyCurves).dirty = true; } }