mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Nodes - Implemented saving/loading
Nodes - Added data model node
This commit is contained in:
1 parent
61d7f1e1fb
commit
afc4bee7ac
29 files changed
+730
-157
No files matched your search
@@ -0,0 +1,42 @@
|
||||
using Artemis.Core;
|
||||
using Artemis.UI.Shared;
|
||||
using Artemis.UI.Shared.Input;
|
||||
using Artemis.UI.Shared.Services;
|
||||
using Stylet;
|
||||
|
||||
namespace Artemis.VisualScripting.Nodes.CustomViewModels
|
||||
{
|
||||
public class DataModelNodeCustomViewModel : CustomNodeViewModel
|
||||
{
|
||||
private readonly DataModelNode _node;
|
||||
|
||||
public DataModelNodeCustomViewModel(DataModelNode node, IDataModelUIService dataModelUIService) : base(node)
|
||||
{
|
||||
_node = node;
|
||||
|
||||
Execute.OnUIThreadSync(() =>
|
||||
{
|
||||
SelectionViewModel = dataModelUIService.GetDynamicSelectionViewModel(module: null);
|
||||
SelectionViewModel.PropertySelected += SelectionViewModelOnPropertySelected;
|
||||
});
|
||||
}
|
||||
|
||||
public DataModelDynamicViewModel SelectionViewModel { get; set; }
|
||||
|
||||
private void SelectionViewModelOnPropertySelected(object? sender, DataModelInputDynamicEventArgs e)
|
||||
{
|
||||
_node.DataModelPath = SelectionViewModel.DataModelPath;
|
||||
if (_node.DataModelPath != null)
|
||||
{
|
||||
_node.DataModelPath.Save();
|
||||
_node.Storage = _node.DataModelPath.Entity;
|
||||
}
|
||||
else
|
||||
{
|
||||
_node.Storage = null;
|
||||
}
|
||||
|
||||
_node.UpdateOutputPin();
|
||||
}
|
||||
}
|
||||
}
|
||||
+14
-5
@@ -1,15 +1,24 @@
|
||||
using Stylet;
|
||||
using Artemis.Core;
|
||||
|
||||
namespace Artemis.VisualScripting.Nodes.CustomViewModels
|
||||
{
|
||||
public class StaticDoubleValueNodeCustomViewModel : PropertyChangedBase
|
||||
public class StaticDoubleValueNodeCustomViewModel : CustomNodeViewModel
|
||||
{
|
||||
private double _input;
|
||||
private readonly StaticDoubleValueNode _node;
|
||||
|
||||
public StaticDoubleValueNodeCustomViewModel(StaticDoubleValueNode node) : base(node)
|
||||
{
|
||||
_node = node;
|
||||
}
|
||||
|
||||
public double Input
|
||||
{
|
||||
get => _input;
|
||||
set => SetAndNotify(ref _input, value);
|
||||
get => (double) _node.Storage;
|
||||
set
|
||||
{
|
||||
_node.Storage = value;
|
||||
OnPropertyChanged(nameof(Input));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+14
-5
@@ -1,15 +1,24 @@
|
||||
using Stylet;
|
||||
using Artemis.Core;
|
||||
|
||||
namespace Artemis.VisualScripting.Nodes.CustomViewModels
|
||||
{
|
||||
public class StaticIntegerValueNodeCustomViewModel : PropertyChangedBase
|
||||
public class StaticIntegerValueNodeCustomViewModel : CustomNodeViewModel
|
||||
{
|
||||
private int _input;
|
||||
private readonly StaticIntegerValueNode _node;
|
||||
|
||||
public StaticIntegerValueNodeCustomViewModel(StaticIntegerValueNode node) : base(node)
|
||||
{
|
||||
_node = node;
|
||||
}
|
||||
|
||||
public int Input
|
||||
{
|
||||
get => _input;
|
||||
set => SetAndNotify(ref _input, value);
|
||||
get => (int)(long) _node.Storage;
|
||||
set
|
||||
{
|
||||
_node.Storage = value;
|
||||
OnPropertyChanged(nameof(Input));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+14
-5
@@ -1,15 +1,24 @@
|
||||
using Stylet;
|
||||
using Artemis.Core;
|
||||
|
||||
namespace Artemis.VisualScripting.Nodes.CustomViewModels
|
||||
{
|
||||
public class StaticStringValueNodeCustomViewModel : PropertyChangedBase
|
||||
public class StaticStringValueNodeCustomViewModel : CustomNodeViewModel
|
||||
{
|
||||
private string _input;
|
||||
private readonly StaticStringValueNode _node;
|
||||
|
||||
public StaticStringValueNodeCustomViewModel(StaticStringValueNode node) : base(node)
|
||||
{
|
||||
_node = node;
|
||||
}
|
||||
|
||||
public string Input
|
||||
{
|
||||
get => _input;
|
||||
set => SetAndNotify(ref _input, value);
|
||||
get => (string) _node.Storage;
|
||||
set
|
||||
{
|
||||
_node.Storage = value;
|
||||
OnPropertyChanged(nameof(Input));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user