浏览代码

Fixed Brush render size

flabbet 1 天之前
父节点
当前提交
d2b20a4bad

+ 4 - 5
src/PixiEditor.ChangeableDocument/Changeables/Brushes/BrushEngine.cs

@@ -106,9 +106,9 @@ public class BrushEngine : IDisposable
         {
             fullTexture = UpdateFullTexture(target, colorSpace, brushNode.AllowSampleStacking.Value);
         }
-
+        
         BrushRenderContext context = new BrushRenderContext(
-            texture?.DrawingSurface.Canvas, frameTime, ChunkResolution.Full, target.CommittedSize, target.CommittedSize,
+            texture?.DrawingSurface.Canvas, frameTime, ChunkResolution.Full, brushNode.FitToStrokeSize.NonOverridenValue ? rect.Size : target.CommittedSize, target.CommittedSize,
             colorSpace, samplingOptions, brushData,
             surfaceUnderRect, fullTexture, brushData.BrushGraph,
             (VecD)startPos, (VecD)lastPos)
@@ -120,6 +120,7 @@ public class BrushEngine : IDisposable
             KeyboardInfo = keyboardInfo
         };
 
+
         var previous = brushNode.Previous.Value;
         while(previous != null)
         {
@@ -148,9 +149,7 @@ public class BrushEngine : IDisposable
         {
             return;
         }
-
-        context.RenderOutputSize = (VecI)vectorShape.VisualAABB.Size;
-
+        
         bool autoPosition = brushNode.AutoPosition.Value;
         bool fitToStrokeSize = brushNode.FitToStrokeSize.Value;
         float pressure = brushNode.Pressure.Value;

+ 1 - 2
src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/Animable/TimeNode.cs

@@ -9,7 +9,6 @@ public class TimeNode : Node
 {
     public OutputProperty<int> ActiveFrame { get; set; }
     public OutputProperty<double> NormalizedTime { get; set; }
-    
     public OutputProperty<double> Time { get; set; }
 
 
@@ -24,7 +23,7 @@ public class TimeNode : Node
     {
         ActiveFrame.Value = context.FrameTime.Frame;
         NormalizedTime.Value = context.FrameTime.NormalizedTime;
-        Time.Value = (DateTime.UtcNow - Process.GetCurrentProcess().StartTime.ToUniversalTime()).Seconds;
+        Time.Value = (DateTime.UtcNow - Process.GetCurrentProcess().StartTime.ToUniversalTime()).TotalSeconds;
     }
 
     public override Node CreateCopy()

+ 2 - 1
src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/Brushes/BrushOutputNode.cs

@@ -23,6 +23,7 @@ public class BrushOutputNode : Node
 {
     public const string NodeId = "BrushOutput";
     public const string BrushNameProperty = "BrushName";
+    public const string FitToStrokeSizeProperty = "FitToStrokeSize";
 
     public InputProperty<string> BrushName { get; }
     public InputProperty<ShapeVectorData> VectorShape { get; }
@@ -69,7 +70,7 @@ public class BrushOutputNode : Node
             Drawie.Backend.Core.Surfaces.BlendMode.SrcOver);
 
         Pressure = CreateInput<float>("Pressure", "PRESSURE", 1f);
-        FitToStrokeSize = CreateInput<bool>("FitToStrokeSize", "FIT_TO_STROKE_SIZE", true);
+        FitToStrokeSize = CreateInput<bool>(FitToStrokeSizeProperty, "FIT_TO_STROKE_SIZE", true);
         AutoPosition = CreateInput<bool>("AutoPosition", "AUTO_POSITION", true);
         AllowSampleStacking = CreateInput<bool>("AllowSampleStacking", "ALLOW_SAMPLE_STACKING", false);
         AlwaysClear = CreateInput<bool>("AlwaysClear", "ALWAYS_CLEAR", false);

+ 1 - 0
src/PixiEditor/ViewModels/Document/Nodes/Brushes/BrushOutputNodeViewModel.cs

@@ -9,5 +9,6 @@ internal class BrushOutputNodeViewModel : NodeViewModel<BrushOutputNode>
     public override void OnInitialized()
     {
         InputPropertyMap[BrushOutputNode.BrushNameProperty].SocketEnabled = false;
+        InputPropertyMap[BrushOutputNode.FitToStrokeSizeProperty].SocketEnabled = false;
     }
 }