Răsfoiți Sursa

Added color node

Krzysztof Krysiński 7 luni în urmă
părinte
comite
7f0d337ec6

+ 28 - 0
src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/ColorNode.cs

@@ -0,0 +1,28 @@
+using Drawie.Backend.Core.ColorsImpl;
+using Drawie.Backend.Core.Shaders.Generation.Expressions;
+using PixiEditor.ChangeableDocument.Rendering;
+
+namespace PixiEditor.ChangeableDocument.Changeables.Graph.Nodes;
+
+[NodeInfo("Color")]
+public class ColorNode : Node
+{
+    public FuncInputProperty<Half4> InputColor { get; }
+    public FuncOutputProperty<Half4> Color { get; }
+    
+    public ColorNode()
+    {
+        InputColor = CreateFuncInput<Half4>("InputColor", "COLOR", Colors.White);
+        Color = CreateFuncOutput<Half4>("OutputColor", "COLOR", ctx => ctx.GetValue(InputColor));
+    }
+    
+    protected override void OnExecute(RenderContext context)
+    {
+        
+    }
+
+    public override Node CreateCopy()
+    {
+        return new ColorNode();
+    }
+}

+ 2 - 1
src/PixiEditor/Data/Localization/Languages/en.json

@@ -834,5 +834,6 @@
   "PRESERVE_ALPHA": "Preserve alpha",
   "BLUR_FILTER_NODE": "Gaussian Blur Filter",
   "LENGTH": "Length",
-  "GREATER_THAN_OR_EQUAL": "Greater than or equal"
+  "GREATER_THAN_OR_EQUAL": "Greater than or equal",
+  "COLOR_NODE": "Color"
 }

+ 10 - 0
src/PixiEditor/ViewModels/Document/Nodes/ColorNodeViewModel.cs

@@ -0,0 +1,10 @@
+using PixiEditor.ChangeableDocument.Changeables.Graph.Nodes;
+using PixiEditor.ViewModels.Nodes;
+
+namespace PixiEditor.ViewModels.Document.Nodes;
+
+[NodeViewModel("COLOR_NODE", "COLOR", "\ue907")]
+internal class ColorNodeViewModel : NodeViewModel<ColorNode>
+{
+    
+}