Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2018-04-20 10:56:55 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2018-04-20 11:03:27 +0300
commit8c269d94f4bd1baa080ad939ae96c736d9688016 (patch)
treef43a7a89af24c413ec25a94ae55728272f168626 /release/scripts/modules/bpy
parent22b2bab7024c00cf0ac1ce451650bf28a9192d64 (diff)
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.
Diffstat (limited to 'release/scripts/modules/bpy')
-rw-r--r--release/scripts/modules/bpy/ops.py15
1 files changed, 9 insertions, 6 deletions
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