Re: PyOpenColorIO Constants change from version 1 to 2


Mark Titchener
 

Hi Rajiv,

I believe this was an intentional change and I think it was done as part of this commit https://github.com/AcademySoftwareFoundation/OpenColorIO/pull/976.

There are functions to set/get the the major/minor version of the config e.g. getMajorVersion()

You can find more info here:

Hope this helps!

Thanks,
Mark


On Thu, 30 Jun 2022 at 10:14, rajiv.perseedoss via lists.aswf.io <rajiv.perseedoss=framestore.com@...> wrote:

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



--

Mark Titchener

Principal Product Designer

Tel: +44 (0)20 7479 4350

Web: www.foundry.com


The Foundry Visionmongers Ltd.  -  Registered in England and Wales No: 4642027  -  Address: 5 Golden Square, London, W1F 9HT  -  VAT No: 945701320

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