#[non_exhaustive]pub struct Node { /* private fields */ }Expand description
One ɴsɪ node.
Implementations§
Source§impl Node
impl Node
Sourcepub fn attributes(&self) -> impl Iterator<Item = (&str, &OwnedArgument)>
pub fn attributes(&self) -> impl Iterator<Item = (&str, &OwnedArgument)>
This node’s static attributes, by name.
Sourcepub fn attribute(&self, name: &str) -> Option<&OwnedArgument>
pub fn attribute(&self, name: &str) -> Option<&OwnedArgument>
One static attribute by name.
Use Node::effective unless you mean the static one
specifically: an attribute set with SetAttributeAtTime is
not here, and the renderer honours it.
Sourcepub fn samples(&self) -> impl Iterator<Item = (&str, &[(f64, OwnedArgument)])>
pub fn samples(&self) -> impl Iterator<Item = (&str, &[(f64, OwnedArgument)])>
This node’s sampled attributes, by name, each in call order.
Sourcepub fn sample_calls(&self, name: &str) -> Option<&[(f64, OwnedArgument)]>
pub fn sample_calls(&self, name: &str) -> Option<&[(f64, OwnedArgument)]>
The calls that set one attribute at a time, in call order.
Sourcepub fn f32(&self, name: &str) -> Option<f32>
pub fn f32(&self, name: &str) -> Option<f32>
One attribute as a single f32.
Reads the effective value – static or the last call at a
time – and yields None when the attribute is absent or is not
exactly one f32. A backend pulling one number out of a node
wrote node.effective(name).and_then(OwnedArgument::as_f32)
before this existed; twenty such sites in one backend’s flush
path is what asked for these.
Sourcepub fn flag(&self, name: &str) -> Option<bool>
pub fn flag(&self, name: &str) -> Option<bool>
One attribute as an ɴsɪ integer flag.
ɴsɪ writes booleans as int with 0 and 1 – withalpha,
dithering, clockwisewinding – so this is the shape those
are read in. Anything other than a single integer is None,
which a caller replaces with the attribute’s documented
default rather than with false.
Sourcepub fn string(&self, name: &str) -> Option<&str>
pub fn string(&self, name: &str) -> Option<&str>
One attribute as a single string.
None for a value that is not UTF-8, which is not the same
as absent: an ɴsɪ string is bytes, and a file name on Linux need
not be UTF-8. Use Node::bytes where the value may be a path;
this is for the enumerants – "shader", "uint8", "color"
– where UTF-8 is the whole vocabulary.
Sourcepub fn effective(&self, name: &str) -> Option<&OwnedArgument>
pub fn effective(&self, name: &str) -> Option<&OwnedArgument>
This node’s effective value for an attribute.
Use this, not Node::attributes. SetAttributeAtTime on an
attribute
that is not motion data sets it for the whole shutter, exactly
as SetAttribute would: rendered, an attributes node whose
visibility is set only through SetAttributeAtTime hides the
object, identically to the static form. Reading Node::attributes
alone answers “not set” for an attribute the renderer honours,
which is a silent wrong answer – and was one here until it was
rendered.
Static first, then the last call, which is not the sample
at the greatest time – see Node::samples for the render
that separates the two. The static value and the samples never
coexist: set_attribute clears that name from the log and
set_attribute_at_time clears the static value, which is ɴsɪ’s
own rule and 3Delight’s behaviour.
This is what the resolver reads, so a backend asking a node directly gets the same answer the resolver would.