0
$\begingroup$

I need to render a model, and for that, I need to deactivate the ray visibility options (glossy). I need to do it from the python script ( I need to activate it for one scene and deactivate it for another). How can I do it?

edit: I tried out bpy.context.object.cycles_visibility.glossy = False, but it does not work, and the option in blender is still checked after I save my model.

$\endgroup$
2
  • 2
    $\begingroup$ To turn it off, I think it's bpy.context.object.cycles_visibility.glossy = False (Back on would naturally be True) $\endgroup$ Jun 4, 2021 at 1:51
  • $\begingroup$ Thanks a lot for your answer. I have been doing it, but it has no effect. I just added this line: bpy.context.object.cycles_visibility.glossy = False right before I render, but it has no effect, and the glossy option is checked in the blender application. $\endgroup$
    – Mohammad J
    Jun 4, 2021 at 9:14

1 Answer 1

1
$\begingroup$

Simply adding this line right before the rendering line worked for me: bpy.context.scene.world.cycles_visibility.glossy = False. I simply copied this code from the "info" window under scripting. After I unchecked the box, it shows the python code for this command.

$\endgroup$
1
  • $\begingroup$ Hi, thanks for the post. This site is not a regular forum, answers should be substantial and thoroughly explain the solution and required workflow. One liners and short tips rarely make for a good answer. If you can edit your post and provide some more details about the procedure and why it works feel free to restore it, otherwise it may be deleted or converted into a comment. Perhaps add a few images illustrating the workflow and final results. See How do I write a good answer? $\endgroup$ Jun 4, 2021 at 14:33

You must log in to answer this question.

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