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/blob/master/LICENSE)
|
||||
[](https://github.com/SpoinkyNL/Artemis/stargazers)
|
||||
[](https://discord.gg/S3MVaC9)
|
||||
[](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.
|
||||
**Download**: https://github.com/SpoinkyNL/Artemis/releases
|
||||
**FAQ**: https://github.com/SpoinkyNL/Artemis/wiki/Frequently-Asked-Questions-(FAQ)
|
||||
**Documentation**: https://artemis-rgb.com/docs/
|
||||
**Pre-release download**: https://github.com/SpoinkyNL/Artemis/releases
|
||||
**Plugin Documentation**: https://artemis-rgb.com/docs/
|
||||
|
||||
### Notice
|
||||
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)
|
||||
return;
|
||||
|
||||
// Disable data bindings during an override
|
||||
var wasApplyingDataBindings = ApplyDataBindingsEnabled;
|
||||
ApplyDataBindingsEnabled = false;
|
||||
|
||||
UpdateDisplayCondition();
|
||||
|
||||
// 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];
|
||||
profileElement.Update(deltaTime);
|
||||
}
|
||||
|
||||
// Restore the old data bindings enabled state
|
||||
ApplyDataBindingsEnabled = wasApplyingDataBindings;
|
||||
}
|
||||
|
||||
protected internal override void UpdateTimelineLength()
|
||||
|
||||
@ -76,7 +76,7 @@ namespace Artemis.Core
|
||||
var result = new List<ILayerProperty>();
|
||||
result.AddRange(General.GetAllLayerProperties());
|
||||
result.AddRange(Transform.GetAllLayerProperties());
|
||||
if (LayerBrush?.BaseProperties != null)
|
||||
if (LayerBrush?.BaseProperties != null)
|
||||
result.AddRange(LayerBrush.BaseProperties.GetAllLayerProperties());
|
||||
foreach (var layerEffect in LayerEffects)
|
||||
{
|
||||
@ -300,6 +300,10 @@ namespace Artemis.Core
|
||||
if (!Enabled || LayerBrush?.BaseProperties == null || !LayerBrush.BaseProperties.PropertiesInitialized)
|
||||
return;
|
||||
|
||||
// Disable data bindings during an override
|
||||
var wasApplyingDataBindings = ApplyDataBindingsEnabled;
|
||||
ApplyDataBindingsEnabled = false;
|
||||
|
||||
var beginTime = TimelinePosition;
|
||||
|
||||
if (stickToMainSegment)
|
||||
@ -330,6 +334,9 @@ namespace Artemis.Core
|
||||
baseLayerEffect.BaseProperties?.Update(delta);
|
||||
baseLayerEffect.Update(delta);
|
||||
}
|
||||
|
||||
// Restore the old data bindings enabled state
|
||||
ApplyDataBindingsEnabled = wasApplyingDataBindings;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@ -373,7 +380,7 @@ namespace Artemis.Core
|
||||
// No point rendering if the alpha was set to zero by one of the effects
|
||||
if (layerPaint.Color.Alpha == 0)
|
||||
return;
|
||||
|
||||
|
||||
if (!LayerBrush.SupportsTransformation)
|
||||
SimpleRender(layerCanvas, _layerBitmap.Info, layerPaint, layerPath);
|
||||
else if (General.ResizeMode.CurrentValue == LayerResizeMode.Normal)
|
||||
|
||||
@ -43,8 +43,10 @@ namespace Artemis.Core
|
||||
|
||||
CurrentValue = BaseValue;
|
||||
|
||||
UpdateKeyframes();
|
||||
UpdateDataBindings(deltaTime);
|
||||
if (ProfileElement.ApplyKeyframesEnabled)
|
||||
UpdateKeyframes();
|
||||
if (ProfileElement.ApplyDataBindingsEnabled)
|
||||
UpdateDataBindings(deltaTime);
|
||||
|
||||
OnUpdated();
|
||||
}
|
||||
|
||||
@ -15,6 +15,9 @@ namespace Artemis.Core
|
||||
{
|
||||
protected RenderProfileElement()
|
||||
{
|
||||
ApplyDataBindingsEnabled = true;
|
||||
ApplyKeyframesEnabled = true;
|
||||
|
||||
LayerEffectStore.LayerEffectAdded += LayerEffectStoreOnLayerEffectAdded;
|
||||
LayerEffectStore.LayerEffectRemoved += LayerEffectStoreOnLayerEffectRemoved;
|
||||
}
|
||||
@ -405,6 +408,16 @@ namespace Artemis.Core
|
||||
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()
|
||||
{
|
||||
var conditionMet = DisplayCondition == null || DisplayCondition.Evaluate();
|
||||
|
||||
@ -83,6 +83,10 @@
|
||||
|
||||
<materialDesign:Card Grid.Row="3" Grid.ColumnSpan="2" Margin="0 5 0 0">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
@ -91,8 +95,18 @@
|
||||
<TextBlock Grid.Row="0" Margin="10 10 4 0">
|
||||
Test result
|
||||
</TextBlock>
|
||||
<Separator Grid.Row="1" Style="{StaticResource MaterialDesignLightSeparator}" Margin="0" />
|
||||
<Grid Grid.Row="2" Margin="10 4 10 10">
|
||||
<CheckBox Grid.Row="0"
|
||||
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>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Timers;
|
||||
using Artemis.Core;
|
||||
using Artemis.UI.Ninject.Factories;
|
||||
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
|
||||
{
|
||||
private readonly IDataBindingsVmFactory _dataBindingsVmFactory;
|
||||
private readonly IDataModelUIService _dataModelUIService;
|
||||
private readonly IProfileEditorService _profileEditorService;
|
||||
private DataBinding<TLayerProperty, TProperty> _dataBinding;
|
||||
private readonly Timer _updateTimer;
|
||||
private int _easingTime;
|
||||
private bool _isDataBindingEnabled;
|
||||
private bool _isEasingTimeEnabled;
|
||||
@ -22,6 +22,8 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.DataBindings
|
||||
private TimelineEasingViewModel _selectedEasingViewModel;
|
||||
|
||||
private bool _updating;
|
||||
private bool _applyTestResultToLayer;
|
||||
|
||||
|
||||
public DataBindingViewModel(DataBindingRegistration<TLayerProperty, TProperty> registration,
|
||||
IProfileEditorService profileEditorService,
|
||||
@ -30,8 +32,8 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.DataBindings
|
||||
{
|
||||
Registration = registration;
|
||||
_profileEditorService = profileEditorService;
|
||||
_dataModelUIService = dataModelUIService;
|
||||
_dataBindingsVmFactory = dataBindingsVmFactory;
|
||||
_updateTimer = new Timer(40);
|
||||
|
||||
if (Registration.Member != null)
|
||||
DisplayName = Registration.Member.Name.ToUpper();
|
||||
@ -40,8 +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);
|
||||
TestInputValue = dataModelUIService.GetDataModelDisplayViewModel(typeof(TProperty), true);
|
||||
TestResultValue = dataModelUIService.GetDataModelDisplayViewModel(typeof(TProperty), true);
|
||||
|
||||
Initialize();
|
||||
}
|
||||
@ -69,6 +71,12 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.DataBindings
|
||||
set => SetAndNotify(ref _isDataBindingEnabled, value);
|
||||
}
|
||||
|
||||
public bool ApplyTestResultToLayer
|
||||
{
|
||||
get => _applyTestResultToLayer;
|
||||
set => SetAndNotify(ref _applyTestResultToLayer, value);
|
||||
}
|
||||
|
||||
public TimelineEasingViewModel SelectedEasingViewModel
|
||||
{
|
||||
get => _selectedEasingViewModel;
|
||||
@ -101,13 +109,16 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.DataBindings
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_profileEditorService.ProfilePreviewUpdated -= ProfileEditorServiceOnProfilePreviewUpdated;
|
||||
_updateTimer.Dispose();
|
||||
_updateTimer.Elapsed -= OnUpdateTimerOnElapsed;
|
||||
}
|
||||
|
||||
private void Initialize()
|
||||
{
|
||||
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();
|
||||
Update();
|
||||
@ -212,6 +223,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.DataBindings
|
||||
return;
|
||||
}
|
||||
|
||||
Registration.DataBinding.Update(0.04);
|
||||
if (ActiveItem.SupportsTestValue)
|
||||
{
|
||||
var currentValue = Registration.Converter.ConvertFromObject(ActiveItem?.GetTestValue() ?? default(TProperty));
|
||||
@ -220,8 +232,14 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.DataBindings
|
||||
}
|
||||
else
|
||||
TestResultValue.UpdateValue(Registration.DataBinding != null ? Registration.DataBinding.GetValue(default) : default);
|
||||
}
|
||||
|
||||
if (ApplyTestResultToLayer)
|
||||
{
|
||||
Registration.DataBinding.Apply();
|
||||
_profileEditorService.UpdateProfilePreview();
|
||||
}
|
||||
}
|
||||
|
||||
private void EnableDataBinding()
|
||||
{
|
||||
if (Registration.DataBinding != null)
|
||||
@ -242,7 +260,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.DataBindings
|
||||
_profileEditorService.UpdateSelectedProfileElement();
|
||||
}
|
||||
|
||||
private void ProfileEditorServiceOnProfilePreviewUpdated(object sender, EventArgs e)
|
||||
private void OnUpdateTimerOnElapsed(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
UpdateTestResult();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user