Register class 'ImageFormatSettings' as a new Viewlayer property

Hi all,

I am looking for a solution to this problem and couldn’t find anything online:

There is this class ImageFormatSettings which is for example used for the render settings in


and can be displayed in the ui with the template_image_settings function:

UILayout.template_image_settings(bpy.context.scene.render.image_settings, color_management=False)

I am currently looking for a way to distribute this class as a property of every viewlayer. So you can change the image output settings per viewlayer and display the settings easily with the layout function mentioned before.

This was my approach (which obviously does not work because it can’t be registered like a PropertyGroup):

import bpy

def register():
    bpy.types.ViewLayer.image_format_settings = bpy.props.PointerProperty(type=bpy.types.ImageFormatSettings)

My current workaround is to register my own custom PropertyGroup and add most of the settings of the ImageFormatSettings class as properties manually. But this way I can’t use the ui template function which is really handy because it changes its layout automatically depending on the current file format.

If anyone has a solution for that, I would be really grateful.