Repository navigation
chore: Add raycast grid annotation infrastructure for an upcoming screenshot capability - #1660
Conversation
origin/mainの最終形からRaycastGridAnnotator/RaycastHitClusterer/ RaycastLayerMaskResolver/RaycastSampleOutlineBuilderを移植した。 main実装をレビューしたFable5の指摘に基づき、以下をmainの構成から変更している: - 配置場所: main側はRaycastToolとScreenshotTool両方から使われる想定でUtils/直下に 置かれていたが、実際の利用元はScreenshotToolのみだったため、新規共有asmdefを作らず FirstPartyTools/Screenshot/RaycastAnnotation/サブフォルダに配置した(YAGNI)。 - UIElementInfo拡張: RaycastGridAnnotatorがLayer/Components/RaycastOutlineSegments フィールドに代入するため、UIElementInfo(ToolContracts)にこの3フィールドを先行追加した。 RaycastOutlineSegment型もCommonではなくToolContractsに新設(ToolContractsはCommonを 参照できない最下層のため)。 - UiRaycastHelperにRaycastContextを追加: グリッド全点(最大40x40=1600サンプル)の UI occlusion判定でCanvas全走査を毎回繰り返すとUnity Freeze Prevention上の懸念があるため、 main同様にCanvas走査結果をキャッシュするRaycastContextを追加した。ただしmain版を 逐語コピーすると、v3-beta独自に入っていた正しさ修正(子Canvas帰属チェック、 ignoreReversedGraphics対応)が失われ、スクリーンショットのocclusion判定と simulate-mouse-uiのクリック解決が食い違う不整合を生むため、既存のIsRaycastCandidateは 維持し、Canvas収集/判定ロジックのみをメソッド抽出してRaycastContextから再利用する形にした。 既存のRaycastUIもRaycastContext委譲にし、マージ規則の重複を除去した。 RaycastGridAnnotatorTests.cs(30テスト)を移植し、各テストにWHATコメントを付与。 uloop compileでエラー・warning 0件を確認、既存のUiRaycastHelper利用箇所 (MouseUiDragTargetResolverTests / MouseUiPointerTargetResolverTests / SimulateMouseUiTests / SimulateMouseUiInputSystemTests / InputReplayVerificationE2ETests)が全てgreenのままであることを 確認し、リファクタによる回帰がないことを検証した。
|
Warning Review limit reached
Next review available in: 5 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (10)
📒 Files selected for processing (11)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
…eenshot capability (hatayama#1660)
Summary
main(RaycastGridAnnotator,RaycastHitClusterer,RaycastLayerMaskResolver,RaycastSampleOutlineBuilder) so a later PR can wire it into the screenshot tool.UiRaycastHelper.RaycastContextso repeated UI-occlusion raycasts (up to 1600 per screenshot capture) can reuse cached Canvas/EventSystem state instead of rescanning every sample.User Impact
RaycastUInow delegates toRaycastContextinternally but keeps identical hit-testing semantics.Changes
RaycastGridAnnotator/RaycastHitClusterer/RaycastLayerMaskResolver/RaycastSampleOutlineBuilderunderFirstPartyTools/Screenshot/RaycastAnnotation/(only the screenshot tool uses these onmain, so no new sharedCommonmodule was introduced).RaycastGridPointInfo,RaycastLayerSummaryInfo,RaycastOutlineSegmenttoToolContracts, and extendedUIElementInfowithLayer/Components/RaycastOutlineSegments.CollectCanvasRaycastSources/RaycastCanvasSpaceFromSourcesfrom the existingUiRaycastHelper.RaycastCanvasSpace, and built a newRaycastContexton top of them. Kept this repo's existing (more correct)IsRaycastCandidatefiltering instead of copyingmain's older logic, to avoid two divergent UI hit-testing implementations.RaycastGridAnnotatorTests.cs(30 tests) with a what-comment on each test.Verification
uloop compile: 0 errors, 0 warningsRaycastGridAnnotatorTests(30/30 green)MouseUiDragTargetResolverTests+MouseUiPointerTargetResolverTests(EditMode, 13/13 green)SimulateMouseUiTests+SimulateMouseUiInputSystemTests+InputReplayVerificationE2ETests(PlayMode, 34/34 + 2/2 green) — confirms theUiRaycastHelperrefactor has no behavior regression for existing callers