mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
Profile editor - Integrated visual scripting
This commit is contained in:
1 parent
372991a69b
commit
66ea718316
96 files changed
+2413
-238
No files matched your search
@@ -39,10 +39,8 @@ namespace Artemis.Core
|
||||
/// Gets the layer property this data binding targets
|
||||
/// </summary>
|
||||
public LayerProperty<TLayerProperty> LayerProperty { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the script used to populate the data binding
|
||||
/// </summary>
|
||||
|
||||
/// <inheritdoc />
|
||||
public INodeScript Script => _script;
|
||||
|
||||
/// <summary>
|
||||
@@ -126,7 +124,7 @@ namespace Artemis.Core
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes the <see cref="DataBindingDisabled" /> event
|
||||
/// Invokes the <see cref="DataBindingPropertiesCleared" /> event
|
||||
/// </summary>
|
||||
protected virtual void OnDataBindingPropertiesCleared()
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Artemis.Core
|
||||
Setter = setter ?? throw new ArgumentNullException(nameof(setter));
|
||||
DisplayName = displayName ?? throw new ArgumentNullException(nameof(displayName));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the function to call to get the value of the property
|
||||
/// </summary>
|
||||
@@ -37,10 +37,27 @@ namespace Artemis.Core
|
||||
/// <inheritdoc />
|
||||
public void SetValue(object? value)
|
||||
{
|
||||
if (value is TProperty match)
|
||||
Setter(match);
|
||||
else
|
||||
throw new ArgumentException("Value must match the type of the data binding registration", nameof(value));
|
||||
// Numeric has a bunch of conversion, this seems the cheapest way to use them :)
|
||||
switch (value)
|
||||
{
|
||||
case TProperty match:
|
||||
Setter(match);
|
||||
break;
|
||||
case Numeric numeric when Setter is Action<float> floatSetter:
|
||||
floatSetter(numeric);
|
||||
break;
|
||||
case Numeric numeric when Setter is Action<int> intSetter:
|
||||
intSetter(numeric);
|
||||
break;
|
||||
case Numeric numeric when Setter is Action<double> doubleSetter:
|
||||
doubleSetter(numeric);
|
||||
break;
|
||||
case Numeric numeric when Setter is Action<byte> byteSetter:
|
||||
byteSetter(numeric);
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentException("Value must match the type of the data binding registration", nameof(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,11 @@ namespace Artemis.Core
|
||||
/// </summary>
|
||||
ILayerProperty BaseLayerProperty { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the script used to populate the data binding
|
||||
/// </summary>
|
||||
INodeScript Script { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of sub-properties this data binding applies to
|
||||
/// </summary>
|
||||
|
||||
Reference in new issue
Block a user