diff options
-rw-r--r-- | release/scripts/modules/bl_previews_utils/bl_previews_render.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/release/scripts/modules/bl_previews_utils/bl_previews_render.py b/release/scripts/modules/bl_previews_utils/bl_previews_render.py index a20e5f46e9d..8d1a782bc54 100644 --- a/release/scripts/modules/bl_previews_utils/bl_previews_render.py +++ b/release/scripts/modules/bl_previews_utils/bl_previews_render.py @@ -284,7 +284,8 @@ def do_previews(do_objects, do_collections, do_scenes, do_data_intern): camera = bpy.data.objects[render_context.camera, None] light = bpy.data.objects[render_context.light, None] if render_context.light is not None else None cos = objects_bbox_calc(camera, objects, offset_matrix) - loc, _ortho_scale = camera.camera_fit_coords(bpy.context.depsgraph, cos) + depsgraph = bpy.context.evaluated_depsgraph_get() + loc, _ortho_scale = camera.camera_fit_coords(depsgraph, cos) camera.location = loc # Set camera clipping accordingly to computed bbox. min_dist = 1e24 @@ -298,9 +299,9 @@ def do_previews(do_objects, do_collections, do_scenes, do_data_intern): camera.data.clip_start = min_dist / 2 camera.data.clip_end = max_dist * 2 if light: - loc, _ortho_scale = light.camera_fit_coords(bpy.context.depsgraph, cos) + loc, _ortho_scale = light.camera_fit_coords(depsgraph, cos) light.location = loc - scene.update() + bpy.context.view_layer.update() bpy.ops.render.render(write_still=True) @@ -350,7 +351,7 @@ def do_previews(do_objects, do_collections, do_scenes, do_data_intern): if obname not in scene.objects: scene.collection.objects.link(ob) ob.hide_render = False - scene.update() + bpy.context.view_layer.update() preview_render_do(render_context, 'objects', root.name, objects) @@ -392,7 +393,7 @@ def do_previews(do_objects, do_collections, do_scenes, do_data_intern): bpy.ops.object.collection_instance_add(collection=grp.name) grp_ob = next((ob for ob in scene.objects if ob.instance_collection and ob.instance_collection.name == grp.name)) grp_obname = grp_ob.name - scene.update() + bpy.context.view_layer.update() offset_matrix = Matrix.Translation(grp.instance_offset).inverted() @@ -411,7 +412,7 @@ def do_previews(do_objects, do_collections, do_scenes, do_data_intern): has_camera = scene.camera is not None bpy.context.window.scene = scene render_context = render_context_create('__SCENE', objects_ignored) - scene.update() + bpy.context.view_layer.update() objects = None if not has_camera: |