I wanted to change the cycles render to Blender internal through a panel button but only want the panel button to appear only when the current render engine is cycles. How do I create the conditional statement ?

Here the code I'm trying but it's not working:

if context.scene.render.engine == {'CYCLES'}:

2 Answers 2


You don't want the curly braces around the string.

if context.scene.render.engine == 'CYCLES':

Note that cycles and blender internal are not the only choices for render engine. It would be better to test if blender internal is the current engine.

if context.scene.render.engine != 'BLENDER_RENDER':
    layout.label(text='Blender render is active.')

Okay so this kind of partially worked but I fixed it, had to create an additional class to switch to Blender Internal.

Here is the class

class SwitchBI(bpy.types.Operator):
       bl_idname = "switch.bi_operator"
       bl_label = "Switch BI"
       def execute(self, context):
             bpy.context.scene.render.engine = 'BLENDER_RENDER'
             return {"FINISHED"}

And then the conditional Statement

If context.scene.render.engine == 'CYCLES':

You must log in to answer this question.

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