Nodes - Avoid overriding paths pointing to unloaded plugins with empty values

Nodes  - Store the type of paths so that node connections can be restored even if the path their types are based on are unavailable
This commit is contained in:
Robert committed 2023-09-25 20:21:00 +02:00
1 parent 279761abd3
commit 919199a8d0
5 files changed
+29 -14

No files matched your search

@@ -38,7 +38,7 @@ public class DataModelEventCycleNodeCustomViewModel : CustomNodeViewModel
// Subscribe to node changes
_cycleNode.WhenAnyValue(n => n.Storage).Subscribe(UpdateDataModelPath).DisposeWith(d);
this.WhenAnyValue(vm => vm.DataModelPath).Subscribe(ApplyDataModelPath).DisposeWith(d);
this.WhenAnyValue(vm => vm.DataModelPath).WhereNotNull().Subscribe(ApplyDataModelPath).DisposeWith(d);
Disposable.Create(() =>
{
@@ -82,18 +82,18 @@ public class DataModelEventCycleNodeCustomViewModel : CustomNodeViewModel
}
}
private void ApplyDataModelPath(DataModelPath? path)
private void ApplyDataModelPath(DataModelPath path)
{
try
{
if (_updating)
return;
if (path?.Path == _cycleNode.Storage?.Path)
if (path.Path == _cycleNode.Storage?.Path)
return;
_updating = true;
path?.Save();
path.Save();
_nodeEditorService.ExecuteCommand(Script, new UpdateStorage<DataModelPathEntity>(_cycleNode, path?.Entity, "event"));
}
finally
@@ -44,7 +44,7 @@ public class DataModelEventNodeCustomViewModel : CustomNodeViewModel
// Subscribe to node changes
_node.WhenAnyValue(n => n.Storage).Subscribe(UpdateDataModelPath).DisposeWith(d);
this.WhenAnyValue(vm => vm.DataModelPath).Subscribe(ApplyDataModelPath).DisposeWith(d);
this.WhenAnyValue(vm => vm.DataModelPath).WhereNotNull().Subscribe(ApplyDataModelPath).DisposeWith(d);
Disposable.Create(() =>
{
@@ -89,18 +89,18 @@ public class DataModelEventNodeCustomViewModel : CustomNodeViewModel
}
}
private void ApplyDataModelPath(DataModelPath? path)
private void ApplyDataModelPath(DataModelPath path)
{
try
{
if (_updating)
return;
if (path?.Path == _node.Storage?.Path)
if (path.Path == _node.Storage?.Path)
return;
_updating = true;
path?.Save();
path.Save();
_nodeEditorService.ExecuteCommand(Script, new UpdateStorage<DataModelPathEntity>(_node, path?.Entity, "event"));
}
finally
@@ -41,7 +41,7 @@ public class DataModelNodeCustomViewModel : CustomNodeViewModel
// Subscribe to node changes
_node.WhenAnyValue(n => n.Storage).Subscribe(UpdateDataModelPath).DisposeWith(d);
this.WhenAnyValue(vm => vm.DataModelPath).Subscribe(ApplyDataModelPath).DisposeWith(d);
this.WhenAnyValue(vm => vm.DataModelPath).WhereNotNull().Subscribe(ApplyDataModelPath).DisposeWith(d);
Disposable.Create(() =>
{
@@ -86,18 +86,18 @@ public class DataModelNodeCustomViewModel : CustomNodeViewModel
}
}
private void ApplyDataModelPath(DataModelPath? path)
private void ApplyDataModelPath(DataModelPath path)
{
try
{
if (_updating)
return;
if (path?.Path == _node.Storage?.Path)
if (path.Path == _node.Storage?.Path)
return;
_updating = true;
path?.Save();
path.Save();
_nodeEditorService.ExecuteCommand(Script, new UpdateStorage<DataModelPathEntity>(_node, path?.Entity, "path"));
}
finally