getSceneProperty function
Read one authored property by the name a SceneNode.bindings entry keys it under — the table's reader, with the two shapes a binding sees differently: edges as their uniform value, a nested argument at its override else the child's default.
Implementation
Object? getSceneProperty(SceneNode node, String prop) =>
switch (resolveSceneKey(node, prop)) {
ScenePropertyKey(:var prop) => switch (prop.kind) {
ScenePropKind.edges => (prop.read(node)! as SceneQuad).sides.first,
ScenePropKind.size => sizeToWire(prop.read(node) as double?),
_ => prop.read(node),
},
ScenePartKey(:var prop, :var part) when prop.kind == ScenePropKind.args =>
switch (node) {
SceneRefNode r =>
r.args[part] ?? r.instance?.paramNamed(part)?.defaultValue,
ExternalNode e => e.args[part],
_ => null,
},
ScenePartKey(:var prop, :var part) when prop.kind == ScenePropKind.axes =>
(prop.read(node)! as Map<String, double>)[part],
ScenePartKey(:var prop, :var sideIndex) =>
(prop.read(node)! as SceneQuad).sides[sideIndex],
null => null,
};