katana – CEL expr, objects with a parameter value
Cel expressions are a powerful tool In katana to assign, select, prune, collect objects according to an specific rule.
This is even more powerful when couple with a pipeline and a defined workflow.
Adding custom parameters and values to the objects, and pushing those into an alembic .abc file can give you further control over how to apply this rules in your Katana templates.
For example, you can add a parameter to the alembic, to read in katana this way:
/root/world//*{attr("geometry.arbitrary.myCustomAttr.value") == "myCustomStringValue"}
This will do the operation on all the objects under the scene location /root/world, that their “myCustomAttr” attribute value matches “myCustomStringValue”.
But what if you want to do prune all the objects that the attr value does not match? for ie: prune all object that the value is not “myCustomStringValue”. So you end up with only the ones that match.
In this case you would use the != operator right? however, this will evaluate as True also for the objects that do not have the parameter!
So for this scenario, you need to first encompass the objects that Do have the attribute, and from that group remove the objects that match the value.
Prune=(all objects that have the attr) minus (objects that the attr matches to the value)
/root/world//*{hasattr("geometry.arbitrary.myCustomAttr")} - /root/world//*{attr("geometry.arbitrary.myCustomAttr.value") == "myCustomStringValue"}
This above, would prune all objects, except the ones that myCustomAttr matches MyCustomStringValue