Psyop / CryptomatteArnold

Cryptomatte for Arnold
BSD 3-Clause "New" or "Revised" License
54 stars 19 forks source link

Support layer tokens in outputs #8

Closed sebastienblor closed 2 years ago

sebastienblor commented 2 years ago

This PR requires #7 to be merged first as it's based on this branch. Reason is that part of the code that has to be added for the layers is in a chunk that is modified by the first PR.

Apart from the changes in #7 , the changes here are that we're adding one more token in TokenizedOutputs called layer_tok and we're reading one more token c6. We need to make the tokens "testing" more robust, since there are several optional tokens that make the logic a bit complicated. The rationale is as follow :

This PR reproduces this logic parsing the output lines.

Note that, in setup_new_outputs when we create the "rank" AOVs (e.g. crypto_material00, crypto_object01, etc...) we copy the "parent" AOV (e.g. crypto_material) and modify the aov name and filter. Now, if a layer name is present we also need to modify it, otherwise this new output would conflict with the parent one. The logic I'm using here is to add the same "rank" suffix to the layer than the one we add to the AOV. So if crypto_material has a layer name called kryptonite, then crypto_material00 will have a layer name set to kryptonite00, etc...

In theory, this PR shouldn't change anything when no layer name token is present, but it does change the logic of parsing the outputs, so it needs to be tested carefully to ensure it's not causing any regression