obj.loadへsceneとbrushの読込種別を追加

このコミットが含まれているのは:
routersys committed 2026-07-04 20:32:07 +09:00
1 親 fd06fdafe7
コミット b6a1e6e43c
1ファイル変更
+39
+39
ファイルの表示
@@ -548,6 +548,17 @@ namespace LuaScript
args[1].String,
args.Count > 2 ? args[2].CastToNumber() ?? _activeContext.Time : _activeContext.Time);
break;
case "scene" when args.Count > 1 && args[1].Type == DataType.String:
LoadScene(
args[1].String,
args.Count > 2 ? args[2].CastToNumber() ?? _activeContext.Time : _activeContext.Time);
break;
case "brush" when args.Count > 1 && args[1].Type == DataType.String:
LoadBrush(
args[1].String,
args.Count > 2 ? args[2].CastToNumber() ?? 0d : 0d,
args.Count > 3 ? args[3].CastToNumber() ?? 0d : 0d);
break;
}
return DynValue.Void;
}
@@ -947,6 +958,34 @@ namespace LuaScript
RefreshObjDimensions();
}
private void LoadScene(string name, double time)
{
var ctx = _activeContext!;
var loader = ctx.SceneImageLoader;
if (loader is null)
return;
var (buffer, w, h) = loader(name, time);
if (w <= 0 || h <= 0)
return;
ctx.ReplaceBuffer(buffer, w, h);
RefreshObjDimensions();
}
private void LoadBrush(string name, double width, double height)
{
var ctx = _activeContext!;
var loader = ctx.BrushImageLoader;
if (loader is null)
return;
double w = width > 0d ? width : ctx.ImageWidth;
double h = height > 0d ? height : ctx.ImageHeight;
var (buffer, bw, bh) = loader(name, w, h);
if (bw <= 0 || bh <= 0)
return;
ctx.ReplaceBuffer(buffer, bw, bh);
RefreshObjDimensions();
}
private void LoadMovie(string path, double time)
{
_mediaLoader ??= _mediaLoaderFactory();