Core - Streamlined public parts of profile creation

UI - Started adjusting the VMs for the layer refactor
This commit is contained in:
Robert authored and SpoinkyNL committed 2020-09-12 10:39:44 +02:00
1 parent 12ac50226f
commit 3e75f200f4
58 files changed
+694 -1196

No files matched your search

@@ -10,7 +10,7 @@ namespace Artemis.UI.Shared.Services
{
Profile SelectedProfile { get; }
RenderProfileElement SelectedProfileElement { get; }
BaseLayerProperty SelectedDataBinding { get; }
ILayerProperty SelectedDataBinding { get; }
TimeSpan CurrentTime { get; set; }
int PixelsPerSecond { get; set; }
IReadOnlyList<PropertyInputRegistration> RegisteredPropertyEditors { get; }
@@ -19,7 +19,7 @@ namespace Artemis.UI.Shared.Services
void UpdateSelectedProfile();
void ChangeSelectedProfileElement(RenderProfileElement profileElement);
void UpdateSelectedProfileElement();
void ChangeSelectedDataBinding(BaseLayerProperty layerProperty);
void ChangeSelectedDataBinding(ILayerProperty layerProperty);
void UpdateProfilePreview();
bool UndoUpdateProfile();
bool RedoUpdateProfile();
@@ -88,5 +88,10 @@ namespace Artemis.UI.Shared.Services
/// <param name="excludedKeyframe">A keyframe to exclude during keyframe snapping</param>
/// <returns></returns>
TimeSpan SnapToTimeline(TimeSpan time, TimeSpan tolerance, bool snapToSegments, bool snapToCurrentTime, bool snapToKeyframes, BaseLayerPropertyKeyframe excludedKeyframe = null);
/// <summary>
/// If a matching registration is found, creates a new <see cref="PropertyInputViewModel{T}"/> supporting <typeparamref name="T"/>
/// </summary>
PropertyInputViewModel<T> CreatePropertyInputViewModel<T>(LayerProperty<T> layerProperty);
}
}
@@ -5,6 +5,7 @@ using Artemis.Core;
using Artemis.Core.Modules;
using Artemis.Core.Services;
using Ninject;
using Ninject.Parameters;
using Serilog;
using Stylet;
@@ -269,6 +270,16 @@ namespace Artemis.UI.Shared.Services
return time;
}
public PropertyInputViewModel<T> CreatePropertyInputViewModel<T>(LayerProperty<T> layerProperty)
{
var registration = RegisteredPropertyEditors.FirstOrDefault(r => r.SupportedType == typeof(T));
if (registration == null)
return null;
var parameter = new ConstructorArgument("layerProperty", layerProperty);
return (PropertyInputViewModel<T>) Kernel.Get(registration.ViewModelType, parameter);
}
public ProfileModule GetCurrentModule()
{
return SelectedProfile?.Module;