so I want to get the list of available render engines, like in the error shown to check if luxcore is available, a workaround is to list the attribute names of bpy.context.scene if there's the luxcore string but I don't think this is neat

Traceback (most recent call last):
  File "<blender_console>", line 1, in <module>
TypeError: bpy_struct: item.attr = val: enum "FOO" not found in ('BLENDER_EEVEE', 'BLENDER_WORKBENCH', 'CYCLES', 'LUXCORE')

This is the error thrown when you set a random string in C.scene.render.engine = 'FOO'

  • 2
    $\begingroup$ A possible answer is in this question: blender.stackexchange.com/questions/58030/… but I noticed something odd: when listing the enum entires for the render engine, only BLENDER_EEVEE is listed. When trying other enum properties in Blender, multiple values are listed as expected. Not sure why this is. $\endgroup$ – RLGUY Oct 1 at 0:18
  • 1
    $\begingroup$ This is handled a bit strangely by Blender, the enum is initialized only with Eevee in the items and the others can't be access through the bl_rna properties with enum_items. For every render engine that is registered through Python inheriting from bpy.types.RenderEngine you can list them through bpy.types.RenderEngine.__subclasses__() and their respective bl_idname. This however does not include BLENDER_EEVEE and BLENDER_WORKBENCH. $\endgroup$ – Robert Gützkow Oct 1 at 9:53
  • $\begingroup$ As far as I can tell the enum is dynamically populated by rna_RenderSettings_engine_itemf in rna_scene.c. $\endgroup$ – Robert Gützkow Oct 1 at 10:12
  • $\begingroup$ For luxcore using bpy.types.RenderEngine.__subclasses__() lists luxcore and cycles, but the others not, maybe because blender_eevee and blender workbench are not addons, and listing enum properties (didn't know that, nice) should list the entries like in the error. $\endgroup$ – Iszotic Oct 2 at 3:52
  • $\begingroup$ @Iszotic yes Eevee and the Workbench engine are considered internal (which they are) and therefore not inheriting the RenderEngine class, which is only the case for the Python add-ons. The enum_items only contains the value from the time of declaration, where only BLENDER_EEVEE is in it. It works when adding the bpy.context.scene.render.engine as prop in a panel, because that internally retrieves the items through the additional callback function rna_RenderSettings_engine_itemf which is not accessible through the Python API. $\endgroup$ – Robert Gützkow Oct 2 at 22:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.