From 803534d804f706771e5c3d27b13de6709fa7f4a3 Mon Sep 17 00:00:00 2001 From: routersys Date: Wed, 1 Jul 2026 13:49:41 +0900 Subject: [PATCH] =?UTF-8?q?draw=5Fstate=E3=81=A7=E4=BD=9C=E6=A5=AD?= =?UTF-8?q?=E7=94=BB=E5=83=8F=E3=81=AE=E5=87=BA=E5=8A=9B=E3=82=92=E5=BC=B7?= =?UTF-8?q?=E5=88=B6=E3=81=BE=E3=81=9F=E3=81=AF=E6=8A=91=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LuaScript/LuaScriptEffectProcessor.cs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/LuaScript/LuaScriptEffectProcessor.cs b/LuaScript/LuaScriptEffectProcessor.cs index e56b285..97d9375 100644 --- a/LuaScript/LuaScriptEffectProcessor.cs +++ b/LuaScript/LuaScriptEffectProcessor.cs @@ -303,6 +303,8 @@ namespace LuaScript } } + ApplyDrawState(ctx, bounds); + outDesc = BuildOutputDesc(inDesc, ctx); if (ctx.EffectRequests.Count > 0) @@ -464,6 +466,7 @@ namespace LuaScript ctx.ClearQueries(); ctx.ClearEffects(); ctx.ClearDraws(); + ctx.DrawStateOverride = null; ctx.ImageWidth = imgW; ctx.ImageHeight = imgH; @@ -524,6 +527,29 @@ namespace LuaScript return layout.GetTrack(index) is { } p ? Math.Clamp(value, p.Min, p.Max) : value; } + private void ApplyDrawState(AviUtlScriptContext ctx, RawRectF bounds) + { + if (ctx.DrawStateOverride is not { } drawn) + return; + + if (!drawn) + { + effectOutput = null; + return; + } + + if (effectOutput is not null) + return; + + ctx.EnsurePixelBuffer(); + var buffer = ctx.GetPixelBuffer(); + if (buffer is null) + return; + + _pixelManager!.WritePixelsToOutput(buffer, ctx.ImageWidth, ctx.ImageHeight); + effectOutput = _pixelManager.GetTransformOutput(bounds.Left, bounds.Top); + } + private static DrawDescription BuildOutputDesc(DrawDescription inDesc, AviUtlScriptContext ctx) { return inDesc with