diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-04-05 19:20:27 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-04-05 19:21:14 +0300 |
commit | 1c24c04e6023f2d2a328dfcdc9f86cd381d029a3 (patch) | |
tree | 7a5af59ce078cb66fb17ec33cf111ffc8d5fb328 /release/scripts/modules/bpy_extras/object_utils.py | |
parent | 57329304b061efe756e3a4ce1b828e9a7c7f7030 (diff) |
Remove workspace object mode, reverts changes w/ 2.8
This caused too many problems syncing object modes
with multiple objects/windows/workspaces, see: D3130 for details.
Diffstat (limited to 'release/scripts/modules/bpy_extras/object_utils.py')
-rw-r--r-- | release/scripts/modules/bpy_extras/object_utils.py | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/release/scripts/modules/bpy_extras/object_utils.py b/release/scripts/modules/bpy_extras/object_utils.py index 31938f3ad3e..04b3858bb0d 100644 --- a/release/scripts/modules/bpy_extras/object_utils.py +++ b/release/scripts/modules/bpy_extras/object_utils.py @@ -119,7 +119,6 @@ def object_data_add(context, obdata, operator=None, name=None): :return: the newly created object in the scene. :rtype: :class:`bpy.types.Object` """ - workspace = context.workspace scene = context.scene layer = context.view_layer layer_collection = context.layer_collection @@ -147,9 +146,9 @@ def object_data_add(context, obdata, operator=None, name=None): # caused because entering edit-mode does not add a empty undo slot! if context.user_preferences.edit.use_enter_edit_mode: if not (obj_act and - obj_act.type == obj_new.type and - workspace.object_mode == 'EDIT' - ): + obj_act.mode == 'EDIT' and + obj_act.type == obj_new.type): + _obdata = bpy.data.meshes.new(name) obj_act = bpy.data.objects.new(_obdata.name, _obdata) obj_act.matrix_world = obj_new.matrix_world @@ -160,10 +159,7 @@ def object_data_add(context, obdata, operator=None, name=None): bpy.ops.ed.undo_push(message="Enter Editmode") # XXX - if (obj_act and - obj_act.type == obj_new.type and - workspace.object_mode == 'EDIT' - ): + if obj_act and obj_act.mode == 'EDIT' and obj_act.type == obj_new.type: bpy.ops.mesh.select_all(action='DESELECT') obj_act.select_set(action='SELECT') bpy.ops.object.mode_set(mode='OBJECT') @@ -253,10 +249,9 @@ def object_image_guess(obj, bm=None): first checking the texture-faces, then the material. """ # TODO, cycles/nodes materials - workspace = context.workspace me = obj.data if bm is None: - if workspace.object_mode == 'EDIT': + if obj.mode == 'EDIT': import bmesh bm = bmesh.from_edit_mesh(me) |