mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-25 11:08:11 +08:00
Resolve a named read's offset when the graph compiles
The fold already holds the name and the read input's finished layout, so the offset falls out there rather than at construction: `RecordLayout` carries the resolved numbers and `set_layout` copies them into the read slots. Constructors are untouched, and census-marker reads keep their current installation. A read meets the value type the name was written at, so a disagreement between a read here and a write upstream is the same graph error as two writes disagreeing; the one-name-one-type check now spans reads and writes together. An absent attribute stays absent and the read serves the forced default rather than reporting it. `read_attribute` is the catalog's get half, typed and never `Option` at the kernel boundary, with the name declared exactly as the write side declares it. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
fc94487d0b
commit
5eb80721dd
@@ -387,6 +387,22 @@ pub fn write_attribute<'e, T, V: WireValue>(
|
||||
Ok((content, Attr(parked)))
|
||||
}
|
||||
|
||||
/// Reads the attribute `name` names off each lane. An absent attribute reads as
|
||||
/// the name's own default, so the value carries the declared type either way;
|
||||
/// the name is constant text the compiler folds into an offset when the graph
|
||||
/// compiles.
|
||||
#[node_macro::node(category("Attributes: Read"))]
|
||||
pub fn read_attribute<'e>(
|
||||
_: impl Ctx,
|
||||
/// The content whose lanes carry the attribute.
|
||||
(content, value): (f64, Attr<'e, Named<Name0, f64>>),
|
||||
/// The attribute name, folded into an offset when the graph compiles.
|
||||
name: Named<Name0>,
|
||||
) -> f64 {
|
||||
let _ = content;
|
||||
*value
|
||||
}
|
||||
|
||||
/// Joins two levels of the same type, the base's lanes followed by the new's.
|
||||
#[node_macro::node(category("General"), extent(extend_extent))]
|
||||
pub fn extend<T>(
|
||||
|
||||
Reference in New Issue
Block a user