mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
Data model nodes - Only allow picking data model entries of types supported by nodes
Data models - Fixed path registration not registering two paths pointing to the same property twice (fixes data model-reliant node scripts that stop updating)
This commit is contained in:
1 parent
3836fae37a
commit
94b91bfc31
9 files changed
+116
-32
No files matched your search
@@ -345,8 +345,8 @@ public abstract class DataModel
|
||||
{
|
||||
lock (_activePaths)
|
||||
{
|
||||
if (_activePaths.Contains(path))
|
||||
return;
|
||||
if (_activePaths.Any(p => ReferenceEquals(p, path)))
|
||||
throw new ArtemisCoreException("Path already present on this data model, initialization done twice?");
|
||||
|
||||
_activePaths.Add(path);
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
@@ -37,6 +38,12 @@ internal class NodeService : INodeService
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <inheritdoc />
|
||||
public List<Type> GetRegisteredTypes()
|
||||
{
|
||||
return NodeTypeStore.GetColors().Select(c => c.Type).Distinct().ToList();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public TypeColorRegistration GetTypeColorRegistration(Type type)
|
||||
{
|
||||
@@ -132,6 +139,12 @@ public interface INodeService : IArtemisService
|
||||
/// </summary>
|
||||
IEnumerable<NodeData> AvailableNodes { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets all currently available node pin types.
|
||||
/// </summary>
|
||||
/// <returns>A <see cref="List{T}"/> of <see cref="Type"/> containing the currently available node pin types.</returns>
|
||||
List<Type> GetRegisteredTypes();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the best matching registration for the provided type
|
||||
/// </summary>
|
||||
|
||||
@@ -96,6 +96,14 @@ internal class NodeTypeStore
|
||||
}
|
||||
}
|
||||
|
||||
public static List<TypeColorRegistration> GetColors()
|
||||
{
|
||||
lock (ColorRegistrations)
|
||||
{
|
||||
return new List<TypeColorRegistration>(ColorRegistrations);
|
||||
}
|
||||
}
|
||||
|
||||
public static TypeColorRegistration? GetColor(Type type)
|
||||
{
|
||||
lock (ColorRegistrations)
|
||||
|
||||
Reference in new issue
Block a user