I can't figure out how to get a list of all available view transforms and display devices with Python.

For color spaces I am using this code and it works as expected:

enums = bpy.context.scene.render.image_settings.linear_colorspace_settings.bl_rna.properties['name'].enum_items
for enum in enums:

But these both attempts for view transforms and display devices are returning only one entry with 'None':



When I try to purposely set a wrong view_transform or display_device, I get error messages with the desired list of all available enum_items:

TypeError: bpy_struct: item.attr = val: enum "xy" not found in ('Standard', 'Filmic', 'Filmic Log', 'Raw', 'False Color')

TypeError: bpy_struct: item.attr = val: enum "xy" not found in ('sRGB', 'XYZ', 'None')

If the error message returns me that list, it means Blender can read them somehow, doesn't it? But how can I get access to it in a clean way? Parsing it from an error message doesn't seem right to me.

Or is there maybe another way to get all view transforms and display devices from an ocio config file inside Blender with Python?

  • $\begingroup$ AFAIK it's not possible to retrieve it that way, the last solution I witnessed to this problem was to purposely provide a wrong enum argument, capture the error message string, slice out the start and process the parts between the parentheses. You can also try enum_items_static instead of enum_items $\endgroup$
    – Gorgious
    Sep 9, 2022 at 19:34
  • $\begingroup$ Thanks for the quick answer @Gorgious. I was hoping that there is a less dirty way to do it. Already tried enum_items_static but it has the same result. $\endgroup$
    – fishsnack
    Sep 10, 2022 at 18:29
  • $\begingroup$ Yeah it's horribly dirty :p but it seems to work... until something somewhere changes and it doesn't work anymore $\endgroup$
    – Gorgious
    Sep 10, 2022 at 18:32

1 Answer 1


I still couldn't find out how Blender is doing it. There is this official python module PyOpenColorIO but it's not included in Blender as far as I can see.

For now this is my solution and it might be also helpful for someone else:

def get_ocio_settings():
    displays = []
    views = []
    # check user defined ocio path
    ocio_path = os.environ.get('OCIO')
    # get blender default ocio path
    if not ocio_path or not os.path.isfile(ocio_path):
        bl_dir = os.path.dirname(bpy.app.binary_path)
        bl_version = bpy.app.version
        ocio_dir = os.path.join(bl_dir, '{}.{}'.format(bl_version[0], bl_version[1]), 'datafiles', 'colormanagement')
        ocio_path = os.path.join(ocio_dir, 'config.ocio')
    # parse ocio file for active displays and active views
    if os.path.isfile(ocio_path):
        with open(ocio_path) as f:
            for line in f.readlines():
                if 'active_displays: ' in line:
                    string = line.strip('active_displays: ').strip()
                    displays = ''.join(filter(lambda x: x not in '[]', string)).split(', ')
                elif 'active_views: ' in line:
                    string = line.strip('active_views: ').strip()
                    views = ''.join(filter(lambda x: x not in '[]', string)).split(', ')
    return displays, views

The script is looking for the ocio config file and parses it for the lines starting with "active displays" or "active views". If it can find them, it strips everything redundant and returns all the active displays and views as a list.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .