mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 20:06:33 +00:00
Event condition - Added toggle off mode
Profile editor - Added element copy/pasting Shared UI - Fix namespaces
This commit is contained in:
1 parent
8c7bbc3f0f
commit
52f2338154
84 files changed
+1059
-608
No files matched your search
@@ -12,8 +12,9 @@ public class DataModelEventNode : Node<DataModelPathEntity, DataModelEventNodeCu
|
||||
private int _currentIndex;
|
||||
private Type _currentType;
|
||||
private DataModelPath? _dataModelPath;
|
||||
private DateTime _lastTrigger;
|
||||
private bool _updating;
|
||||
private DateTime _lastTrigger;
|
||||
private object? _lastPathValue;
|
||||
|
||||
public DataModelEventNode() : base("Data Model-Event", "Responds to a data model event trigger")
|
||||
{
|
||||
@@ -47,27 +48,44 @@ public class DataModelEventNode : Node<DataModelPathEntity, DataModelEventNodeCu
|
||||
|
||||
public override void Evaluate()
|
||||
{
|
||||
object? outputValue = null;
|
||||
if (_dataModelPath?.GetValue() is IDataModelEvent dataModelEvent)
|
||||
object? pathValue = _dataModelPath?.GetValue();
|
||||
bool hasTriggered = pathValue is IDataModelEvent dataModelEvent
|
||||
? EvaluateEvent(dataModelEvent)
|
||||
: EvaluateValue(pathValue);
|
||||
|
||||
if (hasTriggered)
|
||||
{
|
||||
if (dataModelEvent.LastTrigger > _lastTrigger)
|
||||
{
|
||||
_lastTrigger = dataModelEvent.LastTrigger;
|
||||
_currentIndex++;
|
||||
_currentIndex++;
|
||||
|
||||
if (_currentIndex >= CycleValues.Count())
|
||||
_currentIndex = 0;
|
||||
}
|
||||
|
||||
outputValue = CycleValues.ElementAt(_currentIndex).PinValue;
|
||||
if (_currentIndex >= CycleValues.Count())
|
||||
_currentIndex = 0;
|
||||
}
|
||||
|
||||
object? outputValue = CycleValues.ElementAt(_currentIndex).PinValue;
|
||||
if (Output.Type.IsInstanceOfType(outputValue))
|
||||
Output.Value = outputValue;
|
||||
else if (Output.Type.IsValueType)
|
||||
Output.Value = Output.Type.GetDefault()!;
|
||||
}
|
||||
|
||||
private bool EvaluateEvent(IDataModelEvent dataModelEvent)
|
||||
{
|
||||
if (dataModelEvent.LastTrigger <= _lastTrigger)
|
||||
return false;
|
||||
|
||||
_lastTrigger = dataModelEvent.LastTrigger;
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool EvaluateValue(object? pathValue)
|
||||
{
|
||||
if (Equals(pathValue, _lastPathValue))
|
||||
return false;
|
||||
|
||||
_lastPathValue = pathValue;
|
||||
return true;
|
||||
}
|
||||
|
||||
private void CycleValuesOnPinAdded(object? sender, SingleValueEventArgs<IPin> e)
|
||||
{
|
||||
e.Value.PinConnected += OnPinConnected;
|
||||
@@ -109,7 +127,6 @@ public class DataModelEventNode : Node<DataModelPathEntity, DataModelEventNodeCu
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void UpdateDataModelPath()
|
||||
{
|
||||
DataModelPath? old = _dataModelPath;
|
||||
|
||||
+5
-3
@@ -2,8 +2,8 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:dataModelPicker="clr-namespace:Artemis.UI.Shared.Controls.DataModelPicker;assembly=Artemis.UI.Shared"
|
||||
xmlns:screens="clr-namespace:Artemis.VisualScripting.Nodes.DataModel.Screens"
|
||||
xmlns:dataModelPicker="clr-namespace:Artemis.UI.Shared.DataModelPicker;assembly=Artemis.UI.Shared"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="Artemis.VisualScripting.Nodes.DataModel.Screens.DataModelEventNodeCustomView"
|
||||
x:DataType="screens:DataModelEventNodeCustomViewModel">
|
||||
@@ -11,6 +11,8 @@
|
||||
DataModelPath="{CompiledBinding DataModelPath}"
|
||||
Modules="{CompiledBinding Modules}"
|
||||
ShowDataModelValues="{CompiledBinding ShowDataModelValues.Value}"
|
||||
FilterTypes="{CompiledBinding FilterTypes}"
|
||||
VerticalAlignment="Top"/>
|
||||
ShowFullPath="{CompiledBinding ShowFullPaths.Value}"
|
||||
IsEventPicker="True"
|
||||
VerticalAlignment="Top"
|
||||
MaxWidth="300"/>
|
||||
</UserControl>
|
||||
-1
@@ -50,7 +50,6 @@ public class DataModelEventNodeCustomViewModel : CustomNodeViewModel
|
||||
|
||||
public PluginSetting<bool> ShowFullPaths { get; }
|
||||
public PluginSetting<bool> ShowDataModelValues { get; }
|
||||
public ObservableCollection<Type> FilterTypes { get; } = new() {typeof(IDataModelEvent)};
|
||||
|
||||
public ObservableCollection<Module>? Modules
|
||||
{
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:dataModelPicker="clr-namespace:Artemis.UI.Shared.Controls.DataModelPicker;assembly=Artemis.UI.Shared"
|
||||
xmlns:screens="clr-namespace:Artemis.VisualScripting.Nodes.DataModel.Screens"
|
||||
xmlns:dataModelPicker="clr-namespace:Artemis.UI.Shared.DataModelPicker;assembly=Artemis.UI.Shared"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="Artemis.VisualScripting.Nodes.DataModel.Screens.DataModelNodeCustomView"
|
||||
x:DataType="screens:DataModelNodeCustomViewModel">
|
||||
@@ -11,5 +11,6 @@
|
||||
DataModelPath="{CompiledBinding DataModelPath}"
|
||||
Modules="{CompiledBinding Modules}"
|
||||
ShowDataModelValues="{CompiledBinding ShowDataModelValues.Value}"
|
||||
ShowFullPath="{CompiledBinding ShowFullPaths.Value}"/>
|
||||
ShowFullPath="{CompiledBinding ShowFullPaths.Value}"
|
||||
MaxWidth="300"/>
|
||||
</UserControl>
|
||||
Reference in new issue
Block a user