I simply need to know how to unhide a collection after hiding it using bpy. Many questions have been answered but none seem to work with Blender 2.83.
My product has many add-ons and I need to render each one individually, for argument's sake let's say it's an ice cream and I need to show a cone but with a ball of each type of ice cream in it. The cone and each ball of ice cream is in a separate collection.
I start with disabling all from the render (a form of reset of the scene if you will), re-enable the cone and subsequently re-enable each ball for rendering, rendering it then re-disabling it and re-enabling the next ball.
I can get all collections to disable for render, re-enabling is proving elusive.
My code:
import bpy
import mathutils
# Store the current scene inside a variable
scene = bpy.context.scene
# Exlude all Collections from view layer
coll = bpy.data.collections
for c in coll:
c.hide_render=True
# ENABLING BY COLLECTION NAME GOES HERE
# ENABLING BY COLLECTION NAME GOES HERE
# ENABLING BY COLLECTION NAME GOES HERE
# ENABLING BY COLLECTION NAME GOES HERE
# ENABLING BY COLLECTION NAME GOES HERE
# Rendering
# set file image index
index = 0
# render settings
scene.render.image_settings.file_format = 'PNG'
bpy.data.scenes["CONFIGURATOR 800x600"].render.filepath = '/BlenderPythonTest/render_%d.png' % index
bpy.ops.render.render(write_still = 1)
I have tried bpy.data.scenes.layer_collection exclude, bpy.data.collections hide_render False and bpy.context.collection hide_render methods, but nothing works. By that I mean it renders a large black square (if I do not disable at the beginning, all renders fine).
Please help... failing that, enjoy the ice cream you're heading to the fridge for... ;-)