mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Plugins - Added timed updates
Modules - Added option to disable updates while activation is overridden Display conditions - Added SKColor support Data bindings - Added SKColor support
This commit is contained in:
1 parent
35b3b1d1f6
commit
29e5bc998e
48 files changed
+269
-100
No files matched your search
@@ -315,10 +315,19 @@
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Update="DataModelVisualization\Input\DoubleDataModelInputView.xaml">
|
||||
<Page Update="DefaultTypes\DataModel\Display\SKColorDataModelDisplayView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="DataModelVisualization\Input\IntDataModelInputView.xaml">
|
||||
<Page Update="DefaultTypes\DataModel\Input\DoubleDataModelInputView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="DefaultTypes\DataModel\Input\IntDataModelInputView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="DefaultTypes\DataModel\Input\SKColorDataModelInputView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="DefaultTypes\DataModel\Input\StringDataModelInputView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
|
||||
+2
-3
@@ -1,10 +1,10 @@
|
||||
<UserControl x:Class="Artemis.UI.DataModelVisualization.Display.SKColorDataModelDisplayView"
|
||||
<UserControl x:Class="Artemis.UI.DefaultTypes.DataModel.Display.SKColorDataModelDisplayView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:display="clr-namespace:Artemis.UI.DataModelVisualization.Display"
|
||||
xmlns:shared="clr-namespace:Artemis.UI.Shared;assembly=Artemis.UI.Shared"
|
||||
xmlns:display="clr-namespace:Artemis.UI.DefaultTypes.DataModel.Display"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800"
|
||||
d:DataContext="{d:DesignInstance {x:Type display:SKColorDataModelDisplayViewModel}}">
|
||||
@@ -16,7 +16,6 @@
|
||||
<shared:ColorToStringConverter x:Key="SKColorToStringConverter" />
|
||||
<shared:SKColorToColorConverter x:Key="SKColorToColorConverter" />
|
||||
</ResourceDictionary>
|
||||
|
||||
</UserControl.Resources>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<TextBlock x:Name="HexDisplay"
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
using Artemis.UI.Shared;
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Artemis.UI.DataModelVisualization.Display
|
||||
namespace Artemis.UI.DefaultTypes.DataModel.Display
|
||||
{
|
||||
public class SKColorDataModelDisplayViewModel : DataModelDisplayViewModel<SKColor>
|
||||
{
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
<UserControl x:Class="Artemis.UI.DataModelVisualization.Input.DoubleDataModelInputView"
|
||||
<UserControl x:Class="Artemis.UI.DefaultTypes.DataModel.Input.DoubleDataModelInputView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
+1
-1
@@ -4,7 +4,7 @@ using System.Windows.Input;
|
||||
using Artemis.Core.DataModelExpansions;
|
||||
using Artemis.UI.Shared;
|
||||
|
||||
namespace Artemis.UI.DataModelVisualization.Input
|
||||
namespace Artemis.UI.DefaultTypes.DataModel.Input
|
||||
{
|
||||
public class DoubleDataModelInputViewModel : DataModelInputViewModel<double>
|
||||
{
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
<UserControl x:Class="Artemis.UI.DataModelVisualization.Input.IntDataModelInputView"
|
||||
<UserControl x:Class="Artemis.UI.DefaultTypes.DataModel.Input.IntDataModelInputView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
+1
-1
@@ -3,7 +3,7 @@ using System.Windows.Input;
|
||||
using Artemis.Core.DataModelExpansions;
|
||||
using Artemis.UI.Shared;
|
||||
|
||||
namespace Artemis.UI.DataModelVisualization.Input
|
||||
namespace Artemis.UI.DefaultTypes.DataModel.Input
|
||||
{
|
||||
public class IntDataModelInputViewModel : DataModelInputViewModel<int>
|
||||
{
|
||||
@@ -0,0 +1,20 @@
|
||||
<UserControl x:Class="Artemis.UI.DefaultTypes.DataModel.Input.SKColorDataModelInputView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:s="https://github.com/canton7/Stylet"
|
||||
xmlns:shared="clr-namespace:Artemis.UI.Shared;assembly=Artemis.UI.Shared"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/Artemis.UI.Shared;component/Resources/ArtemisShared.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<shared:SKColorToColorConverter x:Key="SKColorToColorConverter" />
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<shared:ColorPicker VerticalAlignment="Center" Color="{Binding InputValue, Converter={StaticResource SKColorToColorConverter}}" StaysOpen="True" Width="140"/>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,13 @@
|
||||
using Artemis.Core.DataModelExpansions;
|
||||
using Artemis.UI.Shared;
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Artemis.UI.DefaultTypes.DataModel.Input
|
||||
{
|
||||
public class SKColorDataModelInputViewModel : DataModelInputViewModel<SKColor>
|
||||
{
|
||||
public SKColorDataModelInputViewModel(DataModelPropertyAttribute targetDescription, SKColor initialValue) : base(targetDescription, initialValue)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
<UserControl x:Class="Artemis.UI.DataModelVisualization.Input.StringDataModelInputView"
|
||||
<UserControl x:Class="Artemis.UI.DefaultTypes.DataModel.Input.StringDataModelInputView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
using Artemis.Core.DataModelExpansions;
|
||||
using Artemis.UI.Shared;
|
||||
|
||||
namespace Artemis.UI.DataModelVisualization.Input
|
||||
namespace Artemis.UI.DefaultTypes.DataModel.Input
|
||||
{
|
||||
public class StringDataModelInputViewModel : DataModelInputViewModel<string>
|
||||
{
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+14
-2
@@ -105,10 +105,22 @@
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Margin="0 2">Input</TextBlock>
|
||||
<TextBlock Grid.Row="0" Grid.Column="1" Margin="0 2" FontFamily="Consolas" Text="{Binding TestInputValue}" />
|
||||
<ContentControl Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
s:View.Model="{Binding TestInputValue}"
|
||||
Margin="0 2"
|
||||
FontFamily="Consolas"
|
||||
VerticalAlignment="Stretch"
|
||||
HorizontalAlignment="Right" />
|
||||
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Margin="0 2">Output</TextBlock>
|
||||
<TextBlock Grid.Row="1" Grid.Column="1" Margin="0 2" FontFamily="Consolas" Text="{Binding TestResultValue}" />
|
||||
<ContentControl Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
s:View.Model="{Binding TestResultValue}"
|
||||
Margin="0 2"
|
||||
FontFamily="Consolas"
|
||||
VerticalAlignment="Stretch"
|
||||
HorizontalAlignment="Right" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</materialDesign:Card>
|
||||
|
||||
+12
-20
@@ -13,6 +13,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.DataBindings
|
||||
{
|
||||
private readonly IDataBindingsVmFactory _dataBindingsVmFactory;
|
||||
private readonly IProfileEditorService _profileEditorService;
|
||||
private readonly IDataModelUIService _dataModelUIService;
|
||||
private DataBinding<TLayerProperty, TProperty> _dataBinding;
|
||||
private int _easingTime;
|
||||
private bool _isEasingTimeEnabled;
|
||||
@@ -26,10 +27,12 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.DataBindings
|
||||
|
||||
public DataBindingViewModel(DataBindingRegistration<TLayerProperty, TProperty> registration,
|
||||
IProfileEditorService profileEditorService,
|
||||
IDataModelUIService dataModelUIService,
|
||||
IDataBindingsVmFactory dataBindingsVmFactory)
|
||||
{
|
||||
Registration = registration;
|
||||
_profileEditorService = profileEditorService;
|
||||
_dataModelUIService = dataModelUIService;
|
||||
_dataBindingsVmFactory = dataBindingsVmFactory;
|
||||
|
||||
if (Registration.Member != null)
|
||||
@@ -39,6 +42,8 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.DataBindings
|
||||
|
||||
DataBindingModes = new BindableCollection<ValueDescription>(EnumUtilities.GetAllValuesAndDescriptions(typeof(DataBindingModeType)));
|
||||
EasingViewModels = new BindableCollection<TimelineEasingViewModel>();
|
||||
TestInputValue = _dataModelUIService.GetDataModelDisplayViewModel(typeof(TProperty), true);
|
||||
TestResultValue = _dataModelUIService.GetDataModelDisplayViewModel(typeof(TProperty), true);
|
||||
|
||||
DataBinding = Registration.DataBinding;
|
||||
|
||||
@@ -49,6 +54,8 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.DataBindings
|
||||
|
||||
public BindableCollection<ValueDescription> DataBindingModes { get; }
|
||||
public BindableCollection<TimelineEasingViewModel> EasingViewModels { get; }
|
||||
public DataModelDisplayViewModel TestInputValue { get; }
|
||||
public DataModelDisplayViewModel TestResultValue { get; }
|
||||
|
||||
public DataBindingModeType SelectedDataBindingMode
|
||||
{
|
||||
@@ -102,18 +109,6 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.DataBindings
|
||||
set => SetAndNotify(ref _dataBinding, value);
|
||||
}
|
||||
|
||||
public TProperty TestInputValue
|
||||
{
|
||||
get => _testInputValue;
|
||||
set => SetAndNotify(ref _testInputValue, value);
|
||||
}
|
||||
|
||||
public TProperty TestResultValue
|
||||
{
|
||||
get => _testResultValue;
|
||||
set => SetAndNotify(ref _testResultValue, value);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_profileEditorService.ProfilePreviewUpdated -= ProfileEditorServiceOnProfilePreviewUpdated;
|
||||
@@ -222,18 +217,15 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.DataBindings
|
||||
{
|
||||
if (DataBinding == null)
|
||||
{
|
||||
TestInputValue = default;
|
||||
TestResultValue = default;
|
||||
TestInputValue.UpdateValue(default);
|
||||
TestResultValue.UpdateValue(default);
|
||||
return;
|
||||
}
|
||||
|
||||
var currentValue = ActiveItem?.GetTestValue() ?? default(TProperty);
|
||||
var currentValue = Registration.Converter.ConvertFromObject(ActiveItem?.GetTestValue() ?? default(TProperty));
|
||||
|
||||
TestInputValue = Registration.Converter.ConvertFromObject(currentValue);
|
||||
if (DataBinding != null)
|
||||
TestResultValue = DataBinding.GetValue(TestInputValue);
|
||||
else
|
||||
TestInputValue = default;
|
||||
TestInputValue.UpdateValue(currentValue);
|
||||
TestResultValue.UpdateValue(DataBinding != null ? DataBinding.GetValue(currentValue) : default);
|
||||
}
|
||||
|
||||
private void EnableDataBinding()
|
||||
|
||||
+7
@@ -79,11 +79,13 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.DataBindings.DirectDa
|
||||
private void ParameterSelectionViewModelOnPropertySelected(object sender, DataModelInputDynamicEventArgs e)
|
||||
{
|
||||
Modifier.UpdateParameter(e.DataModelVisualizationViewModel.DataModel, e.DataModelVisualizationViewModel.PropertyPath);
|
||||
_profileEditorService.UpdateSelectedProfileElement();
|
||||
}
|
||||
|
||||
private void StaticInputViewModelOnValueUpdated(object sender, DataModelInputStaticEventArgs e)
|
||||
{
|
||||
Modifier.UpdateParameter(e.Value);
|
||||
_profileEditorService.UpdateSelectedProfileElement();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
@@ -155,6 +157,11 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.DataBindings.DirectDa
|
||||
DynamicSelectionViewModel.Dispose();
|
||||
DynamicSelectionViewModel.PropertySelected -= ParameterSelectionViewModelOnPropertySelected;
|
||||
}
|
||||
|
||||
if (StaticInputViewModel != null)
|
||||
{
|
||||
StaticInputViewModel.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -97,21 +97,7 @@
|
||||
<TextBlock Grid.Column="1" Text="{Binding PropertyDescription.Name}" ToolTip="{Binding PropertyDescription.Description}" />
|
||||
|
||||
<!-- Value display -->
|
||||
<TextBlock Grid.Column="2"
|
||||
Text="{Binding DisplayValue, Mode=OneWay}"
|
||||
FontFamily="Consolas"
|
||||
HorizontalAlignment="Right"
|
||||
Visibility="{Binding ShowToString, Converter={x:Static s:BoolToVisibilityConverter.Instance}, Mode=OneWay}" />
|
||||
<TextBlock Grid.Column="2"
|
||||
Text="null"
|
||||
FontFamily="Consolas"
|
||||
HorizontalAlignment="Right"
|
||||
Foreground="{DynamicResource MaterialDesignCheckBoxDisabled}"
|
||||
Visibility="{Binding ShowNull, Converter={x:Static s:BoolToVisibilityConverter.Instance}, Mode=OneWay}" />
|
||||
<ContentControl Grid.Column="2"
|
||||
s:View.Model="{Binding DisplayViewModel}"
|
||||
FontFamily="Consolas"
|
||||
Visibility="{Binding ShowViewModel, Converter={x:Static s:BoolToVisibilityConverter.Instance}, Mode=OneWay}" />
|
||||
<ContentControl Grid.Column="2" s:View.Model="{Binding DisplayViewModel}" FontFamily="Consolas" />
|
||||
</Grid>
|
||||
</HierarchicalDataTemplate>
|
||||
<HierarchicalDataTemplate DataType="{x:Type dataModel:DataModelListPropertyViewModel}">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Artemis.Core;
|
||||
using Artemis.UI.DataModelVisualization.Display;
|
||||
using Artemis.UI.DataModelVisualization.Input;
|
||||
using Artemis.UI.DefaultTypes.DataModel.Display;
|
||||
using Artemis.UI.DefaultTypes.DataModel.Input;
|
||||
using Artemis.UI.PropertyInput;
|
||||
using Artemis.UI.Services.Interfaces;
|
||||
using Artemis.UI.Shared.Services;
|
||||
@@ -36,9 +36,10 @@ namespace Artemis.UI.Services
|
||||
if (_registeredBuiltInDataModelInputs)
|
||||
return;
|
||||
|
||||
_dataModelUIService.RegisterDataModelInput<StringDataModelInputViewModel>(Constants.CorePluginInfo, null);
|
||||
_dataModelUIService.RegisterDataModelInput<IntDataModelInputViewModel>(Constants.CorePluginInfo, Constants.IntegralNumberTypes);
|
||||
_dataModelUIService.RegisterDataModelInput<DoubleDataModelInputViewModel>(Constants.CorePluginInfo, Constants.FloatNumberTypes);
|
||||
_dataModelUIService.RegisterDataModelInput<IntDataModelInputViewModel>(Constants.CorePluginInfo, Constants.IntegralNumberTypes);
|
||||
_dataModelUIService.RegisterDataModelInput<SKColorDataModelInputViewModel>(Constants.CorePluginInfo, null);
|
||||
_dataModelUIService.RegisterDataModelInput<StringDataModelInputViewModel>(Constants.CorePluginInfo, null);
|
||||
|
||||
_registeredBuiltInDataModelInputs = true;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user