mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 19:36:28 +00:00
Nodes - Provide scripts with a context
Nodes - Inform nodes about the script they're being initialized for Nodes - Added float nodes matching the existing other number types Core - Add API for retrieving data binding values via the interface
This commit is contained in:
1 parent
3ed3cd1b1e
commit
836e979991
26 files changed
+305
-122
No files matched your search
@@ -19,7 +19,7 @@ namespace Artemis.Core
|
||||
Entity = new DataBindingEntity();
|
||||
|
||||
ApplyRegistration(dataBindingRegistration);
|
||||
Script = new NodeScript<TProperty>(GetScriptName(), "The value to put into the data binding");
|
||||
Script = new NodeScript<TProperty>(GetScriptName(), "The value to put into the data binding", LayerProperty.ProfileElement.Profile);
|
||||
|
||||
Save();
|
||||
}
|
||||
@@ -28,7 +28,7 @@ namespace Artemis.Core
|
||||
{
|
||||
LayerProperty = layerProperty;
|
||||
Entity = entity;
|
||||
Script = new NodeScript<TProperty>(GetScriptName(), "The value to put into the data binding");
|
||||
Script = new NodeScript<TProperty>(GetScriptName(), "The value to put into the data binding", LayerProperty.ProfileElement.Profile);
|
||||
|
||||
// Load will add children so be initialized before that
|
||||
Load();
|
||||
@@ -245,8 +245,8 @@ namespace Artemis.Core
|
||||
|
||||
Script.Dispose();
|
||||
Script = Entity.NodeScript != null
|
||||
? new NodeScript<TProperty>(GetScriptName(), "The value to put into the data binding", Entity.NodeScript)
|
||||
: new NodeScript<TProperty>(GetScriptName(), "The value to put into the data binding");
|
||||
? new NodeScript<TProperty>(GetScriptName(), "The value to put into the data binding", Entity.NodeScript, LayerProperty.ProfileElement.Profile)
|
||||
: new NodeScript<TProperty>(GetScriptName(), "The value to put into the data binding", LayerProperty.ProfileElement.Profile);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -40,6 +40,9 @@ namespace Artemis.Core
|
||||
/// <inheritdoc />
|
||||
public string DisplayName { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public Type ValueType => typeof(TProperty);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the data binding created using this registration
|
||||
/// </summary>
|
||||
@@ -74,5 +77,11 @@ namespace Artemis.Core
|
||||
// The related entity is left behind, just in case the data binding is added back later
|
||||
LayerProperty.DisableDataBinding(DataBinding);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public object? GetValue()
|
||||
{
|
||||
return Getter();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
namespace Artemis.Core
|
||||
using System;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a data binding registration
|
||||
@@ -10,6 +12,11 @@
|
||||
/// </summary>
|
||||
string DisplayName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the type of the value this data binding registration points to
|
||||
/// </summary>
|
||||
Type ValueType { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the data binding applied using this registration
|
||||
/// </summary>
|
||||
@@ -25,5 +32,11 @@
|
||||
/// If present, removes the current data binding
|
||||
/// </summary>
|
||||
void ClearDataBinding();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the value of the data binding
|
||||
/// </summary>
|
||||
/// <returns>A value matching the type of <see cref="ValueType" /></returns>
|
||||
object? GetValue();
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@ namespace Artemis.Core
|
||||
internal RenderProfileElement(Profile profile) : base(profile)
|
||||
{
|
||||
_typeDisplayName = this is Layer ? "layer" : "folder";
|
||||
_displayCondition = new NodeScript<bool>($"Activate {_typeDisplayName}", $"Whether or not this {_typeDisplayName} should be active");
|
||||
_displayCondition = new NodeScript<bool>($"Activate {_typeDisplayName}", $"Whether or not this {_typeDisplayName} should be active", Profile);
|
||||
|
||||
Timeline = new Timeline();
|
||||
ExpandedPropertyGroups = new List<string>();
|
||||
@@ -71,8 +71,8 @@ namespace Artemis.Core
|
||||
internal void LoadRenderElement()
|
||||
{
|
||||
DisplayCondition = RenderElementEntity.NodeScript != null
|
||||
? new NodeScript<bool>($"Activate {_typeDisplayName}", $"Whether or not this {_typeDisplayName} should be active", RenderElementEntity.NodeScript)
|
||||
: new NodeScript<bool>($"Activate {_typeDisplayName}", $"Whether or not this {_typeDisplayName} should be active");
|
||||
? new NodeScript<bool>($"Activate {_typeDisplayName}", $"Whether or not this {_typeDisplayName} should be active", RenderElementEntity.NodeScript, Profile)
|
||||
: new NodeScript<bool>($"Activate {_typeDisplayName}", $"Whether or not this {_typeDisplayName} should be active", Profile);
|
||||
|
||||
Timeline = RenderElementEntity.Timeline != null
|
||||
? new Timeline(RenderElementEntity.Timeline)
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Artemis.Core
|
||||
|
||||
Entity = new ProfileConfigurationEntity();
|
||||
Icon = new ProfileConfigurationIcon(Entity) {MaterialIcon = icon};
|
||||
ActivationCondition = new NodeScript<bool>("Activate profile", "Whether or not the profile should be active");
|
||||
ActivationCondition = new NodeScript<bool>("Activate profile", "Whether or not the profile should be active", this);
|
||||
}
|
||||
|
||||
internal ProfileConfiguration(ProfileCategory category, ProfileConfigurationEntity entity)
|
||||
@@ -39,7 +39,7 @@ namespace Artemis.Core
|
||||
|
||||
Entity = entity;
|
||||
Icon = new ProfileConfigurationIcon(Entity);
|
||||
ActivationCondition = new NodeScript<bool>("Activate profile", "Whether or not the profile should be active");
|
||||
ActivationCondition = new NodeScript<bool>("Activate profile", "Whether or not the profile should be active", this);
|
||||
|
||||
Load();
|
||||
}
|
||||
@@ -242,8 +242,8 @@ namespace Artemis.Core
|
||||
|
||||
ActivationCondition.Dispose();
|
||||
ActivationCondition = Entity.ActivationCondition != null
|
||||
? new NodeScript<bool>("Activate profile", "Whether or not the profile should be active", Entity.ActivationCondition)
|
||||
: new NodeScript<bool>("Activate profile", "Whether or not the profile should be active");
|
||||
? new NodeScript<bool>("Activate profile", "Whether or not the profile should be active", Entity.ActivationCondition, this)
|
||||
: new NodeScript<bool>("Activate profile", "Whether or not the profile should be active", this);
|
||||
|
||||
EnableHotkey = Entity.EnableHotkey != null ? new ProfileConfigurationHotkey(Entity.EnableHotkey) : null;
|
||||
DisableHotkey = Entity.DisableHotkey != null ? new ProfileConfigurationHotkey(Entity.DisableHotkey) : null;
|
||||
|
||||
Reference in new issue
Block a user