get method
dynamic
get(
- dynamic node,
- dynamic prop
Implementation
get(node, prop) {
if (prop is String && node[prop] == null) {
if (RegExp(r"^[xyzwrgbastpq]{1,4}$").hasMatch(prop) == true) {
// accessing properties ( swizzle )
prop = prop
..replaceAll(RegExp(r"r|s"), 'x')
.replaceAll(RegExp(r"g|t"), 'y')
.replaceAll(RegExp(r"b|p"), 'z')
.replaceAll(RegExp(r"a|q"), 'w');
return shaderNodeObject(SplitNode(node, prop));
} else if (RegExp(r"^\d+$").hasMatch(prop) == true) {
// accessing array
return shaderNodeObject(ArrayElementNode(node, FloatNode(num.parse(prop)).setConst(true)));
}
}
return node[prop];
}