[Bf-extensions-cvs] [222969e3] master: Update for Depsgraph API changes

Philipp Oeser noreply at git.blender.org
Fri May 17 14:18:59 CEST 2019


Commit: 222969e3805359444579d7ab96d75b93c73212fe
Author: Philipp Oeser
Date:   Fri May 17 12:36:11 2019 +0200
Branches: master
https://developer.blender.org/rBA222969e3805359444579d7ab96d75b93c73212fe

Update for Depsgraph API changes

Reviewers: sergey

Differential Revision: https://developer.blender.org/D4883

===================================================================

M	add_mesh_discombobulator/mesh_discombobulator.py
M	add_mesh_extra_objects/add_mesh_gears.py
M	add_mesh_geodesic_domes/third_domes_panel_271.py
M	blenderkit/autothumb_model_bg.py
M	io_anim_bvh/import_bvh.py
M	io_export_unreal_psk_psa.py
M	io_import_dxf/dxfimport/do.py
M	io_import_images_as_planes.py
M	io_import_scene_lwo.py
M	io_import_scene_unreal_psa_psk.py
M	io_scene_3ds/import_3ds.py
M	io_scene_fbx/export_fbx_bin.py
M	io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py
M	io_scene_gltf2/blender/imp/gltf2_blender_node.py
M	io_scene_ms3d/ms3d_ui.py
M	io_scene_x3d/import_x3d.py
M	object_fracture_cell/fracture_cell_setup.py
M	object_print3d_utils/mesh_helpers.py
M	sequencer_kinoraw_tools/audio_tools.py
M	sequencer_kinoraw_tools/jumptocut.py
M	sequencer_kinoraw_tools/proxy_tools.py

===================================================================

