2
$\begingroup$

This give an error: AttributeError: 'Scene' object has no attribute 'use_denoising'

I know that in the previous version like Blender 2.79 the command to access use_denoising was:

bpy.context.scene.render.layers[0].cycles.use_denoising

How to access this in Blender 2.8x?

This question is very specific to use_denoising, so it has no precise answer except in this post (at the moment), I think it can be useful to many.

The answers are given by @ydvisual and @batFINGER has specified an important question.

$\endgroup$
3
  • $\begingroup$ Does this answer your question? Blender Python and pass settings $\endgroup$
    – Robert Gützkow
    Jan 16, 2020 at 10:38
  • 2
    $\begingroup$ There is a distinct difference between command, property (class attribute) and parameter. $\endgroup$
    – p2or
    Jan 17, 2020 at 17:06
  • $\begingroup$ @p2or You're absolutely right, I corrected the question $\endgroup$
    – Noob Cat
    Jan 17, 2020 at 17:38

1 Answer 1

2
$\begingroup$

Try this:

bpy.context.scene.view_layers[0].cycles.use_denoising = True
$\endgroup$
3
  • 5
    $\begingroup$ Or context.view_layer.cycles.use_denoising $\endgroup$
    – batFINGER
    Jan 16, 2020 at 6:57
  • $\begingroup$ @batFINGER Do you think using bpy.context.scene.view_layers [0] could get errors in particular situations? $\endgroup$
    – Noob Cat
    Jan 16, 2020 at 7:04
  • 5
    $\begingroup$ The context view layer may be view_layers[0] or view_layers[1].... for each vew_layer in scene. In general we are interested in changing objects that have context. If you wish to change for all viewlayers in the scene would then use for vl in scene.view_layers: Could say it's never a good idea to use first object in a collection if you are not sure that's the one you wish to update. $\endgroup$
    – batFINGER
    Jan 16, 2020 at 7:11

You must log in to answer this question.

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