Profile editor - Integrated visual scripting

This commit is contained in:
Robert committed 2022-04-03 22:21:56 +02:00
1 parent 372991a69b
commit 66ea718316
96 files changed
+2413 -238

No files matched your search

@@ -6,7 +6,7 @@ using Artemis.VisualScripting.Nodes.DataModel.Screens;
namespace Artemis.VisualScripting.Nodes.DataModel;
[Node("Data Model-Event", "Responds to a data model event trigger", "Data Model", OutputType = typeof(bool))]
[Node("Data Model-Event", "Responds to a data model event trigger", "Data Model", OutputType = typeof(object))]
public class DataModelEventNode : Node<DataModelPathEntity, DataModelEventNodeCustomViewModel>, IDisposable
{
private int _currentIndex;
@@ -1,12 +1,11 @@
using System.ComponentModel;
using Artemis.Core;
using Artemis.Core;
using Artemis.Storage.Entities.Profile;
using Artemis.VisualScripting.Nodes.DataModel.Screens;
using Avalonia.Threading;
namespace Artemis.VisualScripting.Nodes.DataModel;
[Node("Data Model-Value", "Outputs a selectable data model value.", "Data Model")]
[Node("Data Model-Value", "Outputs a selectable data model value.", "Data Model", OutputType = typeof(object))]
public class DataModelNode : Node<DataModelPathEntity, DataModelNodeCustomViewModel>, IDisposable
{
private DataModelPath? _dataModelPath;
@@ -19,7 +18,7 @@ public class DataModelNode : Node<DataModelPathEntity, DataModelNodeCustomViewMo
public INodeScript? Script { get; private set; }
public OutputPin Output { get; }
public override void Initialize(INodeScript script)
{
Script = script;
@@ -30,17 +29,6 @@ public class DataModelNode : Node<DataModelPathEntity, DataModelNodeCustomViewMo
UpdateDataModelPath();
}
private void UpdateDataModelPath()
{
DataModelPath? old = _dataModelPath;
old?.Dispose();
_dataModelPath = Storage != null ? new DataModelPath(Storage) : null;
if (_dataModelPath != null)
_dataModelPath.PathValidated += DataModelPathOnPathValidated;
UpdateOutputPin();
}
public override void Evaluate()
{
if (_dataModelPath == null || !_dataModelPath.IsValid)
@@ -69,6 +57,17 @@ public class DataModelNode : Node<DataModelPathEntity, DataModelNodeCustomViewMo
Output.ChangeType(type);
}
private void UpdateDataModelPath()
{
DataModelPath? old = _dataModelPath;
old?.Dispose();
_dataModelPath = Storage != null ? new DataModelPath(Storage) : null;
if (_dataModelPath != null)
_dataModelPath.PathValidated += DataModelPathOnPathValidated;
UpdateOutputPin();
}
private void DataModelPathOnPathValidated(object? sender, EventArgs e)
{
Dispatcher.UIThread.InvokeAsync(UpdateOutputPin);