mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Merge branch 'development'
This commit is contained in:
commit
61419a5390
@ -15,11 +15,9 @@ resources:
|
||||
name: Artemis-RGB/Artemis.Plugins
|
||||
ref: master
|
||||
|
||||
pool:
|
||||
vmImage: "windows-latest"
|
||||
|
||||
variables:
|
||||
windowsProject: "**/Artemis.UI.Windows/Artemis.UI.Windows.csproj"
|
||||
linuxProject: "**/Artemis.UI.Linux/Artemis.UI.Linux.csproj"
|
||||
pluginProjects: "**/Artemis.Plugins.*.csproj"
|
||||
BuildId: $(Build.BuildId)
|
||||
BuildNumber: $(Build.BuildNumber)
|
||||
@ -28,6 +26,8 @@ variables:
|
||||
|
||||
jobs:
|
||||
- job: Windows
|
||||
pool:
|
||||
vmImage: "windows-latest"
|
||||
steps:
|
||||
- checkout: self
|
||||
path: s/Artemis
|
||||
@ -119,3 +119,98 @@ jobs:
|
||||
clean: false
|
||||
preservePaths: true
|
||||
trustSSL: false
|
||||
|
||||
- job: Linux
|
||||
pool:
|
||||
vmImage: "ubuntu-latest"
|
||||
steps:
|
||||
- checkout: self
|
||||
path: s/Artemis
|
||||
- checkout: Plugins
|
||||
path: s/Artemis.Plugins
|
||||
|
||||
- task: DotNetCoreCLI@2
|
||||
displayName: "Artemis - Publish"
|
||||
inputs:
|
||||
command: "publish"
|
||||
publishWebProjects: false
|
||||
projects: "$(linuxProject)"
|
||||
arguments: '--configuration Release --runtime linux-x64 --output $(Build.ArtifactStagingDirectory)/linux-build /nowarn:cs1591'
|
||||
zipAfterPublish: false
|
||||
modifyOutputPath: false
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: "Artemis - Create buildinfo.json"
|
||||
inputs:
|
||||
targetType: "inline"
|
||||
script: |
|
||||
$OFS = "`r`n"
|
||||
SET-Content -Path 'buildinfo.json' -Value ('{' + $OFS + ' "BuildId": 0,' + $OFS + ' "BuildNumber": 0.0,' + $OFS + ' "SourceBranch": "",' + $OFS + ' "SourceVersion": ""' + $OFS + '}')
|
||||
workingDirectory: "$(Build.ArtifactStagingDirectory)/linux-build"
|
||||
|
||||
- task: FileTransform@1
|
||||
displayName: "Artemis - Populate buildinfo.json"
|
||||
inputs:
|
||||
folderPath: "$(Build.ArtifactStagingDirectory)/linux-build"
|
||||
fileType: "json"
|
||||
targetFiles: "**/buildinfo.json"
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: "Plugins - Insert build number into plugin.json"
|
||||
inputs:
|
||||
targetType: "inline"
|
||||
script: |
|
||||
Get-ChildItem -Recurse -Filter plugin.json |
|
||||
Foreach-Object {
|
||||
$buidNumber = "1.0.1." + $Env:BUILD_BUILDID;
|
||||
$a = Get-Content $_.FullName | ConvertFrom-Json
|
||||
$a.Version = $buidNumber;
|
||||
$a | ConvertTo-Json | Set-Content $_.FullName
|
||||
}
|
||||
workingDirectory: "Artemis.Plugins"
|
||||
|
||||
- task: DotNetCoreCLI@2
|
||||
displayName: "Plugins - Publish"
|
||||
inputs:
|
||||
command: "publish"
|
||||
publishWebProjects: false
|
||||
arguments: "--configuration Release --runtime linux-x64 --output $(Build.ArtifactStagingDirectory)/linux-build/Plugins"
|
||||
projects: "$(pluginProjects)"
|
||||
zipAfterPublish: true
|
||||
|
||||
- task: PublishPipelineArtifact@1
|
||||
displayName: "Upload build to Azure Pipelines"
|
||||
inputs:
|
||||
targetPath: "$(Build.ArtifactStagingDirectory)/linux-build"
|
||||
artifact: "Artemis build"
|
||||
publishLocation: "pipeline"
|
||||
|
||||
- task: ArchiveFiles@2
|
||||
displayName: "ZIP binaries"
|
||||
inputs:
|
||||
rootFolderOrFile: "$(Build.ArtifactStagingDirectory)/linux-build"
|
||||
includeRootFolder: false
|
||||
archiveType: "zip"
|
||||
archiveFile: "$(Build.ArtifactStagingDirectory)/archive/artemis-build-linux.zip"
|
||||
replaceExistingArchive: true
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: "Calculate ZIP hash"
|
||||
inputs:
|
||||
targetType: "inline"
|
||||
script: '(Get-FileHash .\artemis-build-linux.zip).Hash | Out-File -FilePath .\hash-linux.txt'
|
||||
workingDirectory: "$(Build.ArtifactStagingDirectory)/archive"
|
||||
|
||||
- task: FtpUpload@2
|
||||
displayName: "Upload binaries to FTP"
|
||||
inputs:
|
||||
credentialsOption: "inputs"
|
||||
serverUrl: "ftp://artemis-rgb.com"
|
||||
username: "devops"
|
||||
password: "$(ftp_password)"
|
||||
rootDirectory: "$(Build.ArtifactStagingDirectory)/archive"
|
||||
filePatterns: "**"
|
||||
remoteDirectory: "/builds.artemis-rgb.com/binaries/$(Build.SourceBranchName)/$(Build.BuildNumber)"
|
||||
clean: false
|
||||
preservePaths: true
|
||||
trustSSL: false
|
||||
|
||||
@ -32,13 +32,13 @@ internal class ProcessMonitorService : IProcessMonitorService
|
||||
foreach (Process startedProcess in newProcesses.Except(_lastScannedProcesses, _comparer))
|
||||
{
|
||||
ProcessStarted?.Invoke(this, new ProcessEventArgs(startedProcess));
|
||||
_logger.Verbose("Started Process: {startedProcess}", startedProcess.ProcessName);
|
||||
//_logger.Verbose("Started Process: {startedProcess}", startedProcess.ProcessName);
|
||||
}
|
||||
|
||||
foreach (Process stoppedProcess in _lastScannedProcesses.Except(newProcesses, _comparer))
|
||||
{
|
||||
ProcessStopped?.Invoke(this, new ProcessEventArgs(stoppedProcess));
|
||||
_logger.Verbose("Stopped Process: {stoppedProcess}", stoppedProcess.ProcessName);
|
||||
//_logger.Verbose("Stopped Process: {stoppedProcess}", stoppedProcess.ProcessName);
|
||||
}
|
||||
|
||||
_lastScannedProcesses = newProcesses;
|
||||
|
||||
@ -121,9 +121,9 @@ internal class ScriptingService : IScriptingService
|
||||
throw new ArtemisCoreException("Scripts must have exactly one constructor");
|
||||
|
||||
// Find the ScriptConfiguration parameter, it is required by the base constructor so its there for sure
|
||||
ParameterInfo configurationParameter = constructors.First().GetParameters().First(p => value.GetType().IsAssignableFrom(p.ParameterType));
|
||||
ParameterInfo? configurationParameter = constructors.First().GetParameters().FirstOrDefault(p => value.GetType().IsAssignableFrom(p.ParameterType));
|
||||
|
||||
if (configurationParameter.Name == null)
|
||||
if (configurationParameter?.Name == null)
|
||||
throw new ArtemisCoreException($"Couldn't find a valid constructor argument on {scriptType.Name} with type {value.GetType().Name}");
|
||||
return new ConstructorArgument(configurationParameter.Name, value);
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Ninject;
|
||||
using Ninject.Parameters;
|
||||
|
||||
@ -16,7 +17,7 @@ public abstract class Node : CorePropertyChanged, INode
|
||||
public event EventHandler? Resetting;
|
||||
|
||||
#region Properties & Fields
|
||||
|
||||
|
||||
private readonly List<OutputPin> _outputPinBucket = new();
|
||||
private readonly List<InputPin> _inputPinBucket = new();
|
||||
|
||||
@ -164,7 +165,7 @@ public abstract class Node : CorePropertyChanged, INode
|
||||
OnPropertyChanged(nameof(Pins));
|
||||
return pin;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Creates or adds an output pin to the node using a bucket.
|
||||
/// The bucket might grow a bit over time as the user edits the node but pins won't get lost, enabling undo/redo in the
|
||||
@ -194,7 +195,7 @@ public abstract class Node : CorePropertyChanged, INode
|
||||
|
||||
return pin;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Creates or adds an input pin to the node using a bucket.
|
||||
/// The bucket might grow a bit over time as the user edits the node but pins won't get lost, enabling undo/redo in the
|
||||
@ -447,7 +448,17 @@ public abstract class Node<TStorage, TViewModel> : Node<TStorage> where TViewMod
|
||||
/// <param name="nodeScript"></param>
|
||||
public virtual TViewModel GetViewModel(NodeScript nodeScript)
|
||||
{
|
||||
return Kernel.Get<TViewModel>(new ConstructorArgument("node", this), new ConstructorArgument("script", nodeScript));
|
||||
// Limit to one constructor, there's no need to have more and it complicates things anyway
|
||||
ConstructorInfo[] constructors = typeof(TViewModel).GetConstructors();
|
||||
if (constructors.Length != 1)
|
||||
throw new ArtemisCoreException("Node VMs must have exactly one constructor");
|
||||
|
||||
// Find the ScriptConfiguration parameter, it is required by the base constructor so its there for sure
|
||||
ParameterInfo? configurationParameter = constructors.First().GetParameters().FirstOrDefault(p => GetType().IsAssignableFrom(p.ParameterType));
|
||||
|
||||
if (configurationParameter?.Name == null)
|
||||
throw new ArtemisCoreException($"Couldn't find a valid constructor argument on {typeof(TViewModel).Name} with type {GetType().Name}");
|
||||
return Kernel.Get<TViewModel>(new ConstructorArgument(configurationParameter.Name, this), new ConstructorArgument("script", nodeScript));
|
||||
}
|
||||
|
||||
/// <param name="nodeScript"></param>
|
||||
|
||||
@ -45,12 +45,12 @@ public abstract class PinCollection : CorePropertyChanged, IPinCollection
|
||||
/// <inheritdoc />
|
||||
public abstract Type Type { get; }
|
||||
|
||||
private readonly ObservableCollection<IPin> _pins = new();
|
||||
private readonly List<IPin> _pins = new();
|
||||
|
||||
/// <summary>
|
||||
/// Gets a read only observable collection of the pins
|
||||
/// </summary>
|
||||
public ReadOnlyObservableCollection<IPin> Pins => new(_pins);
|
||||
public ReadOnlyCollection<IPin> Pins => new(_pins);
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@ -112,7 +112,18 @@ public class LinuxInputProvider : InputProvider
|
||||
switch (args.Type)
|
||||
{
|
||||
case LinuxInputEventType.KEY:
|
||||
bool isDown = args.Value != 0;
|
||||
var key = (LinuxKeyboardKeyCodes)args.Code;
|
||||
if (key == LinuxKeyboardKeyCodes.BTN_TOUCH ||
|
||||
(key >= LinuxKeyboardKeyCodes.BTN_TOOL_PEN && key <= LinuxKeyboardKeyCodes.BTN_TOOL_QUADTAP))
|
||||
{
|
||||
//trackpad input, ignore.
|
||||
return;
|
||||
}
|
||||
|
||||
//0 - up
|
||||
//1 - down
|
||||
//2 - repeat input
|
||||
bool isDown = args.Value == 1;
|
||||
MouseButton button = InputUtilities.MouseButtonFromButtonCode((LinuxKeyboardKeyCodes) args.Code);
|
||||
|
||||
//_logger.Verbose($"Mouse Button: {(LinuxKeyboardKeyCodes)args.Code} | Down: {isDown}");
|
||||
|
||||
@ -107,7 +107,7 @@ public static class InputUtilities
|
||||
LinuxKeyboardKeyCodes.KEY_KPENTER => KeyboardKey.NumPadEnter,
|
||||
LinuxKeyboardKeyCodes.KEY_RIGHTCTRL => KeyboardKey.RightCtrl,
|
||||
LinuxKeyboardKeyCodes.KEY_KPSLASH => KeyboardKey.Divide,
|
||||
LinuxKeyboardKeyCodes.KEY_SYSRQ => KeyboardKey.System, //TODO:?
|
||||
LinuxKeyboardKeyCodes.KEY_SYSRQ => KeyboardKey.PrintScreen,
|
||||
LinuxKeyboardKeyCodes.KEY_RIGHTALT => KeyboardKey.RightAlt,
|
||||
LinuxKeyboardKeyCodes.KEY_LINEFEED => KeyboardKey.LineFeed,
|
||||
LinuxKeyboardKeyCodes.KEY_HOME => KeyboardKey.Home,
|
||||
@ -135,7 +135,7 @@ public static class InputUtilities
|
||||
// LinuxKeyboardKeyCodes.KEY_YEN => expr,
|
||||
LinuxKeyboardKeyCodes.KEY_LEFTMETA => KeyboardKey.LWin,
|
||||
LinuxKeyboardKeyCodes.KEY_RIGHTMETA => KeyboardKey.RWin,
|
||||
// LinuxKeyboardKeyCodes.KEY_COMPOSE => ,
|
||||
LinuxKeyboardKeyCodes.KEY_COMPOSE => KeyboardKey.Apps,
|
||||
LinuxKeyboardKeyCodes.KEY_STOP => KeyboardKey.MediaStop,
|
||||
// LinuxKeyboardKeyCodes.KEY_AGAIN => ,
|
||||
// LinuxKeyboardKeyCodes.KEY_PROPS => expr,
|
||||
|
||||
@ -287,6 +287,12 @@ public abstract class TreeItemViewModel : ActivatableViewModelBase
|
||||
}
|
||||
|
||||
string[] formats = await Application.Current.Clipboard.GetFormatsAsync();
|
||||
//diogotr7: This can be null on Linux sometimes. I'm not sure why.
|
||||
if (formats == null)
|
||||
{
|
||||
CanPaste = false;
|
||||
return;
|
||||
}
|
||||
CanPaste = formats.Contains(ProfileElementExtensions.ClipboardDataFormat);
|
||||
}
|
||||
|
||||
|
||||
@ -29,9 +29,10 @@ public class NumericEasingNode : Node
|
||||
public override void Evaluate()
|
||||
{
|
||||
DateTime now = DateTime.Now;
|
||||
float inputValue = Input.Value;
|
||||
|
||||
// If the value changed reset progress
|
||||
if (Math.Abs(_targetValue - Input.Value) > 0.001f)
|
||||
if (Math.Abs(_targetValue - inputValue) > 0.001f)
|
||||
{
|
||||
_sourceValue = _currentValue;
|
||||
_targetValue = Input.Value;
|
||||
@ -55,10 +56,11 @@ public class NumericEasingNode : Node
|
||||
|
||||
private void Update()
|
||||
{
|
||||
float easingTime = EasingTime.Value != 0f ? EasingTime.Value : 1f;
|
||||
TimeSpan delta = DateTime.Now - _lastEvaluate;
|
||||
|
||||
// In case of odd delta's, keep progress between 0f and 1f
|
||||
_progress = Math.Clamp(_progress + (float) delta.TotalMilliseconds / EasingTime.Value, 0f, 1f);
|
||||
_progress = Math.Clamp(_progress + (float) delta.TotalMilliseconds / easingTime, 0f, 1f);
|
||||
|
||||
double eased = _sourceValue + (_targetValue - _sourceValue) * Easings.Interpolate(_progress, EasingFunction.Value);
|
||||
_currentValue = (float) eased;
|
||||
|
||||
@ -56,10 +56,11 @@ public class SKColorEasingNode : Node
|
||||
|
||||
private void Update()
|
||||
{
|
||||
float easingTime = EasingTime.Value != 0f ? EasingTime.Value : 1f;
|
||||
TimeSpan delta = DateTime.Now - _lastEvaluate;
|
||||
|
||||
// In case of odd delta's, keep progress between 0f and 1f
|
||||
_progress = Math.Clamp(_progress + (float) delta.TotalMilliseconds / EasingTime.Value, 0f, 1f);
|
||||
_progress = Math.Clamp(_progress + (float) delta.TotalMilliseconds / easingTime, 0f, 1f);
|
||||
_currentValue = _sourceValue.Interpolate(_targetValue, (float) Easings.Interpolate(_progress, EasingFunction.Value));
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user