[Bf-blender-cvs] [8c269d94f4b] blender2.8: Limit updates to active view layer only

Sergey Sharybin noreply at git.blender.org
Fri Apr 20 10:10:30 CEST 2018


Commit: 8c269d94f4bd1baa080ad939ae96c736d9688016
Author: Sergey Sharybin
Date:   Fri Apr 20 09:56:55 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB8c269d94f4bd1baa080ad939ae96c736d9688016

Limit updates to active view layer only

This is rather uncommon when operator will operate on a non-active view layer,
so there is no need to do full scene update.

This change solves lag first time using Extrude operator in edit mode.

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

M	release/scripts/modules/bpy/ops.py

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

diff --git a/release/scripts/modules/bpy/ops.py b/release/scripts/modules/bpy/ops.py
index d3d9255123b..a549395597b 100644
--- a/release/scripts/modules/bpy/ops.py
+++ b/release/scripts/modules/bpy/ops.py
@@ -145,10 +145,10 @@ class BPyOpsSubModOp:
         return C_dict, C_exec, C_undo
 
     @staticmethod
-    def _scene_update(context):
-        scene = context.scene
-        if scene:  # None in background mode
-            scene.update()
+    def _view_layer_update(context):
+        view_layer = context.view_layer
+        if view_layer:  # None in background mode
+            view_layer.update()
         else:
             import bpy
             for scene in bpy.data.scenes:
@@ -180,7 +180,10 @@ class BPyOpsSubModOp:
         wm = context.window_manager
 
         # run to account for any rna values the user changes.
-        BPyOpsSubModOp._scene_update(context)
+        # NOTE: We only update active vew layer, since that's what
+        # operators are supposed to operate on. There might be some
+        # corner cases when operator need a full scene update though.
+        BPyOpsSubModOp._view_layer_update(context)
 
         if args:
             C_dict, C_exec, C_undo = BPyOpsSubModOp._parse_args(args)
@@ -189,7 +192,7 @@ class BPyOpsSubModOp:
             ret = op_call(self.idname_py(), None, kw)
 
         if 'FINISHED' in ret and context.window_manager == wm:
-            BPyOpsSubModOp._scene_update(context)
+            BPyOpsSubModOp._view_layer_update(context)
 
         return ret



More information about the Bf-blender-cvs mailing list