# How do I unhide all objects of a certain type?

I'm using blender 2.93 so not sure if that changes anything but i'm trying a simple script as found here

import bpy

for o in ("Cube", "Camera", "Light"):
obj = bpy.context.scene.objects.get(o)
#if obj: obj.hide_viewport = False
if obj: obj.hide_set(False)


I have made a simple scene with cubes, point lights and cameras, some hidden, but if I run the script, nothing happens. It doesn't give any errors either so im not sure what I'm doing wrong. I'm so stupid I guess. Any ideas?

Files here Script file Scene

The function bpy.context.scene.objects.get() will get an object matching the name of the parameter passed to it, or return nothing if there isn't an object with that name. The line for o in ("Cube", "Camera", "Light"): iterates over the strings "Cube", "Camera", and "Light", which are the names of the default three objects when a new .blend file is created, so only those objects will get unhidden.
import bpy

• for obj in (o for o in bpy.context.scene.objects if o.type == 'LIGHT'): Here are all the possible object types : docs.blender.org/api/current/… (Make sure you use all caps) Sep 3, 2021 at 7:46