4
$\begingroup$

I'm trying to render a timeline (or some specified frames) with a plugin. I set the active camera I want with

context.scene.camera = mycamera

but there are markers in the timeline with different cameras and I end up with the wrong camera rendered.

How can I ignore those markers while rendering or, at least, change them to my intended camera?

$\endgroup$
1
$\begingroup$

A quick easy way without scripting is to use the Outliner to disable render from cameras you do not wish to use.

If you specifically want to do it in script, you'll need to run through all objects of type 'camera' then set the value for those you wish to not to render.

bpy.data.scenes['Scene'].camera.hide_render=True

Render your scene then return the cameras.

Below seems to work fine but be sure to have your camera selected.

import bpy

list_of_all_scenes = bpy.data.scenes

if bpy.data.is_saved:
    for y in list_of_all_scenes:
        bpy.context.screen.scene = y
        selected = bpy.context.selected_objects
        objs = y.objects
        for x in objs:
            if x.type == 'CAMERA':
                x.hide_render = True
        objs.active.hide_render = False
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.