Add direct camera aim tool#81
Conversation
|
Warning Review limit reached
More reviews will be available in 43 minutes and 33 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughThis PR introduces the ChangesCamera aiming MCP tool
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@lib/ai/agents.ts`:
- Line 1963: The description for the schema field set_dof_focus is ambiguous
about what happens when callers omit it; update the schema and/or description to
make the behavior explicit: either (A) make it a client-side default by changing
the Zod declaration for set_dof_focus to z.boolean().optional().default(true)
and update the description to "Defaults to true (client will set true when
omitted)", or (B) keep it optional but change the description to "Optional; when
omitted the Blender add-on treats it as true" to indicate a server-side default;
modify the set_dof_focus line in the schema in lib/ai/agents.ts accordingly and
ensure any consumers of this schema (e.g., code that reads set_dof_focus) are
consistent with the chosen default policy.
In `@lib/orchestration/prompts/blender-agent-system.md`:
- Line 119: Update the `aim_camera_at` signature description to explicitly state
the default for set_dof_focus to match the schema in lib/ai/agents.ts
(referenced at the comment on agents.ts:1963); locate the `aim_camera_at(name,
target_name?, target_location?, set_active?, set_dof_focus?)` line in
lib/orchestration/prompts/blender-agent-system.md and replace the ambiguous
"defaults true in Blender" phrasing with the exact default behavior used in the
schema (e.g., "defaults to true" or "defaults to false" as defined in the
schema) so documentation and the schema for aim_camera_at are consistent.
In `@lib/orchestration/tool-registry.ts`:
- Around line 385-386: The planner-facing parameters string in
lib/orchestration/tool-registry.ts currently marks both target_name and
target_location as optional but the tool contract requires at least one target
selector; update the "parameters" declaration (the parameters string) to state
that at least one of target_name or target_location is required (e.g., add “(at
least one of target_name or target_location required)”) and add a runtime
validation where the tool contract is constructed/validated (the code that reads
this parameters string in the tool registry) to throw or mark the tool invalid
when both are missing so prompt formatting and tool selection cannot produce or
call an invalid contract.
In `@public/downloads/vipermesh-addon.py`:
- Around line 5451-5456: Normalize the boolean-like inputs set_dof_focus and
set_active before applying camera side effects: add a small helper (e.g.,
normalize_bool) that treats string values like "false","0","no"
(case-insensitive) as False and "true","1","yes" as True, then call that helper
on set_dof_focus and set_active before the existing checks; use the normalized
booleans when deciding to toggle camera_obj.data.dof/use_dof, set
camera_obj.data.dof.focus_distance, and assign bpy.context.scene.camera =
camera_obj so stringy truthy values don't trigger side effects.
In `@scripts/test/test-blender-camera-aim-tool.ts`:
- Around line 18-19: The test's assertions are brittle because they require
exact variable names and operator syntax (target_obj.matrix_world @
mathutils.Vector and camera_obj.data.dof.focus_distance = focus_distance); relax
them by matching behaviorally relevant tokens instead: change the first
assertion to look for use of matrix_world together with mathutils.Vector (e.g.,
regex that allows any identifier before .matrix_world and the presence of
mathutils.Vector) and change the second to assert that some camera object's
.data.dof.focus_distance is set (e.g., match \.data\.dof\.focus_distance without
requiring camera_obj), or replace these with higher-level checks that the
exported/returned command updates DoF focus distance and computes a bounds
center value rather than exact variable names.
🪄 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: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: b912eb19-9d40-4072-a666-f4df2e0b1139
📒 Files selected for processing (11)
app/api/test-pipeline/route.tsdata/tool-guides/camera-guide.mddesktop/assets/vipermesh-addon.pylib/ai/agents.tslib/orchestration/prompts/blender-agent-system.mdlib/orchestration/tool-filter.tslib/orchestration/tool-registry.tspublic/downloads/vipermesh-addon.pyscripts/test/test-blender-camera-aim-tool.tsscripts/test/test-camera-light-render-tool-registry.tsscripts/test/test-tool-guide-trigger-coverage.ts
Summary
aim_camera_atto both Blender addon bundles.Validation
python -m py_compile desktop/assets/vipermesh-addon.py public/downloads/vipermesh-addon.pynpx tsx scripts/test/test-blender-camera-aim-tool.tsnpx tsx scripts/test/test-camera-light-render-tool-registry.tsnpx tsx scripts/test/test-direct-tool-surface-coverage.tsnpx tsx scripts/test/test-tool-guide-trigger-coverage.tsnpx tsc --noEmit --incremental falsenpm run lint(passes with existing baseline-browser-mapping freshness warning)Summary by CodeRabbit
New Features
Documentation
Tests