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
d9017c67b4
commit
2eb4d615ae
48 files changed
+269
-100
No files matched your search
+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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user