1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00
Robert 836e979991 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
2021-08-21 12:15:01 +02:00

89 lines
2.2 KiB
C#

using Artemis.Core;
namespace Artemis.VisualScripting.Nodes.CustomViewModels
{
public class StaticDoubleValueNodeCustomViewModel : CustomNodeViewModel
{
private readonly StaticDoubleValueNode _node;
public StaticDoubleValueNodeCustomViewModel(StaticDoubleValueNode node) : base(node)
{
_node = node;
}
public double Input
{
get => (double) _node.Storage;
set
{
_node.Storage = value;
OnPropertyChanged(nameof(Input));
}
}
}
public class StaticFloatValueNodeCustomViewModel : CustomNodeViewModel
{
private readonly StaticFloatValueNode _node;
public StaticFloatValueNodeCustomViewModel(StaticFloatValueNode node) : base(node)
{
_node = node;
}
public float Input
{
get => (float)_node.Storage;
set
{
_node.Storage = value;
OnPropertyChanged(nameof(Input));
}
}
}
public class StaticIntegerValueNodeCustomViewModel : CustomNodeViewModel
{
private readonly StaticIntegerValueNode _node;
public StaticIntegerValueNodeCustomViewModel(StaticIntegerValueNode node) : base(node)
{
_node = node;
}
public int Input
{
get
{
if (_node.Storage is long longInput)
return (int)longInput;
return (int)_node.Storage;
}
set
{
_node.Storage = value;
OnPropertyChanged(nameof(Input));
}
}
}
public class StaticStringValueNodeCustomViewModel : CustomNodeViewModel
{
private readonly StaticStringValueNode _node;
public StaticStringValueNodeCustomViewModel(StaticStringValueNode node) : base(node)
{
_node = node;
}
public string Input
{
get => (string)_node.Storage;
set
{
_node.Storage = value;
OnPropertyChanged(nameof(Input));
}
}
}
}