Skip to content

fix(assets): keep polygon sprite-frame vertices across reimport - #898

Open
looopmax wants to merge 1 commit into
cocos:mainfrom
looopmax:fix/sprite-frame-keep-polygon-vertices
Open

fix(assets): keep polygon sprite-frame vertices across reimport#898
looopmax wants to merge 1 commit into
cocos:mainfrom
looopmax:fix/sprite-frame-keep-polygon-vertices

Conversation

@looopmax

Copy link
Copy Markdown
Contributor

Summary

  • Keep valid polygon rawPosition across SpriteFrame reimport. The Bayazit generator in initVerticesData was never implemented, so clearing vertices on every init destroyed custom meshes written by PinK Sprite Editor.
  • If polygon vertices are missing or not a multiple of 3 with length >= 9, log a warning, fall meshType back to RECT, and write a rect mesh.

Test plan

  • Reimport a sprite-frame whose meta has meshType: polygon and valid vertices.rawPosition (length >= 9 and % 3 === 0). Vertices must stay.
  • Reimport a sprite-frame with polygon meshType but invalid rawPosition. Expect a warning, meshType reset to rect, and a rect mesh written.

Valid polygon meshes were wiped on every init because the Bayazit generator was never implemented. Keep them, and fall back to a rect mesh when vertices are invalid.

Co-authored-by: Cursor <cursoragent@cursor.com>
@looopmax
looopmax force-pushed the fix/sprite-frame-keep-polygon-vertices branch from 54a0486 to 53cd99f Compare August 31, 2026 07:51
@wuzhiming
wuzhiming requested a review from yanOO1497 September 1, 2026 10:08
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