mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 03:19:56 +00:00
Editor - Fixed suspending layers
Editor - Disable suspending layers with spacebar Nodes - Fixed changed event source node not using numerics Nodes - Simplify checking wether a pin is numeric
This commit is contained in:
1 parent
eec2419005
commit
5c4175ed9c
16 files changed
+55
-36
No files matched your search
@@ -38,7 +38,7 @@ namespace Artemis.Core
|
||||
/// <summary>
|
||||
/// The full path to the Artemis data folder
|
||||
/// </summary>
|
||||
public static readonly string DataFolder = Path.Combine(BaseFolder, "Artemis.Avalonia");
|
||||
public static readonly string DataFolder = Path.Combine(BaseFolder, "Artemis");
|
||||
|
||||
/// <summary>
|
||||
/// The full path to the Artemis logs folder
|
||||
|
||||
@@ -382,7 +382,7 @@ namespace Artemis.Core
|
||||
|
||||
if (ShouldBeEnabled)
|
||||
Enable();
|
||||
else if (Timeline.IsFinished && !_renderCopies.Any())
|
||||
else if (Suspended || (Timeline.IsFinished && !_renderCopies.Any()))
|
||||
Disable();
|
||||
|
||||
if (Timeline.Delta == TimeSpan.Zero)
|
||||
|
||||
@@ -60,6 +60,7 @@ namespace Artemis.Core
|
||||
int value => value,
|
||||
double value => (float) value,
|
||||
byte value => value,
|
||||
Numeric value => value,
|
||||
_ => ParseFloatOrDefault(pathValue?.ToString())
|
||||
};
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace Artemis.Core
|
||||
: base(node, name)
|
||||
{
|
||||
Value = default;
|
||||
IsNumeric = typeof(T) == typeof(Numeric);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -80,6 +81,7 @@ namespace Artemis.Core
|
||||
{
|
||||
_type = type;
|
||||
_value = type.GetDefault();
|
||||
IsNumeric = type == typeof(Numeric);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -103,6 +105,7 @@ namespace Artemis.Core
|
||||
// Change the type
|
||||
SetAndNotify(ref _type, type, nameof(Type));
|
||||
Value = type.GetDefault();
|
||||
IsNumeric = type == typeof(Numeric);
|
||||
}
|
||||
|
||||
private void Evaluate()
|
||||
@@ -169,7 +172,7 @@ namespace Artemis.Core
|
||||
OnPropertyChanged(nameof(PinValue));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,11 @@ namespace Artemis.Core
|
||||
/// </summary>
|
||||
Type Type { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a boolean indicating whether the type of this pin is numeric.
|
||||
/// </summary>
|
||||
bool IsNumeric { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the value the pin holds
|
||||
/// </summary>
|
||||
|
||||
@@ -47,7 +47,10 @@ internal class EventConditionEventStartNode : DefaultNode, IEventConditionNode
|
||||
foreach ((PropertyInfo propertyInfo, OutputPin outputPin) in _propertyPins)
|
||||
{
|
||||
if (outputPin.ConnectedTo.Any())
|
||||
outputPin.Value = propertyInfo.GetValue(_dataModelEvent.LastEventArgumentsUntyped) ?? outputPin.Type.GetDefault()!;
|
||||
{
|
||||
object value = propertyInfo.GetValue(_dataModelEvent.LastEventArgumentsUntyped) ?? outputPin.Type.GetDefault()!;
|
||||
outputPin.Value = outputPin.IsNumeric ? new Numeric(value) : value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,6 +64,9 @@ internal class EventConditionEventStartNode : DefaultNode, IEventConditionNode
|
||||
// Grab the first pin from the bucket that isn't on the node yet
|
||||
OutputPin? pin = _pinBucket.FirstOrDefault(p => !Pins.Contains(p));
|
||||
|
||||
if (Numeric.IsTypeCompatible(valueType))
|
||||
valueType = typeof(Numeric);
|
||||
|
||||
// If there is none, create a new one and add it to the bucket
|
||||
if (pin == null)
|
||||
{
|
||||
|
||||
@@ -20,10 +20,11 @@ internal class EventConditionValueChangedStartNode : DefaultNode, IEventConditio
|
||||
|
||||
public void UpdateOutputPins(DataModelPath dataModelPath)
|
||||
{
|
||||
Type? type = dataModelPath?.GetPropertyType();
|
||||
if (Numeric.IsTypeCompatible(type))
|
||||
Type? type = dataModelPath.GetPropertyType();
|
||||
if (type == null)
|
||||
type = typeof(object);
|
||||
else if (Numeric.IsTypeCompatible(type))
|
||||
type = typeof(Numeric);
|
||||
type ??= typeof(object);
|
||||
|
||||
if (NewValue.Type != type)
|
||||
NewValue.ChangeType(type);
|
||||
@@ -33,8 +34,8 @@ internal class EventConditionValueChangedStartNode : DefaultNode, IEventConditio
|
||||
|
||||
public void UpdateValues(object? newValue, object? oldValue)
|
||||
{
|
||||
_newValue = newValue;
|
||||
_oldValue = oldValue;
|
||||
_newValue = NewValue.IsNumeric ? new Numeric(newValue) : newValue;
|
||||
_oldValue = OldValue.IsNumeric ? new Numeric(oldValue) : oldValue;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace Artemis.Core
|
||||
: base(node, name)
|
||||
{
|
||||
_value = default;
|
||||
IsNumeric = typeof(T) == typeof(Numeric);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -70,6 +71,7 @@ namespace Artemis.Core
|
||||
{
|
||||
_type = type;
|
||||
_value = type.GetDefault();
|
||||
IsNumeric = type == typeof(Numeric);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -90,6 +92,7 @@ namespace Artemis.Core
|
||||
// Change the type
|
||||
SetAndNotify(ref _type, type, nameof(Type));
|
||||
Value = type.GetDefault();
|
||||
IsNumeric = type == typeof(Numeric);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -50,10 +50,19 @@ namespace Artemis.Core
|
||||
get => _isEvaluated;
|
||||
set => SetAndNotify(ref _isEvaluated, value);
|
||||
}
|
||||
|
||||
private bool _isNumeric;
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool IsNumeric
|
||||
{
|
||||
get => _isNumeric;
|
||||
protected set => SetAndNotify(ref _isNumeric, value);
|
||||
}
|
||||
|
||||
private readonly List<IPin> _connectedTo = new();
|
||||
private string _name;
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public IReadOnlyList<IPin> ConnectedTo => new ReadOnlyCollection<IPin>(_connectedTo);
|
||||
|
||||
|
||||
Reference in new issue
Block a user