Skip to content

Fix transform frame parsing for empty and non-object input#993

Open
A-kirami wants to merge 2 commits into
OpenWebGAL:devfrom
A-kirami:fix/transform-empty-frame-parsing
Open

Fix transform frame parsing for empty and non-object input#993
A-kirami wants to merge 2 commits into
OpenWebGAL:devfrom
A-kirami:fix/transform-empty-frame-parsing

Conversation

@A-kirami

Copy link
Copy Markdown
Contributor

概要

  • 将空的 setTransform: 内容按空变换帧处理,使其与 setTransform:{}-writeDefault 下语义一致。
  • setTransformchangeFigure -transformchangeBg -transform 增加统一的 transform frame 解析边界。
  • transform frame 现在只接受普通 JSON 对象;数组、数字、布尔值、非法 JSON 都不会进入动画帧。
  • changeFigure / changeBg 的无效 transform 输入会走默认 transform 路径。
  • 未修改 parser 的全局参数解析行为,避免影响 -duration=-zIndex= 等历史语义。

背景

解决 #984

此前 setTransform:{} -writeDefaultsetTransform: -writeDefault 行为不一致。原因是空内容会 JSON 解析失败,并被处理成空动画列表,导致默认 transform 终态没有写入。

另外,changeFigure / changeBg-transform 参数缺少对象形态校验,数组或 primitive JSON 可能被当作动画帧进入后续流程。

Treat empty setTransform content as an empty transform frame so
-writeDefault follows the same base default path as setTransform:{}.

Accept only object-shaped transform JSON for setTransform, changeFigure,
and changeBg. Non-object values from malformed or empty transform input
fall back to the default transform path instead of entering animation
frames.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the parsing of transform frames across multiple game scripts (changeBg, changeFigure, and setTransform) by introducing and utilizing helper functions parseTransformFrame and parseSetTransformFrame. This eliminates inline JSON.parse calls and try-catch blocks, and reduces code duplication by extracting common animation application logic into applyTransform functions. There are no review comments, so I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@A-kirami A-kirami changed the base branch from main to dev June 25, 2026 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant