mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
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:
1 parent
279761abd3
commit
919199a8d0
5 files changed
+29
-14
No files matched your search
+4
-4
@@ -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
|
||||
|
||||
+4
-4
@@ -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
|
||||
|
||||
Reference in new issue
Block a user