mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 03:19: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
@@ -158,7 +158,16 @@ public class DataModelPath : IStorageModel, IDisposable
|
||||
if (_disposed)
|
||||
throw new ObjectDisposedException("DataModelPath");
|
||||
|
||||
return Segments.LastOrDefault()?.GetPropertyType();
|
||||
// Prefer the actual type from the segments
|
||||
Type? segmentType = Segments.LastOrDefault()?.GetPropertyType();
|
||||
if (segmentType != null)
|
||||
return segmentType;
|
||||
|
||||
// Fall back to stored type
|
||||
if (!string.IsNullOrWhiteSpace(Entity.Type))
|
||||
return Type.GetType(Entity.Type);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -358,9 +367,14 @@ public class DataModelPath : IStorageModel, IDisposable
|
||||
// Do not save an invalid state
|
||||
if (!IsValid)
|
||||
return;
|
||||
|
||||
|
||||
Entity.Path = Path;
|
||||
Entity.DataModelId = DataModelId;
|
||||
|
||||
// Store the type name but only if available
|
||||
Type? pathType = Segments.LastOrDefault()?.GetPropertyType();
|
||||
if (pathType != null)
|
||||
Entity.Type = pathType.FullName;
|
||||
}
|
||||
|
||||
#region Equality members
|
||||
|
||||
Reference in new issue
Block a user