protected KeyFrameCurveViewModel([NotNull] CurveEditorViewModel editor, CurveViewModelBase parent, [NotNull] ComputeAnimationCurve <TValue> computeCurve, string name = null) : base(editor, parent, computeCurve, name) { KeyFramesNode = CurveNode[nameof(computeCurve.KeyFrames)].Target; KeyFramesNode.ItemChanged += KeyFramesContentChanged; controlPoints.CollectionChanged += ControlPointsCollectionChanged; }
protected CurveViewModelBase([NotNull] CurveEditorViewModel editor, CurveViewModelBase parent) : base(editor.SafeArgument(nameof(editor)).ServiceProvider) { Editor = editor; Parent = parent; children.CollectionChanged += ChildrenCollectionChanged; }
protected ControlPointViewModelBase([NotNull] CurveViewModelBase curve) : base(curve.SafeArgument(nameof(curve)).ServiceProvider) { Curve = curve; DependentProperties.Add(nameof(Point), new[] { nameof(ActualKey), nameof(ActualPoint), nameof(ActualValue) }); }
public Vector3ComponentControlPointViewModel([NotNull] CurveViewModelBase curve, [NotNull] IMemberNode keyNode, [NotNull] IMemberNode valueNode, [NotNull] IMemberNode tangentTypeNode, VectorComponent component) : base(curve, keyNode, valueNode, tangentTypeNode, component) { if (component == VectorComponent.W) { throw new ArgumentException("Vector component 'W' is invalid, only 'X', 'Y' and 'Z' are supported.", nameof(component)); } }
public Vector3ComponentCurveViewModel([NotNull] CurveEditorViewModel editor, CurveViewModelBase parent, [NotNull] ComputeAnimationCurve <Vector3> computeCurve, VectorComponent component) : base(editor, parent, computeCurve, component) { if (component == VectorComponent.W) { throw new ArgumentException("Vector component 'W' is invalid, only 'X', 'Y' and 'Z' are supported.", nameof(component)); } }
private void RemoveCurve(CurveViewModelBase curve) { if (curve == null) { return; } if (curves.Remove(curve)) { curve.Destroy(); } }
public override void Destroy() { var curvesCopy = curves.ToList(); // clear before destroying curves.Clear(); SelectedControlPoints.Clear(); selectedCurve = null; foreach (var curve in curvesCopy) { curve.Destroy(); } base.Destroy(); }
protected KeyFrameControlPointViewModel([NotNull] CurveViewModelBase curve, [NotNull] IMemberNode keyNode, [NotNull] IMemberNode valueNode, [NotNull] IMemberNode tangentTypeNode) : base(curve) { if (keyNode == null) { throw new ArgumentNullException(nameof(keyNode)); } if (valueNode == null) { throw new ArgumentNullException(nameof(valueNode)); } if (tangentTypeNode == null) { throw new ArgumentNullException(nameof(tangentTypeNode)); } keyBinding = CreateBinding <float>(keyNode, nameof(Key)); ValueBinding = CreateBinding <TValue>(valueNode, nameof(Value)); tangentTypeBinding = CreateBinding <AnimationKeyTangentType>(tangentTypeNode, nameof(TangentType)); }
private CurveViewModelBase CreateCurveHierarchy <TValue>([NotNull] IComputeCurve <TValue> computeCurve, CurveViewModelBase parent = null, string name = null) where TValue : struct { var colorCurve = computeCurve as IComputeCurve <Color4>; if (colorCurve != null) { return(CreateCurveHierarchy <Color4, Color4CurveViewModel, Color4KeyFrameCurveViewModel>(colorCurve, parent, name)); } var floatCurve = computeCurve as IComputeCurve <float>; if (floatCurve != null) { return(CreateCurveHierarchy <float, FloatCurveViewModel, FloatKeyFrameCurveViewModel>(floatCurve, parent, name)); } var rotationCurve = computeCurve as IComputeCurve <Quaternion>; if (rotationCurve != null) { return(CreateCurveHierarchy <Quaternion, RotationCurveViewModel, RotationKeyFrameCurveViewModel>(rotationCurve, parent, name)); } var vector2Curve = computeCurve as IComputeCurve <Vector2>; if (vector2Curve != null) { return(CreateCurveHierarchy <Vector2, Vector2CurveViewModel, Vector2KeyFrameCurveViewModel>(vector2Curve, parent, name)); } var vector3Curve = computeCurve as IComputeCurve <Vector3>; if (vector3Curve != null) { return(CreateCurveHierarchy <Vector3, Vector3CurveViewModel, Vector3KeyFrameCurveViewModel>(vector3Curve, parent, name)); } var vector4Curve = computeCurve as IComputeCurve <Vector4>; if (vector4Curve != null) { return(CreateCurveHierarchy <Vector4, Vector4CurveViewModel, Vector4KeyFrameCurveViewModel>(vector4Curve, parent, name)); } throw new NotSupportedException($"The type IComputeCurve<{typeof(TValue).Name}> is not supported by this editor."); }
public RotationComponentCurveViewModel([NotNull] CurveEditorViewModel editor, CurveViewModelBase parent, [NotNull] ComputeAnimationCurve <Quaternion> computeCurve, VectorComponent component) : base(editor, parent, computeCurve) { Component = component; Color = Editor.GetColor(component); }
public Vector4KeyFrameCurveViewModel([NotNull] CurveEditorViewModel editor, [NotNull] ComputeAnimationCurve <Vector4> computeCurve, CurveViewModelBase parent = null, string name = null) : base(editor, parent, computeCurve, name) { Children.Add(new Vector4ComponentCurveViewModel(editor, this, computeCurve, VectorComponent.X)); Children.Add(new Vector4ComponentCurveViewModel(editor, this, computeCurve, VectorComponent.Y)); Children.Add(new Vector4ComponentCurveViewModel(editor, this, computeCurve, VectorComponent.Z)); Children.Add(new Vector4ComponentCurveViewModel(editor, this, computeCurve, VectorComponent.W)); }
public RotationCurveViewModel([NotNull] CurveEditorViewModel editor, [NotNull] IComputeCurve<Quaternion> computeCurve, CurveViewModelBase parent = null, string name = null) : base(editor, parent, computeCurve, name) { }
public Color4ComponentCurveViewModel([NotNull] CurveEditorViewModel editor, CurveViewModelBase parent, [NotNull] ComputeAnimationCurve <Color4> computeCurve, ColorComponent component) : base(editor, parent, computeCurve, component) { }
public Color4KeyFrameCurveViewModel([NotNull] CurveEditorViewModel editor, [NotNull] ComputeAnimationCurve <Color4> computeCurve, CurveViewModelBase parent = null, string name = null) : base(editor, parent, computeCurve, name) { Children.Add(new Color4ComponentCurveViewModel(editor, this, computeCurve, ColorComponent.R)); Children.Add(new Color4ComponentCurveViewModel(editor, this, computeCurve, ColorComponent.G)); Children.Add(new Color4ComponentCurveViewModel(editor, this, computeCurve, ColorComponent.B)); Children.Add(new Color4ComponentCurveViewModel(editor, this, computeCurve, ColorComponent.A)); }
protected DecomposedCurveViewModel([NotNull] CurveEditorViewModel editor, CurveViewModelBase parent, [NotNull] IComputeCurve <TValue> computeCurve, string name = null) : base(editor, parent, computeCurve, name) { }
public FloatKeyFrameCurveViewModel([NotNull] CurveEditorViewModel editor, [NotNull] ComputeAnimationCurve <float> computeCurve, CurveViewModelBase parent = null, string name = null) : base(editor, parent, computeCurve, name) { }
public Vector4ComponentControlPointViewModel([NotNull] CurveViewModelBase curve, [NotNull] IMemberNode keyNode, [NotNull] IMemberNode valueNode, [NotNull] IMemberNode tangentTypeNode, VectorComponent component) : base(curve, keyNode, valueNode, tangentTypeNode, component) { }
protected VectorComponentControlPointViewModel([NotNull] CurveViewModelBase curve, [NotNull] IMemberNode keyNode, [NotNull] IMemberNode valueNode, [NotNull] IMemberNode tangentTypeNode, VectorComponent component) : base(curve, keyNode, valueNode, tangentTypeNode) { Component = component; SynchronizePoint(); }
public FloatControlPointViewModel([NotNull] CurveViewModelBase curve, [NotNull] IMemberNode keyNode, [NotNull] IMemberNode valueNode, [NotNull] IMemberNode tangentTypeNode) : base(curve, keyNode, valueNode, tangentTypeNode) { SynchronizePoint(); }
private CurveViewModelBase <TValue> CreateCurveHierarchy <TValue, TCurveViewModel, TKeyFrameCurveViewModel>([NotNull] IComputeCurve <TValue> computeCurve, CurveViewModelBase parent = null, string name = null) where TValue : struct where TCurveViewModel : CurveViewModelBase <TValue> where TKeyFrameCurveViewModel : CurveViewModelBase <TValue> { var animationCurve = computeCurve as ComputeAnimationCurve <TValue>; if (animationCurve != null) { var curve = (TKeyFrameCurveViewModel)Activator.CreateInstance(typeof(TKeyFrameCurveViewModel), this, (ComputeAnimationCurve <TValue>)computeCurve, parent, name); curve.Initialize(); return(curve); } var binaryCurve = computeCurve as ComputeBinaryCurve <TValue>; if (binaryCurve != null) { var curve = (TCurveViewModel)Activator.CreateInstance(typeof(TCurveViewModel), this, binaryCurve, parent, name); if (binaryCurve.LeftChild != null) { var displayName = GetDisplayName(typeof(ComputeBinaryCurve <TValue>), nameof(ComputeBinaryCurve <TValue> .LeftChild)); curve.Children.Add(CreateCurveHierarchy <TValue, TCurveViewModel, TKeyFrameCurveViewModel>(binaryCurve.LeftChild, curve, displayName ?? "Left")); } if (binaryCurve.RightChild != null) { // Retrieve the display attribute var displayName = GetDisplayName(typeof(ComputeBinaryCurve <TValue>), nameof(ComputeBinaryCurve <TValue> .RightChild)); curve.Children.Add(CreateCurveHierarchy <TValue, TCurveViewModel, TKeyFrameCurveViewModel>(binaryCurve.RightChild, curve, displayName ?? "Right")); } curve.Initialize(); return(curve); } // Fallback curve else { var curve = (TCurveViewModel)Activator.CreateInstance(typeof(TCurveViewModel), this, computeCurve, parent, name); curve.Initialize(); return(curve); } }
private void AddCurvePrivate([NotNull] CurveViewModelBase curve) { curve.EnsureAxes(); curves.Add(curve); SelectedCurve = curve; }
public Vector2CurveViewModel([NotNull] CurveEditorViewModel editor, [NotNull] IComputeCurve <Vector2> computeCurve, CurveViewModelBase parent = null, string name = null) : base(editor, parent, computeCurve, name) { }
protected ColorComponentCurveViewModel([NotNull] CurveEditorViewModel editor, CurveViewModelBase parent, [NotNull] ComputeAnimationCurve <TValue> computeCurve, ColorComponent component) : base(editor, parent, computeCurve) { Component = component; Color = Editor.GetColor((VectorComponent)component); }