feat: add parent-inverse-orrery example (matrix_parent_inverse contract)#55
Merged
Conversation
Generated Blender code constantly writes `child.parent = pivot` and is surprised the child teleports, then reads `matrix_world` before the depsgraph has evaluated it. No existing example covers object parenting or the transform-update contract, so this one witnesses both with a brass orrery whose hierarchy is the subject: arms, planets, and a two-level moon parented with the keep-world idiom (matrix_parent_inverse = parent.matrix_world.inverted()), spun to closed-form orbit positions the check verifies exactly. The trap itself is asserted too - a bare-parented probe must jump, and the fix must restore its world position to within 1e-5. Runs check-only headless on Blender 4.5 LTS and 5.1 (both verified locally on 4.5.11 and 5.1.2); --output renders the gallery still. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
examples/parent-inverse-orrery/— the sixteenth smoke-gated example. A brass tabletop orrery (sun, three planets on pivot arms inside orbit rings, one moon) assembled entirely throughbpy.data, where the object hierarchy itself is the subject: every arm, planet, and the two-level moon assembly is parented with the keep-world idiom and then spun to its display angle by rotating only the pivots.No existing example covers object parenting or the transform-update contract, and both are things AI-generated Blender code reliably gets wrong.
API contract witnessed
probe.parent = pivotalone re-interprets the probe's local matrix in the pivot's space: the check asserts the probe jumps (> 0.5 units).probe.matrix_parent_inverse = pivot.matrix_world.inverted()restores the world position to within 1e-5.matrix_worldis the last-evaluated matrix — after a transform edit it must stay stale untilbpy.context.view_layer.update(), then reflect the edit.Rz(theta) @ p0, and the moon on the two-level compositionpc + Rz(theta1 + thetam) @ (m0 - pc0), proving the parenting algebra carries a real hierarchy.Exits non-zero (codes 3–7) on any violation. Check-only by default;
--outputrenders the gallery still (EEVEE,--engine cyclesfor GPU-less hosts).Visual notes
Dark-studio recipe from
bmesh-gear: key/fill/rim area lights, floor + wall, faint warm world. Brass column, arms, and POLY-circle orbit rings; emissive sun crowning the column; lapis/terracotta/jade planets on three ring levels; silver moon on its rod beside the outer planet. Verified at full size and thumbnail scale — subject silhouette and hierarchy read clearly in both.Test plan
blender --background --python examples/parent-inverse-orrery/parent_inverse_orrery.py --exits 0 on Blender 5.1.2 (local)-- --output orrery.pngrenders on both 5.1.2 and 4.5.11; final image visually inspected at 1280×720 and thumbnail sizepython scripts/build_gallery.pyregenerateddocs/gallery/(index + 16 detail pages)🤖 Generated with Claude Code