|
@@ -1,12 +1,7 @@
|
|
-using System.Collections.Concurrent;
|
|
|
|
-using PixiEditor.ChangeableDocument.Changeables.Animations;
|
|
|
|
-using PixiEditor.ChangeableDocument.Changeables.Graph.Context;
|
|
|
|
|
|
+using PixiEditor.ChangeableDocument.Changeables.Graph.Context;
|
|
using PixiEditor.ChangeableDocument.Changeables.Graph.Interfaces;
|
|
using PixiEditor.ChangeableDocument.Changeables.Graph.Interfaces;
|
|
using PixiEditor.ChangeableDocument.Rendering;
|
|
using PixiEditor.ChangeableDocument.Rendering;
|
|
using PixiEditor.DrawingApi.Core;
|
|
using PixiEditor.DrawingApi.Core;
|
|
-using PixiEditor.DrawingApi.Core.ColorsImpl;
|
|
|
|
-using PixiEditor.DrawingApi.Core.Shaders;
|
|
|
|
-using PixiEditor.DrawingApi.Core.Shaders.Generation;
|
|
|
|
using PixiEditor.DrawingApi.Core.Shaders.Generation.Expressions;
|
|
using PixiEditor.DrawingApi.Core.Shaders.Generation.Expressions;
|
|
using PixiEditor.DrawingApi.Core.Surfaces;
|
|
using PixiEditor.DrawingApi.Core.Surfaces;
|
|
using PixiEditor.Numerics;
|
|
using PixiEditor.Numerics;
|
|
@@ -15,9 +10,9 @@ namespace PixiEditor.ChangeableDocument.Changeables.Graph.Nodes;
|
|
|
|
|
|
[NodeInfo("ModifyImageLeft")]
|
|
[NodeInfo("ModifyImageLeft")]
|
|
[PairNode(typeof(ModifyImageRightNode), "ModifyImageZone", true)]
|
|
[PairNode(typeof(ModifyImageRightNode), "ModifyImageZone", true)]
|
|
-public class ModifyImageLeftNode : Node, IPairNode
|
|
|
|
|
|
+public class ModifyImageLeftNode : Node, IPairNode, IPreviewRenderable
|
|
{
|
|
{
|
|
- public RenderInputProperty Image { get; }
|
|
|
|
|
|
+ public InputProperty<Texture?> Image { get; }
|
|
|
|
|
|
public FuncOutputProperty<Float2> Coordinate { get; }
|
|
public FuncOutputProperty<Float2> Coordinate { get; }
|
|
|
|
|
|
@@ -25,11 +20,9 @@ public class ModifyImageLeftNode : Node, IPairNode
|
|
|
|
|
|
public Guid OtherNode { get; set; }
|
|
public Guid OtherNode { get; set; }
|
|
|
|
|
|
- public Texture InputTexture { get; private set; }
|
|
|
|
-
|
|
|
|
public ModifyImageLeftNode()
|
|
public ModifyImageLeftNode()
|
|
{
|
|
{
|
|
- Image = CreateRenderInput("Surface", "IMAGE");
|
|
|
|
|
|
+ Image = CreateInput<Texture?>("Surface", "IMAGE", null);
|
|
Coordinate = CreateFuncOutput("Coordinate", "UV", ctx => ctx.OriginalPosition);
|
|
Coordinate = CreateFuncOutput("Coordinate", "UV", ctx => ctx.OriginalPosition);
|
|
Color = CreateFuncOutput("Color", "COLOR", GetColor);
|
|
Color = CreateFuncOutput("Color", "COLOR", GetColor);
|
|
}
|
|
}
|
|
@@ -38,14 +31,33 @@ public class ModifyImageLeftNode : Node, IPairNode
|
|
{
|
|
{
|
|
context.ThrowOnMissingContext();
|
|
context.ThrowOnMissingContext();
|
|
|
|
|
|
- return context.SampleSurface(InputTexture.DrawingSurface, context.SamplePosition);
|
|
|
|
|
|
+ return context.SampleSurface(Image.Value.DrawingSurface, context.SamplePosition);
|
|
}
|
|
}
|
|
|
|
|
|
protected override void OnExecute(RenderContext context)
|
|
protected override void OnExecute(RenderContext context)
|
|
{
|
|
{
|
|
- InputTexture = RequestTexture(0, context.DocumentSize);
|
|
|
|
- Image.Value.Paint(context, InputTexture.DrawingSurface);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
public override Node CreateCopy() => new ModifyImageLeftNode();
|
|
public override Node CreateCopy() => new ModifyImageLeftNode();
|
|
|
|
+ public RectD? GetPreviewBounds(int frame, string elementToRenderName = "")
|
|
|
|
+ {
|
|
|
|
+ if(Image.Value == null)
|
|
|
|
+ {
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return new RectD(0, 0, Image.Value.Size.X, Image.Value.Size.Y);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public bool RenderPreview(DrawingSurface renderOn, ChunkResolution resolution, int frame, string elementToRenderName)
|
|
|
|
+ {
|
|
|
|
+ if(Image.Value is null)
|
|
|
|
+ {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ RenderContext renderContext = new(renderOn, frame, ChunkResolution.Full, VecI.Zero);
|
|
|
|
+ renderOn.Canvas.DrawSurface(Image.Value.DrawingSurface, 0, 0);
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
}
|
|
}
|