diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2019-06-04 15:11:55 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2019-06-04 15:39:51 +0300 |
commit | 1d2e4c44bddeb21e04f6ef73b96b51a759a3352e (patch) | |
tree | 270a3f28064333574e260eb694490757b2b45736 /release/scripts/modules | |
parent | c0c2f8663e4f3b4166a95b1978bf2441b8f3152a (diff) |
Fix T64827: "Batch-Generate Previews" crashes.
Missed when py API for depsgraph was changed... tsst...
Based on D4917 by @lichtwerk, thanks.
Diffstat (limited to 'release/scripts/modules')
-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: |