0
$\begingroup$

I have a script that I run to automate a task from CLI using blender --background --python my_automation_script.py which has a material with a ShaderNodeScript node.

That script ensures that cycles is the render engine with bpy.context.scene.render.engine = 'CYCLES' but I cannot find a way to enable Open Shading Language in a similar way.

Is it possible to enable Open Shading Language from a Python script? Or alternatively, from the CLI call to blender?

$\endgroup$

1 Answer 1

1
$\begingroup$

If you go into the 'Scripting' tab in recent Blender versions and toggle the Open Shading Language checkbox you can see the property name that is being affected by that change :

bpy.context.scene.cycles.shading_system = True

Set the property to True to enable OSL or to False to disable OSL.

$\endgroup$
1
  • 1
    $\begingroup$ Thanks, working perfectly. I didn't actually know you could do that with the scripting tab. That's super helpful. $\endgroup$ Jun 26, 2021 at 9:06

You must log in to answer this question.

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