Reframe procedural doctrine as spatial playbook
This commit is contained in:
parent
78c70c8b7f
commit
9c0e1b03c0
3 changed files with 330 additions and 161 deletions
|
|
@ -1,249 +1,416 @@
|
|||
# Procedural Geometry Doctrine
|
||||
|
||||
This note distills what the translation corpus teaches about turning geometric
|
||||
ideas into Geometry Script graphs.
|
||||
This note is a spatial reasoning playbook for turning geometric ideas into
|
||||
Geometry Script graphs. The metaphors are not decorative labels. They are meant
|
||||
to make the right tool feel salient when a form is still only a mental picture:
|
||||
a rail, a stencil, a chassis, a switchboard, a relay.
|
||||
|
||||
## Think In Pipelines
|
||||
Each pattern should answer four questions:
|
||||
|
||||
Most useful procedural graphs are not magic knots. They are pipelines:
|
||||
- What visual problem makes this tool relevant?
|
||||
- What mental move turns that problem into graph structure?
|
||||
- What does the Geometry Script shape look like?
|
||||
- What evidence proves the translation kept its behavior?
|
||||
|
||||
## Start With A Pipeline
|
||||
|
||||
Reach for this when the form feels like it has stages: a seed shape, a sampling
|
||||
strategy, a spatial rule, and a final visible body.
|
||||
|
||||
Mental move:
|
||||
|
||||
```text
|
||||
seed geometry -> sampled domain -> field math -> deformation -> realization
|
||||
visual target -> seed -> domain -> field rule -> deformation -> realization
|
||||
```
|
||||
|
||||
For the Cartesian examples:
|
||||
For a function plot, do not start by imagining mesh coordinates. Imagine a rail
|
||||
with evenly spaced stations, then a weather field that tells each station where
|
||||
to move.
|
||||
|
||||
```text
|
||||
line curve -> resampled curve points -> y=f(x) -> set position -> curve to mesh
|
||||
```python
|
||||
curve = curve_line(mode=CurveLine.Mode.POINTS, start=(0.0, 0.0, 0.0), end=(length, 0.0, 0.0))
|
||||
parts = separate_xyz(vector=position())
|
||||
y = math(operation=Math.Operation.ADD, value=(parts.x * m, value))
|
||||
positioned = curve.set_position(position=combine_xyz(x=parts.x, y=y, z=parts.z))
|
||||
mesh = positioned.curve_to_mesh(profile_curve=curve_circle(radius=thickness))
|
||||
```
|
||||
|
||||
The graph becomes legible when each stage has one job. If a stage cannot be
|
||||
named in plain language, it is probably hiding either cleverness or confusion.
|
||||
Both invoice later.
|
||||
Verification cue: evaluate the output geometry and compare vertices against the
|
||||
source or expected curve. A script that creates similar node names has not
|
||||
proved it has kept the shape.
|
||||
|
||||
## Curves Are Rails
|
||||
|
||||
A curve is the rail the shape rides on. It can be a crude two-point line at
|
||||
first. Detail comes later from resampling, profile thickness, and fields.
|
||||
Reach for curves when the target reads as a stroke, tube, arc, path, cable,
|
||||
branch, contour, function trace, or anything whose main identity is a route
|
||||
through space.
|
||||
|
||||
Geometry Script calls:
|
||||
Mental move: draw the centerline first. Thickness, surface, bevel, and material
|
||||
are later decisions. This keeps you from hand-authoring a mesh when the form is
|
||||
really a path wearing a body.
|
||||
|
||||
- `curve_line(...)` creates the rail.
|
||||
- `resample_curve(count=...)` places regular stations along it.
|
||||
- `curve_to_mesh(profile_curve=...)` gives it physical thickness.
|
||||
```python
|
||||
rail = curve_line(mode=CurveLine.Mode.POINTS, start=start, end=end)
|
||||
sampled = rail.resample_curve(count=sample_count)
|
||||
profile = curve_circle(mode=CurveCircle.Mode.RADIUS, resolution=32, radius=thickness)
|
||||
solid = sampled.curve_to_mesh(profile_curve=profile)
|
||||
```
|
||||
|
||||
Use curves when the intended form is a path, stroke, vine, tube, branch, cable,
|
||||
arc, contour, or function plot.
|
||||
Metaphor in use: a curve is the rail the shape rides on. If the idea in your
|
||||
head moves like a train route, script a rail before you script a surface.
|
||||
|
||||
Verification cue: compare the sampled path or the realized mesh. If downstream
|
||||
topology order matters, direct vertex order matters; otherwise sorted vertex
|
||||
comparison may be enough to prove the same visible path.
|
||||
|
||||
## Fields Are Weather
|
||||
|
||||
A field is not a stored list until Blender evaluates it. It is weather over the
|
||||
geometry: every point can ask, "what is the value here?"
|
||||
Reach for fields when the shape should respond to position, index, normal,
|
||||
random value, attribute, or any other per-element condition.
|
||||
|
||||
In the Cartesian graphs:
|
||||
Mental move: stop asking "what are the coordinates?" and ask "what does every
|
||||
point feel here?" The graph is not storing a list. It is defining weather that
|
||||
Blender evaluates over the current geometry.
|
||||
|
||||
- `position()` asks each point where it currently is.
|
||||
- `separate_xyz(position())` extracts the local X address.
|
||||
- math nodes compute the new Y value at that address.
|
||||
- `combine_xyz(...)` builds the target position field.
|
||||
```python
|
||||
parts = separate_xyz(vector=position())
|
||||
x_squared = math(operation=Math.Operation.POWER, value=(parts.x, 2.0))
|
||||
y = math(operation=Math.Operation.MULTIPLY, value=(x_squared, amplitude))
|
||||
target_position = combine_xyz(x=parts.x, y=y, z=parts.z)
|
||||
geometry = sampled_curve.set_position(position=target_position)
|
||||
```
|
||||
|
||||
Use fields when the graph should react to location, index, normal, random value,
|
||||
attributes, or any other per-element condition.
|
||||
Metaphor in use: a point enters the weather, asks for local X, gets back a Y
|
||||
rule, and moves. This is how equations, ripples, tapers, masks, and gradients
|
||||
become geometry without precomputing coordinates in Python.
|
||||
|
||||
Verification cue: test more than one parameter value. Field graphs often look
|
||||
right at one value and reveal swapped axes or stale constants when controls
|
||||
move.
|
||||
|
||||
## Set Position Is The Hinge
|
||||
|
||||
`Set Position` is where an invisible idea becomes shape. Before it, math is just
|
||||
a promise. After it, the geometry has moved.
|
||||
Reach for `set_position` when your graph has built an invisible spatial rule
|
||||
and needs to make it real.
|
||||
|
||||
The reliable pattern is:
|
||||
Mental move: preserve the coordinates that should remain stable, replace only
|
||||
the coordinate or offset that carries the design change, then let `Set Position`
|
||||
be the hinge between math and form.
|
||||
|
||||
```text
|
||||
source geometry
|
||||
+ target position field
|
||||
-> set_position(position=target)
|
||||
```python
|
||||
parts = separate_xyz(vector=position())
|
||||
new_y = math(operation=Math.Operation.ADD, value=(parts.x * slope, intercept))
|
||||
target = combine_xyz(x=parts.x, y=new_y, z=parts.z)
|
||||
positioned = source_geometry.set_position(position=target)
|
||||
```
|
||||
|
||||
For function curves, preserve X and Z from `Position`, then replace Y with the
|
||||
formula output. This keeps the rail's sampling and bends only the dimension you
|
||||
intend to control.
|
||||
For local nudges, use `offset` instead of an absolute `position`:
|
||||
|
||||
## Profiles Make Curves Inspectable
|
||||
|
||||
Curves can be visually thin or renderer-dependent. A circular profile turns a
|
||||
curve into an inspectable mesh:
|
||||
|
||||
```text
|
||||
curve_circle(radius=thickness) -> curve_to_mesh(profile_curve=profile)
|
||||
```python
|
||||
offset = combine_xyz(x=0.0, y=vertical_shift, z=0.0)
|
||||
dot = mesh_circle(fill_type=MeshCircle.FillType.NGON, vertices=32, radius=radius).set_position(offset=offset)
|
||||
```
|
||||
|
||||
Think of `Curve to Mesh` as dragging a drill bit along a path. The path gives
|
||||
direction; the profile gives body.
|
||||
Metaphor in use: before `Set Position`, the graph is making promises. After it,
|
||||
the object has moved. If you cannot name what is preserved and what changes,
|
||||
the hinge is probably attached to the wrong door.
|
||||
|
||||
## Attributes Are Optional Handles
|
||||
Verification cue: compare evaluated vertices before and after parameter changes
|
||||
that should move only one axis.
|
||||
|
||||
The Cartesian source graphs use:
|
||||
## Profiles Give Rails A Body
|
||||
|
||||
```text
|
||||
named_attribute("radius").exists
|
||||
? named_attribute("radius").attribute
|
||||
: 1.0
|
||||
Reach for profiles when a path exists but the renderable or inspectable object
|
||||
should have thickness.
|
||||
|
||||
Mental move: separate route from cross-section. The curve says where the object
|
||||
goes; the profile says what gets dragged along it.
|
||||
|
||||
```python
|
||||
profile = curve_circle(mode=CurveCircle.Mode.RADIUS, resolution=32, radius=thickness)
|
||||
mesh = path_curve.curve_to_mesh(profile_curve=profile)
|
||||
```
|
||||
|
||||
This is a good control pattern. A graph can expose a broad global control like
|
||||
`Thickness`, while also accepting a per-point or per-curve override when a
|
||||
`radius` attribute exists.
|
||||
When upstream geometry may carry variable thickness, look for an attribute
|
||||
handle:
|
||||
|
||||
Use this when a graph should work plainly by default but become more expressive
|
||||
when upstream geometry brings richer attributes.
|
||||
|
||||
## Groups Can Pass Batons
|
||||
|
||||
Reusable node groups do not have to output geometry alone. They can output
|
||||
state: an angle, count, bound, accumulated offset, or any other value the next
|
||||
group needs.
|
||||
|
||||
The pie chart segment returns:
|
||||
|
||||
```text
|
||||
Curve: visible wedge geometry
|
||||
End: the angle where the next wedge should begin
|
||||
```python
|
||||
radius = named_attribute(data_type=NamedAttribute.DataType.FLOAT, name="radius")
|
||||
scale = switch(input_type=Switch.InputType.FLOAT, switch=radius.exists, false=1.0, true=radius.attribute)
|
||||
mesh = path_curve.curve_to_mesh(profile_curve=profile, scale=scale)
|
||||
```
|
||||
|
||||
That makes the chart group a relay. Each segment runs its stretch, then passes
|
||||
the end angle forward. This is the pattern for cumulative structures: charts,
|
||||
stairs, chains, segmented shells, stacked floors, ribs, vertebrae, and anything
|
||||
where part N+1 depends on where part N stopped.
|
||||
Metaphor in use: `Curve to Mesh` is a drill bit dragged down a rail. A `radius`
|
||||
attribute lets some stations use a wider bit without changing the rail.
|
||||
|
||||
## Values Need Harnesses
|
||||
|
||||
Some node groups are value transducers rather than shape makers. They transform
|
||||
numbers, booleans, vectors, rotations, or strings so larger graph organs can use
|
||||
them later.
|
||||
|
||||
The `Digit At` translation extracts a single digit from a number. To verify it,
|
||||
the value output is wired into `Mesh Line.Count`; the number of evaluated
|
||||
vertices becomes the observable behavior.
|
||||
|
||||
Metaphor: if a graph only whispers a number, build a little megaphone around it.
|
||||
The verifier's job is not to be beautiful. It is to make the invisible output
|
||||
hard to lie about.
|
||||
|
||||
## Branch Helpers Are Switchboards
|
||||
|
||||
Some scalar helpers exist only to choose which already-tested value path should
|
||||
feed the next stage. `Next Digit` decides whether to read from the fractional
|
||||
part or the whole part of a number based on `Position < Max Precision`.
|
||||
|
||||
The useful pattern is:
|
||||
|
||||
```text
|
||||
branch condition -> candidate A -> candidate B -> switch -> value output
|
||||
```
|
||||
|
||||
Verify both sides of the branch. If all tests stay on one side, the switchboard
|
||||
has not actually been tested; it has merely sat there looking employed.
|
||||
|
||||
## Glyphs Are Parts
|
||||
|
||||
Display systems are made from small, boring geometry tokens: bars, dots,
|
||||
strokes, caps, labels. `Create Decimal` is only a filled circle moved downward,
|
||||
but naming it as a group gives the larger display graph a clean punctuation
|
||||
part instead of another anonymous mesh primitive.
|
||||
|
||||
Tiny named parts are not overengineering when they carry stable intent.
|
||||
|
||||
## Chassis Groups Compose Parts
|
||||
|
||||
Once a part has a stable contract, the next group up should read like assembly,
|
||||
not reinvention. `Seven Segments` does not know how to pinch bar tips; it calls
|
||||
`Create Segment` seven times with different orientation, length, thickness, and
|
||||
offset controls, then joins the results with a decimal dot.
|
||||
|
||||
The useful pattern is:
|
||||
|
||||
```text
|
||||
tested part -> repeated placements -> joined chassis -> later visibility logic
|
||||
```
|
||||
|
||||
Metaphor: the lower group machines the bolt. The chassis group decides where
|
||||
the bolts go. Keep those jobs separate so later graph layers can remove,
|
||||
materialize, or transform parts without reopening the primitive geometry logic.
|
||||
|
||||
## Boolean Thickets Are Often Tables
|
||||
|
||||
Large boolean node regions can look more algorithmic than they are. `Delete
|
||||
Segments` is mostly a truth table: compare the digit, compare the segment
|
||||
position, combine masks, and decide whether that part should disappear.
|
||||
|
||||
When a graph is a table, translate it as a table with named clauses:
|
||||
|
||||
```text
|
||||
input values -> grouped masks -> digit-specific clauses -> final OR
|
||||
```
|
||||
|
||||
The source node count is not sacred. The behavior is. A compact translation is
|
||||
acceptable when full-grid verification proves every input pair still lands on
|
||||
the same boolean result.
|
||||
Verification cue: inspect mesh vertex counts and bounding dimensions, not just
|
||||
the existence of a `Curve to Mesh` node.
|
||||
|
||||
## Field Masks Are Chisels
|
||||
|
||||
You can sculpt simple meshes by combining a regular seed mesh with field masks.
|
||||
`Create Segment` starts with a tiny grid, reads each vertex position, and uses
|
||||
comparisons to decide which corners receive a tip offset.
|
||||
Reach for field masks when a regular seed mesh should become a shaped part by
|
||||
moving only selected vertices, edges, faces, or instances.
|
||||
|
||||
The useful pattern is:
|
||||
Mental move: start with a boring mesh, describe the local conditions that mark
|
||||
the parts allowed to move, multiply the movement by those masks, then set
|
||||
position. This is how `Create Segment` turns a grid into a pointed display bar.
|
||||
|
||||
```text
|
||||
regular mesh -> position field -> boolean/math masks -> gated offset -> set position
|
||||
```python
|
||||
parts = separate_xyz(vector=position())
|
||||
major = switch(input_type=Switch.InputType.FLOAT, switch=x_major, false=parts.y, true=parts.x)
|
||||
secondary = switch(input_type=Switch.InputType.FLOAT, switch=x_major, false=parts.x, true=parts.y)
|
||||
|
||||
tip_amount = 0.5 * sharpness * secondary_axis_segment_thickness
|
||||
tip_vector = combine_xyz(x=x_major * tip_amount, y=(1.0 - x_major) * tip_amount, z=0.0)
|
||||
|
||||
on_side = compare(operation=Compare.Operation.NOT_EQUAL, data_type=Compare.DataType.FLOAT, a=secondary, b=0.0)
|
||||
positive_end = math(operation=Math.Operation.GREATER_THAN, value=(major, 0.0)) * on_side
|
||||
negative_end = math(operation=Math.Operation.LESS_THAN, value=(major, 0.0)) * on_side
|
||||
```
|
||||
|
||||
This is how a rectangle becomes a seven-segment bar with pointed ends. No custom
|
||||
mesh coordinates need to be hard-coded; the graph says which local conditions
|
||||
cause movement.
|
||||
Metaphor in use: the mask is the stencil; `Set Position` is the chisel strike.
|
||||
Do not hard-code every vertex if the part can be described as "these local
|
||||
conditions get this movement."
|
||||
|
||||
## Stack Abstractions Carefully
|
||||
Verification cue: test both orientations. The horizontal and vertical segment
|
||||
cases caught whether major and secondary axes were wired correctly.
|
||||
|
||||
There are two abstraction layers available:
|
||||
## Glyphs Are Parts
|
||||
|
||||
- Python authoring abstractions: helper functions that emit repeated node
|
||||
patterns.
|
||||
- Blender graph abstractions: reusable node groups nested inside other node
|
||||
groups.
|
||||
Reach for named glyph parts when a larger form is built from small repeated
|
||||
tokens: bars, dots, strokes, caps, labels, ticks, beads, rivets.
|
||||
|
||||
The repo-local Geometry Script clone needed a Blender 5.1 patch before nested
|
||||
`@tree` group references worked. After that patch, nested groups are the
|
||||
preferred form for stable motifs with a named contract. Python helper functions
|
||||
remain useful for tiny repeated node idioms or for sketching before a motif
|
||||
deserves a public socket surface.
|
||||
Mental move: isolate the small thing by intent, even if its geometry is simple.
|
||||
The point is not abstraction theater; it is making future composition read like
|
||||
the visual idea.
|
||||
|
||||
Metaphor: a Python helper is a stencil. It draws the same shape again wherever
|
||||
you place it. A node group is a machine part bolted into another machine. Both
|
||||
are useful, but they fail differently.
|
||||
```python
|
||||
@tree("VG Create Decimal")
|
||||
def vg_create_decimal(vertical_segment_size: Float = 2.0, radius: Float = 0.0):
|
||||
dot = mesh_circle(fill_type=MeshCircle.FillType.NGON, vertices=32, radius=radius)
|
||||
offset = combine_xyz(x=0.0, y=-1.0 * vertical_segment_size, z=0.0)
|
||||
return {"Dot": dot.set_position(offset=offset)}
|
||||
```
|
||||
|
||||
## Verify Shape, Not Just Vocabulary
|
||||
Metaphor in use: a decimal point is punctuation geometry. Naming it keeps the
|
||||
display script from devolving into anonymous circles with suspicious offsets.
|
||||
|
||||
Matching node types is weak evidence. Matching evaluated output is strong
|
||||
evidence.
|
||||
Verification cue: compare the part alone before composing it into the larger
|
||||
system.
|
||||
|
||||
Use multiple checks:
|
||||
## Chassis Groups Compose Parts
|
||||
|
||||
- Node vocabulary and link shape: catches obvious translation mistakes.
|
||||
- Interface sockets: catches broken control contracts.
|
||||
- Evaluated vertex comparison: catches semantic drift.
|
||||
- Sorted vertex comparison: useful when generated geometry is identical but
|
||||
join/order differs.
|
||||
- Direct vertex comparison: needed when downstream topology order matters.
|
||||
Reach for chassis groups when tested parts need to be arranged into a reusable
|
||||
frame: digits, panels, facades, mechanical assemblies, tiled motifs, creature
|
||||
limbs, modular buildings.
|
||||
|
||||
The circle translation proves the distinction: the geometry matched exactly as
|
||||
a set of vertices, but direct vertex order differed even after restoring nested
|
||||
group reuse. Matching shape and matching topology order are related but not the
|
||||
same promise.
|
||||
Mental move: do not reopen the primitive geometry. Compute placements, call the
|
||||
part group repeatedly, and join the result. `Seven Segments` uses the tested
|
||||
bar and dot groups to build a digit scaffold.
|
||||
|
||||
## Control Names Are Contracts
|
||||
```python
|
||||
half_x = horizontal_segment_size / 2.0
|
||||
half_y = vertical_segment_size / 2.0
|
||||
bar_length = horizontal_segment_size - x_separation
|
||||
|
||||
Geometry Script may title-case parameter names. For user-facing groups,
|
||||
post-generation cleanup can be needed to preserve source-compatible controls
|
||||
such as `r`, `m`, `a`, `b`, and `c`.
|
||||
top = vg_create_segment(
|
||||
x_major=True,
|
||||
segment_length_along_x=bar_length,
|
||||
segment_length_along_y=horizontal_segment_thickness,
|
||||
secondary_axis_segment_thickness=vertical_segment_thickness,
|
||||
sharpness=tip_sharpness,
|
||||
offset=combine_xyz(x=0.0, y=vertical_segment_size, z=0.0),
|
||||
)
|
||||
|
||||
Do not treat socket names as cosmetic. They are the handles an agent or artist
|
||||
will grab later. Bad handles make good machinery feel broken.
|
||||
return {"bars": join_geometry(geometry=[top, middle, bottom, upper_left, lower_left, upper_right, lower_right, dot])}
|
||||
```
|
||||
|
||||
Metaphor in use: the lower group machines the bolt. The chassis group decides
|
||||
where the bolts go. Keep those jobs separate so later visibility or material
|
||||
logic can act on the assembly.
|
||||
|
||||
Verification cue: compare the whole chassis geometry and preserve part names in
|
||||
script even when the output is one joined stream.
|
||||
|
||||
## Groups Can Pass Batons
|
||||
|
||||
Reach for baton outputs when part N+1 depends on state produced by part N:
|
||||
angles, offsets, bounds, accumulated length, counts, or any other running value.
|
||||
|
||||
Mental move: return visible geometry plus the state the next group needs. The
|
||||
pie segment returns its wedge and the angle where the next wedge should begin.
|
||||
|
||||
```python
|
||||
@tree("VG Pie Segment")
|
||||
def vg_pie_segment(start: Float, value: Float, total: Float):
|
||||
sweep = value / total * TAU
|
||||
end = start + sweep
|
||||
arc_curve = arc(mode=Arc.Mode.RADIUS, radius=1.0, start_angle=start, sweep_angle=sweep, connect_center=True)
|
||||
return {"Curve": arc_curve.fill_curve(), "End": end}
|
||||
|
||||
a_geometry, a_end = vg_pie_segment(start=0.0, value=a, total=total)
|
||||
b_geometry, b_end = vg_pie_segment(start=a_end, value=b, total=total)
|
||||
```
|
||||
|
||||
Metaphor in use: each group runs its stretch and passes the baton. This is the
|
||||
pattern for charts, stairs, chains, segmented shells, ribs, tracks, and
|
||||
anything cumulative.
|
||||
|
||||
Verification cue: test the composed graph, not only the segment. A baton can be
|
||||
correct locally but passed to the wrong next socket.
|
||||
|
||||
## Branch Helpers Are Switchboards
|
||||
|
||||
Reach for branch helpers when the same output contract can be fed by multiple
|
||||
candidate value paths.
|
||||
|
||||
Mental move: compute both candidates, compute the condition, switch. `Next
|
||||
Digit` chooses whether the current display position reads from the fractional
|
||||
part or the whole part.
|
||||
|
||||
```python
|
||||
whole_position = math(operation=Math.Operation.SUBTRACT, value=(position, max_precision))
|
||||
use_fraction = math(operation=Math.Operation.LESS_THAN, value=(position, max_precision))
|
||||
whole_digit = vg_digit_at(number=whole_part, position=whole_position)
|
||||
fraction_digit = vg_digit_at(number=fraction_part, position=position)
|
||||
|
||||
return switch(input_type=Switch.InputType.INT, switch=use_fraction, false=whole_digit, true=fraction_digit)
|
||||
```
|
||||
|
||||
Metaphor in use: a switchboard does not make the signal interesting. It routes
|
||||
the right signal at the right moment. Verify both sides or it has merely sat
|
||||
there looking employed.
|
||||
|
||||
Verification cue: choose cases on both sides of the branch boundary.
|
||||
|
||||
## Boolean Thickets Are Often Tables
|
||||
|
||||
Reach for table translation when a dense boolean region is mostly comparisons
|
||||
against constants and OR/AND wiring.
|
||||
|
||||
Mental move: name the masks and clauses. Preserve behavior, not the ceremony of
|
||||
every source `OR` node. `Delete Segments` is a truth table for which segment
|
||||
positions should disappear for a digit.
|
||||
|
||||
```python
|
||||
p01 = _int_equal(segment_position, 0) | _int_equal(segment_position, 1)
|
||||
p45 = _int_equal(segment_position, 4) | _int_equal(segment_position, 5)
|
||||
p67 = _int_equal(segment_position, 6) | _int_equal(segment_position, 7)
|
||||
|
||||
d1 = _float_equal(digit_minus_one, 1.0)
|
||||
delete_for_one = d1 & ~(p45 | p67)
|
||||
|
||||
return delete_for_zero | delete_for_one | delete_for_two | delete_for_decimal
|
||||
```
|
||||
|
||||
Metaphor in use: this is a stencil card, not a sculptor. Given a digit and slot,
|
||||
it punches out the pieces that should go dark.
|
||||
|
||||
Verification cue: full-grid verification beats reverent node copying. The
|
||||
translated delete mask was checked across 195 digit/segment-position cases.
|
||||
|
||||
## Values Need Megaphones
|
||||
|
||||
Reach for harnesses when the graph returns an invisible scalar, boolean, vector,
|
||||
rotation, or string and you need behavioral evidence.
|
||||
|
||||
Mental move: convert the value into small observable geometry. For integer
|
||||
digits, drive `Mesh Line.Count`; for booleans, switch between count 0 and 1.
|
||||
|
||||
```python
|
||||
digit = nodes.new("GeometryNodeGroup")
|
||||
digit.node_tree = bpy.data.node_groups["VG Digit At"]
|
||||
|
||||
line = nodes.new("GeometryNodeMeshLine")
|
||||
line.count_mode = "TOTAL"
|
||||
links.new(digit.outputs["Result"], line.inputs["Count"])
|
||||
```
|
||||
|
||||
Metaphor in use: if a graph only whispers a number, build a little megaphone.
|
||||
The harness does not need to be beautiful. It needs to make the output hard to
|
||||
lie about.
|
||||
|
||||
Verification cue: record the harness because it defines what behavior was made
|
||||
observable.
|
||||
|
||||
## Stack Abstractions Deliberately
|
||||
|
||||
Reach for Python helpers when repeating a tiny authoring idiom. Reach for
|
||||
nested node groups when a motif has a stable visual or semantic contract that
|
||||
future graphs should grab by name.
|
||||
|
||||
Mental move:
|
||||
|
||||
```text
|
||||
one-off repeated node idiom -> Python helper
|
||||
reusable graph part with sockets -> @tree node group
|
||||
larger assembly -> nested @tree calls
|
||||
```
|
||||
|
||||
```python
|
||||
def _int_equal(value, target: int):
|
||||
return compare(operation=Compare.Operation.EQUAL, data_type=Compare.DataType.INT, a=value, b=target)
|
||||
|
||||
@tree("VG Seven Segments")
|
||||
def vg_seven_segments(...):
|
||||
top = vg_create_segment(...)
|
||||
dot = vg_create_decimal(...)
|
||||
return {"bars": join_geometry(geometry=[top, dot])}
|
||||
```
|
||||
|
||||
Metaphor in use: a Python helper is a stencil; a node group is a machine part
|
||||
with bolt holes. Stencils keep authoring clean. Machine parts keep graphs
|
||||
inspectable.
|
||||
|
||||
Verification cue: nested groups require both generation checks and behavior
|
||||
checks. The local Geometry Script fork exists because nested `@tree` calls had
|
||||
to be patched for Blender 5.1.
|
||||
|
||||
## Verify Shape, Contract, And Intent
|
||||
|
||||
Reach for verification before accepting any translation, especially when the
|
||||
script feels obvious. Obvious code is where quiet swaps and axis mistakes go to
|
||||
breed paperwork.
|
||||
|
||||
Mental move: choose the evidence that matches the promise.
|
||||
|
||||
- Interface sockets prove the control contract.
|
||||
- Node vocabulary catches broad translation mistakes.
|
||||
- Evaluated vertices prove visible shape.
|
||||
- Sorted vertices prove identical shape when join order differs.
|
||||
- Direct vertex order proves topology/order-sensitive behavior.
|
||||
- Scalar harnesses prove invisible values.
|
||||
- Full-grid tests prove table behavior.
|
||||
|
||||
```python
|
||||
max_delta = max(
|
||||
(math.dist(a, b) for a, b in zip(sorted(source_vertices), sorted(translated_vertices))),
|
||||
default=0.0,
|
||||
)
|
||||
ok = len(source_vertices) == len(translated_vertices) and max_delta <= 1e-6
|
||||
```
|
||||
|
||||
Metaphor in use: verification is not a trophy ceremony. It is a pressure test
|
||||
on the exact promise the graph is making.
|
||||
|
||||
## Control Names Are Handles
|
||||
|
||||
Reach for socket cleanup when Geometry Script's generated names drift away from
|
||||
the source or intended user-facing contract.
|
||||
|
||||
Mental move: treat names as the handles an artist, agent, or future graph grabs
|
||||
later. Do not let generated title casing silently change the control surface.
|
||||
|
||||
```python
|
||||
for item in group.interface.items_tree:
|
||||
if item.item_type == "SOCKET" and item.in_out == "OUTPUT" and item.name == "Bars":
|
||||
item.name = "bars"
|
||||
if item.item_type == "SOCKET" and item.in_out == "INPUT" and item.name in {"Radius", "Offset"}:
|
||||
item.name = item.name.lower()
|
||||
```
|
||||
|
||||
Metaphor in use: bad handles make good machinery feel broken. The graph can be
|
||||
mathematically correct and still hostile if the controls are named wrong.
|
||||
|
||||
Verification cue: inspect interface sockets after generation, not just Python
|
||||
function signatures.
|
||||
|
|
|
|||
|
|
@ -41,13 +41,14 @@ The completed pie chart translation is
|
|||
|
||||
The completed field-value helper translation is
|
||||
`docs/research/translations/shriinivas-fieldvalue-digit-at.md`. It covers
|
||||
`Create Decimal`, `Create Segment`, `Seven Segments`, `Delete Segments`, and
|
||||
`Create Decimal`, `Create Segment`, `Seven Segments`, `Delete Segments`,
|
||||
`Next Digit`, and `Digit At` from `fieldvalue.blend`.
|
||||
|
||||
`docs/research/procedural-doctrine.md` now stores the current intuitive model
|
||||
for mapping geometric ideas to Geometry Script: curves as rails, fields as
|
||||
weather, `Set Position` as the hinge, profiles as body, attributes as optional
|
||||
handles, and Python helpers as authoring stencils.
|
||||
`docs/research/procedural-doctrine.md` now stores the current spatial reasoning
|
||||
playbook for mapping geometric ideas to Geometry Script. Doctrine entries should
|
||||
explain when a tool becomes salient for a visual form, the mental move that
|
||||
turns the form into graph structure, a small code sketch, and the verification
|
||||
cue.
|
||||
|
||||
The repo-local Geometry Script clone has a Blender 5.1 patch for nested `@tree`
|
||||
group reuse. See `docs/research/geometry-script-fork-notes.md`.
|
||||
|
|
|
|||
|
|
@ -17,3 +17,4 @@
|
|||
{"ts": "2026-05-04T13:34:19+00:00", "type": "implementation", "status": "accepted", "note": "Extended fieldvalue translation with Delete Segments -> VG Delete Segments. Verified source and translation across 195 digit/segment-position cases with zero mismatches by driving the boolean output into a Mesh Line count harness. Doctrine added: dense boolean node regions often encode lookup tables and should be translated into named clauses plus full-grid verification."}
|
||||
{"ts": "2026-05-04T13:37:51+00:00", "type": "implementation", "status": "accepted", "note": "Extended fieldvalue translation with Next Digit -> VG Next Digit. Verified four branch cases spanning both sides of Max Precision by driving Result into Mesh Line.Count; all source and translated counts matched."}
|
||||
{"ts": "2026-05-04T13:37:51+00:00", "type": "research", "status": "accepted", "note": "Full fieldvalue Field Value graph is a 176-node composition with menu switches, capture attributes across domains, sample-index reads, instancing, transforms, delete geometry, and material assignment. Manual one-pass translation would be high-risk; next action should test or port upstream Geometry Script nodes_to_script as a generated first-draft tool before attempting the full graph."}
|
||||
{"ts": "2026-05-04T13:47:26+00:00", "type": "documentation", "status": "accepted", "note": "Reframed procedural doctrine as a spatial reasoning playbook rather than abstraction glossary. Each doctrine pattern should describe the visual cue, mental move, Geometry Script code shape, and verification cue so metaphors help an agent choose tools while reasoning about form."}
|
||||
|
|
|
|||
Loading…
Reference in a new issue