@ninkch/dsh-infinite-canvas 0.19.10 → 0.19.12

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.
@@ -958,14 +958,16 @@ export const BONE_POSES = [
958
958
  RightForeArm: [-0.24, -0.05, 0.22]
959
959
  } },
960
960
  { id: 'ap_hands_head', zh: '双手抱头', en: 'Hands on head', rootY: 0,
961
- // 来源:awplanet DIRECTOR_POSE_RECIPES(加法欧拉)→ 本表 base 四元数(同语义)
961
+ // 方向约束替代旧的固定欧拉:肘向上抬,前臂向头顶收拢,手落在头附近而不是髋外侧。
962
962
  base: {
963
- Spine: [-0.08, 0, 0],
964
- LeftArm: [-0.84, 0.18, 0.82],
965
- RightArm: [-0.84, -0.18, -0.82],
966
- LeftForeArm: [-0.54, 0, -1.12],
967
- RightForeArm: [-0.54, 0, 1.12]
968
- } },
963
+ Spine: [-0.04, 0, 0]
964
+ },
965
+ dirs: [
966
+ { bone: 'LeftArm', to: [0.15, 1.0, 0.10] },
967
+ { bone: 'RightArm', to: [-0.15, 1.0, 0.10] },
968
+ { bone: 'LeftForeArm', to: [-0.10, -0.05, 0.25] },
969
+ { bone: 'RightForeArm', to: [0.10, -0.05, 0.25] }
970
+ ] },
969
971
  { id: 'ap_talk_open', zh: '说话 · 张开', en: 'Talk open', rootY: 0,
970
972
  // 来源:awplanet DIRECTOR_POSE_RECIPES(加法欧拉)→ 本表 base 四元数(同语义)
971
973
  base: {
@@ -1585,14 +1587,20 @@ export function decodeModelPack(pack, actionClips) {
1585
1587
  rawHeight: pack.rawHeight,
1586
1588
  verts: pack.verts, tris: pack.tris,
1587
1589
  };
1590
+ // 骨架来源:动作轨道的 node 索引与局部轴向只在同源骨架上成立。
1591
+ // 旧包没有 rig 字段时按资产 id 兜底;Explorer 是 awplanet 动作库的源骨架。
1592
+ asset.rig = String(pack.rig || pack.sourceRig || (pack.id === 'explorer' ? 'awplanet-explorer' : pack.id || 'default'));
1588
1593
  // 动作库(内置成熟动作:three.js AnimationClip 转 tracks,base64 Float32)
1589
1594
  if (Array.isArray(actionClips)) {
1590
1595
  for (const c of actionClips) {
1591
1596
  if (!c || !c.name || !Array.isArray(c.tracks)) continue;
1597
+ // 异骨架动作绝不能盲加:node 索引不同、局部轴向不同,套错骨架会整身扭曲。
1598
+ if (c.sourceRig && c.sourceRig !== asset.rig) continue;
1592
1599
  // 只追加同名不存在的动作:内置片段(待机/行走/奔跑/潜行)保持原样,绝不被覆盖
1593
1600
  if (asset.animations.some((a) => a.name === c.name)) continue;
1594
1601
  asset.animations.push({
1595
1602
  name: c.name, duration: Number(c.duration) || 0, label: c.label || c.name, loop: !!c.loop,
1603
+ sourceRig: c.sourceRig || '',
1596
1604
  tracks: c.tracks.map((t) => ({ node: t.node, path: t.path, times: b64ToF32(t.times), vals: b64ToF32(t.vals) })),
1597
1605
  });
1598
1606
  }
@@ -1608,6 +1616,7 @@ export function decodeActionClips(list) {
1608
1616
  label: c.label || c.name || '',
1609
1617
  duration: Number(c.duration) || 0,
1610
1618
  loop: !!c.loop,
1619
+ sourceRig: c.sourceRig ? String(c.sourceRig) : '',
1611
1620
  tracks: (c.tracks || []).map((t) => ({ node: t.node, path: t.path, times: t.times, vals: t.vals })),
1612
1621
  }));
1613
1622
  }
