mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Code style - Use file scoped namespaces
Code style - Ran code cleanup
This commit is contained in:
1 parent
e68e16df4d
commit
f6090dc296
691 files changed
+37301
-38119
No files matched your search
@@ -20,6 +20,22 @@ public class BooleanBranchNode : Node
|
||||
FalseInput.PinDisconnected += InputPinDisconnected;
|
||||
}
|
||||
|
||||
public InputPin<bool> BooleanInput { get; set; }
|
||||
public InputPin TrueInput { get; set; }
|
||||
public InputPin FalseInput { get; set; }
|
||||
|
||||
public OutputPin Output { get; set; }
|
||||
|
||||
#region Overrides of Node
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Evaluate()
|
||||
{
|
||||
Output.Value = BooleanInput.Value ? TrueInput.Value : FalseInput.Value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void InputPinConnected(object? sender, SingleValueEventArgs<IPin> e)
|
||||
{
|
||||
if (TrueInput.ConnectedTo.Any() && !FalseInput.ConnectedTo.Any())
|
||||
@@ -40,20 +56,4 @@ public class BooleanBranchNode : Node
|
||||
FalseInput.ChangeType(type);
|
||||
Output.ChangeType(type);
|
||||
}
|
||||
|
||||
public InputPin<bool> BooleanInput { get; set; }
|
||||
public InputPin TrueInput { get; set; }
|
||||
public InputPin FalseInput { get; set; }
|
||||
|
||||
public OutputPin Output { get; set; }
|
||||
|
||||
#region Overrides of Node
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Evaluate()
|
||||
{
|
||||
Output.Value = BooleanInput.Value ? TrueInput.Value : FalseInput.Value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,12 +1,10 @@
|
||||
using Artemis.UI.Shared.Controls.GradientPicker;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.VisualScripting.Nodes.Color.Screens;
|
||||
|
||||
public partial class RampSKColorNodeCustomView : ReactiveUserControl<RampSKColorNodeCustomViewModel>
|
||||
public class RampSKColorNodeCustomView : ReactiveUserControl<RampSKColorNodeCustomViewModel>
|
||||
{
|
||||
public RampSKColorNodeCustomView()
|
||||
{
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.ComponentModel;
|
||||
using Artemis.Core;
|
||||
using Artemis.Core;
|
||||
using Artemis.Core.Events;
|
||||
using Artemis.Storage.Entities.Profile;
|
||||
using Artemis.VisualScripting.Nodes.DataModel.Screens;
|
||||
@@ -12,9 +11,9 @@ public class DataModelEventNode : Node<DataModelPathEntity, DataModelEventNodeCu
|
||||
private int _currentIndex;
|
||||
private Type _currentType;
|
||||
private DataModelPath? _dataModelPath;
|
||||
private bool _updating;
|
||||
private DateTime _lastTrigger;
|
||||
private object? _lastPathValue;
|
||||
private DateTime _lastTrigger;
|
||||
private bool _updating;
|
||||
|
||||
public DataModelEventNode() : base("Data Model-Event", "Responds to a data model event trigger")
|
||||
{
|
||||
|
||||
+12
-13
@@ -1,18 +1,17 @@
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.VisualScripting.Nodes.DataModel.Screens
|
||||
{
|
||||
public partial class DataModelEventNodeCustomView : ReactiveUserControl<DataModelEventNodeCustomViewModel>
|
||||
{
|
||||
public DataModelEventNodeCustomView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
namespace Artemis.VisualScripting.Nodes.DataModel.Screens;
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
public class DataModelEventNodeCustomView : ReactiveUserControl<DataModelEventNodeCustomViewModel>
|
||||
{
|
||||
public DataModelEventNodeCustomView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -15,9 +15,9 @@ public class DataModelEventNodeCustomViewModel : CustomNodeViewModel
|
||||
{
|
||||
private readonly DataModelEventNode _node;
|
||||
private readonly INodeEditorService _nodeEditorService;
|
||||
private bool _updating;
|
||||
private DataModelPath? _dataModelPath;
|
||||
private ObservableCollection<Module>? _modules;
|
||||
private bool _updating;
|
||||
|
||||
public DataModelEventNodeCustomViewModel(DataModelEventNode node, INodeScript script, ISettingsService settingsService, INodeEditorService nodeEditorService) : base(node, script)
|
||||
{
|
||||
|
||||
+12
-13
@@ -1,18 +1,17 @@
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.VisualScripting.Nodes.DataModel.Screens
|
||||
{
|
||||
public partial class DataModelNodeCustomView : ReactiveUserControl<DataModelNodeCustomViewModel>
|
||||
{
|
||||
public DataModelNodeCustomView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
namespace Artemis.VisualScripting.Nodes.DataModel.Screens;
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
public class DataModelNodeCustomView : ReactiveUserControl<DataModelNodeCustomViewModel>
|
||||
{
|
||||
public DataModelNodeCustomView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
}
|
||||
@@ -15,8 +15,8 @@ public class DataModelNodeCustomViewModel : CustomNodeViewModel
|
||||
{
|
||||
private readonly DataModelNode _node;
|
||||
private readonly INodeEditorService _nodeEditorService;
|
||||
private ObservableCollection<Module>? _modules;
|
||||
private DataModelPath? _dataModelPath;
|
||||
private ObservableCollection<Module>? _modules;
|
||||
private bool _updating;
|
||||
|
||||
public DataModelNodeCustomViewModel(DataModelNode node, INodeScript script, ISettingsService settingsService, INodeEditorService nodeEditorService) : base(node, script)
|
||||
|
||||
+12
-13
@@ -1,18 +1,17 @@
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.VisualScripting.Nodes.Easing.Screens
|
||||
{
|
||||
public partial class EasingTypeNodeCustomView : ReactiveUserControl<EasingTypeNodeCustomViewModel>
|
||||
{
|
||||
public EasingTypeNodeCustomView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
namespace Artemis.VisualScripting.Nodes.Easing.Screens;
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
public class EasingTypeNodeCustomView : ReactiveUserControl<EasingTypeNodeCustomViewModel>
|
||||
{
|
||||
public EasingTypeNodeCustomView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,8 @@ public class EasingTypeNodeCustomViewModel : CustomNodeViewModel
|
||||
_nodeEditorService = nodeEditorService;
|
||||
|
||||
NodeModified += (_, _) => this.RaisePropertyChanged(nameof(SelectedEasingViewModel));
|
||||
EasingViewModels = new ObservableCollection<EasingTypeNodeEasingViewModel>(Enum.GetValues(typeof(Easings.Functions)).Cast<Easings.Functions>().Select(e => new EasingTypeNodeEasingViewModel(e)));
|
||||
EasingViewModels =
|
||||
new ObservableCollection<EasingTypeNodeEasingViewModel>(Enum.GetValues(typeof(Easings.Functions)).Cast<Easings.Functions>().Select(e => new EasingTypeNodeEasingViewModel(e)));
|
||||
}
|
||||
|
||||
public ObservableCollection<EasingTypeNodeEasingViewModel> EasingViewModels { get; }
|
||||
|
||||
+12
-13
@@ -1,18 +1,17 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Artemis.VisualScripting.Nodes.Easing.Screens
|
||||
{
|
||||
public partial class EasingTypeNodeEasingView : UserControl
|
||||
{
|
||||
public EasingTypeNodeEasingView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
namespace Artemis.VisualScripting.Nodes.Easing.Screens;
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
public class EasingTypeNodeEasingView : UserControl
|
||||
{
|
||||
public EasingTypeNodeEasingView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
}
|
||||
Vendored
+3
-3
@@ -5,10 +5,10 @@ namespace Artemis.VisualScripting.Nodes.External.Commands;
|
||||
|
||||
public class UpdateLayerPropertyNodeSelectedLayerProperty : INodeEditorCommand
|
||||
{
|
||||
private readonly LayerPropertyNode _node;
|
||||
private readonly ILayerProperty? _value;
|
||||
private readonly ILayerProperty? _oldValue;
|
||||
private readonly NodeConnectionStore _connections;
|
||||
private readonly LayerPropertyNode _node;
|
||||
private readonly ILayerProperty? _oldValue;
|
||||
private readonly ILayerProperty? _value;
|
||||
|
||||
public UpdateLayerPropertyNodeSelectedLayerProperty(LayerPropertyNode node, ILayerProperty? value)
|
||||
{
|
||||
|
||||
src/Artemis.VisualScripting/Nodes/External/Commands/UpdateLayerPropertyNodeSelectedProfileElement.cs
Vendored
+3
-3
@@ -5,12 +5,12 @@ namespace Artemis.VisualScripting.Nodes.External.Commands;
|
||||
|
||||
public class UpdateLayerPropertyNodeSelectedProfileElement : INodeEditorCommand
|
||||
{
|
||||
private readonly LayerPropertyNode _node;
|
||||
private readonly NodeConnectionStore _connections;
|
||||
private readonly LayerPropertyNode _node;
|
||||
private readonly ILayerProperty? _oldLayerProperty;
|
||||
private readonly RenderProfileElement? _oldValue;
|
||||
|
||||
private readonly RenderProfileElement? _value;
|
||||
private readonly RenderProfileElement? _oldValue;
|
||||
private readonly ILayerProperty? _oldLayerProperty;
|
||||
|
||||
public UpdateLayerPropertyNodeSelectedProfileElement(LayerPropertyNode node, RenderProfileElement? value)
|
||||
{
|
||||
|
||||
+12
-13
@@ -1,18 +1,17 @@
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.VisualScripting.Nodes.External.Screens
|
||||
{
|
||||
public partial class LayerPropertyNodeCustomView : ReactiveUserControl<LayerPropertyNodeCustomViewModel>
|
||||
{
|
||||
public LayerPropertyNodeCustomView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
namespace Artemis.VisualScripting.Nodes.External.Screens;
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
public class LayerPropertyNodeCustomView : ReactiveUserControl<LayerPropertyNodeCustomViewModel>
|
||||
{
|
||||
public LayerPropertyNodeCustomView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,9 @@ public class CounterNode : Node
|
||||
Output = CreateOutputPin<Numeric>();
|
||||
}
|
||||
|
||||
public InputPin<Numeric> Time { get; set; }
|
||||
public OutputPin<Numeric> Output { get; set; }
|
||||
|
||||
public override void Evaluate()
|
||||
{
|
||||
DateTime now = DateTime.Now;
|
||||
@@ -26,7 +29,4 @@ public class CounterNode : Node
|
||||
Output.Value = new Numeric(MathF.Round(_progress, 4, MidpointRounding.AwayFromZero));
|
||||
_lastEvaluate = now;
|
||||
}
|
||||
|
||||
public InputPin<Numeric> Time { get; set; }
|
||||
public OutputPin<Numeric> Output { get; set; }
|
||||
}
|
||||
@@ -8,8 +8,8 @@ namespace Artemis.VisualScripting.Nodes.Mathematics;
|
||||
[Node("Math Expression", "Outputs the result of a math expression.", "Mathematics", InputType = typeof(Numeric), OutputType = typeof(Numeric))]
|
||||
public class MathExpressionNode : Node<string, MathExpressionNodeCustomViewModel>
|
||||
{
|
||||
private readonly INoStringEvaluator _evaluator;
|
||||
private readonly IFormulaChecker _checker;
|
||||
private readonly INoStringEvaluator _evaluator;
|
||||
private readonly PinsVariablesContainer _variables;
|
||||
|
||||
#region Constructors
|
||||
@@ -30,6 +30,45 @@ public class MathExpressionNode : Node<string, MathExpressionNodeCustomViewModel
|
||||
|
||||
#endregion
|
||||
|
||||
public bool IsSyntaxValid(string? s)
|
||||
{
|
||||
if (s == null)
|
||||
return true;
|
||||
|
||||
if (!_checker.CheckSyntax(s).Ok)
|
||||
return false;
|
||||
|
||||
try
|
||||
{
|
||||
_evaluator.CalcNumber(s, _variables);
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public string GetSyntaxErrors(string? s)
|
||||
{
|
||||
if (s == null)
|
||||
return "";
|
||||
|
||||
CheckFormulaResult? syntaxCheck = _checker.CheckSyntax(s);
|
||||
if (!syntaxCheck.Ok)
|
||||
return string.Join(",", syntaxCheck.Mistakes);
|
||||
|
||||
try
|
||||
{
|
||||
_evaluator.CalcNumber(s, _variables);
|
||||
return "";
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return e.Message;
|
||||
}
|
||||
}
|
||||
|
||||
#region Properties & Fields
|
||||
|
||||
public OutputPin<Numeric> Output { get; }
|
||||
@@ -78,43 +117,4 @@ public class MathExpressionNode : Node<string, MathExpressionNodeCustomViewModel
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public bool IsSyntaxValid(string? s)
|
||||
{
|
||||
if (s == null)
|
||||
return true;
|
||||
|
||||
if (!_checker.CheckSyntax(s).Ok)
|
||||
return false;
|
||||
|
||||
try
|
||||
{
|
||||
_evaluator.CalcNumber(s, _variables);
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public string GetSyntaxErrors(string? s)
|
||||
{
|
||||
if (s == null)
|
||||
return "";
|
||||
|
||||
CheckFormulaResult? syntaxCheck = _checker.CheckSyntax(s);
|
||||
if (!syntaxCheck.Ok)
|
||||
return string.Join(",", syntaxCheck.Mistakes);
|
||||
|
||||
try
|
||||
{
|
||||
_evaluator.CalcNumber(s, _variables);
|
||||
return "";
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return e.Message;
|
||||
}
|
||||
}
|
||||
}
|
||||
+12
-13
@@ -1,18 +1,17 @@
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.VisualScripting.Nodes.Operators.Screens
|
||||
{
|
||||
public partial class EnumEqualsNodeCustomView : ReactiveUserControl<EnumEqualsNodeCustomViewModel>
|
||||
{
|
||||
public EnumEqualsNodeCustomView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
namespace Artemis.VisualScripting.Nodes.Operators.Screens;
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
public class EnumEqualsNodeCustomView : ReactiveUserControl<EnumEqualsNodeCustomViewModel>
|
||||
{
|
||||
public EnumEqualsNodeCustomView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
}
|
||||
+12
-13
@@ -8,7 +8,6 @@ using Artemis.UI.Shared.VisualScripting;
|
||||
using Avalonia.Controls.Mixins;
|
||||
using Avalonia.Threading;
|
||||
using DynamicData;
|
||||
using FluentAvalonia.Core;
|
||||
using Humanizer;
|
||||
using ReactiveUI;
|
||||
|
||||
@@ -43,6 +42,18 @@ public class EnumEqualsNodeCustomViewModel : CustomNodeViewModel
|
||||
});
|
||||
}
|
||||
|
||||
public ObservableCollection<(long, string)> EnumValues { get; } = new();
|
||||
|
||||
public (long, string) CurrentValue
|
||||
{
|
||||
get => EnumValues.FirstOrDefault(v => v.Item1 == _node.Storage);
|
||||
set
|
||||
{
|
||||
if (!Equals(_node.Storage, value.Item1))
|
||||
_nodeEditorService.ExecuteCommand(Script, new UpdateStorage<long>(_node, value.Item1));
|
||||
}
|
||||
}
|
||||
|
||||
private void AddEnumValues(Type type)
|
||||
{
|
||||
Dispatcher.UIThread.Post(() =>
|
||||
@@ -56,16 +67,4 @@ public class EnumEqualsNodeCustomViewModel : CustomNodeViewModel
|
||||
this.RaisePropertyChanged(nameof(CurrentValue));
|
||||
}, DispatcherPriority.Background);
|
||||
}
|
||||
|
||||
public ObservableCollection<(long, string)> EnumValues { get; } = new();
|
||||
|
||||
public (long, string) CurrentValue
|
||||
{
|
||||
get => EnumValues.FirstOrDefault(v => v.Item1 == _node.Storage);
|
||||
set
|
||||
{
|
||||
if (!Equals(_node.Storage, value.Item1))
|
||||
_nodeEditorService.ExecuteCommand(Script, new UpdateStorage<long>(_node, value.Item1));
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-3
@@ -1,11 +1,9 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.VisualScripting.Nodes.Static.Screens;
|
||||
|
||||
public partial class DisplayValueNodeCustomView : ReactiveUserControl<DisplayValueNodeCustomViewModel>
|
||||
public class DisplayValueNodeCustomView : ReactiveUserControl<DisplayValueNodeCustomViewModel>
|
||||
{
|
||||
public DisplayValueNodeCustomView()
|
||||
{
|
||||
|
||||
+12
-13
@@ -1,18 +1,17 @@
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.VisualScripting.Nodes.Static.Screens
|
||||
{
|
||||
public partial class StaticNumericValueNodeCustomView : ReactiveUserControl<StaticNumericValueNodeCustomViewModel>
|
||||
{
|
||||
public StaticNumericValueNodeCustomView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
namespace Artemis.VisualScripting.Nodes.Static.Screens;
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
public class StaticNumericValueNodeCustomView : ReactiveUserControl<StaticNumericValueNodeCustomViewModel>
|
||||
{
|
||||
public StaticNumericValueNodeCustomView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
}
|
||||
+12
-13
@@ -1,18 +1,17 @@
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Artemis.VisualScripting.Nodes.Static.Screens
|
||||
{
|
||||
public partial class StaticStringValueNodeCustomView : ReactiveUserControl<StaticStringValueNodeCustomViewModel>
|
||||
{
|
||||
public StaticStringValueNodeCustomView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
namespace Artemis.VisualScripting.Nodes.Static.Screens;
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
public class StaticStringValueNodeCustomView : ReactiveUserControl<StaticStringValueNodeCustomViewModel>
|
||||
{
|
||||
public StaticStringValueNodeCustomView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user