Browse Source

Added colors to the structure member nodes

CPKreuz 11 months ago
parent
commit
d94930db84

+ 1 - 2
src/PixiEditor.ChangeableDocument/ChangeInfos/NodeGraph/CreateNode_ChangeInfo.cs

@@ -55,8 +55,7 @@ public record CreateNode_ChangeInfo(
             pairNodeGuid = pairNode.OtherNode;
         }
         
-        NodeMetadata metadata = new NodeMetadata() { PairNodeGuid = pairNodeGuid };
-        metadata.AddAttributes(node);
+        NodeMetadata metadata = new NodeMetadata(node) { PairNodeGuid = pairNodeGuid };
 
         return new CreateNode_ChangeInfo(internalName, node.DisplayName, node.Position,
             node.Id,

+ 8 - 3
src/PixiEditor.ChangeableDocument/ChangeInfos/NodeGraph/NodeMetadata.cs

@@ -15,10 +15,15 @@ public class NodeMetadata
     
     public string? Category { get; private set; }
 
-    public void AddAttributes(IReadOnlyNode node)
+    public NodeMetadata(Type type)
+    {
+        AddAttributes(type);
+    }
+    
+    public NodeMetadata(IReadOnlyNode node) : this(node.GetType()) { }
+
+    private void AddAttributes(Type type)
     {
-        Type type = node.GetType();
-        
         AddNodeInfoAttribute(type);
         AddPairAttributes(type);
     }

+ 5 - 3
src/PixiEditor.ChangeableDocument/ChangeInfos/Structure/CreateFolder_ChangeInfo.cs

@@ -18,9 +18,10 @@ public record class CreateFolder_ChangeInfo : CreateStructureMember_ChangeInfo
         bool hasMask,
         bool maskIsVisible,
         ImmutableArray<NodePropertyInfo> Inputs,
-        ImmutableArray<NodePropertyInfo> Outputs
+        ImmutableArray<NodePropertyInfo> Outputs,
+        NodeMetadata metadata
     ) : base(internalName, opacity, isVisible, clipToMemberBelow, name, blendMode, guidValue, hasMask,
-        maskIsVisible, Inputs, Outputs)
+        maskIsVisible, Inputs, Outputs, metadata)
     {
     }
 
@@ -36,6 +37,7 @@ public record class CreateFolder_ChangeInfo : CreateStructureMember_ChangeInfo
             folder.Id,
             folder.Mask.Value is not null,
             folder.MaskIsVisible.Value, CreatePropertyInfos(folder.InputProperties, true, folder.Id),
-            CreatePropertyInfos(folder.OutputProperties, false, folder.Id));
+            CreatePropertyInfos(folder.OutputProperties, false, folder.Id),
+            new NodeMetadata(folder));
     }
 }

+ 5 - 3
src/PixiEditor.ChangeableDocument/ChangeInfos/Structure/CreateLayer_ChangeInfo.cs

@@ -21,9 +21,10 @@ public record class CreateLayer_ChangeInfo : CreateStructureMember_ChangeInfo
         bool maskIsVisible,
         bool lockTransparency,
         ImmutableArray<NodePropertyInfo> inputs,
-        ImmutableArray<NodePropertyInfo> outputs) :
+        ImmutableArray<NodePropertyInfo> outputs,
+        NodeMetadata metadata) :
         base(internalName, opacity, isVisible, clipToMemberBelow, name, blendMode, guidValue, hasMask,
-            maskIsVisible, inputs, outputs)
+            maskIsVisible, inputs, outputs, metadata)
     {
         LockTransparency = lockTransparency;
     }
@@ -44,7 +45,8 @@ public record class CreateLayer_ChangeInfo : CreateStructureMember_ChangeInfo
             layer.MaskIsVisible.Value,
             layer is ITransparencyLockable { LockTransparency: true },
             CreatePropertyInfos(layer.InputProperties, true, layer.Id),
-            CreatePropertyInfos(layer.OutputProperties, false, layer.Id)
+            CreatePropertyInfos(layer.OutputProperties, false, layer.Id),
+            new NodeMetadata(layer.GetType())
         );
     }
 }

+ 3 - 2
src/PixiEditor.ChangeableDocument/ChangeInfos/Structure/CreateStructureMember_ChangeInfo.cs

@@ -17,8 +17,9 @@ public abstract record class CreateStructureMember_ChangeInfo(
     bool HasMask,
     bool MaskIsVisible,
     ImmutableArray<NodePropertyInfo> InputProperties,
-    ImmutableArray<NodePropertyInfo> OutputProperties
-) : CreateNode_ChangeInfo(InternalName, Name, new VecD(0, 0), Id, InputProperties, OutputProperties, null)
+    ImmutableArray<NodePropertyInfo> OutputProperties,
+    NodeMetadata Metadata
+) : CreateNode_ChangeInfo(InternalName, Name, new VecD(0, 0), Id, InputProperties, OutputProperties, Metadata)
 {
     public ImmutableArray<NodePropertyInfo> InputProperties { get; init; } = InputProperties;
     public ImmutableArray<NodePropertyInfo> OutputProperties { get; init; } = OutputProperties;

+ 2 - 0
src/PixiEditor.UI.Common/Accents/Base.axaml

@@ -67,6 +67,7 @@
             
             <!-- Categories -->
             <Color x:Key="ImageCategoryBackgroundColor">#5B7348</Color>
+            <Color x:Key="StructureCategoryBackgroundColor">#735C39</Color>
             <Color x:Key="FiltersCategoryBackgroundColor">#733535</Color>
             <Color x:Key="ShapeCategoryBackgroundColor">#654266</Color>
             <Color x:Key="NumbersCategoryBackgroundColor">#666666</Color>
@@ -146,6 +147,7 @@
             
             <!-- Categories -->
             <SolidColorBrush x:Key="ImageCategoryBackgroundBrush" Color="{StaticResource ImageCategoryBackgroundColor}" />
+            <SolidColorBrush x:Key="StructureCategoryBackgroundBrush" Color="{StaticResource StructureCategoryBackgroundColor}" />
             <SolidColorBrush x:Key="FiltersCategoryBackgroundBrush" Color="{StaticResource FiltersCategoryBackgroundColor}" />
             <SolidColorBrush x:Key="ShapeCategoryBackgroundBrush" Color="{StaticResource ShapeCategoryBackgroundColor}" />
             <SolidColorBrush x:Key="NumbersCategoryBackgroundBrush" Color="{StaticResource NumbersCategoryBackgroundColor}" />