2
$\begingroup$

The objects i make invisible in viewport i want them to automatically be invisible to render. Is there any cool way to have this option ?

$\endgroup$
6
  • 2
    $\begingroup$ I do not know of a cool way, but you can click the camera icon in the outliner. $\endgroup$
    – rob
    Commented Jun 28, 2019 at 13:17
  • $\begingroup$ That i know, but when you have too many objects, you need to go through all. Was wondering if there was some option or python script $\endgroup$
    – kay777
    Commented Jun 28, 2019 at 13:19
  • 2
    $\begingroup$ bpy.data.objects["Cube"].hide_render = True $\endgroup$
    – rob
    Commented Jun 28, 2019 at 13:24
  • 1
    $\begingroup$ Select every visible objects by pressing "A" then hit "W" and select "Restrict Render Unselected" $\endgroup$
    – FFeller
    Commented Jun 28, 2019 at 14:59
  • $\begingroup$ @FFeller this doesnt seem to work on blender 2.8, nothing comes up after pressin W $\endgroup$
    – kay777
    Commented Jun 30, 2019 at 2:43

2 Answers 2

3
$\begingroup$

Handlers

Could set in a handler. bpy.app.handlers.depsgraph_update_[pre or post] are the v2.8x equivalent of scene update in versions prior.

Run this script once. Now every time the depsgraph updates ( a lot ) it will match the hide render attribute to the objects hide status.

import bpy

def hide(scene):
    for o in scene.objects:
        o.hide_render = o.hide_get()

    return None

# uncomment to clear all
#bpy.app.handlers.depsgraph_update_post.clear()
bpy.app.handlers.depsgraph_update_post.append(hide)
$\endgroup$
1
  • $\begingroup$ Great! 👍🏻 !!!!! $\endgroup$
    – Chris
    Commented May 23, 2021 at 16:31
1
$\begingroup$

This code when run will hide all the selected objects from being rendered

import bpy 

selection = bpy.context.selected_objects 

for obj in selection: 
    bpy.data.objects[obj.name].hide_render = True

It also make sense if you are doing this a lot to change the functionality to toggle. This version will toggle the render visibility of all the selected objects

import bpy 

selection = bpy.context.selected_objects 

for obj in selection: 
    obj.hide_render = not obj.hide_render
$\endgroup$
2
  • $\begingroup$ thanks @batFINGER, updated $\endgroup$
    – rob
    Commented Jul 1, 2019 at 11:32
  • $\begingroup$ In 2.79 version we could move the selected objects to some other layer and leave that layer hidden. Could it be a similar way to do it in 2.8? Unfortunately, I can't use the 2.8 version yet. $\endgroup$
    – LeoNas
    Commented Jul 1, 2019 at 17:18

You must log in to answer this question.

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