@@ -3023,7 +3032,11 @@ export function buildStageFromSpec(spec) {
3023
3032
  if (Array.isArray(c.poseKeys)) ob.poseKeys = c.poseKeys.map((k) => ({ t: num(k.t, 0), bonePose: JSON.parse(JSON.stringify(k.bonePose || {})), ease: String(k.ease || 'auto') })).sort((a, b) => a.t - b.t);
3024
3033
  if (Array.isArray(c.poseAnim)) {
3025
3034
  ob.poseAnim = c.poseAnim.map((k) => ({ t: num(k.t, 0), poseId: poseOf(k.pose || k.poseId) || 'none' })).sort((a, b) => a.t - b.t);
3026
- if (c.loop) { ob.poseLoop = num(c.loopPeriod, ob.poseAnim[ob.poseAnim.length - 1].t); }
3035
+ if (c.loop) { ob.loop = true; ob.poseLoop = num(c.loopPeriod, ob.poseAnim[ob.poseAnim.length - 1].t); }
3036
+ }
3037
+ if (c.loop && !ob.loop) {
3038
+ ob.loop = true;
3039
+ ob.poseLoop = num(c.loopPeriod, 0);
3027
3040
  }
3028
3041
  if (Array.isArray(c.keys)) {
3029
3042
  ob.keys = c.keys.map((k) => ({ t: num(k.t, 0), pos: v3of(k.pos, 0), rotY: num(k.rotY, 0), rx: num(k.rx, 0), rz: num(k.rz, 0), ease: String(k.ease || 'auto') })).sort((a, b) => a.t - b.t);
@@ -3168,6 +3181,10 @@ export function compileStageSpec(scene) {
3168
3181
  }
3169
3182
  if (ob.locomotion) c.locomotion = { ...ob.locomotion };
3170
3183
  if (Array.isArray(ob.poseAnim) && ob.poseAnim.length) c.poseAnim = ob.poseAnim.map((k) => ({ t: round3(k.t), pose: k.poseId }));
3184
+ if (ob.loop === true || Number(ob.poseLoop) > 0) {
3185
+ c.loop = true;
3186
+ c.loopPeriod = round3(Number(ob.poseLoop) || Number((ob.poseAnim || []).at(-1)?.t) || 0);
3187
+ }
3171
3188
  if (Array.isArray(ob.poseKeys) && ob.poseKeys.length) c.poseKeys = ob.poseKeys.map((k) => ({ t: round3(k.t), bonePose: JSON.parse(JSON.stringify(k.bonePose || {})), ease: k.ease || 'auto' }));
3172
3189
  if (Array.isArray(ob.keys) && ob.keys.length) c.keys = ob.keys.map((k) => ({ t: round3(k.t), pos: arr(k.pos), rotY: round3(k.rotY || 0), rx: round3(k.rx || 0), rz: round3(k.rz || 0), ease: k.ease || 'auto' }));
3173
3190
  characters.push(c);
@@ -3444,7 +3461,12 @@ export function applyPlayhead(scene, t) {
3444
3461
  if (locoSrc === 'clip') next.animTime = motion.animTime;
3445
3462
  else if (locoSrc === 'action') next.poseTime = motion.poseTime;
3446
3463
  }
3447
- const poseSampleTime = next.poseTime !== undefined && next.poseTime !== null ? next.poseTime : time;
3464
+ let poseSampleTime = next.poseTime !== undefined && next.poseTime !== null ? next.poseTime : time;
3465
+ // 用户动作循环:poseLoop 是姿态序列周期;只作用于 poseAnim/自定义姿态,不改变对象/镜头时间轴。
3466
+ if (o.loop === true && Number(o.poseLoop) > 1e-6) {
3467
+ const period = Number(o.poseLoop);
3468
+ poseSampleTime = ((poseSampleTime % period) + period) % period;
3469
+ }
3448
3470
  // 姿态动画:poseAnim=[{t,poseId}] → 混合权重(在蒙皮时按权重 slerp)
3449
3471
  if (Array.isArray(o.poseAnim) && o.poseAnim.length) {
3450
3472
  const bl = poseBlendAt(BONE_POSES, o.poseAnim, poseSampleTime);
@@ -3576,6 +3598,23 @@ export function applyPlayhead(scene, t) {
3576
3598
  return out;
3577
3599
  }
3578
3600
 
3601
+ /**
3602
+ * 蒙皮缓存的统一姿态键:静态姿态、poseAnim、poseKeys、NLA clips 都会改变顶点,
3603
+ * 任一字段漏进缓存键都会让时间轴播放命中旧网格,表现为“关键帧没动”。
3604
+ */
3605
+ export function directorPoseCacheKey(ob) {
3606
+ if (!ob) return '';
3607
+ return [
3608
+ ob.poseId || '',
3609
+ ob.bonePose ? JSON.stringify(ob.bonePose) : '',
3610
+ Array.isArray(ob.poseAnim) ? JSON.stringify(ob.poseAnim) : '',
3611
+ Array.isArray(ob.poseKeys) ? JSON.stringify(ob.poseKeys) : '',
3612
+ Array.isArray(ob.clips) ? JSON.stringify(ob.clips) : '',
3613
+ ob.poseBlend ? JSON.stringify(ob.poseBlend) : '',
3614
+ ob.loop === true ? 'loop:' + (Number(ob.poseLoop) || 0) : '',
3615
+ ].join('|');
3616
+ }
3617
+
3579
3618
  /** 复位到默认(新建布景时)的机位视角。 */
3580
3619
  export function resetView(scene) {
3581
3620
  const def = directorDefaultScene();
@@ -4548,6 +4587,10 @@ export function saveUserAction(pid, action) {
4548
4587
  poseId: action.poseId || null,
4549
4588
  bonePose: action.bonePose && Object.keys(action.bonePose).length ? action.bonePose : null,
4550
4589
  poseAnim: Array.isArray(action.poseAnim) && action.poseAnim.length ? action.poseAnim : null,
4590
+ poseKeys: Array.isArray(action.poseKeys) && action.poseKeys.length ? JSON.parse(JSON.stringify(action.poseKeys)) : null,
4591
+ clips: Array.isArray(action.clips) && action.clips.length ? JSON.parse(JSON.stringify(action.clips)) : null,
4592
+ loop: action.loop === true,
4593
+ loopPeriod: Number(action.loopPeriod) > 0 ? Number(action.loopPeriod) : 0,
4551
4594
  duration: Number(action.duration) || 0,
4552
4595
  createdAt: Date.now(),
4553
4596
  };
@@ -4570,6 +4613,14 @@ export function applyUserAction(ob, action) {
4570
4613
  ob.poseId = action.poseId || null;
4571
4614
  ob.bonePose = action.bonePose ? JSON.parse(JSON.stringify(action.bonePose)) : {};
4572
4615
  ob.poseAnim = Array.isArray(action.poseAnim) ? JSON.parse(JSON.stringify(action.poseAnim)) : [];
4616
+ ob.poseKeys = Array.isArray(action.poseKeys) ? JSON.parse(JSON.stringify(action.poseKeys)) : [];
4617
+ ob.clips = Array.isArray(action.clips) ? JSON.parse(JSON.stringify(action.clips)) : [];
4618
+ ob.loop = action.loop === true;
4619
+ ob.poseLoop = Number(action.loopPeriod) > 0 ? Number(action.loopPeriod) : 0;
4620
+ if (!ob.poseKeys.length) delete ob.poseKeys;
4621
+ if (!ob.clips.length) delete ob.clips;
4622
+ if (!ob.loop) delete ob.loop;
4623
+ if (!ob.poseLoop) delete ob.poseLoop;
4573
4624
  return ob;
4574
4625
  }
4575
4626
  export function saveStageDoc(pid, scene) {
@@ -5142,7 +5193,7 @@ export function createDirectorGlRenderer(canvas) {
5142
5193
  if (ob.kind === "model" || ob.kind === "gltf") {
5143
5194
  const asset = gltfAssetOf(ob.assetId);
5144
5195
  if (!asset) continue;
5145
- const poseKey = (ob.poseId || '') + '|' + (Array.isArray(ob.poseAnim) ? ob.poseAnim.map((p) => p.poseId + '@' + p.t).join(',') + '#' + (Number(ob.animTime) || 0).toFixed(3) : '') + '|' + (ob.bonePose ? Object.keys(ob.bonePose).sort().map((bi) => bi + '=' + (ob.bonePose[bi] || []).map((v) => Number(v).toFixed(3)).join(',')).join(';') : '');
5196
+ const poseKey = directorPoseCacheKey(ob);
5146
5197
  const kk = ob.id + ":" + (ob.clip || "") + ":" + (Number(ob.animTime) || 0).toFixed(3) + ":" + (ob.typeId || "") + ":" + (ob.skinning || "lbs") + ":" + (ob.ik ? JSON.stringify(ob.ik) : "") + ":" + (ob.constraints ? JSON.stringify(ob.constraints) : "") + ":" + poseKey + ":shadowV2";
5147
5198
  let sk = skCache.get(kk);
5148
5199
  if (!sk) {
@@ -5616,7 +5667,7 @@ export function createDirectorGlRenderer(canvas) {
5616
5667
  const asset = gltfAssetOf(ob.assetId);
5617
5668
  if (asset) {
5618
5669
  // 缓存键必须包含「体型 + 骨骼姿态」:姿态一改就得重新蒙皮,否则永远命中旧网格
5619
- const poseKey = (ob.poseId || '') + '|' + (ob.bonePose ? Object.keys(ob.bonePose).sort().map((bi) => bi + '=' + (ob.bonePose[bi] || []).map((v) => Number(v).toFixed(3)).join(',')).join(';') : '');
5670
+ const poseKey = directorPoseCacheKey(ob);
5620
5671
  const k = ob.id + ':' + (ob.clip || '') + ':' + (Number(ob.animTime) || 0).toFixed(3) + ':' + (ob.typeId || '') + ':' + (ob.skinning || 'lbs') + ':' + (ob.ik ? JSON.stringify(ob.ik) : '') + ':' + (ob.constraints ? JSON.stringify(ob.constraints) : '') + ':' + poseKey;
5621
5672
  let sk = skCache.get(k);
5622
5673
  if (!sk) {
package/client.js CHANGED
@@ -274,6 +274,25 @@ function revealCanvasInRight() {
274
274
  function isNodeNonOpenTarget(t) {
275
275
  return !!(t && typeof t.closest === 'function' && t.closest(NODE_NON_OPEN_SELECTOR));
276
276
  }
277
+ // 画布滚轮分流:输入区/整个下拉浮层总是保留原生行为;正文与清单只在真正溢出时放行。
278
+ // 否则画布根上的非 passive wheel 会抢先 preventDefault,文本/剧本节点没法滚。
279
+ const NATIVE_WHEEL_DIRECT_SELECTORS = ['textarea', 'input', 'select', '.dshic-composer', '.dshic-pick-menu'];
280
+ const NATIVE_WHEEL_SCROLL_SELECTORS = ['.dshic-scroll-preview', '.dshic-shot-list', '.dshic-pick-list'];
281
+ function wheelScrollTarget(t) {
282
+ if (!t || typeof t.closest !== 'function') return null;
283
+ for (const s of NATIVE_WHEEL_DIRECT_SELECTORS) {
284
+ const hit = t.closest(s);
285
+ if (hit) return hit;
286
+ }
287
+ for (const s of NATIVE_WHEEL_SCROLL_SELECTORS) {
288
+ const hit = t.closest(s);
289
+ if (!hit) continue;
290
+ const dy = Number(hit.scrollHeight) - Number(hit.clientHeight);
291
+ const dx = Number(hit.scrollWidth) - Number(hit.clientWidth);
292
+ return (dy > 1 || dx > 1) ? hit : null;
293
+ }
294
+ return null;
295
+ }
277
296
  // 允许多条入线的输入端口(参考图类),其余输入端口保持单线
278
297
  const MULTI_INPUT_PORTS = new Set(['ref', 'char', 'scene', 'prop']);
279
298
  // 分镜端口期望的资产分类(仅用于连接时的非阻断提示)
@@ -3332,6 +3351,15 @@ body[data-ds-dark-theme] .dshic-pick-menu{border-color:var(--dsw-alias-border-l2
3332
3351
  .dshic-pick-search{padding:7px;border-bottom:1px solid var(--dshic-line);flex:none;}
3333
3352
  .dshic-pick-search .dshic-input{height:26px;font-size:12px;}
3334
3353
  .dshic-pick-list{overflow-y:auto;padding:5px;flex:1;}
3354
+ /* 下拉 / 文本正文 / 分镜清单:滚动条必须可见且可命中;不能用系统默认的淡细条。
3355
+ 12px 命中宽 + 3px 透明内边 + 32px 最短 thumb:视觉约 6px,命中区域明显更大。 */
3356
+ .dshic-pick-list,.dshic-scroll-preview,.dshic-shot-list{scrollbar-width:thin;scrollbar-color:var(--dsw-alias-border-l2) transparent;}
3357
+ .dshic-pick-list::-webkit-scrollbar,.dshic-scroll-preview::-webkit-scrollbar,.dshic-shot-list::-webkit-scrollbar{width:12px;height:12px;}
3358
+ .dshic-pick-list::-webkit-scrollbar-track,.dshic-scroll-preview::-webkit-scrollbar-track,.dshic-shot-list::-webkit-scrollbar-track{background:color-mix(in srgb,var(--dsw-alias-label-primary) 6%,transparent);border-radius:999px;}
3359
+ .dshic-pick-list::-webkit-scrollbar-thumb,.dshic-scroll-preview::-webkit-scrollbar-thumb,.dshic-shot-list::-webkit-scrollbar-thumb{background:var(--dsw-alias-border-l2);border:3px solid transparent;background-clip:padding-box;border-radius:999px;min-height:32px;min-width:32px;}
3360
+ .dshic-pick-list::-webkit-scrollbar-thumb:hover,.dshic-scroll-preview::-webkit-scrollbar-thumb:hover,.dshic-shot-list::-webkit-scrollbar-thumb:hover{background:var(--dsw-alias-brand-primary);border:3px solid transparent;background-clip:padding-box;}
3361
+ /* 下拉打开期间只暂停节点尺寸把手:防止菜单/滚动条边缘误触发底层拉宽箭头。 */
3362
+ body[data-dshic-pick-open] .dshic-rs{pointer-events:none;}
3335
3363
  /* 自定义数值输入:下拉底部的固定行;不参与列表滚动,Enter/失焦提交 */
3336
3364
  .dshic-pick-custom{padding:7px;border-top:1px solid var(--dshic-line);flex:none;}
3337
3365
  .dshic-pick-custom .dshic-input{width:100%;height:26px;font-size:12px;box-sizing:border-box;}
@@ -5618,6 +5646,24 @@ function queueThumb(assetId) {
5618
5646
  if (!v || typeof v !== 'object' || Array.isArray(v)) throw new Error('扩展参数必须是 JSON 对象(如 {"watermark":false})');
5619
5647
  return v;
5620
5648
  }
5649
+ /**
5650
+ * 厂商字段校验型 400 的自愈:报错文案指出某字段不被支持(如「watermark 不是文生图队列支持的字段」),
5651
+ * 返回该字段名;不匹配则返回 null。识别规则(大小写不敏感,覆盖中英文两种文案习惯):
5652
+ * ① 「X 不是 … 支持的字段/参数」(中文,X 与"不是"之间可有限定词)
5653
+ * ② "X is not (a )?supported (field|parameter)" / "unknown (field|parameter) X" / "unsupported field X"(英文)
5654
+ * 只在 HTTP 400(invalid_request 类)时调用——4xx 之外不剥字段,避免掩盖真实错误。
5655
+ */
5656
+ function unsupportedFieldName(errText) {
5657
+ const t = String(errText || '');
5658
+ const zh = /([A-Za-z_][A-Za-z0-9_]*)\s*不是[^。\n]{0,24}?(支持的字段|支持的参数|有效参数|合法参数|有效字段|合法字段)/.exec(t);
5659
+ if (zh) return zh[1];
5660
+ const en1 = /(?:unsupported|unknown|invalid)\s+(?:field|parameter)\s*["']?([A-Za-z_][A-Za-z0-9_]*)/.exec(t);
5661
+ if (en1) return en1[1];
5662
+ const en2 = /["']?([A-Za-z_][A-Za-z0-9_]*)["']?\s+is not (?:a )?supported (?:field|parameter)/.exec(t);
5663
+ if (en2) return en2[1];
5664
+ return null;
5665
+ }
5666
+
5621
5667
  async function apiImage(prompt, refBlobs, s, opts) {
5622
5668
  if (!s.baseUrl) throw new Error('未配置图片 API');
5623
5669
  // URL 归一化:裸域 → /v1;粘贴完整端点也不会被二次拼接
@@ -5687,11 +5733,27 @@ function queueThumb(assetId) {
5687
5733
  else { const dims = imageDimsFor(opts); body.size = `${dims.w}x${dims.h}`; }
5688
5734
  // 厂商专属扩展参数最后合并(可覆盖以上任何字段):换厂商不需要改代码
5689
5735
  if (extra) Object.assign(body, extra);
5690
- const res = await fetchViaProxy(base + '/images/generations', {
5736
+ // 发送(含一次字段校验型 400 的自愈重试):有些厂商把 /images/generations 转成自己的
5737
+ // 队列式文生图接口,字段表严格(实测某厂商拒绝 watermark 字段)。收到「X 不是…支持的
5738
+ // 字段」类 400 时,剥掉 X 重试一次;仍失败则带上下文抛出。
5739
+ const send = (b, label) => fetchViaProxy(base + '/images/generations', {
5691
5740
  headers: { 'Content-Type': 'application/json', ...auth },
5692
- body, timeoutMs: upstreamTimeout, label: '图片 API',
5741
+ body: b, timeoutMs: upstreamTimeout, label,
5693
5742
  });
5694
- if (!res.ok) throw new Error('图片 API HTTP ' + res.status + ':' + res.text.slice(0, 300));
5743
+ let res = await send(body, '图片 API');
5744
+ if (!res.ok && res.status === 400) {
5745
+ const bad = unsupportedFieldName(res.text);
5746
+ if (bad && Object.prototype.hasOwnProperty.call(body, bad)) {
5747
+ const retried = { ...body };
5748
+ delete retried[bad];
5749
+ res = await send(retried, '图片 API(剥字段重试)');
5750
+ if (!res.ok) throw new Error('图片 API HTTP ' + res.status + '(已剥离 ' + bad + ' 重试):' + res.text.slice(0, 300));
5751
+ } else {
5752
+ throw new Error('图片 API HTTP 400:' + res.text.slice(0, 300));
5753
+ }
5754
+ } else if (!res.ok) {
5755
+ throw new Error('图片 API HTTP ' + res.status + ':' + res.text.slice(0, 300));
5756
+ }
5695
5757
  let j = null;
5696
5758
  try { j = JSON.parse(res.text); } catch { j = null; }
5697
5759
  const d = j && j.data && j.data[0];
@@ -9821,6 +9883,9 @@ function queueThumb(assetId) {
9821
9883
  const durationPlan = videoDurationFor(n, shotList, !!sbUp);
9822
9884
  const autoDuration = durationPlan.value || 5;
9823
9885
  const handWritten = String(n.data.prompt || '').trim();
9886
+ // 手写厂商结构化提示词 = 高级直通路径:保留用户的 subject/shot 结构,
9887
+ // 只补实体设定文字;风格锁与承接前置块都不再追加,避免污染厂商协议格式。
9888
+ const handStructured = handWritten.includes('subject_definitions');
9824
9889
  // 分镜衔接规划:段落类型(续帧/换场/新角色/特写插入)+ 首镜承接口 + 是否接力尾帧
9825
9890
  const zh = effLang() !== 'en';
9826
9891
  const plan = (() => {
@@ -9896,10 +9961,9 @@ function queueThumb(assetId) {
9896
9961
  let p;
9897
9962
  // 图1=尾帧(降级模式)时实体参考图为图2..N+1:两条提示词组装路径都要同步偏移
9898
9963
  const effOpts = { picOffset: (useFrame && anchorRole === 'reference_image') ? 1 : 0 };
9899
- if (handWritten.includes('subject_definitions')) {
9900
- p = handWritten; // 高级用法:手写结构化提示词,原样发送
9901
- // 手写结构化提示词也要注入 @实体@ 的设定文字(外观/声音)——缺陷 3 的第三条路径。
9902
- // 只追加 series_bible 文字块:不动用户写好的主体/镜头结构,也不追加任何参考图。
9964
+ if (handStructured) {
9965
+ p = handWritten; // 高级用法:手写结构化提示词,结构原样保留
9966
+ // 只追加 series_bible 文字块:不动用户写好的主体/镜头结构,也不追加任何参考图与风格锁。
9903
9967
  if (!/series_bible/i.test(p)) {
9904
9968
  const bb = entityBibleBlock(entities, bible, zh);
9905
9969
  if (bb) p = p + '\n' + bb;
@@ -9915,15 +9979,17 @@ function queueThumb(assetId) {
9915
9979
  p = buildEffectivePrompt(prompt, refs, entities, bible, false, effOpts);
9916
9980
  }
9917
9981
  // 非结构化路径(无参考图/手写提示词)也要有首帧锚定与承接说明
9918
- if (!shotList.length || !p.includes('subject_definitions')) {
9982
+ if ((!shotList.length || !p.includes('subject_definitions')) && !handStructured) {
9919
9983
  const pre = [frameAnchorText({ hasFrame: useFrame, role: anchorRole, zh }), continuity].filter(Boolean).join(zh ? ';' : '; ');
9920
9984
  if (pre) p = pre + '\n' + p;
9921
9985
  }
9922
- // 技能包的「镜头语言锁」:附在末尾(结构化提示词也能拿到风格参数与负向词,且不打断它的字段顺序)
9923
- try {
9924
- const lock = await buildShotLockText('prompt');
9925
- if (lock) p = p + '\n' + lock;
9926
- } catch { /* 技能包不可用时不影响生成 */ }
9986
+ // 自动组装路径才追加技能包风格锁;手写厂商结构化提示词保持用户协议结构
9987
+ if (!handStructured) {
9988
+ try {
9989
+ const lock = await buildShotLockText('prompt');
9990
+ if (lock) p = p + '\n' + lock;
9991
+ } catch { /* 技能包不可用时不影响生成 */ }
9992
+ }
9927
9993
  const mcfg = resolveVideoModelCfg(settings, nodeVideoModelRef(n));
9928
9994
  if (!mcfg) throw new Error(T('errNoVideoModel'));
9929
9995
  if (sbUp && !durationPlan.value) addWarn('已连接分镜但暂无镜头时长:视频时长回退 5s(先生成分镜镜头后重跑)');
@@ -11346,6 +11412,9 @@ function queueThumb(assetId) {
11346
11412
  };
11347
11413
  useEffect(() => {
11348
11414
  if (!open) return undefined;
11415
+ // 下拉打开期间挂 body 标记:只禁用节点尺寸把手,不禁用节点本体,
11416
+ // 否则滚动条/菜单边缘的鼠标会先命中底层“拉宽箭头”。
11417
+ document.body.dataset.dshicPickOpen = '1';
11349
11418
  const onDown = (e) => {
11350
11419
  const t = e && e.target;
11351
11420
  if (menuRef.current && t && menuRef.current.contains && menuRef.current.contains(t)) return;
@@ -11353,7 +11422,10 @@ function queueThumb(assetId) {
11353
11422
  setOpen(false);
11354
11423
  };
11355
11424
  document.addEventListener('pointerdown', onDown, true);
11356
- return () => document.removeEventListener('pointerdown', onDown, true);
11425
+ return () => {
11426
+ delete document.body.dataset.dshicPickOpen;
11427
+ document.removeEventListener('pointerdown', onDown, true);
11428
+ };
11357
11429
  }, [open]);
11358
11430
  const cur = options.find((o) => String(o.value) === String(value));
11359
11431
  // 自定义值不在预设里时,按钮显示真实当前值(绝不能错显第一项,否则用户以为没生效)
@@ -14069,7 +14141,7 @@ function queueThumb(assetId) {
14069
14141
 
14070
14142
  async function buildShotLockText(kind, opts) {
14071
14143
  const medium = (opts && opts.medium) || 'video';
14072
- const pid = S.activeId;
14144
+ const pid = (opts && opts.pid) || S.activeId;
14073
14145
  if (!pid) return '';
14074
14146
  const manifest = await loadPackManifest();
14075
14147
  if (!manifest) return '';
@@ -14086,6 +14158,16 @@ function queueThumb(assetId) {
14086
14158
  const b = String(body || '').trim();
14087
14159
  if (b) parts.push(label + '\n' + b);
14088
14160
  };
14161
+ // 负向词跨四层全局收集:单卡内去重不够——导演/题材/规格/影调经常重复同类禁令,
14162
+ // 重复注入会稀释权重。统一去重后再给总预算,防止异常卡把视频请求撑成负向词文本墙。
14163
+ const negs = [];
14164
+ const seenNeg = new Set();
14165
+ const addNegs = (phrases) => {
14166
+ for (const raw of (phrases || [])) {
14167
+ const s = String(raw || '').trim();
14168
+ if (s && !seenNeg.has(s.toLowerCase())) { seenNeg.add(s.toLowerCase()); negs.push(s); }
14169
+ }
14170
+ };
14089
14171
 
14090
14172
  // ① 导演透镜:风格参数 YAML(机读、可核对)+ 灯光与色彩(成型规则)
14091
14173
  const lensEntry = profile.lens ? (manifest.lenses || []).find((x) => x.id === profile.lens) : null;
@@ -14123,9 +14205,8 @@ function queueThumb(assetId) {
14123
14205
  // 以前只在 script 切片里出现、进不了 prompt,等于题材对成片没有约束力。这里补上。
14124
14206
  const forbid = P.sectionText(md, '禁止漂移');
14125
14207
  if (forbid) push('本题材的画面禁项(' + entry.name + ',必须排除):', forbid);
14126
- // 题材级负向词(与规格/透镜/影调同一机制):题材卡若写了「类型级负向词」小节就一并注入。
14127
- const genreNeg = P.negativePhrases(md);
14128
- if (genreNeg.length) push('本题材负向词(' + entry.name + ',必须排除):', genreNeg.join(', '));
14208
+ // 题材级负向词与其它层合并,统一去重后在块尾注入
14209
+ addNegs(P.negativePhrases(md));
14129
14210
  }
14130
14211
 
14131
14212
  // ④ 规格:节奏与负向词(画幅不在这里定,由视频节点选)
@@ -14138,24 +14219,36 @@ function queueThumb(assetId) {
14138
14219
  if (spec.asl_floor_s) bits.push('单镜不短于 ' + spec.asl_floor_s + 's');
14139
14220
  if (spec.asl_target_s) bits.push('平均镜长 ' + spec.asl_target_s + 's');
14140
14221
  if (bits.length) push('交付规格(' + formEntry.name + '):', bits.join(';'));
14141
- const neg = P.negativePhrases(md);
14142
- if (neg.length) push('本类型负向词(必须排除):', neg.join(', '));
14222
+ addNegs(P.negativePhrases(md));
14143
14223
  }
14144
14224
  }
14145
14225
 
14146
- // ⑤ 透镜与影调各自的负向词(两处规格不同,都要)
14147
- for (const [layer, label] of [['lens', '镜头负向词'], ['look', '画质负向词']]) {
14226
+ // ⑤ 透镜与影调负向词:和题材/规格合并,块尾统一注入
14227
+ for (const layer of ['lens', 'look']) {
14148
14228
  const id = layer === 'lens' ? profile.lens : profile.look;
14149
14229
  const entry = id ? (manifest[layer === 'lens' ? 'lenses' : 'looks'] || []).find((x) => x.id === id) : null;
14150
14230
  if (!entry) continue;
14151
14231
  const md = await readPackCard(layer, entry.file);
14152
14232
  if (!md) continue;
14153
- const neg = P.negativePhrases(md);
14154
- if (neg.length) push(label + '(必须排除):', neg.join(', '));
14233
+ addNegs(P.negativePhrases(md));
14234
+ }
14235
+
14236
+ if (negs.length) {
14237
+ // 预算按 UTF-8 字节计算(pack.js 的 utf8Bytes 与浏览器/Node 同口径);逗号分隔符也计入。
14238
+ // 超过预算的尾部短语直接截掉,不做半句截断——截半条负向词可能反转语义。
14239
+ const kept = [];
14240
+ let bytes = 0;
14241
+ for (const s of negs) {
14242
+ const need = P.utf8Bytes(s) + (kept.length ? 2 : 0);
14243
+ if (!need || bytes + need > 2400) continue;
14244
+ kept.push(s);
14245
+ bytes += need;
14246
+ }
14247
+ if (kept.length) push('全局负向词(必须排除):', kept.join(', '));
14155
14248
  }
14156
14249
 
14157
14250
  if (!parts.length) return '';
14158
- const head = '[风格增强锁] 以下三块直接决定画面成败,与提示词正文冲突时以本块为准:';
14251
+ const head = '[风格增强锁] 以下分块直接决定画面成败,与提示词正文冲突时以本块为准:';
14159
14252
  return head + '\n' + parts.join('\n\n');
14160
14253
  }
14161
14254
 
@@ -14874,7 +14967,9 @@ const DIRECTOR_KEY_HELP = [
14874
14967
  const curKeysRef = () => {
14875
14968
  const cam2 = (scene.cameras || []).find((c) => c.id === scene.activeCameraId);
14876
14969
  const ob2 = (scene.objects || []).find((x) => x.id === S.directorSel);
14877
- if (ob2 && Array.isArray(ob2.keys) && ob2.keys.length) return ob2.keys.concat(Array.isArray(ob2.poseAnim) ? ob2.poseAnim : []);
14970
+ if (ob2) return (Array.isArray(ob2.keys) ? ob2.keys : [])
14971
+ .concat(Array.isArray(ob2.poseKeys) ? ob2.poseKeys.map((k) => ({ ...k, _poseKey: true })) : [])
14972
+ .concat(Array.isArray(ob2.poseAnim) ? ob2.poseAnim.map((k) => ({ ...k, _poseAnim: true })) : []);
14878
14973
  if (cam2 && Array.isArray(cam2.keys)) return cam2.keys;
14879
14974
  return [];
14880
14975
  };
@@ -14901,8 +14996,10 @@ const DIRECTOR_KEY_HELP = [
14901
14996
  patch((n) => {
14902
14997
  const cam2 = (n.cameras || []).find((c) => c.id === n.activeCameraId);
14903
14998
  if (cam2 && Array.isArray(cam2.keys)) { const idx = E.keyIndexAt(cam2.keys, playT); if (idx >= 0) cam2.keys.splice(idx, 1); }
14904
- const ob2 = (n.objects || []).find((x) => x.id === S.directorSel);
14905
- if (ob2 && Array.isArray(ob2.keys)) { const idx = E.keyIndexAt(ob2.keys, playT); if (idx >= 0) ob2.keys.splice(idx, 1); }
14999
+ const ob2 = (n.objects || []).find((x) => x.id === S.directorSel);
15000
+ if (ob2 && Array.isArray(ob2.keys)) { const idx = E.keyIndexAt(ob2.keys, playT); if (idx >= 0) ob2.keys.splice(idx, 1); }
15001
+ if (ob2 && Array.isArray(ob2.poseKeys)) { const idx = E.keyIndexAt(ob2.poseKeys, playT); if (idx >= 0) ob2.poseKeys.splice(idx, 1); }
15002
+ if (ob2 && Array.isArray(ob2.poseAnim)) { const idx = E.keyIndexAt(ob2.poseAnim, playT); if (idx >= 0) ob2.poseAnim.splice(idx, 1); }
14906
15003
  });
14907
15004
  setMsg({ kind: 'ok', text: T('dirKeyDeleted') });
14908
15005
  } }, '✖|'),
@@ -14914,9 +15011,11 @@ const DIRECTOR_KEY_HELP = [
14914
15011
  patch((n) => {
14915
15012
  const cam2 = (n.cameras || []).find((c) => c.id === n.activeCameraId);
14916
15013
  if (cam2 && Array.isArray(cam2.keys)) { const idx = E.keyIndexAt(cam2.keys, playT); if (idx >= 0) cam2.keys[idx].ease = mode; }
14917
- const ob2 = (n.objects || []).find((x) => x.id === S.directorSel);
14918
- if (ob2 && Array.isArray(ob2.keys)) { const idx = E.keyIndexAt(ob2.keys, playT); if (idx >= 0) ob2.keys[idx].ease = mode; }
14919
- });
15014
+ const ob2 = (n.objects || []).find((x) => x.id === S.directorSel);
15015
+ if (ob2 && Array.isArray(ob2.keys)) { const idx = E.keyIndexAt(ob2.keys, playT); if (idx >= 0) ob2.keys[idx].ease = mode; }
15016
+ if (ob2 && Array.isArray(ob2.poseKeys)) { const idx = E.keyIndexAt(ob2.poseKeys, playT); if (idx >= 0) ob2.poseKeys[idx].ease = mode; }
15017
+ if (ob2 && Array.isArray(ob2.poseAnim)) { const idx = E.keyIndexAt(ob2.poseAnim, playT); if (idx >= 0) ob2.poseAnim[idx].ease = mode; }
15018
+ });
14920
15019
  bumpView();
14921
15020
  },
14922
15021
  }, [
@@ -16514,7 +16613,9 @@ const DIRECTOR_KEY_HELP = [
16514
16613
  if (!nm) { setMsg({ kind: 'err', text: T('dirActionNeedName') }); return; }
16515
16614
  const rec = E.saveUserAction(S.activeId, {
16516
16615
  name: nm, poseId: sel.poseId, bonePose: sel.bonePose,
16517
- poseAnim: sel.poseAnim, duration: Number((scene.shot || {}).duration) || 0,
16616
+ poseAnim: sel.poseAnim, poseKeys: sel.poseKeys, clips: sel.clips,
16617
+ loop: sel.loop === true, loopPeriod: sel.poseLoop,
16618
+ duration: Number((scene.shot || {}).duration) || 0,
16518
16619
  });
16519
16620
  if (rec) {
16520
16621
  markDirty();
@@ -19300,9 +19401,9 @@ const DIRECTOR_KEY_HELP = [
19300
19401
  const el = rootRef.current;
19301
19402
  if (!el) return;
19302
19403
  const fn = (e) => {
19303
- // 文本/下拉等交互区域与生成面板保持原生滚动,不缩放画布
19304
- const t = e.target;
19305
- if (t && t.closest && t.closest('textarea, input, select, .dshic-shot-list, .dshic-composer')) return;
19404
+ // 输入区/生成面板/下拉菜单保持原生行为;正文与清单只在确实可滚时放行。
19405
+ // 这样短文本不会把滚轮抢走,画布仍可在节点空白/短内容上缩放。
19406
+ if (wheelScrollTarget(e.target)) return;
19306
19407
  e.preventDefault();
19307
19408
  const rect = el.getBoundingClientRect();
19308
19409
  const sx = e.clientX - rect.left, sy = e.clientY - rect.top;
@@ -19908,6 +20009,7 @@ const DIRECTOR_KEY_HELP = [
19908
20009
  sizeForRatio, nodeSizeForRatio, mediaBarsHeight, mediaHasFooter,
19909
20010
  ratioIsValid, ratioAspect, ratioFromDims, mediaRatioOf, mediaAspectOf, mediaRatioForDims,
19910
20011
  normalizeMediaNodeSize, normalizeGraphDoc, resizeBoxFor, composerWidthFor,
20012
+ wheelScrollTarget,
19911
20013
  // 下拉自定义数值的纯函数:范围夹取 / 整数与小数口径(分镜数、单段上限共用)
19912
20014
  clampCustomNumber,
19913
20015
  // 视频请求时长策略:手动秒数 vs 分镜节拍(供面板禁用态与请求侧共用)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ninkch/dsh-infinite-canvas",
3
- "version": "0.19.10",
3
+ "version": "0.19.12",
4
4
  "description": "无限画布(Infinite Canvas)for DeepSeek Harness:节点式创作工作室(剧本/分镜/生成/成片),内置「媒体创作」预设模式(导演第一视角 + 引导工作坊)。Version-agnostic: reads the live catalog from the installed package at load time.",
5
5
  "keywords": [
6
6
  "dsh",