/// <summary> /// Associates the keyframe engine with the provided layer property. /// </summary> /// <param name="layerProperty"></param> public void Initialize(BaseLayerProperty layerProperty) { if (Initialized) { throw new ArtemisCoreException("Cannot initialize the same keyframe engine twice"); } if (!CompatibleTypes.Contains(layerProperty.Type)) { throw new ArtemisCoreException($"This property engine does not support the provided type {layerProperty.Type.Name}"); } LayerProperty = layerProperty; LayerProperty.KeyframeEngine = this; Initialized = true; }
public KeyframeEngine InstantiateKeyframeEngine(BaseLayerProperty layerProperty) { // This creates an instance of each keyframe engine, which is pretty cheap since all the expensive stuff is done during // Initialize() call but it's not ideal var keyframeEngines = _kernel.Get <List <KeyframeEngine> >(); var keyframeEngine = keyframeEngines.FirstOrDefault(k => k.CompatibleTypes.Contains(layerProperty.Type)); if (keyframeEngine == null) { return(null); } keyframeEngine.Initialize(layerProperty); return(keyframeEngine); }
public LayerPropertyViewModel(BaseLayerProperty layerProperty, LayerPropertyViewModel parent, ILayerPropertyViewModelFactory layerPropertyViewModelFactory, IKernel kernel, IProfileEditorService profileEditorService) { _kernel = kernel; _profileEditorService = profileEditorService; _keyframesEnabled = layerProperty.IsUsingKeyframes; LayerProperty = layerProperty; Parent = parent; Children = new List <LayerPropertyViewModel>(); IsExpanded = layerProperty.ExpandByDefault; foreach (var child in layerProperty.Children) { Children.Add(layerPropertyViewModelFactory.Create(child, this)); } }