dsh-game-material-master 0.11.0 → 0.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +2 -0
- package/README.md +2 -0
- package/lib/chroma.js +74 -15
- package/lib/client.js +233 -48
- package/lib/config.js +6 -3
- package/lib/customimage.js +43 -0
- package/lib/directions.js +69 -8
- package/lib/imagegen.js +18 -4
- package/lib/imageprovider.js +7 -2
- package/lib/index.js +61 -12
- package/lib/isocompose.js +26 -17
- package/lib/isogen.js +7 -3
- package/lib/keycolor.js +251 -0
- package/lib/mapgen.js +11 -7
- package/lib/pipeline.js +10 -3
- package/lib/riggen.js +4 -4
- package/lib/seqgen.js +7 -0
- package/lib/store.js +23 -12
- package/lib/toolguides.js +14 -14
- package/lib/wire.js +13 -5
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -305,16 +305,12 @@ window.__ModuleLoader__.load({
|
|
|
305
305
|
"收起选帧": "Hide frame picker",
|
|
306
306
|
"调整选帧": "Adjust frame pick",
|
|
307
307
|
"手动选帧": "Pick frames manually",
|
|
308
|
-
"
|
|
308
|
+
"正在抠背景并合成整图…": "Keying the background and composing sheet…",
|
|
309
309
|
"抠像在这里会**再跑一次**:第 3 步那次抠的是每个方向的预览带(顺便把整图合出来),这里重抠是为了让下面这些参数改完立刻生效——两次读的是同一份帧缓存(raw.bin)、同一套参数,所以结果一致。": "Keying runs **one more time** here: step 3 keyed the preview strip for each direction (and composed the sheet along the way), while re-keying here makes the parameters below take effect the moment you change them. Both passes read the same frame cache (raw.bin) with the same settings, so the results always match.",
|
|
310
310
|
"改完参数会自动重新抠像并合成整图,不需要重新抽帧。": "Changing the parameters re-keys and recomposes the sheet automatically, with no need to re-extract frames.",
|
|
311
311
|
"整图单格宽(px)": "Sheet cell width (px)",
|
|
312
312
|
"整图单格高(px)": "Sheet cell height (px)",
|
|
313
313
|
"像素块边长(0/1 = 关闭)": "Pixel block size (0/1 = off)",
|
|
314
|
-
"背景分割容差(0 = 只认绿色)": "Background split tolerance (0 = green only)",
|
|
315
|
-
"抠像下限(绿色优势)": "Key low (green dominance)",
|
|
316
|
-
"抠像上限(绿色优势)": "Key high (green dominance)",
|
|
317
|
-
"去绿溢出 0~1": "Despill green 0~1",
|
|
318
314
|
"边缘收缩(px)": "Edge shrink (px)",
|
|
319
315
|
"自动裁剪填充比例 0.5~1": "Auto-crop fill ratio 0.5~1",
|
|
320
316
|
"底部留白(px)": "Bottom padding (px)",
|
|
@@ -384,7 +380,6 @@ window.__ModuleLoader__.load({
|
|
|
384
380
|
"描述你要生成的图片…": "Describe the image you want to generate…",
|
|
385
381
|
"统一附加提示词(可留空)": "Shared suffix prompt (optional)",
|
|
386
382
|
"生图模型": "Image model",
|
|
387
|
-
"尺寸": "Size",
|
|
388
383
|
"生成张数(1~8)": "Images to generate (1~8)",
|
|
389
384
|
"正在生成 {n0} 张…": "Generating {n0} images…",
|
|
390
385
|
"已开始生成 {n0} 张": "Started generating {n0} images",
|
|
@@ -395,13 +390,13 @@ window.__ModuleLoader__.load({
|
|
|
395
390
|
"把参考图拖到这里": "Drag reference images here",
|
|
396
391
|
"已移除参考图": "Reference image removed",
|
|
397
392
|
"移除": "Remove",
|
|
398
|
-
"③
|
|
393
|
+
"③ 背景抠像": "③ Background keying",
|
|
399
394
|
"开启后每张生成完会自动抠一遍;也可以上传已有图片只做抠像。": "When on, each image is keyed automatically after it is generated; you can also upload existing images to key them only.",
|
|
400
395
|
"不抠像": "No keying",
|
|
401
|
-
"
|
|
396
|
+
"自动抠背景输出 PNG": "Auto-key the background, output PNG",
|
|
402
397
|
"正在抠像…": "Keying…",
|
|
403
398
|
"已开始抠像": "Keying started",
|
|
404
|
-
"
|
|
399
|
+
"正在抠背景…": "Keying the background…",
|
|
405
400
|
"按当前参数重新抠像": "Re-key with current settings",
|
|
406
401
|
"上传一张已有图片,直接抠成透明 PNG": "Upload an existing image to key straight to a transparent PNG",
|
|
407
402
|
"④ 结果({n0} 张)": "④ Results ({n0} images)",
|
|
@@ -1027,7 +1022,6 @@ window.__ModuleLoader__.load({
|
|
|
1027
1022
|
"可通过 · 角色在上面": "Walkable · character drawn on top",
|
|
1028
1023
|
"不可通过": "Blocked",
|
|
1029
1024
|
"可通过 · 物件盖住角色": "Walkable · object covers the character",
|
|
1030
|
-
"抠掉绿幕背景": "Key out the green background",
|
|
1031
1025
|
"名字": "Name",
|
|
1032
1026
|
"{n0} 帧/秒": "{n0} fps",
|
|
1033
1027
|
"格子宽": "Cell width",
|
|
@@ -1090,7 +1084,6 @@ window.__ModuleLoader__.load({
|
|
|
1090
1084
|
"一格只有 {n0}px:任何细节不能小于一格的 1/4(约 {n1}px);比这更细的纹理缩到格子上会糊成色雾。": "One cell is only {n0}px: no detail smaller than 1/4 of a cell (about {n1}px); finer texture turns into color mush at this size.",
|
|
1091
1085
|
"① 先出一张静态首帧图:createImageJob({name}) → saveImageJob({jobId, prompt:<上面的主题 + 画法要求 + 排布>}) → runImageJob({jobId, count:1}) → game_material({action:'wait', id:jobId});然后 getImageJob({jobId}) 取 dir 与 items[0].file,首帧绝对路径 = dir + '/' + file。": "1) First make one static first frame: createImageJob({name}) -> saveImageJob({jobId, prompt:<subject + rendering requirements + layout above>}) -> runImageJob({jobId, count:1}) -> game_material({action:'wait', id:jobId});then getImageJob({jobId}) for dir and items[0].file; absolute first-frame path = dir + '/' + file.",
|
|
1092
1086
|
"② 再让它动起来并抽帧:createSequenceJob({name}) → game_material({action:'upload', module:'sequence', id, kind:'firstFrame', path:<首帧绝对路径>}) → runSequenceVideo({jobId}) → game_material({action:'wait'}) → runSequenceFrames({jobId, count:{n0}}) → game_material({action:'wait'});然后 getSequenceJob({jobId}) 取 dir 与 frames.files,按顺序取前 {n0} 帧的绝对路径 = dir + '/' + file。": "2) Then animate and extract frames: createSequenceJob({name}) -> game_material({action:'upload', module:'sequence', id, kind:'firstFrame', path:<absolute first-frame path>}) -> runSequenceVideo({jobId}) -> game_material({action:'wait'}) -> runSequenceFrames({jobId, count:{n0}}) -> game_material({action:'wait'});then getSequenceJob({jobId}) for dir and frames.files; take the first {n0} absolute paths in order = dir + '/' + file.",
|
|
1093
|
-
"第四步 · 整理并回链:game_material({action:'call', method:'composeIsoAsset', payload:{projectId:'{n0}', name:'{n1}', files:[<上面那些绝对路径,按顺序>], kind:'<ground 或 object>', footprint:<物件时给 {{cols:{n2},rows:{n3}}}>}})": "Step 4 - assemble and post the link: game_material({action:'call', method:'composeIsoAsset', payload:{projectId:'{n0}', name:'{n1}', files:[<those absolute paths, in order>], kind:'<ground or object>', footprint:<for objects: {{cols:{n2},rows:{n3}}}>}})",
|
|
1094
1087
|
" `kind` 必须和这次实际画的一致;不要传 `auto`。物件必须给 footprint;地面不需要。": " `kind` must match what you actually drew; never pass `auto`. Objects require footprint; ground does not.",
|
|
1095
1088
|
" 把这次调用返回的 openUrl **原样**贴成 Markdown 链接(例如 [回到 45° 地图编辑器](…)):点开就回到项目、素材窗口展开、": " Post the openUrl returned by that call **verbatim** as a Markdown link (for example [Back to the 45° map editor](...)): it returns to the project, opens the assets window and",
|
|
1096
1089
|
"「新增素材」里这张图与用途 / 帧数 / 占格都已经预选好,用户点「确定」才真的导入。": "\"Add asset\" already has the image, use, frame count and footprint preselected; the user clicks \"OK\" to import.",
|
|
@@ -1429,11 +1422,9 @@ window.__ModuleLoader__.load({
|
|
|
1429
1422
|
"画法要求:**只画物件本体、背景是纯绿幕**(上面整图那段写了)—— 插件会把绿抠成透明,剩下的部分要铺满、不留白边。": "Painting rules: **only the object itself on a pure green background** (see the stamp section above) - the plugin keys the green to transparent; what remains must fill the frame with no white margins.",
|
|
1430
1423
|
" ⚠️ 整图**不要**自己去抠像(别为了抠图再跑一次 image 模块的 keyImageJob):`composeMapAsset` 会先抠绿幕、再按占格切片。生成完直接把原图路径交给它。": " WARNING: for stamps do **not** run keying yourself (do not call the image module's keyImageJob just to cut it out): `composeMapAsset` keys the green screen first and then slices by the cell span. Hand it the generated image paths directly.",
|
|
1431
1424
|
"背景": "Background",
|
|
1432
|
-
"抠掉绿幕背景(只留建筑本体)": "Key out the green screen (keep only the object)",
|
|
1433
1425
|
"整图是「立在格子上的物件」:背景该是透明的,不然地图上会多出一块绿框。AI 生成的图请在提示词里要**纯绿背景**,这里勾上就会自动抠掉;自己导的透明 PNG 也可以勾着(没有绿就什么都不做)。": "A stamp is an object standing on the map: its background should be transparent, otherwise a green rectangle shows up on the map. For AI images, ask for a **pure green background** in the prompt and tick this box to key it out automatically; a transparent PNG of your own can leave it ticked too (with no green there, nothing changes).",
|
|
1434
1426
|
" · 整图(stamp):**一张画占好几格**的多格建筑 / 装饰 —— 雕像 / 壁画 / 喷泉 / 大门 / 摊位 / 地毯这种「一整个物件」;判据是「它比一格大,而且不该被切成小块重复」。": " - Stamp (stamp): a multi-cell building/prop where **one picture covers several cells** - statue / mural / fountain / gate / stall / carpet, i.e. a single object. The test is: it is bigger than one cell and must not be sliced into repeated fragments.",
|
|
1435
1427
|
" 【整图】只画**一整张**完整的画(整张图就是这栋建筑 / 这座雕像本身,**不要**分格、**不要**画成 N×N 的格子拼图、不要裁成小块):": " [Stamp] Draw **one whole picture** (the entire image IS the building/statue; do NOT split it into cells, do NOT draw an NxN tile sheet, do NOT crop it into pieces):",
|
|
1436
|
-
"第四步 · 整理并回链:game_material({action:'call', method:'composeMapAsset', payload:{projectId:'{n0}', name:'{n1}', files:[<上面那些绝对路径,按顺序>], shape:'<你选的形态:plain|corner16|a2quad|stamp>'}})": "Step 4 - Assemble and post the link: game_material({action:'call', method:'composeMapAsset', payload:{projectId:'{n0}', name:'{n1}', files:[<those absolute paths, in order>], shape:'<the shape you chose: plain|corner16|a2quad|stamp>'}})",
|
|
1437
1428
|
" 整图还要多给「占几格」:shape:'stamp', stampCols:{n0}, stampRows:{n1}(每张源图 = 一帧的整张画;区域留给用户在导入时点)。": " Stamps also need the cell span: shape:'stamp', stampCols:{n0}, stampRows:{n1} (each source image = one whole frame; areas are clicked by the user at import).",
|
|
1438
1429
|
"整图(一张画占好几格)": "Stamp (one picture, several cells)",
|
|
1439
1430
|
"多格建筑 / 装饰:雕像、壁画、喷泉、大门、地毯。每张图 = 一整张完整的画(不要分格),插件按「占几格」切成格子;哪些格能走导入时你自己点。": "Multi-cell buildings/props: statues, murals, fountains, gates, carpets. Each image is one whole picture (not split into cells); the plugin slices it by the cell span. You click which cells are walkable at import time.",
|
|
@@ -1838,6 +1829,35 @@ window.__ModuleLoader__.load({
|
|
|
1838
1829
|
"默认模型": "Default model",
|
|
1839
1830
|
"默认输出格式": "Default output format",
|
|
1840
1831
|
"默认采样率": "Default sample rate",
|
|
1832
|
+
"背景分割容差(0 = 只认背景色)": "Background split tolerance (0 = background color only)",
|
|
1833
|
+
"抠像下限(背景色接近度)": "Key low (background closeness)",
|
|
1834
|
+
"抠像上限(背景色接近度)": "Key high (background closeness)",
|
|
1835
|
+
"去溢色 0~1": "Despill 0~1",
|
|
1836
|
+
"绿幕(默认)": "Green screen (default)",
|
|
1837
|
+
"蓝幕": "Blue screen",
|
|
1838
|
+
"品红幕": "Magenta screen",
|
|
1839
|
+
"青幕": "Cyan screen",
|
|
1840
|
+
"黄幕": "Yellow screen",
|
|
1841
|
+
"红幕": "Red screen",
|
|
1842
|
+
"白幕": "White screen",
|
|
1843
|
+
"黑幕": "Black screen",
|
|
1844
|
+
"抠像背景色": "Key background color",
|
|
1845
|
+
"自定义背景色": "Custom background color",
|
|
1846
|
+
"自定义": "Custom",
|
|
1847
|
+
"抠掉背景色(只留建筑本体)": "Key out the background color (keep only the object)",
|
|
1848
|
+
"抠掉背景色": "Key out the background color",
|
|
1849
|
+
"抠像背景色(全局默认)": "Key background color (global default)",
|
|
1850
|
+
"第四步 · 整理并回链:game_material({action:'call', method:'composeMapAsset', payload:{projectId:'{n0}', name:'{n1}', files:[<上面那些绝对路径,按顺序>], shape:'<你选的形态:plain|corner16|a2quad|stamp>', keyColor:'{n2}'}})": "Step 4 - Assemble and post the link: game_material({action:'call', method:'composeMapAsset', payload:{projectId:'{n0}', name:'{n1}', files:[<those absolute paths, in order>], shape:'<the shape you chose: plain|corner16|a2quad|stamp>', keyColor:'{n2}'}})",
|
|
1851
|
+
" 抠像底色是 {n0}:composeMapAsset 必须带上 keyColor:'{n0}',与提示词里的背景色一致。": " The key color is {n0}: composeMapAsset must pass keyColor:'{n0}' so keying matches the prompt background.",
|
|
1852
|
+
"第四步 · 整理并回链:game_material({action:'call', method:'composeIsoAsset', payload:{projectId:'{n0}', name:'{n1}', files:[<上面那些绝对路径,按顺序>], kind:'<ground 或 object>', footprint:<物件时给 {{cols:{n2},rows:{n3}}}>, keyColor:'{n4}'}})": "Step 4 - assemble and post the link: game_material({action:'call', method:'composeIsoAsset', payload:{projectId:'{n0}', name:'{n1}', files:[<those absolute paths, in order>], kind:'<ground or object>', footprint:<for objects: {{cols:{n2},rows:{n3}}}>, keyColor:'{n4}'}})",
|
|
1853
|
+
" 抠像底色是 {n0}:composeIsoAsset 必须带上 keyColor:'{n0}',与提示词里的背景色一致。": " The key color is {n0}: composeIsoAsset must pass keyColor:'{n0}' so keying matches the prompt background.",
|
|
1854
|
+
"1K / 2K / 4K 由模型决定像素;要固定尺寸请直接填 宽x高": "1K / 2K / 4K are model-defined pixel sizes; enter width x height to pin exact dimensions",
|
|
1855
|
+
"尺寸来源": "Size source",
|
|
1856
|
+
"跟随全局({n0})": "Follow global ({n0})",
|
|
1857
|
+
"任务尺寸": "Task size",
|
|
1858
|
+
"只影响这个任务;支持 1K / 2K / 4K 或 宽x高": "Affects only this task; accepts 1K / 2K / 4K or width x height",
|
|
1859
|
+
"当前全局尺寸": "Current global size",
|
|
1860
|
+
"在「设置 → 游戏素材大师 → 输出尺寸」里改": "Change it in Settings → Game Material Master → Output size",
|
|
1841
1861
|
};
|
|
1842
1862
|
/* i18n-ignore-end */
|
|
1843
1863
|
/**
|
|
@@ -2133,9 +2153,79 @@ window.__ModuleLoader__.load({
|
|
|
2133
2153
|
function guideFirstLine(topic) {
|
|
2134
2154
|
return T("先读手册:game_material({action:'guide', topic:'{n0}'});下面所有远程方法都通过 game_material({action:'call', method:'<名>', payload:{…}}) 调用,wait/upload 用同工具的对应 action。", { n0: topic });
|
|
2135
2155
|
}
|
|
2156
|
+
/**
|
|
2157
|
+
* 抠像底色:浏览器半区不 import 宿主模块(经典脚本),这里保留一份很小的
|
|
2158
|
+
* 颜色名表/替换逻辑。只用于**拼给模型看的提示词**,真正的颜色解析与
|
|
2159
|
+
* 抠像都在宿主 `keycolor.ts` / `chroma.ts`。
|
|
2160
|
+
*/
|
|
2161
|
+
const KEY_COLOR_NAMES = [
|
|
2162
|
+
{ hex: "#00FF00", zh: "绿幕", zhWord: "绿", en: "green screen", enWord: "green" },
|
|
2163
|
+
{ hex: "#0000FF", zh: "蓝幕", zhWord: "蓝", en: "blue screen", enWord: "blue" },
|
|
2164
|
+
{ hex: "#FF00FF", zh: "品红幕", zhWord: "品红", en: "magenta screen", enWord: "magenta" },
|
|
2165
|
+
{ hex: "#00FFFF", zh: "青幕", zhWord: "青", en: "cyan screen", enWord: "cyan" },
|
|
2166
|
+
{ hex: "#FFFF00", zh: "黄幕", zhWord: "黄", en: "yellow screen", enWord: "yellow" },
|
|
2167
|
+
{ hex: "#FF0000", zh: "红幕", zhWord: "红", en: "red screen", enWord: "red" },
|
|
2168
|
+
{ hex: "#FFFFFF", zh: "白幕", zhWord: "白", en: "white screen", enWord: "white" },
|
|
2169
|
+
{ hex: "#000000", zh: "黑幕", zhWord: "黑", en: "black screen", enWord: "black" }
|
|
2170
|
+
];
|
|
2171
|
+
function normalizeKeyColorHex(value) {
|
|
2172
|
+
const text = typeof value === "string" ? value.trim().toLowerCase() : "";
|
|
2173
|
+
if (/^#[0-9a-f]{6}$/u.test(text))
|
|
2174
|
+
return text.toUpperCase();
|
|
2175
|
+
if (/^#[0-9a-f]{3}$/u.test(text)) {
|
|
2176
|
+
const [r, g, b] = text.slice(1).split("");
|
|
2177
|
+
return `#${r}${r}${g}${g}${b}${b}`.toUpperCase();
|
|
2178
|
+
}
|
|
2179
|
+
return "#00FF00";
|
|
2180
|
+
}
|
|
2181
|
+
/** 把内置默认提示词里的「绿幕」换成当前底色;绿色保持原样(逐字兼容旧提示词)。 */
|
|
2182
|
+
function applyKeyColorText(text, value) {
|
|
2183
|
+
const color = normalizeKeyColorHex(value);
|
|
2184
|
+
if (color === "#00FF00" || typeof text !== "string")
|
|
2185
|
+
return text;
|
|
2186
|
+
const preset = KEY_COLOR_NAMES.find((entry) => entry.hex === color);
|
|
2187
|
+
const zhScreen = preset === undefined ? "纯色背景" : preset.zh;
|
|
2188
|
+
const zhWord = preset === undefined ? color : preset.zhWord;
|
|
2189
|
+
const zhBackground = preset === undefined ? "纯色背景" : `${preset.zh}背景`;
|
|
2190
|
+
const enScreen = preset === undefined ? "solid background" : preset.en;
|
|
2191
|
+
const enWord = preset === undefined ? color.toLowerCase() : preset.enWord;
|
|
2192
|
+
const enBackground = preset === undefined ? "solid background" : `${preset.en} background`;
|
|
2193
|
+
let out = text;
|
|
2194
|
+
// 中文:先换更长的固定搭配,最后才换单独的「绿幕」。
|
|
2195
|
+
out = out.split("不要用绿幕背景").join("不要用纯色背景");
|
|
2196
|
+
out = out.split("不要用绿幕").join("不要用纯色背景");
|
|
2197
|
+
out = out.split("纯绿幕").join(preset === undefined ? "纯色背景" : `纯${zhScreen}`);
|
|
2198
|
+
out = out.split("绿幕背景").join(zhBackground);
|
|
2199
|
+
out = out.split("干净的绿幕").join(`干净的${zhScreen}`);
|
|
2200
|
+
out = out.split("没检测到绿幕").join(`没检测到${zhScreen}`);
|
|
2201
|
+
out = out.split("每一片绿").join(`每一片${zhWord}`);
|
|
2202
|
+
out = out.split("一片绿").join(`一片${zhWord}`);
|
|
2203
|
+
out = out.split("抠绿幕").join(`抠${zhScreen}`);
|
|
2204
|
+
out = out.split("抠绿").join(`抠${zhWord}`);
|
|
2205
|
+
out = out.split("绿框").join(`${zhWord}框`);
|
|
2206
|
+
out = out.split("绿色描边").join(`${zhWord}色描边`);
|
|
2207
|
+
out = out.split("绿色外发光").join(`${zhWord}色外发光`);
|
|
2208
|
+
out = out.split("绿色").join(`${zhWord}色`);
|
|
2209
|
+
out = out.split("绿幕").join(zhScreen);
|
|
2210
|
+
out = out.split("纯绿").join(`纯${zhWord}`);
|
|
2211
|
+
// 英文。
|
|
2212
|
+
out = out.split("no green-screen background").join("no solid-color background");
|
|
2213
|
+
out = out.split("green screen background").join(enBackground);
|
|
2214
|
+
out = out.split("clean green screen").join(`clean ${enScreen}`);
|
|
2215
|
+
out = out.split("pure green").join(`pure ${enWord}`);
|
|
2216
|
+
out = out.split("green outline").join(`${enWord} outline`);
|
|
2217
|
+
out = out.split("green glow").join(`${enWord} glow`);
|
|
2218
|
+
out = out.split("the same green").join(`the same ${enWord}`);
|
|
2219
|
+
out = out.split("green background").join(enBackground);
|
|
2220
|
+
out = out.split("green screen").join(enScreen);
|
|
2221
|
+
// 色值最后换,避免把「标准 chroma key 绿 #00FF00」拆成两半。
|
|
2222
|
+
out = out.split("#00FF00").join(color);
|
|
2223
|
+
return out;
|
|
2224
|
+
}
|
|
2136
2225
|
function buildAssetRequestPrompt(input) {
|
|
2137
2226
|
const shape = ASSET_SHAPES.includes(input.shape) ? input.shape : "auto";
|
|
2138
2227
|
const fixed = shape !== "auto";
|
|
2228
|
+
const keyColorHex = normalizeKeyColorHex(input.keyColor);
|
|
2139
2229
|
/** 整图需要「占几格」:用户指定了就按指定的,没指定就按 3×3 的常见尺寸让 agent 用。 */
|
|
2140
2230
|
const stampCols = clampStampSpan(Number(input.stampCols) || 3, 512);
|
|
2141
2231
|
const stampRows = clampStampSpan(Number(input.stampRows) || 3, 512);
|
|
@@ -2247,13 +2337,19 @@ window.__ModuleLoader__.load({
|
|
|
2247
2337
|
}
|
|
2248
2338
|
lines.push("", shape === "stamp" || !fixed
|
|
2249
2339
|
? T(" ⚠️ 整图**不要**自己去抠像(别为了抠图再跑一次 image 模块的 keyImageJob):`composeMapAsset` 会先抠绿幕、再按占格切片。生成完直接把原图路径交给它。")
|
|
2250
|
-
: null, T("第四步 · 整理并回链:game_material({action:'call', method:'composeMapAsset', payload:{projectId:'{n0}', name:'{n1}', files:[<上面那些绝对路径,按顺序>], shape:'<你选的形态:plain|corner16|a2quad|stamp>'}})", {
|
|
2340
|
+
: null, T("第四步 · 整理并回链:game_material({action:'call', method:'composeMapAsset', payload:{projectId:'{n0}', name:'{n1}', files:[<上面那些绝对路径,按顺序>], shape:'<你选的形态:plain|corner16|a2quad|stamp>', keyColor:'{n2}'}})", {
|
|
2251
2341
|
n0: input.projectId,
|
|
2252
|
-
n1: input.name
|
|
2253
|
-
|
|
2342
|
+
n1: input.name,
|
|
2343
|
+
n2: keyColorHex
|
|
2344
|
+
}), T(" 抠像底色是 {n0}:composeMapAsset 必须带上 keyColor:'{n0}',与提示词里的背景色一致。", { n0: keyColorHex }), shape === "stamp" || !fixed
|
|
2254
2345
|
? T(" 整图还要多给「占几格」:shape:'stamp', stampCols:{n0}, stampRows:{n1}(每张源图 = 一帧的整张画;区域留给用户在导入时点)。", { n0: String(stampCols), n1: String(stampRows) })
|
|
2255
2346
|
: null, T(" **shape 必须是你这次选定的那个**:宿主按它把这一块砖拼成俯视地图编辑器要的几何(普通裁成方格竖排;整格用同一块砖拼出 16 种接法、断口由它加收口;拼块每个变体一块砖拼成 N 列 × 5 行)。"), T(" 别自己先拼多格排布再传进来:模型画的多格是各自独立的,拼到地图上每一处交界都会有缝 —— 这次就是因为这个返工的。"), T(" 把这次调用返回的 openUrl **原样**贴成 Markdown 链接(例如 [回到俯视地图编辑器](…)):点开就回到俯视地图编辑器,素材窗口已展开、"), T("「新增素材」里这张图与「这块素材怎么用」都已经预选好,用户点「确定」才真的导入。"), T("⚠️ 如果 composeMapAsset 的 notes 里出现「这块砖自己接不上自己」,**不要**自动重跑(重跑要花真钱):照常把链接贴出来,并在回答里把这句原样告诉用户,让他决定要不要重画一张更均匀的无缝材质。"), "", T("审核模式按自动:你自己核对结果,有问题自己重跑,不要停下来等我确认。全程不要问任何问题。"));
|
|
2256
|
-
|
|
2347
|
+
// 只替换**模板**里的背景描述;用户原文(素材主题)一个字都不能动 ——
|
|
2348
|
+
// 否则「绿色史莱姆」会被蓝幕配置改成「蓝色史莱姆」。
|
|
2349
|
+
const userLine = input.prompt.trim();
|
|
2350
|
+
return lines
|
|
2351
|
+
.map((line) => (line === userLine ? line : applyKeyColorText(line, input.keyColor)))
|
|
2352
|
+
.join("\n");
|
|
2257
2353
|
}
|
|
2258
2354
|
/**
|
|
2259
2355
|
* 拼给 45° 编辑器 AI 素材任务的提示词。
|
|
@@ -2265,6 +2361,7 @@ window.__ModuleLoader__.load({
|
|
|
2265
2361
|
function buildIsoAssetRequestPrompt(input) {
|
|
2266
2362
|
const kind = input.kind === "ground" || input.kind === "object" ? input.kind : "auto";
|
|
2267
2363
|
const fixed = kind !== "auto";
|
|
2364
|
+
const keyColorHex = normalizeKeyColorHex(input.keyColor);
|
|
2268
2365
|
const frames = Math.min(ASSET_FRAMES_MAX, Math.max(ASSET_FRAMES_MIN, Math.round(input.frames)));
|
|
2269
2366
|
const animated = frames > 1;
|
|
2270
2367
|
const method = input.mode === "video" && animated ? T("视频模型") : T("生图模型");
|
|
@@ -2289,6 +2386,9 @@ window.__ModuleLoader__.load({
|
|
|
2289
2386
|
? T("物件占格:{n0}×{n1}(仅当判断为物件时使用)", { n0: String(footprint.cols), n1: String(footprint.rows) })
|
|
2290
2387
|
: null,
|
|
2291
2388
|
"",
|
|
2389
|
+
T("素材主题(用户提示词):"),
|
|
2390
|
+
input.prompt.trim(),
|
|
2391
|
+
"",
|
|
2292
2392
|
...(fixed
|
|
2293
2393
|
? [T("这块素材怎么用已经定死了({n0}),不要再讨论别的用法,直接按它做。", { n0: kindLabel(kind) })]
|
|
2294
2394
|
: [
|
|
@@ -2311,8 +2411,12 @@ window.__ModuleLoader__.load({
|
|
|
2311
2411
|
? T("① 先出一张静态首帧图:createImageJob({name}) → saveImageJob({jobId, prompt:<上面的主题 + 画法要求 + 排布>}) → runImageJob({jobId, count:1}) → game_material({action:'wait', id:jobId});然后 getImageJob({jobId}) 取 dir 与 items[0].file,首帧绝对路径 = dir + '/' + file。")
|
|
2312
2412
|
: T("用图片生成模块:createImageJob({name}) → saveImageJob({jobId, prompt:<上面的主题 + 画法要求 + 排布>}) → runImageJob({jobId, count:{n0}}) → game_material({action:'wait', id:jobId});", { n0: String(frames) }), input.mode === "video" && animated
|
|
2313
2413
|
? T("② 再让它动起来并抽帧:createSequenceJob({name}) → game_material({action:'upload', module:'sequence', id, kind:'firstFrame', path:<首帧绝对路径>}) → runSequenceVideo({jobId}) → game_material({action:'wait'}) → runSequenceFrames({jobId, count:{n0}}) → game_material({action:'wait'});然后 getSequenceJob({jobId}) 取 dir 与 frames.files,按顺序取前 {n0} 帧的绝对路径 = dir + '/' + file。", { n0: String(frames) })
|
|
2314
|
-
: T("然后 getImageJob({jobId}) 取 dir 与 items[],按顺序取前 {n0} 张的绝对路径 = dir + '/' + file。", { n0: String(frames) }), "", T("第四步 · 整理并回链:game_material({action:'call', method:'composeIsoAsset', payload:{projectId:'{n0}', name:'{n1}', files:[<上面那些绝对路径,按顺序>], kind:'<ground 或 object>', footprint:<物件时给 {{cols:{n2},rows:{n3}}}
|
|
2315
|
-
|
|
2414
|
+
: T("然后 getImageJob({jobId}) 取 dir 与 items[],按顺序取前 {n0} 张的绝对路径 = dir + '/' + file。", { n0: String(frames) }), "", T("第四步 · 整理并回链:game_material({action:'call', method:'composeIsoAsset', payload:{projectId:'{n0}', name:'{n1}', files:[<上面那些绝对路径,按顺序>], kind:'<ground 或 object>', footprint:<物件时给 {{cols:{n2},rows:{n3}}}>, keyColor:'{n4}'}})", { n0: input.projectId, n1: input.name, n2: String(footprint.cols), n3: String(footprint.rows), n4: keyColorHex }), T(" 抠像底色是 {n0}:composeIsoAsset 必须带上 keyColor:'{n0}',与提示词里的背景色一致。", { n0: keyColorHex }), T(" `kind` 必须和这次实际画的一致;不要传 `auto`。物件必须给 footprint;地面不需要。"), T(" 把这次调用返回的 openUrl **原样**贴成 Markdown 链接(例如 [回到 45° 地图编辑器](…)):点开就回到项目、素材窗口展开、"), T("「新增素材」里这张图与用途 / 帧数 / 占格都已经预选好,用户点「确定」才真的导入。"), T("⚠️ 如果 composeIsoAsset 的 notes 说比例不是 2:1 或没检测到绿幕,**不要**自动重跑(重跑要花真钱):照常贴链接,并在回答里原样告诉用户。"), "", T("审核模式按自动:你自己核对结果,有问题自己重跑,不要停下来等我确认。全程不要问任何问题。"));
|
|
2415
|
+
const userLine = input.prompt.trim();
|
|
2416
|
+
return lines
|
|
2417
|
+
.filter((line) => line !== null)
|
|
2418
|
+
.map((line) => (line === userLine ? line : applyKeyColorText(line, input.keyColor)))
|
|
2419
|
+
.join("\n");
|
|
2316
2420
|
}
|
|
2317
2421
|
/**
|
|
2318
2422
|
* 拼给音乐任务新对话的提示词。
|
|
@@ -5862,7 +5966,7 @@ window.__ModuleLoader__.load({
|
|
|
5862
5966
|
// 合成整图是本地 CPU 重活,宿主侧会标 running;重抠像同样走这个状态。
|
|
5863
5967
|
const composing = project.sheet?.status === "running" || tasks.has(KEY_SHEET_COMPOSE) || tasks.has(KEY_SHEET_REKEY);
|
|
5864
5968
|
const keyed = project.sheet?.backgroundFraction;
|
|
5865
|
-
const composeLabel = tasks.label(KEY_SHEET_REKEY) ?? tasks.label(KEY_SHEET_COMPOSE) ?? T("
|
|
5969
|
+
const composeLabel = tasks.label(KEY_SHEET_REKEY) ?? tasks.label(KEY_SHEET_COMPOSE) ?? T("正在抠背景并合成整图…");
|
|
5866
5970
|
const moveRow = (index, delta) => {
|
|
5867
5971
|
const next = [...rowOrder];
|
|
5868
5972
|
const target = index + delta;
|
|
@@ -5899,26 +6003,26 @@ window.__ModuleLoader__.load({
|
|
|
5899
6003
|
min: 0,
|
|
5900
6004
|
max: 32,
|
|
5901
6005
|
onChange: (value) => setSettingsDraft({ ...draft, pixelSize: value })
|
|
5902
|
-
}), h(NumField, {
|
|
5903
|
-
label: T("背景分割容差(0 =
|
|
6006
|
+
}), h(KeyColorField, { value: draft.keyColor, onChange: (value) => { setSettingsDraft({ ...draft, keyColor: value }); void saveSettings({ keyColor: value }); } }), h(NumField, {
|
|
6007
|
+
label: T("背景分割容差(0 = 只认背景色)"),
|
|
5904
6008
|
value: draft.bgTolerance ?? 90,
|
|
5905
6009
|
min: 0,
|
|
5906
6010
|
max: 120,
|
|
5907
6011
|
onChange: (value) => setSettingsDraft({ ...draft, bgTolerance: value })
|
|
5908
6012
|
}), h(NumField, {
|
|
5909
|
-
label: T("
|
|
6013
|
+
label: T("抠像下限(背景色接近度)"),
|
|
5910
6014
|
value: draft.keyLow ?? 14,
|
|
5911
6015
|
min: 0,
|
|
5912
6016
|
max: 255,
|
|
5913
6017
|
onChange: (value) => setSettingsDraft({ ...draft, keyLow: value })
|
|
5914
6018
|
}), h(NumField, {
|
|
5915
|
-
label: T("
|
|
6019
|
+
label: T("抠像上限(背景色接近度)"),
|
|
5916
6020
|
value: draft.keyHigh ?? 80,
|
|
5917
6021
|
min: 1,
|
|
5918
6022
|
max: 255,
|
|
5919
6023
|
onChange: (value) => setSettingsDraft({ ...draft, keyHigh: value })
|
|
5920
6024
|
}), h(NumField, {
|
|
5921
|
-
label: T("
|
|
6025
|
+
label: T("去溢色 0~1"),
|
|
5922
6026
|
value: draft.despill ?? 0.65,
|
|
5923
6027
|
min: 0,
|
|
5924
6028
|
max: 1,
|
|
@@ -5983,7 +6087,7 @@ window.__ModuleLoader__.load({
|
|
|
5983
6087
|
disabled: framesReady === 0 || composing,
|
|
5984
6088
|
onClick: () => void start(() => api.compose({ projectId: project.id }), { reload: true }, {
|
|
5985
6089
|
key: KEY_SHEET_COMPOSE,
|
|
5986
|
-
label: T("
|
|
6090
|
+
label: T("正在抠背景并合成整图…")
|
|
5987
6091
|
})
|
|
5988
6092
|
}, T("合成整图({n0}/8 组帧就绪)", { n0: framesReady })), h(BusyBadge, { show: composing, text: composeLabel }), project.sheet?.file !== undefined
|
|
5989
6093
|
? h("a", {
|
|
@@ -6350,8 +6454,48 @@ window.__ModuleLoader__.load({
|
|
|
6350
6454
|
}, { reload: true }, { key: KEY_LOCAL_VIDEO(key), label: T("正在导入本地视频…") });
|
|
6351
6455
|
}
|
|
6352
6456
|
/** 抠像参数表单(三个模块共用同一套字段)。 */
|
|
6353
|
-
function KeyingFields({ draft, onChange }) {
|
|
6354
|
-
return h("div", { className: "SPR_fields" }, h(NumField, { label: T("
|
|
6457
|
+
function KeyingFields({ draft, onChange, fallbackColor }) {
|
|
6458
|
+
return h("div", { className: "SPR_fields" }, h(KeyColorField, { value: draft.keyColor || fallbackColor, onChange: (v) => onChange({ keyColor: v }) }), h(NumField, { label: T("抠像下限(背景色接近度)"), value: draft.keyLow ?? 14, min: 0, max: 255, onChange: (v) => onChange({ keyLow: v }) }), h(NumField, { label: T("抠像上限(背景色接近度)"), value: draft.keyHigh ?? 80, min: 1, max: 255, onChange: (v) => onChange({ keyHigh: v }) }), h(NumField, { label: T("去溢色 0~1"), value: draft.despill ?? 0.65, min: 0, max: 1, step: 0.05, onChange: (v) => onChange({ despill: v }) }), h(NumField, { label: T("背景分割容差(0 = 只认背景色)"), value: draft.bgTolerance ?? 90, min: 0, max: 160, onChange: (v) => onChange({ bgTolerance: v }) }), h(NumField, { label: T("边缘收缩(px)"), value: draft.edgeShrink ?? 0, min: 0, max: 8, onChange: (v) => onChange({ edgeShrink: v }) }));
|
|
6459
|
+
}
|
|
6460
|
+
/**
|
|
6461
|
+
* 抠像底色选择器(所有需要抠图的地方共用)。
|
|
6462
|
+
*
|
|
6463
|
+
* 角色身上有绿衣服时绿幕会把衣服一起吃掉,所以底色必须可换。预设只列
|
|
6464
|
+
* 饱和纯色;「自定义」用浏览器原生取色器 / 十六进制输入。
|
|
6465
|
+
*/
|
|
6466
|
+
function KeyColorField({ value, onChange, label }) {
|
|
6467
|
+
const current = normalizeKeyColorHex(value);
|
|
6468
|
+
const presets = [
|
|
6469
|
+
{ hex: "#00FF00", label: T("绿幕(默认)") },
|
|
6470
|
+
{ hex: "#0000FF", label: T("蓝幕") },
|
|
6471
|
+
{ hex: "#FF00FF", label: T("品红幕") },
|
|
6472
|
+
{ hex: "#00FFFF", label: T("青幕") },
|
|
6473
|
+
{ hex: "#FFFF00", label: T("黄幕") },
|
|
6474
|
+
{ hex: "#FF0000", label: T("红幕") },
|
|
6475
|
+
{ hex: "#FFFFFF", label: T("白幕") },
|
|
6476
|
+
{ hex: "#000000", label: T("黑幕") }
|
|
6477
|
+
];
|
|
6478
|
+
return h("label", { className: "SPR_field" }, h("span", { className: "SPR_fieldLabel" }, label ?? T("抠像背景色")), h("div", { style: { display: "flex", gap: 6, alignItems: "center", flexWrap: "wrap" } }, h("input", {
|
|
6479
|
+
type: "color",
|
|
6480
|
+
value: current,
|
|
6481
|
+
"data-testid": "key-color",
|
|
6482
|
+
title: T("自定义背景色"),
|
|
6483
|
+
onChange: (event) => onChange(normalizeKeyColorHex(event.target.value)),
|
|
6484
|
+
style: { width: 40, height: 30, padding: 0, border: "1px solid var(--dsw-alias-border-l2)", borderRadius: 6, background: "transparent" }
|
|
6485
|
+
}), h("select", {
|
|
6486
|
+
className: "SPR_input",
|
|
6487
|
+
"data-testid": "key-color-preset",
|
|
6488
|
+
style: { flex: "1 1 120px" },
|
|
6489
|
+
value: presets.some((preset) => preset.hex === current) ? current : "",
|
|
6490
|
+
onChange: (event) => onChange(event.target.value === "" ? current : event.target.value)
|
|
6491
|
+
}, presets.map((preset) => h("option", { key: preset.hex, value: preset.hex }, preset.label)), presets.some((preset) => preset.hex === current) ? null : h("option", { value: "" }, T("自定义"))), h("input", {
|
|
6492
|
+
className: "SPR_input",
|
|
6493
|
+
style: { width: 108 },
|
|
6494
|
+
defaultValue: current,
|
|
6495
|
+
key: current,
|
|
6496
|
+
"data-testid": "key-color-hex",
|
|
6497
|
+
onBlur: (event) => onChange(normalizeKeyColorHex(event.target.value))
|
|
6498
|
+
})));
|
|
6355
6499
|
}
|
|
6356
6500
|
/** 一份任务/项目列表(左侧栏)。 */
|
|
6357
6501
|
/**
|
|
@@ -6727,6 +6871,7 @@ window.__ModuleLoader__.load({
|
|
|
6727
6871
|
function MapModule(props) {
|
|
6728
6872
|
useLocaleTick();
|
|
6729
6873
|
const api = props.api;
|
|
6874
|
+
const globalConfig = useGlobalConfig(api);
|
|
6730
6875
|
// ── 项目与视图 ───────────────────────────────────────────────────────
|
|
6731
6876
|
const [projects, setProjects] = React.useState([]);
|
|
6732
6877
|
const [view, setView] = React.useState(null);
|
|
@@ -7164,7 +7309,8 @@ window.__ModuleLoader__.load({
|
|
|
7164
7309
|
* 回链带 `keyed=1` = 整理时**已经抠过绿幕**:这里要取消勾选,
|
|
7165
7310
|
* 否则会抠第二遍(画面里已经没有绿了,第二遍只会按错误的背景色误伤像素)。
|
|
7166
7311
|
*/
|
|
7167
|
-
stampKey: target.keyed !== 1
|
|
7312
|
+
stampKey: target.keyed !== 1,
|
|
7313
|
+
stampKeyColor: globalConfig?.keyColor
|
|
7168
7314
|
};
|
|
7169
7315
|
setOpenCard("assets");
|
|
7170
7316
|
const base = (loaded !== null && loaded !== undefined && loaded.assetBase) || (view !== null && view.assetBase) || "";
|
|
@@ -8228,8 +8374,9 @@ window.__ModuleLoader__.load({
|
|
|
8228
8374
|
stampRows: "3",
|
|
8229
8375
|
stampFrames: "1",
|
|
8230
8376
|
stampPass: new Array(9).fill(0),
|
|
8231
|
-
//
|
|
8232
|
-
stampKey: true
|
|
8377
|
+
// 整图默认抠背景(AI 那条路生成的就是纯色背景图);回链带 keyed=1 时说明已经抠过。
|
|
8378
|
+
stampKey: true,
|
|
8379
|
+
stampKeyColor: globalConfig?.keyColor
|
|
8233
8380
|
});
|
|
8234
8381
|
/**
|
|
8235
8382
|
* 提交新增:把「图片 + 名字 + 属性」一次性交给宿主。
|
|
@@ -8284,7 +8431,8 @@ window.__ModuleLoader__.load({
|
|
|
8284
8431
|
* 导入时抠绿幕(只对整图有意义):AI 那条路在整理时已经抠过,回链会把它关掉,
|
|
8285
8432
|
* 免得抠第二遍把画面里本就很少的绿误伤掉。
|
|
8286
8433
|
*/
|
|
8287
|
-
stampKey: draft.shape === "stamp" ? draft.stampKey !== false : undefined
|
|
8434
|
+
stampKey: draft.shape === "stamp" ? draft.stampKey !== false : undefined,
|
|
8435
|
+
keyColor: draft.shape === "stamp" ? draft.stampKeyColor : undefined
|
|
8288
8436
|
});
|
|
8289
8437
|
setAddDraft(null);
|
|
8290
8438
|
setNotice({ kind: "info", text: T("已新增素材 {n0}", { n0: draft.name.trim() === "" ? draft.file.name : draft.name.trim() }) });
|
|
@@ -8643,7 +8791,7 @@ window.__ModuleLoader__.load({
|
|
|
8643
8791
|
"data-testid": "map-add-stamp-key",
|
|
8644
8792
|
checked: addDraft.stampKey !== false,
|
|
8645
8793
|
onChange: (event) => setAddDraft((current) => (current === null ? current : { ...current, stampKey: event.target.checked }))
|
|
8646
|
-
}), T("
|
|
8794
|
+
}), T("抠掉背景色(只留建筑本体)")), addDraft.stampKey !== false ? h(KeyColorField, { value: addDraft.stampKeyColor ?? globalConfig?.keyColor, onChange: (value) => setAddDraft((current) => (current === null ? current : { ...current, stampKeyColor: value })) }) : null, h("p", { className: "SPR_mapEdHint" }, T("整图是「立在格子上的物件」:背景该是透明的,不然地图上会多出一块绿框。AI 生成的图请在提示词里要**纯绿背景**,这里勾上就会自动抠掉;自己导的透明 PNG 也可以勾着(没有绿就什么都不做)。")), stampPassGrid({
|
|
8647
8795
|
cols: clampStampSpan(Number(addDraft.stampCols) || 3, mapLimits.maxCols),
|
|
8648
8796
|
rows: clampStampSpan(Number(addDraft.stampRows) || 3, mapLimits.maxRows),
|
|
8649
8797
|
frames: Number(addDraft.stampFrames) || 1,
|
|
@@ -8714,6 +8862,8 @@ window.__ModuleLoader__.load({
|
|
|
8714
8862
|
frames: 1,
|
|
8715
8863
|
mode: "image",
|
|
8716
8864
|
shape: "auto",
|
|
8865
|
+
// 抠像底色:默认跟全局,用户也可以在对话框里单独改。
|
|
8866
|
+
keyColor: globalConfig?.keyColor,
|
|
8717
8867
|
// 整图:占几格(只有选「整图」时才用得上;默认 3×3 是雕像 / 大门最常见的尺寸)。
|
|
8718
8868
|
stampCols: "3",
|
|
8719
8869
|
stampRows: "3"
|
|
@@ -8751,6 +8901,7 @@ window.__ModuleLoader__.load({
|
|
|
8751
8901
|
const loaded = await api.getMapProject({ projectId, lang: activeLang() });
|
|
8752
8902
|
const grid = (loaded !== null && loaded !== undefined && loaded.grid) || { tileWidth: 32, tileHeight: 32 };
|
|
8753
8903
|
const name = draft.name.trim() === "" ? deriveAssetName(prompt) : draft.name.trim();
|
|
8904
|
+
const cfg = typeof api.getConfig === "function" ? await api.getConfig().catch(() => null) : null;
|
|
8754
8905
|
const text = buildAssetRequestPrompt({
|
|
8755
8906
|
projectId,
|
|
8756
8907
|
projectName: (loaded !== null && loaded !== undefined && loaded.name) || "",
|
|
@@ -8760,6 +8911,7 @@ window.__ModuleLoader__.load({
|
|
|
8760
8911
|
frames,
|
|
8761
8912
|
mode,
|
|
8762
8913
|
shape,
|
|
8914
|
+
keyColor: draft.keyColor || cfg?.keyColor,
|
|
8763
8915
|
...(shape === "stamp" ? { stampCols, stampRows } : {})
|
|
8764
8916
|
});
|
|
8765
8917
|
await openAssetChat(text);
|
|
@@ -8802,7 +8954,7 @@ window.__ModuleLoader__.load({
|
|
|
8802
8954
|
value: aiDraft.name,
|
|
8803
8955
|
placeholder: T("留空就用提示词开头几个字"),
|
|
8804
8956
|
onChange: (event) => setAiDraft((current) => (current === null ? current : { ...current, name: event.target.value }))
|
|
8805
|
-
}), h("div", { className: "SPR_mapEdDlgLabel" }, T("动画帧数(1 = 静态)")), h("div", { className: "SPR_mapEdPair" }, h(NumField, {
|
|
8957
|
+
}), h(KeyColorField, { label: T("抠像背景色"), value: aiDraft.keyColor ?? globalConfig?.keyColor, onChange: (value) => setAiDraft((current) => (current === null ? current : { ...current, keyColor: value })) }), h("div", { className: "SPR_mapEdDlgLabel" }, T("动画帧数(1 = 静态)")), h("div", { className: "SPR_mapEdPair" }, h(NumField, {
|
|
8806
8958
|
label: T("帧"),
|
|
8807
8959
|
value: aiDraft.frames,
|
|
8808
8960
|
min: ASSET_FRAMES_MIN,
|
|
@@ -11245,6 +11397,7 @@ window.__ModuleLoader__.load({
|
|
|
11245
11397
|
function IsoModule(props) {
|
|
11246
11398
|
useLocaleTick();
|
|
11247
11399
|
const api = props.api;
|
|
11400
|
+
const globalConfig = useGlobalConfig(api);
|
|
11248
11401
|
const intent = useStudioIntent();
|
|
11249
11402
|
const hiddenModules = useHiddenModules(api);
|
|
11250
11403
|
const [projects, setProjects] = React.useState([]);
|
|
@@ -12177,6 +12330,7 @@ window.__ModuleLoader__.load({
|
|
|
12177
12330
|
frames: 1,
|
|
12178
12331
|
mode: "image",
|
|
12179
12332
|
kind: "auto",
|
|
12333
|
+
keyColor: globalConfig?.keyColor,
|
|
12180
12334
|
footprint: { cols: 1, rows: 1 }
|
|
12181
12335
|
});
|
|
12182
12336
|
const submitIsoAiAsset = async () => {
|
|
@@ -12206,6 +12360,7 @@ window.__ModuleLoader__.load({
|
|
|
12206
12360
|
setAiBusy(true);
|
|
12207
12361
|
try {
|
|
12208
12362
|
const name = draft.name.trim() === "" ? deriveAssetName(prompt) : draft.name.trim();
|
|
12363
|
+
const cfg = typeof api.getConfig === "function" ? await api.getConfig().catch(() => null) : null;
|
|
12209
12364
|
const text = buildIsoAssetRequestPrompt({
|
|
12210
12365
|
projectId: view.id,
|
|
12211
12366
|
projectName: view.name,
|
|
@@ -12215,7 +12370,8 @@ window.__ModuleLoader__.load({
|
|
|
12215
12370
|
frames,
|
|
12216
12371
|
mode,
|
|
12217
12372
|
kind,
|
|
12218
|
-
footprint
|
|
12373
|
+
footprint,
|
|
12374
|
+
keyColor: draft.keyColor || cfg?.keyColor
|
|
12219
12375
|
});
|
|
12220
12376
|
await openIsoAssetChat(text);
|
|
12221
12377
|
setAiDraft(null);
|
|
@@ -12263,6 +12419,7 @@ window.__ModuleLoader__.load({
|
|
|
12263
12419
|
objectScale: 1,
|
|
12264
12420
|
passMode: 1,
|
|
12265
12421
|
keyGreen: target.keyed !== 1,
|
|
12422
|
+
keyColor: globalConfig?.keyColor,
|
|
12266
12423
|
clarity: "smooth"
|
|
12267
12424
|
};
|
|
12268
12425
|
setOpenCard("assets");
|
|
@@ -12308,6 +12465,7 @@ window.__ModuleLoader__.load({
|
|
|
12308
12465
|
objectScale: addDraft.kind === "object" ? Number(addDraft.objectScale) || 1 : undefined,
|
|
12309
12466
|
pass,
|
|
12310
12467
|
keyGreen: addDraft.keyGreen === true,
|
|
12468
|
+
keyColor: addDraft.keyGreen === true ? addDraft.keyColor : undefined,
|
|
12311
12469
|
clarity: addDraft.clarity
|
|
12312
12470
|
});
|
|
12313
12471
|
if (result !== undefined && Array.isArray(result.warnings) && result.warnings.length > 0)
|
|
@@ -12484,7 +12642,7 @@ window.__ModuleLoader__.load({
|
|
|
12484
12642
|
} }), addPreviewNode, h("label", { className: "SPR_isoLabel" }, T("叫什么")), h("input", { className: "SPR_isoInput", value: addDraft.name, onChange: (event) => setAddDraft((current) => ({ ...current, name: event.target.value })) }), h("label", { className: "SPR_isoLabel" }, T("这块素材怎么用")), h("select", { className: "SPR_isoInput", value: addDraft.kind, onChange: (event) => setAddDraft((current) => ({ ...current, kind: event.target.value })) }, h("option", { value: "ground" }, T("地面(网格图块)")), h("option", { value: "autotile" }, T("自动连接(4×4 = 16 块)")), h("option", { value: "object" }, T("物件(一张完整图,可占多格)"))), h("div", { className: "SPR_isoRow" }, h(NumField, { label: T("源图每格宽"), value: Number(addDraft.sourceW), min: 1, max: 512, onChange: (value) => setAddDraft((current) => ({ ...current, sourceW: value })) }), h(NumField, { label: T("源图每格高"), value: Number(addDraft.sourceH), min: 1, max: 768, onChange: (value) => setAddDraft((current) => ({ ...current, sourceH: value })) })), addDraft.kind === "ground"
|
|
12485
12643
|
? h("label", { className: "SPR_isoCheck" }, h("input", { type: "checkbox", checked: addDraft.animRows === true, onChange: (event) => setAddDraft((current) => ({ ...current, animRows: event.target.checked })) }), T("会动(每一行是一帧)"))
|
|
12486
12644
|
: null, addDraft.kind === "object"
|
|
12487
|
-
? h(React.Fragment, null, h("div", { className: "SPR_isoRow" }, h(NumField, { label: T("占几格宽"), value: Number(addDraft.footprint.cols), min: 1, max: 512, onChange: (value) => setAddDraft((current) => ({ ...current, footprint: { ...current.footprint, cols: value } })) }), h(NumField, { label: T("占几格高"), value: Number(addDraft.footprint.rows), min: 1, max: 512, onChange: (value) => setAddDraft((current) => ({ ...current, footprint: { ...current.footprint, rows: value } })) })), h(NumField, { label: T("帧数"), value: Number(addDraft.frames), min: 1, max: 64, onChange: (value) => setAddDraft((current) => ({ ...current, frames: value })) }), h("label", { className: "SPR_isoLabel" }, T("通行性")), h("select", { className: "SPR_isoInput", value: String(addDraft.passMode), onChange: (event) => setAddDraft((current) => ({ ...current, passMode: Number(event.target.value) })) }, h("option", { value: "1" }, T("可通过 · 角色在上面")), h("option", { value: "0" }, T("不可通过")), h("option", { value: "2" }, T("可通过 · 物件盖住角色"))), h("label", { className: "SPR_isoCheck" }, h("input", { type: "checkbox", checked: addDraft.keyGreen === true, onChange: (event) => setAddDraft((current) => ({ ...current, keyGreen: event.target.checked })) }), T("
|
|
12645
|
+
? h(React.Fragment, null, h("div", { className: "SPR_isoRow" }, h(NumField, { label: T("占几格宽"), value: Number(addDraft.footprint.cols), min: 1, max: 512, onChange: (value) => setAddDraft((current) => ({ ...current, footprint: { ...current.footprint, cols: value } })) }), h(NumField, { label: T("占几格高"), value: Number(addDraft.footprint.rows), min: 1, max: 512, onChange: (value) => setAddDraft((current) => ({ ...current, footprint: { ...current.footprint, rows: value } })) })), h(NumField, { label: T("帧数"), value: Number(addDraft.frames), min: 1, max: 64, onChange: (value) => setAddDraft((current) => ({ ...current, frames: value })) }), h("label", { className: "SPR_isoLabel" }, T("通行性")), h("select", { className: "SPR_isoInput", value: String(addDraft.passMode), onChange: (event) => setAddDraft((current) => ({ ...current, passMode: Number(event.target.value) })) }, h("option", { value: "1" }, T("可通过 · 角色在上面")), h("option", { value: "0" }, T("不可通过")), h("option", { value: "2" }, T("可通过 · 物件盖住角色"))), h("label", { className: "SPR_isoCheck" }, h("input", { type: "checkbox", checked: addDraft.keyGreen === true, onChange: (event) => setAddDraft((current) => ({ ...current, keyGreen: event.target.checked })) }), T("抠掉背景色")), addDraft.keyGreen === true ? h(KeyColorField, { value: addDraft.keyColor ?? globalConfig?.keyColor, onChange: (value) => setAddDraft((current) => ({ ...current, keyColor: value })) }) : null)
|
|
12488
12646
|
: null, h("label", { className: "SPR_isoLabel" }, T("清晰度")), h("select", { className: "SPR_isoInput", value: addDraft.clarity, onChange: (event) => setAddDraft((current) => ({ ...current, clarity: event.target.value })) }, h("option", { value: "smooth" }, T("平滑")), h("option", { value: "sharp" }, T("锐利")), h("option", { value: "crisp" }, T("清晰"))), h("div", { className: "SPR_isoRow" }, h(Btn, { onClick: () => setAddDraft(null) }, T("取消")), h(Btn, { primary: true, busy: busyKey === "import", onClick: () => void importAsset() }, T("确定")))));
|
|
12489
12647
|
const aiDialog = aiDraft === null ? null : h("div", { className: "SPR_isoDlgMask", onClick: () => (aiBusy ? undefined : setAiDraft(null)) }, h("div", { className: "SPR_isoDlg", role: "dialog", "aria-label": T("AI 生成素材"), "data-testid": "iso-ai-dialog", onClick: (event) => event.stopPropagation() }, h("div", { className: "SPR_isoDlgHead" }, h("b", null, T("AI 生成素材")), h("span", { style: { flex: 1 } }), h("button", { type: "button", className: "SPR_isoClose", onClick: () => (aiBusy ? undefined : setAiDraft(null)) }, "×")), h("p", { className: "SPR_isoHint" }, T("它会开一个新对话,让对话里的 agent 生成并整理;做完贴一条链接,点回来这张图就会填进「新增素材」。只支持地面 / 物件,自动连接仍走手工导入。")), h("label", { className: "SPR_isoLabel" }, T("提示词")), h("textarea", {
|
|
12490
12648
|
className: "SPR_isoInput",
|
|
@@ -12499,7 +12657,7 @@ window.__ModuleLoader__.load({
|
|
|
12499
12657
|
value: aiDraft.name,
|
|
12500
12658
|
placeholder: T("留空就用提示词开头几个字"),
|
|
12501
12659
|
onChange: (event) => setAiDraft((current) => (current === null ? current : { ...current, name: event.target.value }))
|
|
12502
|
-
}), h("label", { className: "SPR_isoLabel" }, T("动画帧数(1 = 静态)")), h(NumField, {
|
|
12660
|
+
}), h(KeyColorField, { label: T("抠像背景色"), value: aiDraft.keyColor ?? globalConfig?.keyColor, onChange: (value) => setAiDraft((current) => (current === null ? current : { ...current, keyColor: value })) }), h("label", { className: "SPR_isoLabel" }, T("动画帧数(1 = 静态)")), h(NumField, {
|
|
12503
12661
|
label: T("帧"),
|
|
12504
12662
|
value: aiDraft.frames,
|
|
12505
12663
|
min: ASSET_FRAMES_MIN,
|
|
@@ -12577,7 +12735,7 @@ window.__ModuleLoader__.load({
|
|
|
12577
12735
|
const tools = h("div", { className: "SPR_isoTools" }, toolButton("undo", T("撤销"), "undo", () => void doUndo(), { hint: "⌘Z", disabled: view.canUndo !== true }), toolButton("redo", T("重做"), "redo", () => void doRedo(), { hint: "⇧⌘Z", disabled: view.canRedo !== true }), toolButton("pen", T("画笔"), "pen", () => setTool("pen"), { on: tool === "pen", hint: "B" }), toolButton("eraser", T("橡皮"), "eraser", () => setTool("eraser"), { on: tool === "eraser", hint: "E" }), toolButton("bucket", T("油漆桶"), "bucket", () => setTool("bucket"), { on: tool === "bucket", hint: "G" }), toolButton("pipette", T("吸管"), "pipette", () => setTool("pipette"), { on: tool === "pipette", hint: "I" }), toolButton("hand", T("抓手"), "hand", () => setTool("hand"), { on: tool === "hand", hint: "H" }), toolButton("marker", T("标记"), "marker", () => setTool("marker"), { on: tool === "marker", hint: "M" }), h("button", { key: "layer", type: "button", className: "SPR_isoTool SPR_isoLayerBtn", title: T("图层"), onClick: () => setOpenCard(openCard === "layers" ? null : "layers") }, h("span", null, String(layerIndex + 1)), h("small", null, activeLayer?.kind === "object" ? T("物件") : T("地面"))), toolButton("grid", T("网格线"), "grid", () => setShowGrid((value) => value !== true), { on: showGrid === true }), toolButton("gen", T("一键生成"), "magic", () => setOpenCard(openCard === "gen" ? null : "gen"), { on: openCard === "gen" }), toolButton("settings", T("设置"), "settings", () => setOpenCard(openCard === "settings" ? null : "settings"), { on: openCard === "settings" }));
|
|
12578
12736
|
const side = h("div", { className: "SPR_isoSide" }, h("div", { className: "SPR_isoSideTitle" }, activeLayer?.kind === "object" ? T("物件调色板") : T("地面调色板")), palette, tools);
|
|
12579
12737
|
const cardHead = (title) => h("div", { className: "SPR_isoCardHead" }, h("b", null, title), h("span", { style: { flex: 1 } }), h("button", { type: "button", className: "SPR_isoClose", onClick: () => setOpenCard(null) }, "×"));
|
|
12580
|
-
const assetsCard = h("div", { className: "SPR_isoCard" }, cardHead(T("素材")), h("div", { className: "SPR_isoRow" }, h(Btn, { primary: true, onClick: () => { setAddDraft({ base64: "", name: "", kind: "ground", sourceW: view.cell.width, sourceH: view.cell.height, frames: 1, animRows: false, footprint: { cols: 1, rows: 1 }, anchor: { x: 0.5, y: 1 }, objectScale: 1, passMode: 1, keyGreen: false, clarity: "smooth" }); setAddPreview(null); setAddPreviewNatural({ width: 0, height: 0 }); } }, T("新增素材")), h(Btn, { "data-testid": "iso-ai-open", onClick: openIsoAiAsset }, T("AI 生成素材")), h(Btn, { busy: busyKey === "sample", onClick: () => void restoreSamples() }, T("恢复默认素材")), h(Btn, { onClick: () => setGuidePage(0) }, T("素材说明"))), h("div", { className: "SPR_isoAssetList" }, view.tilesets.map((tileset) => h("div", { key: tileset.id, className: "SPR_isoAssetRow" }, h("button", { type: "button", className: "SPR_isoAssetName", onClick: () => setTsEdit({ tilesetId: tileset.id, name: tileset.name, fps: tileset.fps === undefined ? "" : String(tileset.fps), loop: tileset.loop ?? "forward" }) }, tileset.name), h("span", { className: "SPR_isoAssetMeta" }, tileset.reason), tileset.builtin === true ? h("span", { className: "SPR_isoBadge" }, T("自带")) : null, h("button", { type: "button", className: "SPR_isoMini", onClick: async () => {
|
|
12738
|
+
const assetsCard = h("div", { className: "SPR_isoCard" }, cardHead(T("素材")), h("div", { className: "SPR_isoRow" }, h(Btn, { primary: true, onClick: () => { setAddDraft({ base64: "", name: "", kind: "ground", sourceW: view.cell.width, sourceH: view.cell.height, frames: 1, animRows: false, footprint: { cols: 1, rows: 1 }, anchor: { x: 0.5, y: 1 }, objectScale: 1, passMode: 1, keyGreen: false, keyColor: globalConfig?.keyColor, clarity: "smooth" }); setAddPreview(null); setAddPreviewNatural({ width: 0, height: 0 }); } }, T("新增素材")), h(Btn, { "data-testid": "iso-ai-open", onClick: openIsoAiAsset }, T("AI 生成素材")), h(Btn, { busy: busyKey === "sample", onClick: () => void restoreSamples() }, T("恢复默认素材")), h(Btn, { onClick: () => setGuidePage(0) }, T("素材说明"))), h("div", { className: "SPR_isoAssetList" }, view.tilesets.map((tileset) => h("div", { key: tileset.id, className: "SPR_isoAssetRow" }, h("button", { type: "button", className: "SPR_isoAssetName", onClick: () => setTsEdit({ tilesetId: tileset.id, name: tileset.name, fps: tileset.fps === undefined ? "" : String(tileset.fps), loop: tileset.loop ?? "forward" }) }, tileset.name), h("span", { className: "SPR_isoAssetMeta" }, tileset.reason), tileset.builtin === true ? h("span", { className: "SPR_isoBadge" }, T("自带")) : null, h("button", { type: "button", className: "SPR_isoMini", onClick: async () => {
|
|
12581
12739
|
if (!window.confirm(T("确定删除素材「{n0}」?它切出来的块和放下的物件会一起删掉。", { n0: tileset.name })))
|
|
12582
12740
|
return;
|
|
12583
12741
|
try {
|
|
@@ -12818,7 +12976,34 @@ window.__ModuleLoader__.load({
|
|
|
12818
12976
|
if (suffixDraft !== (job.suffix ?? ""))
|
|
12819
12977
|
void saveJob({ suffix: suffixDraft });
|
|
12820
12978
|
}
|
|
12821
|
-
}), h("div", { className: "SPR_fields" }, h(GlobalModelField, { label: T("生图模型"), value: globalConfig?.imageModel ?? globalConfig?.arkModel ?? settingsDraft.model }), h("label", { className: "SPR_field" }, h("span", { className: "SPR_fieldLabel" }, T("
|
|
12979
|
+
}), h("div", { className: "SPR_fields" }, h(GlobalModelField, { label: T("生图模型"), value: globalConfig?.imageModel ?? globalConfig?.arkModel ?? settingsDraft.model }), h("label", { className: "SPR_field" }, h("span", { className: "SPR_fieldLabel" }, T("尺寸来源")), h("select", {
|
|
12980
|
+
className: "SPR_input",
|
|
12981
|
+
"data-testid": "image-size-mode",
|
|
12982
|
+
value: settingsDraft.sizeMode === "custom" ? "custom" : "global",
|
|
12983
|
+
onChange: (event) => {
|
|
12984
|
+
const mode = event.target.value === "custom" ? "custom" : "global";
|
|
12985
|
+
const next = {
|
|
12986
|
+
...settingsDraft,
|
|
12987
|
+
sizeMode: mode,
|
|
12988
|
+
...(mode === "global" ? { size: globalConfig?.imageProviderSize ?? settingsDraft.size } : {})
|
|
12989
|
+
};
|
|
12990
|
+
setSettingsDraft(next);
|
|
12991
|
+
void saveJob({ settings: next });
|
|
12992
|
+
}
|
|
12993
|
+
}, h("option", { value: "global" }, T("跟随全局({n0})", { n0: globalConfig?.imageProviderSize ?? "—" })), h("option", { value: "custom" }, T("自定义")))), settingsDraft.sizeMode === "custom"
|
|
12994
|
+
? h("label", { className: "SPR_field" }, h("span", { className: "SPR_fieldLabel" }, T("任务尺寸")), h("input", {
|
|
12995
|
+
className: "SPR_input",
|
|
12996
|
+
"data-testid": "image-task-size",
|
|
12997
|
+
value: settingsDraft.size ?? "",
|
|
12998
|
+
placeholder: "1K / 2K / 4K / 1024x1024",
|
|
12999
|
+
onChange: (event) => setSettingsDraft({ ...settingsDraft, size: event.target.value }),
|
|
13000
|
+
onKeyDown: (event) => {
|
|
13001
|
+
if (event.key === "Enter")
|
|
13002
|
+
event.target.blur();
|
|
13003
|
+
},
|
|
13004
|
+
onBlur: () => void saveJob({ settings: settingsDraft })
|
|
13005
|
+
}), h("span", { className: "SPR_fieldLabel" }, T("只影响这个任务;支持 1K / 2K / 4K 或 宽x高")))
|
|
13006
|
+
: h("label", { className: "SPR_field" }, h("span", { className: "SPR_fieldLabel" }, T("当前全局尺寸")), h("input", { className: "SPR_input", value: globalConfig?.imageProviderSize ?? settingsDraft.size ?? "", readOnly: true, disabled: true, "data-testid": "image-global-size" }), h("span", { className: "SPR_fieldLabel" }, T("在「设置 → 游戏素材大师 → 输出尺寸」里改"))), h(NumField, { label: T("生成张数(1~8)"), value: settingsDraft.count ?? 1, min: 1, max: 8, onChange: (v) => { setSettingsDraft({ ...settingsDraft, count: v }); void saveJob({ settings: { ...settingsDraft, count: v } }); } })), h("div", { className: "SPR_toolbar" }, h(BusyBtn, {
|
|
12822
13007
|
primary: true,
|
|
12823
13008
|
busy: tasks.has(K_IMG_JOB),
|
|
12824
13009
|
busyText: T("正在生成 {n0} 张…", { n0: settingsDraft.count ?? 1 }),
|
|
@@ -12829,7 +13014,7 @@ window.__ModuleLoader__.load({
|
|
|
12829
13014
|
}, T("已开始生成 {n0} 张", { n0: settingsDraft.count ?? 1 }), { key: K_IMG_JOB, label: T("正在生成 {n0} 张图片…", { n0: settingsDraft.count ?? 1 }) })
|
|
12830
13015
|
}, T("生成 {n0} 张", { n0: settingsDraft.count ?? 1 })), h("span", { className: "SPR_refRow" }, T("按当前生图后端的账号价格计费,实际以平台账单为准")))), h("div", { className: "SPR_card" }, h("div", { className: "SPR_cardHead" }, h("h3", null, T("② 参考图(可留空)"))), h("p", { className: "SPR_hint" }, T("最多 10 张。有参考图时走图生图;引用多张时可在提示词里写「图一」「图二」。")), h(UploadBox, { label: T("把参考图拖到这里"), accept: "image/*", multiple: true, busy: uploading || tasks.has(K_IMG_UPLOAD), onFiles: (files) => void upload(files, "ref") }), (job.refs ?? []).length === 0
|
|
12831
13016
|
? null
|
|
12832
|
-
: h("div", { className: "SPR_grid" }, (job.refs ?? []).map((ref) => h("div", { key: ref.file, className: "SPR_node" }, h("img", { className: "SPR_thumb", src: `${job.assetBase}${ref.file}?v=${job.updatedAt}`, alt: ref.name }), h("span", { className: "SPR_refRow" }, ref.name), h("div", { className: "SPR_btnRow" }, h(Btn, { danger: true, onClick: () => void run(() => api.removeImageRef({ jobId: job.id, file: ref.file }), T("已移除参考图")) }, T("移除"))))))), h("div", { className: "SPR_card" }, h("div", { className: "SPR_cardHead" }, h("h3", null, T("③
|
|
13017
|
+
: h("div", { className: "SPR_grid" }, (job.refs ?? []).map((ref) => h("div", { key: ref.file, className: "SPR_node" }, h("img", { className: "SPR_thumb", src: `${job.assetBase}${ref.file}?v=${job.updatedAt}`, alt: ref.name }), h("span", { className: "SPR_refRow" }, ref.name), h("div", { className: "SPR_btnRow" }, h(Btn, { danger: true, onClick: () => void run(() => api.removeImageRef({ jobId: job.id, file: ref.file }), T("已移除参考图")) }, T("移除"))))))), h("div", { className: "SPR_card" }, h("div", { className: "SPR_cardHead" }, h("h3", null, T("③ 背景抠像"))), h("p", { className: "SPR_hint" }, T("开启后每张生成完会自动抠一遍;也可以上传已有图片只做抠像。")), h("div", { className: "SPR_toolbar" }, h("select", {
|
|
12833
13018
|
className: "SPR_input",
|
|
12834
13019
|
style: { width: 220 },
|
|
12835
13020
|
value: keyingDraft.enabled ? "on" : "off",
|
|
@@ -12838,14 +13023,14 @@ window.__ModuleLoader__.load({
|
|
|
12838
13023
|
setKeyingDraft({ ...keyingDraft, enabled });
|
|
12839
13024
|
void saveJob({ keying: { enabled } });
|
|
12840
13025
|
}
|
|
12841
|
-
}, h("option", { value: "off" }, T("不抠像")), h("option", { value: "on" }, T("
|
|
13026
|
+
}, h("option", { value: "off" }, T("不抠像")), h("option", { value: "on" }, T("自动抠背景输出 PNG"))), h(BusyBtn, {
|
|
12842
13027
|
busy: tasks.has(K_IMG_KEY),
|
|
12843
13028
|
busyText: T("正在抠像…"),
|
|
12844
13029
|
onClick: () => void run(() => api.keyImageJob({ jobId: job.id }), T("已开始抠像"), {
|
|
12845
13030
|
key: K_IMG_KEY,
|
|
12846
|
-
label: T("
|
|
13031
|
+
label: T("正在抠背景…")
|
|
12847
13032
|
})
|
|
12848
|
-
}, T("按当前参数重新抠像"))), h(KeyingFields, { draft: keyingDraft, onChange: (patch) => { const next = { ...keyingDraft, ...patch }; setKeyingDraft(next); void saveJob({ keying: patch }); } }), h(UploadBox, { label: T("上传一张已有图片,直接抠成透明 PNG"), accept: "image/*", multiple: false, busy: uploading || tasks.has(K_IMG_UPLOAD), onFiles: (files) => void upload(files, "item") }), tasks.has(K_IMG_UPLOAD) ? h(BusyBadge, { show: true, text: tasks.label(K_IMG_UPLOAD) }) : null), h("div", { className: "SPR_card" }, h("div", { className: "SPR_cardHead" }, h("h3", null, T("④ 结果({n0} 张)", { n0: (job.items ?? []).length }))), h(ReviewModeBar, { api, module: "image", id: job.id, mode: job.reviewMode, onChanged: () => void load(job.id) }), (job.items ?? []).length === 0
|
|
13033
|
+
}, T("按当前参数重新抠像"))), h(KeyingFields, { draft: keyingDraft, fallbackColor: globalConfig?.keyColor, onChange: (patch) => { const next = { ...keyingDraft, ...patch }; setKeyingDraft(next); void saveJob({ keying: patch }); } }), h(UploadBox, { label: T("上传一张已有图片,直接抠成透明 PNG"), accept: "image/*", multiple: false, busy: uploading || tasks.has(K_IMG_UPLOAD), onFiles: (files) => void upload(files, "item") }), tasks.has(K_IMG_UPLOAD) ? h(BusyBadge, { show: true, text: tasks.label(K_IMG_UPLOAD) }) : null), h("div", { className: "SPR_card" }, h("div", { className: "SPR_cardHead" }, h("h3", null, T("④ 结果({n0} 张)", { n0: (job.items ?? []).length }))), h(ReviewModeBar, { api, module: "image", id: job.id, mode: job.reviewMode, onChanged: () => void load(job.id) }), (job.items ?? []).length === 0
|
|
12849
13034
|
? h("p", { className: "SPR_empty" }, T("还没有图片"))
|
|
12850
13035
|
: h("div", { className: "SPR_grid" }, (job.items ?? []).map((item, index) => {
|
|
12851
13036
|
const itemKey = K_IMG_ITEM(index);
|
|
@@ -12861,7 +13046,7 @@ window.__ModuleLoader__.load({
|
|
|
12861
13046
|
const keyingNow = item.status !== "running" && tasks.has(K_IMG_KEY);
|
|
12862
13047
|
const overlay = itemBusy || keyingNow || waiting;
|
|
12863
13048
|
const overlayText = tasks.label(itemKey) ??
|
|
12864
|
-
(keyingNow ? T("
|
|
13049
|
+
(keyingNow ? T("正在抠背景…") : waiting ? tasks.label(K_IMG_JOB) ?? T("正在生成…") : T("正在生成…"));
|
|
12865
13050
|
return h("div", { key: index, className: "SPR_node", "data-busy": overlay ? "true" : undefined }, h("div", { className: "SPR_nodeTop" }, h("span", { className: "SPR_nodeTitle" }, T("第 {n0} 张", { n0: index + 1 })), overlay ? h(Chip, { kind: "running", text: T("生成中") }) : h(StatusChip, { node: item }), item.source === "uploaded" ? h(Chip, { kind: "empty", text: T("上传") }) : null), h(MediaBox, { overlay, text: overlayText }, item.keyedFile !== undefined
|
|
12866
13051
|
? h("img", { className: "SPR_thumb", src: `${job.assetBase}${item.keyedFile}?v=${item.updatedAt}`, alt: T("抠像结果") })
|
|
12867
13052
|
: item.file !== undefined
|
|
@@ -13150,7 +13335,7 @@ window.__ModuleLoader__.load({
|
|
|
13150
13335
|
key: K_SEQ_FRAMES,
|
|
13151
13336
|
label: T("正在抽帧…")
|
|
13152
13337
|
})
|
|
13153
|
-
}, T("按当前张数抽帧({n0} 张)", { n0: settingsDraft.frameCount ?? 8 })), job.frames?.stale === true ? h(Chip, { kind: "stale", text: T("参数已变,需重抽") }) : null, h(BusyBadge, { show: framesBusy, text: framesText }), h("span", { className: "SPR_refRow" }, job.frames?.duration !== undefined ? T("视频时长 {n0} 秒 · {n1} 帧", { n0: job.frames.duration.toFixed(2), n1: job.frames.files.length }) : ""))), h("div", { className: "SPR_card" }, h("div", { className: "SPR_cardHead" }, h("h3", null, T("④ 绿幕抠像与合成"))), h(KeyingFields, { draft: keyingDraft, onChange: (patch) => { const next = { ...keyingDraft, ...patch }; setKeyingDraft(next); void saveJob({ keying: patch }); } }), h("div", { className: "SPR_toolbar" }, h(BusyBtn, {
|
|
13338
|
+
}, T("按当前张数抽帧({n0} 张)", { n0: settingsDraft.frameCount ?? 8 })), job.frames?.stale === true ? h(Chip, { kind: "stale", text: T("参数已变,需重抽") }) : null, h(BusyBadge, { show: framesBusy, text: framesText }), h("span", { className: "SPR_refRow" }, job.frames?.duration !== undefined ? T("视频时长 {n0} 秒 · {n1} 帧", { n0: job.frames.duration.toFixed(2), n1: job.frames.files.length }) : ""))), h("div", { className: "SPR_card" }, h("div", { className: "SPR_cardHead" }, h("h3", null, T("④ 绿幕抠像与合成"))), h(KeyingFields, { draft: keyingDraft, fallbackColor: globalConfig?.keyColor, onChange: (patch) => { const next = { ...keyingDraft, ...patch }; setKeyingDraft(next); void saveJob({ keying: patch }); } }), h("div", { className: "SPR_toolbar" }, h(BusyBtn, {
|
|
13154
13339
|
busy: tasks.has(K_SEQ_KEY),
|
|
13155
13340
|
busyText: T("正在重新抠像…"),
|
|
13156
13341
|
disabled: framesBusy,
|
|
@@ -15760,7 +15945,7 @@ window.__ModuleLoader__.load({
|
|
|
15760
15945
|
className: "SPR_input",
|
|
15761
15946
|
value: config.arkSize,
|
|
15762
15947
|
onChange: (event) => void patch({ arkSize: event.target.value })
|
|
15763
|
-
})), h("label", { className: "SPR_field" }, h("span", { className: "SPR_fieldLabel" }, "Base URL"), h("input", {
|
|
15948
|
+
}), h("span", { className: "SPR_fieldLabel" }, T("1K / 2K / 4K 由模型决定像素;要固定尺寸请直接填 宽x高"))), h("label", { className: "SPR_field" }, h("span", { className: "SPR_fieldLabel" }, "Base URL"), h("input", {
|
|
15764
15949
|
className: "SPR_input",
|
|
15765
15950
|
value: config.arkBaseUrl,
|
|
15766
15951
|
onChange: (event) => void patch({ arkBaseUrl: event.target.value })
|
|
@@ -16045,7 +16230,7 @@ window.__ModuleLoader__.load({
|
|
|
16045
16230
|
min: 1,
|
|
16046
16231
|
max: 8,
|
|
16047
16232
|
onChange: (value) => void patch({ concurrency: value })
|
|
16048
|
-
}), h(NumField, {
|
|
16233
|
+
}), h(KeyColorField, { label: T("抠像背景色(全局默认)"), value: config.keyColor, onChange: (value) => void patch({ keyColor: value }) }), h(NumField, {
|
|
16049
16234
|
label: T("抠像下限"),
|
|
16050
16235
|
value: config.keyLow,
|
|
16051
16236
|
min: 0,
|
|
@@ -16071,7 +16256,7 @@ window.__ModuleLoader__.load({
|
|
|
16071
16256
|
max: 8,
|
|
16072
16257
|
onChange: (value) => void patch({ edgeShrink: value })
|
|
16073
16258
|
}), h(NumField, {
|
|
16074
|
-
label: T("背景分割容差(0 =
|
|
16259
|
+
label: T("背景分割容差(0 = 只认背景色)"),
|
|
16075
16260
|
value: config.bgTolerance,
|
|
16076
16261
|
min: 0,
|
|
16077
16262
|
max: 160,
|