Skip to content

refactor(particle): rename ParticleScaleMode enums for clarity#2970

Merged
cptbtptpbcptdtptp merged 4 commits intodev/2.0from
refactor/particle-scale-mode-rename
Apr 17, 2026
Merged

refactor(particle): rename ParticleScaleMode enums for clarity#2970
cptbtptpbcptdtptp merged 4 commits intodev/2.0from
refactor/particle-scale-mode-rename

Conversation

@GuoLei1990
Copy link
Copy Markdown
Member

@GuoLei1990 GuoLei1990 commented Apr 16, 2026

Summary

  • Rename ParticleScaleMode.HierarchyWorld to align with the existing worldScale concept users are already familiar with
  • Rename ParticleScaleMode.WorldShape to accurately describe that only the emission shape is scaled (consistent with Unity's ParticleSystemScalingMode.Shape)
  • Update JSDoc comments for clarity and consistency

Note

Enum ordinal values are unchanged (World=0, Local=1, Shape=2), no serialization impact.

Test plan

  • Verify particle scaling behavior unchanged for all three modes
  • Verify no other references to old enum names exist

Summary by CodeRabbit

  • Breaking Changes
    • Particle scale modes reorganized: removed "Hierarchy"; "World" now applies parent transform scaling; added "Shape" to scale only emission shape (particle size/movement unaffected); "Local" retained.
  • Bug Fixes / Maintenance
    • Updated fire particle examples to use the new World mode so visuals match revised scaling behavior.
  • Documentation
    • Docs updated to reflect World/Local/Shape semantics.

Rename `Hierarchy` to `World` and `World` to `Shape` to better align
with user intuition — `World` matches the existing `worldScale` concept,
and `Shape` accurately describes that only the emission shape is scaled.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 16, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 0d49c191-a2de-4201-adc8-5a95cae0b16b

📥 Commits

Reviewing files that changed from the base of the PR and between 6d8f290 and ee611b8.

📒 Files selected for processing (1)
  • packages/core/src/particle/enums/ParticleScaleMode.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/core/src/particle/enums/ParticleScaleMode.ts

Walkthrough

The particle scaling modes were reworked: Hierarchy was removed, World now includes parent transforms, a new Shape mode was added (scale emission shape only), and MainModule shader/position-scale logic and docs/tests were updated to match.

Changes

Cohort / File(s) Summary
Scale enum
packages/core/src/particle/enums/ParticleScaleMode.ts
Removed Hierarchy; added Shape; updated World and Local documentation and semantics.
Runtime logic
packages/core/src/particle/modules/MainModule.ts
Remapped switch logic in _getPositionScale() and _updateShaderData() so World and Shape assign position/size scales according to the new enum semantics; removed Hierarchy handling.
End-to-end test
e2e/case/particleRenderer-fire.ts
Replaced ParticleScaleMode.Hierarchy with ParticleScaleMode.World in three particle creators; minor inline-comment whitespace tweak.
Documentation (EN & ZH)
docs/en/graphics/particle/renderer-main-module.mdx, docs/zh/graphics/particle/renderer-main-module.mdx
Updated scalingMode documentation: removed Hierarchy, clarified World vs Local, and added Shape description.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 I hopped through enums at break of dawn,

Swapped a Hierarchy for Shape on the lawn.
World stretches outward with parent embrace,
Shape holds the spawn in its cozy space.
Tiny particles dance — I munch on a rune.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title describes the main change: renaming ParticleScaleMode enums (Hierarchy→World, World→Shape) for clarity, which is accurately reflected in the changeset across enums, implementation, tests, and documentation.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/particle-scale-mode-rename

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 16, 2026

Codecov Report

❌ Patch coverage is 66.66667% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.25%. Comparing base (708e95b) to head (ee611b8).
⚠️ Report is 3 commits behind head on dev/2.0.

Files with missing lines Patch % Lines
e2e/case/particleRenderer-fire.ts 0.00% 4 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           dev/2.0    #2970      +/-   ##
===========================================
- Coverage    77.51%   77.25%   -0.26%     
===========================================
  Files          900      901       +1     
  Lines        98724    98937     +213     
  Branches      9785     9852      +67     
===========================================
- Hits         76521    76430      -91     
- Misses       22037    22338     +301     
- Partials       166      169       +3     
Flag Coverage Δ
unittests 77.25% <66.66%> (-0.26%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/core/src/particle/enums/ParticleScaleMode.ts`:
- Around line 4-10: References to the removed enum member
ParticleScaleMode.Hierarchy remain in three assignments; replace each usage of
ParticleScaleMode.Hierarchy with an existing mode (e.g.,
ParticleScaleMode.World) so the code compiles — update the three assignments
that set ParticleScaleMode.Hierarchy to instead set ParticleScaleMode.World (or
another appropriate remaining member: Local or Shape) ensuring all occurrences
of ParticleScaleMode.Hierarchy are removed.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: ab430c82-354f-48e9-af44-37efd61fc80e

📥 Commits

Reviewing files that changed from the base of the PR and between 7c5d468 and 852e784.

📒 Files selected for processing (2)
  • packages/core/src/particle/enums/ParticleScaleMode.ts
  • packages/core/src/particle/modules/MainModule.ts

Comment thread packages/core/src/particle/enums/ParticleScaleMode.ts
@hhhhkrx
Copy link
Copy Markdown
Contributor

hhhhkrx commented Apr 16, 2026

仓库内还有旧调用:e2e/case/particleRenderer-fire.ts

@hhhhkrx
Copy link
Copy Markdown
Contributor

hhhhkrx commented Apr 16, 2026

文档的 scalingMode 也还是旧语义

GuoLei1990

This comment was marked as outdated.

@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Apr 16, 2026
@GuoLei1990
Copy link
Copy Markdown
Member Author

已修复:

  • e2e particleRenderer-fire.ts 3 处 HierarchyWorld
  • 中英文文档 renderer-main-module.mdx 更新为新语义 ✅

@hhhhkrx 感谢指出 🙏

GuoLei1990

This comment was marked as outdated.

Copy link
Copy Markdown
Member Author

@GuoLei1990 GuoLei1990 left a comment

Choose a reason for hiding this comment

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

已关闭问题清单

问题 关闭原因
[P0] e2e/case/particleRenderer-fire.ts Hierarchy 引用未更新 已修复 (commit 16c3a5f)
[P2] MainModule.ts fall-through 缺注释 建议性,不阻塞
hhhhkrx: 文档 scalingMode 旧语义 已修复 (commit 6d8f290)
hhhhkrx: 仓库内还有旧调用 e2e 已修复 (commit 16c3a5f)

总结

增量审查:上轮 P0(e2e 旧引用)和 hhhhkrx 指出的文档旧语义均已修复。grep 确认仓库内无残留 ParticleScaleMode.Hierarchy 引用。代码干净,无新问题。可合入。

问题

无新问题。

简化建议

无。

Copy link
Copy Markdown
Member Author

@GuoLei1990 GuoLei1990 left a comment

Choose a reason for hiding this comment

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

总结

纯重命名 PR:ParticleScaleMode.HierarchyWorldParticleScaleMode.WorldShape。命名改进合理——World 与引擎的 worldScale 概念对齐,Shape 与 Unity ParticleSystemScalingMode.Shape 一致且语义更准确。枚举序号不变,无序列化兼容问题。上轮 P0(e2e 旧引用)和 hhhhkrx 指出的文档旧语义均已修复。grep 确认仓库内无残留 ParticleScaleMode.Hierarchy 引用。

问题

无新问题。

简化建议

无。代码干净,可合入。

Copy link
Copy Markdown
Collaborator

@cptbtptpbcptdtptp cptbtptpbcptdtptp left a comment

Choose a reason for hiding this comment

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

+1

@cptbtptpbcptdtptp cptbtptpbcptdtptp merged commit 00942cc into dev/2.0 Apr 17, 2026
10 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants