mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Profile editor - Continue updating datamodel in editor
Display conditions - Added setting to display current values while selecting condition targets
This commit is contained in:
1 parent
35c46a4825
commit
f3cbd819f5
26 files changed
+382
-93
No files matched your search
+17
-3
@@ -1,4 +1,5 @@
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Artemis.Core.Plugins.Abstract.DataModels;
|
||||
using Artemis.UI.Shared.Services;
|
||||
@@ -31,16 +32,29 @@ namespace Artemis.UI.Shared.DataModelVisualization.Shared
|
||||
|
||||
private void PopulateProperties(IDataModelVisualizationService dataModelVisualizationService)
|
||||
{
|
||||
if (Children.Any())
|
||||
if (IsRootViewModel)
|
||||
return;
|
||||
|
||||
// Add missing children
|
||||
var modelType = Parent.IsRootViewModel ? DataModel.GetType() : PropertyInfo.PropertyType;
|
||||
foreach (var propertyInfo in modelType.GetProperties())
|
||||
foreach (var propertyInfo in modelType.GetProperties(BindingFlags.Public | BindingFlags.Instance))
|
||||
{
|
||||
if (Children.Any(c => c.PropertyInfo.Equals(propertyInfo)))
|
||||
continue;
|
||||
|
||||
var child = CreateChild(dataModelVisualizationService, propertyInfo, GetChildDepth());
|
||||
if (child != null)
|
||||
Children.Add(child);
|
||||
}
|
||||
|
||||
// Remove children that should be hidden
|
||||
var childList = new List<DataModelVisualizationViewModel>(Children);
|
||||
var hiddenProperties = DataModel.GetHiddenProperties();
|
||||
foreach (var dataModelVisualizationViewModel in childList)
|
||||
{
|
||||
if (hiddenProperties.Contains(dataModelVisualizationViewModel.PropertyInfo))
|
||||
Children.Remove(dataModelVisualizationViewModel);
|
||||
}
|
||||
}
|
||||
|
||||
protected int GetChildDepth()
|
||||
|
||||
+20
-13
@@ -1,9 +1,12 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Artemis.Core.Extensions;
|
||||
using Artemis.Core.Models.Profile.Conditions;
|
||||
using Artemis.Core.Plugins.Abstract;
|
||||
using Artemis.Core.Plugins.Abstract.DataModels;
|
||||
using Artemis.Core.Plugins.Abstract.DataModels.Attributes;
|
||||
using Artemis.UI.Shared.Exceptions;
|
||||
@@ -23,6 +26,7 @@ namespace Artemis.UI.Shared.DataModelVisualization.Shared
|
||||
private DataModelVisualizationViewModel _parent;
|
||||
private DataModelPropertyAttribute _propertyDescription;
|
||||
private PropertyInfo _propertyInfo;
|
||||
private bool _isIgnored;
|
||||
|
||||
internal DataModelVisualizationViewModel(DataModel dataModel, DataModelVisualizationViewModel parent, PropertyInfo propertyInfo)
|
||||
{
|
||||
@@ -31,7 +35,7 @@ namespace Artemis.UI.Shared.DataModelVisualization.Shared
|
||||
Parent = parent;
|
||||
Children = new BindableCollection<DataModelVisualizationViewModel>();
|
||||
IsMatchingFilteredTypes = true;
|
||||
|
||||
|
||||
if (dataModel == null && parent == null && propertyInfo == null)
|
||||
IsRootViewModel = true;
|
||||
else
|
||||
@@ -118,7 +122,7 @@ namespace Artemis.UI.Shared.DataModelVisualization.Shared
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the datamodel and if in an parent, any children
|
||||
/// Updates the datamodel and if in an parent, any children
|
||||
/// </summary>
|
||||
/// <param name="dataModelVisualizationService"></param>
|
||||
public abstract void Update(IDataModelVisualizationService dataModelVisualizationService);
|
||||
@@ -231,6 +235,9 @@ namespace Artemis.UI.Shared.DataModelVisualization.Shared
|
||||
// Skip properties decorated with DataModelIgnore
|
||||
if (Attribute.IsDefined(propertyInfo, typeof(DataModelIgnoreAttribute)))
|
||||
return null;
|
||||
// Skip properties that are in the ignored properties list of the respective profile module/data model expansion
|
||||
if (DataModel.GetHiddenProperties().Any(p => p.Equals(propertyInfo)))
|
||||
return null;
|
||||
|
||||
// If a display VM was found, prefer to use that in any case
|
||||
var typeViewModel = dataModelVisualizationService.GetDataModelDisplayViewModel(propertyInfo.PropertyType);
|
||||
@@ -248,17 +255,6 @@ namespace Artemis.UI.Shared.DataModelVisualization.Shared
|
||||
return null;
|
||||
}
|
||||
|
||||
#region Events
|
||||
|
||||
public event EventHandler UpdateRequested;
|
||||
|
||||
protected virtual void OnUpdateRequested()
|
||||
{
|
||||
UpdateRequested?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void RequestUpdate()
|
||||
{
|
||||
Parent?.RequestUpdate();
|
||||
@@ -283,6 +279,17 @@ namespace Artemis.UI.Shared.DataModelVisualization.Shared
|
||||
if (PropertyDescription != null && PropertyDescription.Name == null && PropertyInfo != null)
|
||||
PropertyDescription.Name = PropertyInfo.Name.Humanize();
|
||||
}
|
||||
|
||||
#region Events
|
||||
|
||||
public event EventHandler UpdateRequested;
|
||||
|
||||
protected virtual void OnUpdateRequested()
|
||||
{
|
||||
UpdateRequested?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public enum DisplayConditionSide
|
||||
|
||||
@@ -26,8 +26,6 @@ namespace Artemis.UI.Shared.Services.Interfaces
|
||||
void UpdateProfilePreview();
|
||||
void UndoUpdateProfile(ProfileModule module);
|
||||
void RedoUpdateProfile(ProfileModule module);
|
||||
void StopRegularRender();
|
||||
void ResumeRegularRender();
|
||||
Module GetCurrentModule();
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Core.Models.Profile;
|
||||
using Artemis.Core.Models.Profile.LayerProperties;
|
||||
using Artemis.Core.Plugins.Abstract;
|
||||
using Artemis.Core.Plugins.Exceptions;
|
||||
using Artemis.Core.Plugins.Models;
|
||||
using Artemis.Core.Services.Interfaces;
|
||||
using Artemis.Core.Services.Storage.Interfaces;
|
||||
using Artemis.UI.Shared.Events;
|
||||
using Artemis.UI.Shared.PropertyInput;
|
||||
@@ -19,18 +17,16 @@ namespace Artemis.UI.Shared.Services
|
||||
{
|
||||
public class ProfileEditorService : IProfileEditorService
|
||||
{
|
||||
private readonly ICoreService _coreService;
|
||||
private readonly IProfileService _profileService;
|
||||
private readonly ILogger _logger;
|
||||
private readonly IProfileService _profileService;
|
||||
private readonly List<PropertyInputRegistration> _registeredPropertyEditors;
|
||||
private TimeSpan _currentTime;
|
||||
private int _pixelsPerSecond;
|
||||
private object _selectedProfileLock = new object();
|
||||
private object _selectedProfileElementLock = new object();
|
||||
private readonly object _selectedProfileElementLock = new object();
|
||||
private readonly object _selectedProfileLock = new object();
|
||||
|
||||
public ProfileEditorService(ICoreService coreService, IProfileService profileService, IKernel kernel, ILogger logger)
|
||||
public ProfileEditorService(IProfileService profileService, IKernel kernel, ILogger logger)
|
||||
{
|
||||
_coreService = coreService;
|
||||
_profileService = profileService;
|
||||
_logger = logger;
|
||||
_registeredPropertyEditors = new List<PropertyInputRegistration>();
|
||||
@@ -126,7 +122,7 @@ namespace Artemis.UI.Shared.Services
|
||||
{
|
||||
if (SelectedProfile == null)
|
||||
return;
|
||||
|
||||
|
||||
// Stick to the main segment for any element that is not currently selected
|
||||
foreach (var folder in SelectedProfile.GetAllFolders())
|
||||
folder.OverrideProgress(CurrentTime, folder != SelectedProfileElement);
|
||||
@@ -260,19 +256,9 @@ namespace Artemis.UI.Shared.Services
|
||||
public event EventHandler<RenderProfileElementEventArgs> ProfileElementSelected;
|
||||
public event EventHandler<RenderProfileElementEventArgs> SelectedProfileElementUpdated;
|
||||
public event EventHandler CurrentTimeChanged;
|
||||
public event EventHandler CurrentTimelineChanged;
|
||||
public event EventHandler PixelsPerSecondChanged;
|
||||
public event EventHandler ProfilePreviewUpdated;
|
||||
|
||||
public void StopRegularRender()
|
||||
{
|
||||
_coreService.PluginUpdatingDisabled = true;
|
||||
}
|
||||
|
||||
public void ResumeRegularRender()
|
||||
{
|
||||
_coreService.PluginUpdatingDisabled = false;
|
||||
}
|
||||
public event EventHandler CurrentTimelineChanged;
|
||||
|
||||
protected virtual void OnSelectedProfileChanged(ProfileEventArgs e)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user