Comfy-Org / Comfy-Org/ComfyUI_frontend
PLY material mode switch loses gizmo transform (handlePLYModeSwitch not gizmo-aware)
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 699
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 490
Description
## Summary
When a user switches material modes on a PLY model, `handlePLYModeSwitch` in `src/extensions/core/load3d/SceneModelManager.ts` rebuilds the model object entirely. This causes any gizmo transform the user had applied to be lost, and the normalization logic (center + scale, lines ~226–239) repositions/rescales the model inconsistently with the post-gizmo `setupModel` path which no longer auto-normalizes.
## Expected behavior
Switching PLY material modes should preserve the existing gizmo transform. The model should remain at its gizmo-adjusted position/rotation/scale after a material mode switch.
## Proposed fix
1. Save the current gizmo transform before rebuilding the model in `handlePLYModeSwitch`.
2. Call `setupGizmo(newModel)` after adding the new model object to the scene.
3. Reapply the saved gizmo transform to the new model.
## Context
- Identified in PR #11274 (gizmo controls feature).
- `handlePLYModeSwitch` predates this PR; the normalization logic was already there before `setupModel` was changed to skip auto-normalization.
- This is a follow-up concern separate from the main gizmo controls feature.
## References
- PR: https://github.com/Comfy-Org/ComfyUI_frontend/pull/11274
- Comment: https://github.com/Comfy-Org/ComfyUI_frontend/pull/11274#discussion_r3090415686
- Requested by: @jtydhr88
┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-11306-PLY-material-mode-switch-loses-gizmo-transform-handlePLYModeSwitch-not-gizmo-aware-3446d73d3650818584f8df76ec5f4128) by [Unito](https://www.unito.io)
Contributor guide
Assessment
This issue has not been assessed yet.