diff --git a/add_mesh_discombobulator/mesh_discombobulator.py b/add_mesh_discombobulator/mesh_discombobulator.py
index dd7acb29..c5480447 100644
--- a/add_mesh_discombobulator/mesh_discombobulator.py
+++ b/add_mesh_discombobulator/mesh_discombobulator.py
@@ -527,7 +527,7 @@ def discombobulate(self, minHeight, maxHeight, minTaper, maxTaper, sf1, sf2, sf3
 
     bpy.ops.object.select_pattern(pattern=object1.name, extend=False)
     bpy.context.view_layer.objects.active = bpy.data.objects[object1.name]
-    bpy.context.scene.update()
+    bpy.context.view_layer.update()
 
     # translate, scale and rotate discombobulated results
     object1.location = to_translate
diff --git a/add_mesh_extra_objects/add_mesh_gears.py b/add_mesh_extra_objects/add_mesh_gears.py
index 88552d01..d5558e6c 100644
--- a/add_mesh_extra_objects/add_mesh_gears.py
+++ b/add_mesh_extra_objects/add_mesh_gears.py
@@ -556,10 +556,10 @@ def add_worm(teethNum, rowNum, radius, Ad, De, p_angle,
 #### Delete object
 def ObjectDelete(self, context, delete):
 
-    bpy.context.scene.update()
+    bpy.context.view_layer.update()
     bpy.ops.object.mode_set(mode = 'OBJECT')
     bpy.ops.object.delete()
-    bpy.context.scene.update()
+    bpy.context.view_layer.update()
 
     return
     
@@ -765,7 +765,7 @@ class AddGear(Operator):
 
     ##### INVOKE #####
     def invoke(self, context, event):
-        bpy.context.scene.update()
+        bpy.context.view_layer.update()
         if self.change:
             bpy.context.scene.cursor.location = self.startlocation
         else:
@@ -960,7 +960,7 @@ class AddWormGear(Operator):
 
     ##### INVOKE #####
     def invoke(self, context, event):
-        bpy.context.scene.update()
+        bpy.context.view_layer.update()
         if self.change:
             bpy.context.scene.cursor.location = self.startlocation
         else:
@@ -970,4 +970,4 @@ class AddWormGear(Operator):
 
         self.execute(context)
 
-        return {'FINISHED'}
\ No newline at end of file
+        return {'FINISHED'}
diff --git a/add_mesh_geodesic_domes/third_domes_panel_271.py b/add_mesh_geodesic_domes/third_domes_panel_271.py
index 41a3cf5d..2e7956de 100644
--- a/add_mesh_geodesic_domes/third_domes_panel_271.py
+++ b/add_mesh_geodesic_domes/third_domes_panel_271.py
@@ -50,10 +50,10 @@ def align_matrix(context, location):
 #### Delete object
 def ObjectDelete(self, context, delete):
 
-    bpy.context.scene.update()
+    bpy.context.view_layer.update()
     bpy.ops.object.mode_set(mode = 'OBJECT')
     bpy.ops.object.delete()
-    bpy.context.scene.update()
+    bpy.context.view_layer.update()
 
     return
 
@@ -1563,7 +1563,7 @@ class GenerateGeodesicDome(Operator):
         #bpy.ops.view3d.snap_cursor_to_center()
         if geodesic_not_yet_called:
             geodesic_not_yet_called = False
-        bpy.context.scene.update()
+        bpy.context.view_layer.update()
         if self.change:
             bpy.context.scene.cursor.location = self.startlocation
         else:
diff --git a/blenderkit/autothumb_model_bg.py b/blenderkit/autothumb_model_bg.py
index dc34d59c..7ed0aa7d 100644
--- a/blenderkit/autothumb_model_bg.py
+++ b/blenderkit/autothumb_model_bg.py
@@ -45,7 +45,7 @@ def center_obs_for_thumbnail(obs):
         parent = parent.parent
     # reset parent rotation, so we see how it really snaps.
     parent.rotation_euler = (0, 0, 0)
-    bpy.context.scene.update()
+    bpy.context.view_layer.update()
     minx, miny, minz, maxx, maxy, maxz = utils.get_bounds_worldspace(obs)
 
     cx = (maxx - minx) / 2 + minx
@@ -87,7 +87,7 @@ if __name__ == "__main__":
         main_object, allobs = append_link.append_objects(file_name=BLENDERKIT_EXPORT_FILE_INPUT,
                                                          obnames=obnames,
                                                          link=True)
-        bpy.context.scene.update()
+        bpy.context.view_layer.update()
 
         camdict = {
             'GROUND': 'camera ground',
@@ -128,7 +128,7 @@ if __name__ == "__main__":
             = data['thumbnail_background_lightness']
         s.cycles.samples = data['thumbnail_samples']
         bpy.context.view_layer.cycles.use_denoising = data['thumbnail_denoising']
-        bpy.context.scene.update()
+        bpy.context.view_layer.update()
 
         # import blender's HDR here
         hdr_path = Path('datafiles/studiolights/world/interior.exr')
diff --git a/io_anim_bvh/import_bvh.py b/io_anim_bvh/import_bvh.py
index f06a1d87..e43b6090 100644
--- a/io_anim_bvh/import_bvh.py
+++ b/io_anim_bvh/import_bvh.py
@@ -521,7 +521,7 @@ def bvh_node_dict2armature(
         # Quats default
         pass
 
-    context.scene.update()
+    context.view_layer.update()
 
     arm_ob.animation_data_create()
     action = bpy.data.actions.new(name=bvh_name)
diff --git a/io_export_unreal_psk_psa.py b/io_export_unreal_psk_psa.py
index cbccdb9b..3008d6c8 100644
--- a/io_export_unreal_psk_psa.py
+++ b/io_export_unreal_psk_psa.py
@@ -984,7 +984,7 @@ def triangulate_mesh(object):
     depsgraph = bpy.context.evaluated_depsgraph_get()
     me_ob.data = bpy.data.meshes.new_from_object(object.evaluated_get(depsgraph))  # write data object
     bpy.context.collection.objects.link(me_ob)
-    bpy.context.scene.update()
+    view_layer.update()
     bpy.ops.object.mode_set(mode='OBJECT')
 
     for i in scene.objects:
@@ -999,7 +999,7 @@ def triangulate_mesh(object):
     bpy.ops.mesh.select_all(action='SELECT')  # select all the face/vertex/edge
     bpy.ops.object.mode_set(mode='EDIT')
     bpy.ops.mesh.quads_convert_to_tris()
-    bpy.context.scene.update()
+    view_layer.update()
 
     bpy.ops.object.mode_set(mode='OBJECT')
 
@@ -1008,7 +1008,7 @@ def triangulate_mesh(object):
     verbose("Triangulated mesh")
 
     me_ob.data = bpy.data.meshes.new_from_object(me_ob.evaluated_get(depsgraph))  # write data object
-    bpy.context.scene.update()
+    view_layer.update()
     return me_ob
 
 
@@ -1557,7 +1557,7 @@ def parse_animation(armature, udk_bones, actions_to_export, psa):
         # apply action to armature and update scene
         # note if loop all actions that is not armature it will override and will break armature animation
         armature.animation_data.action = action
-        context.scene.update()
+        context.view_layer.update()
 
         # min/max frames define range
         framemin, framemax = action.frame_range
@@ -2048,7 +2048,7 @@ class OBJECT_OT_UTSelectedFaceSmooth(Operator):
                         flatcount += 1
                         face.select = False
                 mesh.to_mesh(obj.data)
-                bpy.context.scene.update()
+                bpy.context.view_layer.update()
                 bpy.ops.object.mode_set(mode='EDIT')
                 print("Select Smooth Count(s):", smoothcount, " Flat Count(s):", flatcount)
                 bselected = True
@@ -2163,7 +2163,7 @@ def rebuildmesh(obj):
 
     me_ob.update()  # need to update the information to able to see into the secne
     obmesh = bpy.data.objects.new(("Re_" + obj.name), me_ob)
-    bpy.context.scene.update()
+    bpy.context.view_layer.update()
 
     # Build tmp materials
     materialname = "ReMaterial"
@@ -2189,7 +2189,7 @@ def rebuildmesh(obj):
         matcount += 1
 
     print("Mesh Object Name:", obmesh.name)
-    bpy.context.scene.update()
+    bpy.context.view_layer.update()
 
     return obmesh
 
@@ -2628,7 +2628,7 @@ def udkcheckmeshline():
                     break
         bpy.ops.object.mode_set(mode='EDIT')  # set in edit mode to see the select vertex
         objmesh.data.update()       # update object
-        bpy.context.scene.update()  # update scene
+        bpy.context.view_layer.update()  # update scene
         message = "MESH PASS"
         if len(vertex_list) > 0:
             message = "MESH FAIL"
diff --git a/io_import_dxf/dxfimport/do.py b/io_import_dxf/dxfimport/do.py
index 1ba3219a..ec2b7d52 100644
--- a/io_import_dxf/dxfimport/do.py
+++ b/io_import_dxf/dxfimport/do.py
@@ -635,10 +635,10 @@ class Do:
                 obj.location = transformation @ obj.location
                 obj.rotation_euler.rotate(transformation)
 
-    def _bbox(self, objects, scene):
+    def _bbox(self, objects):
         xmin = ymin = zmin = float('+inf')
         xmax = ymax = zmax = float('-inf')
-        scene.update()
+        bpy.context.view_layer.update()
 
         for obj in objects:
             om = obj.matrix_basis
@@ -672,8 +672,8 @@ class Do:
 
         return xmin, ymin, zmin, xmax, ymax, zmax
 
-    def _object_bbox(self, objects, scene, name, do_widgets=True):
-        xmin, ymin, zmin, xmax, ymax, zmax = self._bbox(objects, scene)
+    def _object_bbox(self, objects, name, do_widgets=True):
+        xmin, ymin, zmin, xmax, ymax, zmax = self._bbox(objects)
 
         # creating bbox geometry
         bm = bmesh.new()
@@ -879,7 +879,7 @@ class Do:
             # determining the main object o
             if len(objects) > 1 or len(insert_bounding_boxes) > 0:
                 if self.do_bounding_boxes:
-                    o = self._object_bbox(objects + insert_bounding_boxes, scene, name, recursion_level == 0)
+                    o = self._object_bbox(objects + insert_bounding_boxes, name, recursion_level == 0)
                     scene.collection.objects.link(o)
                 else:
                     o = bpy.data.objects.new(name, None)
@@ -986,7 +986,7 @@ class Do:
                 i = self.insert(INSERT, block_scene, None, block_group, invisible, recursion_level + 1, True)
                 inserts.append(i)
 
-            bbox = self._object_bbox(objects + inserts, block_scene, name, True)
+            bbox = self._object_bbox(objects + inserts, name, True)
 
             for i in inserts:
                 sub_group = i.instance_collection
@@ -1398,12 +1398,12 @@ class Do:
 
     def _recenter(self, scene, name):
         bpy.context.screen.scene = scene
-        scene.update()
+        bpy.context.view_layer.update()
         bpy.ops.object.select_all(action='DESELECT')
 
         recenter_objects = (o for o in scene.objects if "BEVEL" not in o.name and "TAPER" not in o.name
                             and o not in self.objects_

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list