Wc.ExpressionAnimation GetExpressionAnimation(Wd.ExpressionAnimation obj) { #if ReuseExpressionAnimation // Reset and reuse the same ExpressionAnimation each time. var result = _expressionAnimation; result.Comment = obj.Comment ?? string.Empty; // If there is a Target set it. Note however that the Target isn't used for anything // interesting in this scenario, and there is no way to reset the Target to an // empty string (the Target API disallows empty). In reality, for all our uses // the Target will not be set and it doesn't matter if it was set previously. if (!string.IsNullOrWhiteSpace(obj.Target)) { result.Target = obj.Target; } result.Expression = obj.Expression.Simplified.ToString(); result.ClearAllParameters(); foreach (var parameter in obj.ReferenceParameters) { result.SetReferenceParameter(parameter.Key, GetCompositionObject(parameter.Value)); } #else if (GetExisting(obj, out Wc.ExpressionAnimation result)) { return(result); } result = CacheAndInitializeAnimation(obj, _c.CreateExpressionAnimation(obj.Expression)); #endif StartAnimations(obj, result); return(result); }
ExpressionAnimation(ExpressionAnimation other, Expression expression) : base(other) { Expression = expression; }