Since last week Blender has Cryptomatte in its core (BlenKernel module). This makes it easier to add an python API for cryptomatte. https://developer.blender.org/T82576 is a task that shows several ways how to setup the API. I would like to have some feedback on the proposed API.
The API can be used to extract Cycles/EEVEE cryptomatte hashes using python. An example what could be done using this API is to create a sidecar JSON file. What we also want to know are what use cases this API should be targeted at.
The proposal will add functions to the Object and Material RNA struct that returns a CryptomatteHash object. The object has functions to retrieve the representation of the hash as a float or an uint.
I’d like to understand the specific use case for this. If it’s mainly to generate the JSON file, perhaps we simply need an API function to generate a complete JSON string for a scene?
Because we might want to support writing that into OpenEXR metadata as part of render output, and if we do then we probably should have that implementation in C/C++. Though I’m not sure how easy it is to do e.g. escaping of name strings for JSON.
Or are there cases where users somehow want to customize the contents of that JSON file, and getting a complete JSON string would not work?
The other thing to note is that a render is done from a render mode evaluated scene, potentially with objects instances that may not exist in the original scene or the scene evaluated in viewport mode. I’m not sure if that’s an issue, or if those instances will somehow share an hash with the original object.