mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
b7b012f863
@ -6,12 +6,12 @@
|
|||||||
[](https://github.com/SpoinkyNL/Artemis/releases)
|
[](https://github.com/SpoinkyNL/Artemis/releases)
|
||||||
[](https://github.com/SpoinkyNL/Artemis/blob/master/LICENSE)
|
[](https://github.com/SpoinkyNL/Artemis/blob/master/LICENSE)
|
||||||
[](https://github.com/SpoinkyNL/Artemis/stargazers)
|
[](https://github.com/SpoinkyNL/Artemis/stargazers)
|
||||||
|
[](https://discord.gg/S3MVaC9)
|
||||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VQBAEJYUFLU4J)
|
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VQBAEJYUFLU4J)
|
||||||
|
|
||||||
Artemis adds highly configurable support for several games to a range of RGB keyboards, mice and headsets.
|
Artemis adds highly configurable support for several games to a range of RGB keyboards, mice and headsets.
|
||||||
**Download**: https://github.com/SpoinkyNL/Artemis/releases
|
**Pre-release download**: https://github.com/SpoinkyNL/Artemis/releases
|
||||||
**FAQ**: https://github.com/SpoinkyNL/Artemis/wiki/Frequently-Asked-Questions-(FAQ)
|
**Plugin Documentation**: https://artemis-rgb.com/docs/
|
||||||
**Documentation**: https://artemis-rgb.com/docs/
|
|
||||||
|
|
||||||
### Notice
|
### Notice
|
||||||
Artemis 2 is in development. In the meanwhile I'm no longer supporting Artemis 1.x, sorry!
|
Artemis 2 is in development. In the meanwhile I'm no longer supporting Artemis 1.x, sorry!
|
||||||
|
|||||||
@ -82,6 +82,10 @@ namespace Artemis.Core
|
|||||||
if (!Enabled)
|
if (!Enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Disable data bindings during an override
|
||||||
|
var wasApplyingDataBindings = ApplyDataBindingsEnabled;
|
||||||
|
ApplyDataBindingsEnabled = false;
|
||||||
|
|
||||||
UpdateDisplayCondition();
|
UpdateDisplayCondition();
|
||||||
|
|
||||||
// Update the layer timeline, this will give us a new delta time which could be negative in case the main segment wrapped back
|
// Update the layer timeline, this will give us a new delta time which could be negative in case the main segment wrapped back
|
||||||
@ -100,6 +104,9 @@ namespace Artemis.Core
|
|||||||
var profileElement = Children[index];
|
var profileElement = Children[index];
|
||||||
profileElement.Update(deltaTime);
|
profileElement.Update(deltaTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Restore the old data bindings enabled state
|
||||||
|
ApplyDataBindingsEnabled = wasApplyingDataBindings;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected internal override void UpdateTimelineLength()
|
protected internal override void UpdateTimelineLength()
|
||||||
|
|||||||
@ -300,6 +300,10 @@ namespace Artemis.Core
|
|||||||
if (!Enabled || LayerBrush?.BaseProperties == null || !LayerBrush.BaseProperties.PropertiesInitialized)
|
if (!Enabled || LayerBrush?.BaseProperties == null || !LayerBrush.BaseProperties.PropertiesInitialized)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Disable data bindings during an override
|
||||||
|
var wasApplyingDataBindings = ApplyDataBindingsEnabled;
|
||||||
|
ApplyDataBindingsEnabled = false;
|
||||||
|
|
||||||
var beginTime = TimelinePosition;
|
var beginTime = TimelinePosition;
|
||||||
|
|
||||||
if (stickToMainSegment)
|
if (stickToMainSegment)
|
||||||
@ -330,6 +334,9 @@ namespace Artemis.Core
|
|||||||
baseLayerEffect.BaseProperties?.Update(delta);
|
baseLayerEffect.BaseProperties?.Update(delta);
|
||||||
baseLayerEffect.Update(delta);
|
baseLayerEffect.Update(delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Restore the old data bindings enabled state
|
||||||
|
ApplyDataBindingsEnabled = wasApplyingDataBindings;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|||||||
@ -43,7 +43,9 @@ namespace Artemis.Core
|
|||||||
|
|
||||||
CurrentValue = BaseValue;
|
CurrentValue = BaseValue;
|
||||||
|
|
||||||
|
if (ProfileElement.ApplyKeyframesEnabled)
|
||||||
UpdateKeyframes();
|
UpdateKeyframes();
|
||||||
|
if (ProfileElement.ApplyDataBindingsEnabled)
|
||||||
UpdateDataBindings(deltaTime);
|
UpdateDataBindings(deltaTime);
|
||||||
|
|
||||||
OnUpdated();
|
OnUpdated();
|
||||||
|
|||||||
@ -15,6 +15,9 @@ namespace Artemis.Core
|
|||||||
{
|
{
|
||||||
protected RenderProfileElement()
|
protected RenderProfileElement()
|
||||||
{
|
{
|
||||||
|
ApplyDataBindingsEnabled = true;
|
||||||
|
ApplyKeyframesEnabled = true;
|
||||||
|
|
||||||
LayerEffectStore.LayerEffectAdded += LayerEffectStoreOnLayerEffectAdded;
|
LayerEffectStore.LayerEffectAdded += LayerEffectStoreOnLayerEffectAdded;
|
||||||
LayerEffectStore.LayerEffectRemoved += LayerEffectStoreOnLayerEffectRemoved;
|
LayerEffectStore.LayerEffectRemoved += LayerEffectStoreOnLayerEffectRemoved;
|
||||||
}
|
}
|
||||||
@ -405,6 +408,16 @@ namespace Artemis.Core
|
|||||||
set => SetAndNotify(ref _displayCondition, value);
|
set => SetAndNotify(ref _displayCondition, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets whether keyframes should be applied when this profile element updates
|
||||||
|
/// </summary>
|
||||||
|
public bool ApplyKeyframesEnabled { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets whether data bindings should be applied when this profile element updates
|
||||||
|
/// </summary>
|
||||||
|
public bool ApplyDataBindingsEnabled { get; set; }
|
||||||
|
|
||||||
public void UpdateDisplayCondition()
|
public void UpdateDisplayCondition()
|
||||||
{
|
{
|
||||||
var conditionMet = DisplayCondition == null || DisplayCondition.Evaluate();
|
var conditionMet = DisplayCondition == null || DisplayCondition.Evaluate();
|
||||||
|
|||||||
@ -83,6 +83,10 @@
|
|||||||
|
|
||||||
<materialDesign:Card Grid.Row="3" Grid.ColumnSpan="2" Margin="0 5 0 0">
|
<materialDesign:Card Grid.Row="3" Grid.ColumnSpan="2" Margin="0 5 0 0">
|
||||||
<Grid>
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
@ -91,8 +95,18 @@
|
|||||||
<TextBlock Grid.Row="0" Margin="10 10 4 0">
|
<TextBlock Grid.Row="0" Margin="10 10 4 0">
|
||||||
Test result
|
Test result
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
<Separator Grid.Row="1" Style="{StaticResource MaterialDesignLightSeparator}" Margin="0" />
|
<CheckBox Grid.Row="0"
|
||||||
<Grid Grid.Row="2" Margin="10 4 10 10">
|
Grid.Column="1"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Margin="0 6 10 0"
|
||||||
|
Style="{StaticResource MaterialDesignCheckBox}"
|
||||||
|
ToolTip="Apply the test value to the layer"
|
||||||
|
IsChecked="{Binding ApplyTestResultToLayer}">
|
||||||
|
Preview on layer
|
||||||
|
</CheckBox>
|
||||||
|
<Separator Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Style="{StaticResource MaterialDesignLightSeparator}" Margin="0" />
|
||||||
|
<Grid Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" Margin="10 4 10 10">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition />
|
<ColumnDefinition />
|
||||||
<ColumnDefinition />
|
<ColumnDefinition />
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Timers;
|
||||||
using Artemis.Core;
|
using Artemis.Core;
|
||||||
using Artemis.UI.Ninject.Factories;
|
using Artemis.UI.Ninject.Factories;
|
||||||
using Artemis.UI.Screens.ProfileEditor.LayerProperties.Timeline;
|
using Artemis.UI.Screens.ProfileEditor.LayerProperties.Timeline;
|
||||||
@ -12,9 +13,8 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.DataBindings
|
|||||||
public class DataBindingViewModel<TLayerProperty, TProperty> : Conductor<IDataBindingModeViewModel>, IDataBindingViewModel
|
public class DataBindingViewModel<TLayerProperty, TProperty> : Conductor<IDataBindingModeViewModel>, IDataBindingViewModel
|
||||||
{
|
{
|
||||||
private readonly IDataBindingsVmFactory _dataBindingsVmFactory;
|
private readonly IDataBindingsVmFactory _dataBindingsVmFactory;
|
||||||
private readonly IDataModelUIService _dataModelUIService;
|
|
||||||
private readonly IProfileEditorService _profileEditorService;
|
private readonly IProfileEditorService _profileEditorService;
|
||||||
private DataBinding<TLayerProperty, TProperty> _dataBinding;
|
private readonly Timer _updateTimer;
|
||||||
private int _easingTime;
|
private int _easingTime;
|
||||||
private bool _isDataBindingEnabled;
|
private bool _isDataBindingEnabled;
|
||||||
private bool _isEasingTimeEnabled;
|
private bool _isEasingTimeEnabled;
|
||||||
@ -22,6 +22,8 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.DataBindings
|
|||||||
private TimelineEasingViewModel _selectedEasingViewModel;
|
private TimelineEasingViewModel _selectedEasingViewModel;
|
||||||
|
|
||||||
private bool _updating;
|
private bool _updating;
|
||||||
|
private bool _applyTestResultToLayer;
|
||||||
|
|
||||||
|
|
||||||
public DataBindingViewModel(DataBindingRegistration<TLayerProperty, TProperty> registration,
|
public DataBindingViewModel(DataBindingRegistration<TLayerProperty, TProperty> registration,
|
||||||
IProfileEditorService profileEditorService,
|
IProfileEditorService profileEditorService,
|
||||||
@ -30,8 +32,8 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.DataBindings
|
|||||||
{
|
{
|
||||||
Registration = registration;
|
Registration = registration;
|
||||||
_profileEditorService = profileEditorService;
|
_profileEditorService = profileEditorService;
|
||||||
_dataModelUIService = dataModelUIService;
|
|
||||||
_dataBindingsVmFactory = dataBindingsVmFactory;
|
_dataBindingsVmFactory = dataBindingsVmFactory;
|
||||||
|
_updateTimer = new Timer(40);
|
||||||
|
|
||||||
if (Registration.Member != null)
|
if (Registration.Member != null)
|
||||||
DisplayName = Registration.Member.Name.ToUpper();
|
DisplayName = Registration.Member.Name.ToUpper();
|
||||||
@ -40,8 +42,8 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.DataBindings
|
|||||||
|
|
||||||
DataBindingModes = new BindableCollection<ValueDescription>(EnumUtilities.GetAllValuesAndDescriptions(typeof(DataBindingModeType)));
|
DataBindingModes = new BindableCollection<ValueDescription>(EnumUtilities.GetAllValuesAndDescriptions(typeof(DataBindingModeType)));
|
||||||
EasingViewModels = new BindableCollection<TimelineEasingViewModel>();
|
EasingViewModels = new BindableCollection<TimelineEasingViewModel>();
|
||||||
TestInputValue = _dataModelUIService.GetDataModelDisplayViewModel(typeof(TProperty), true);
|
TestInputValue = dataModelUIService.GetDataModelDisplayViewModel(typeof(TProperty), true);
|
||||||
TestResultValue = _dataModelUIService.GetDataModelDisplayViewModel(typeof(TProperty), true);
|
TestResultValue = dataModelUIService.GetDataModelDisplayViewModel(typeof(TProperty), true);
|
||||||
|
|
||||||
Initialize();
|
Initialize();
|
||||||
}
|
}
|
||||||
@ -69,6 +71,12 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.DataBindings
|
|||||||
set => SetAndNotify(ref _isDataBindingEnabled, value);
|
set => SetAndNotify(ref _isDataBindingEnabled, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool ApplyTestResultToLayer
|
||||||
|
{
|
||||||
|
get => _applyTestResultToLayer;
|
||||||
|
set => SetAndNotify(ref _applyTestResultToLayer, value);
|
||||||
|
}
|
||||||
|
|
||||||
public TimelineEasingViewModel SelectedEasingViewModel
|
public TimelineEasingViewModel SelectedEasingViewModel
|
||||||
{
|
{
|
||||||
get => _selectedEasingViewModel;
|
get => _selectedEasingViewModel;
|
||||||
@ -101,13 +109,16 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.DataBindings
|
|||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_profileEditorService.ProfilePreviewUpdated -= ProfileEditorServiceOnProfilePreviewUpdated;
|
_updateTimer.Dispose();
|
||||||
|
_updateTimer.Elapsed -= OnUpdateTimerOnElapsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Initialize()
|
private void Initialize()
|
||||||
{
|
{
|
||||||
EasingViewModels.AddRange(Enum.GetValues(typeof(Easings.Functions)).Cast<Easings.Functions>().Select(v => new TimelineEasingViewModel(v, false)));
|
EasingViewModels.AddRange(Enum.GetValues(typeof(Easings.Functions)).Cast<Easings.Functions>().Select(v => new TimelineEasingViewModel(v, false)));
|
||||||
_profileEditorService.ProfilePreviewUpdated += ProfileEditorServiceOnProfilePreviewUpdated;
|
|
||||||
|
_updateTimer.Start();
|
||||||
|
_updateTimer.Elapsed += OnUpdateTimerOnElapsed;
|
||||||
|
|
||||||
CreateDataBindingModeModeViewModel();
|
CreateDataBindingModeModeViewModel();
|
||||||
Update();
|
Update();
|
||||||
@ -212,6 +223,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.DataBindings
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Registration.DataBinding.Update(0.04);
|
||||||
if (ActiveItem.SupportsTestValue)
|
if (ActiveItem.SupportsTestValue)
|
||||||
{
|
{
|
||||||
var currentValue = Registration.Converter.ConvertFromObject(ActiveItem?.GetTestValue() ?? default(TProperty));
|
var currentValue = Registration.Converter.ConvertFromObject(ActiveItem?.GetTestValue() ?? default(TProperty));
|
||||||
@ -220,6 +232,12 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.DataBindings
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
TestResultValue.UpdateValue(Registration.DataBinding != null ? Registration.DataBinding.GetValue(default) : default);
|
TestResultValue.UpdateValue(Registration.DataBinding != null ? Registration.DataBinding.GetValue(default) : default);
|
||||||
|
|
||||||
|
if (ApplyTestResultToLayer)
|
||||||
|
{
|
||||||
|
Registration.DataBinding.Apply();
|
||||||
|
_profileEditorService.UpdateProfilePreview();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void EnableDataBinding()
|
private void EnableDataBinding()
|
||||||
@ -242,7 +260,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.DataBindings
|
|||||||
_profileEditorService.UpdateSelectedProfileElement();
|
_profileEditorService.UpdateSelectedProfileElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ProfileEditorServiceOnProfilePreviewUpdated(object sender, EventArgs e)
|
private void OnUpdateTimerOnElapsed(object sender, ElapsedEventArgs e)
|
||||||
{
|
{
|
||||||
UpdateTestResult();
|
UpdateTestResult();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user