PyOpenColorIO Constants change from version 1 to 2


Rajiv Perseedoss
 

Hi all,
I've come across an issue with PyOpenColorIO where the constants seem to have been restructured from OCIO 1 to 2 and I can't seem to find any documentation or any mention of this in the changelog. This is the issue:
 
import PyOpenColorIO as OCIO

# OCIO 1
OCIO.Constants.ROLE_TEXTURE_PAINT

# OCIO 2
OCIO.ROLE_TEXTURE_PAINT
 
 
All the roles from Constants are now moved. Is that true or am I missing something here?
If this has indeed changed from OCIO 1 to 2, is there any way for me to detect the OCIO version through python and put some sort of guard, so that my script could still be backward compatible? i.e., something like this?
 
import PyOpenColorIO as OCIO

if "OCIO_VERSION" < 2:
  OCIO.Constants.ROLE_TEXTURE_PAINT
else:
  OCIO.ROLE_TEXTURE_PAINT
 
 
Thanks
Rajiv

Join ocio-dev@lists.aswf.io to automatically receive all group messages.