Implemented basic keyframes

This commit is contained in:
Robert committed 2020-01-09 21:13:29 +01:00
1 parent e8570a6dd9
commit 0958c3af9f
41 files changed
+951 -123

No files matched your search

@@ -70,6 +70,7 @@ namespace Artemis.Core.Services.Storage
if (_surfaceService.ActiveSurface != null)
profile.PopulateLeds(_surfaceService.ActiveSurface);
return profile;
}
@@ -78,7 +79,10 @@ namespace Artemis.Core.Services.Storage
{
module.ChangeActiveProfile(profile, _surfaceService.ActiveSurface);
if (profile != null)
{
InstantiateProfileLayerBrushes(profile);
InstantiateProfileKeyframeEngines(profile);
}
}
public void DeleteProfile(Profile profile)
@@ -118,6 +122,15 @@ namespace Artemis.Core.Services.Storage
}
}
private void InstantiateProfileKeyframeEngines(Profile profile)
{
// Only instantiate engines for properties without an existing engine instance
foreach (var layerProperty in profile.GetAllLayers().SelectMany(l => l.Properties).Where(p => p.KeyframeEngine == null))
{
_layerService.InstantiateKeyframeEngine(layerProperty);
}
}
private void ActiveProfilesPopulateLeds(ArtemisSurface surface)
{
var profileModules = _pluginService.GetPluginsOfType<ProfileModule>();
@@ -132,6 +145,13 @@ namespace Artemis.Core.Services.Storage
InstantiateProfileLayerBrushes(profileModule.ActiveProfile);
}
private void ActiveProfilesInstantiateKeyframeEngines()
{
var profileModules = _pluginService.GetPluginsOfType<ProfileModule>();
foreach (var profileModule in profileModules.Where(p => p.ActiveProfile != null).ToList())
InstantiateProfileKeyframeEngines(profileModule.ActiveProfile);
}
#region Event handlers
private void OnActiveSurfaceConfigurationChanged(object sender, SurfaceConfigurationEventArgs e)
@@ -148,7 +168,10 @@ namespace Artemis.Core.Services.Storage
private void OnPluginLoaded(object sender, PluginEventArgs e)
{
if (e.PluginInfo.Instance is LayerBrushProvider)
{
ActiveProfilesInstantiateProfileLayerBrushes();
ActiveProfilesInstantiateKeyframeEngines();
}
}
#endregion