Get visible objects in 3D view port

Is there a way of getting only a list of visible objects in scene? Tried calling object.visible_get() multiple ways but it’s nor working for me.

       depsgraph = context.evaluated_depsgraph_get()
        for dup in depsgraph.object_instances:
            if dup.is_instance:  # Real dupli instance
                obj = dup.instance_object
                yield (obj, dup.matrix_world.copy())
            else:  # Usual object
                obj = dup.object
                if(obj.visible_get()): <-----
                   yield (obj, obj.matrix_world.copy())

Have you tried, to get a list of visible objects:

objects=[ob for ob in bpy.context.view_layer.objects if ob.visible_get()]

That works for me…

This also works in my Python window:

obj =['Camera']

Cheers, Clock.

1 Like

Thxx it works :slight_smile:

1 Like