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 | |
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')
19 files changed, 60 insertions, 114 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) diff --git a/release/scripts/modules/keyingsets_utils.py b/release/scripts/modules/keyingsets_utils.py index 40e74e27ed2..7ce5f3e029b 100644 --- a/release/scripts/modules/keyingsets_utils.py +++ b/release/scripts/modules/keyingsets_utils.py @@ -57,10 +57,9 @@ def path_add_property(path, prop): # selected objects (active object must be in object mode) def RKS_POLL_selected_objects(ksi, context): - workspace = context.workspace ob = context.active_object if ob: - return workspace.object_mode == 'OBJECT' + return ob.mode == 'OBJECT' else: return bool(context.selected_objects) @@ -68,9 +67,8 @@ def RKS_POLL_selected_objects(ksi, context): # selected bones def RKS_POLL_selected_bones(ksi, context): # we must be in Pose Mode, and there must be some bones selected - workspace = context.workspace ob = context.active_object - if ob and workspace.object_mode == 'POSE': + if ob and ob.mode == 'POSE': if context.active_pose_bone or context.selected_pose_bones: return True @@ -89,9 +87,8 @@ def RKS_POLL_selected_items(ksi, context): # all selected objects or pose bones, depending on which we've got def RKS_ITER_selected_item(ksi, context, ks): - workspace = context.workspace ob = context.active_object - if ob and workspace.object_mode == 'POSE': + if ob and ob.mode == 'POSE': for bone in context.selected_pose_bones: ksi.generate(context, ks, bone) else: diff --git a/release/scripts/startup/bl_operators/freestyle.py b/release/scripts/startup/bl_operators/freestyle.py index 9b1d054cc15..0cfe78879db 100644 --- a/release/scripts/startup/bl_operators/freestyle.py +++ b/release/scripts/startup/bl_operators/freestyle.py @@ -53,7 +53,6 @@ class SCENE_OT_freestyle_fill_range_by_selection(bpy.types.Operator): def execute(self, context): import sys - workspace = context.workspace scene = context.scene view_layer = scene.view_layers.active lineset = view_layer.freestyle_settings.linesets.active @@ -80,7 +79,7 @@ class SCENE_OT_freestyle_fill_range_by_selection(bpy.types.Operator): return {'CANCELLED'} # Find selected vertices in editmesh ob = context.active_object - if ob.type == 'MESH' and workspace.object_mode == 'EDIT' and ob.name != ref.name: + if ob.type == 'MESH' and ob.mode == 'EDIT' and ob.name != ref.name: bpy.ops.object.mode_set(mode='OBJECT') selected_verts = [v for v in ob.data.vertices if v.select] bpy.ops.object.mode_set(mode='EDIT') @@ -144,7 +143,6 @@ class SCENE_OT_freestyle_add_edge_marks_to_keying_set(bpy.types.Operator): def execute(self, context): # active keying set - workspace = context.workspace scene = context.scene ks = scene.keying_sets.active if ks is None: @@ -152,7 +150,7 @@ class SCENE_OT_freestyle_add_edge_marks_to_keying_set(bpy.types.Operator): ks.bl_description = "" # add data paths to the keying set ob = context.active_object - ob_mode = workspace.object_mode + ob_mode = ob.mode mesh = ob.data bpy.ops.object.mode_set(mode='OBJECT', toggle=False) for i, edge in enumerate(mesh.edges): @@ -176,7 +174,6 @@ class SCENE_OT_freestyle_add_face_marks_to_keying_set(bpy.types.Operator): def execute(self, context): # active keying set - workspace = context.workspace scene = context.scene ks = scene.keying_sets.active if ks is None: @@ -184,7 +181,7 @@ class SCENE_OT_freestyle_add_face_marks_to_keying_set(bpy.types.Operator): ks.bl_description = "" # add data paths to the keying set ob = context.active_object - ob_mode = workspace.object_mode + ob_mode = ob.mode mesh = ob.data bpy.ops.object.mode_set(mode='OBJECT', toggle=False) for i, polygon in enumerate(mesh.polygons): diff --git a/release/scripts/startup/bl_operators/mesh.py b/release/scripts/startup/bl_operators/mesh.py index ccc592e80b8..c7a11c23c3f 100644 --- a/release/scripts/startup/bl_operators/mesh.py +++ b/release/scripts/startup/bl_operators/mesh.py @@ -57,9 +57,8 @@ class MeshMirrorUV(Operator): precision = self.precision double_warn = 0 - workspace = context.workspace ob = context.active_object - is_editmode = (workspace.object_mode == 'EDIT') + is_editmode = (ob.mode == 'EDIT') if is_editmode: bpy.ops.object.mode_set(mode='OBJECT', toggle=False) diff --git a/release/scripts/startup/bl_operators/object.py b/release/scripts/startup/bl_operators/object.py index 58f3afa3d6c..566487d9d0e 100644 --- a/release/scripts/startup/bl_operators/object.py +++ b/release/scripts/startup/bl_operators/object.py @@ -63,13 +63,12 @@ class SelectPattern(Operator): pattern_match = (lambda a, b: fnmatch.fnmatchcase(a.upper(), b.upper())) is_ebone = False - workspace = context.workspace obj = context.object - if obj and workspace.object_mode == 'POSE': + if obj and obj.mode == 'POSE': items = obj.data.bones if not self.extend: bpy.ops.pose.select_all(action='DESELECT') - elif obj and obj.type == 'ARMATURE' and workspace.object_mode == 'EDIT': + elif obj and obj.type == 'ARMATURE' and obj.mode == 'EDIT': items = obj.data.edit_bones if not self.extend: bpy.ops.armature.select_all(action='DESELECT') @@ -249,8 +248,6 @@ class SubdivisionSet(Operator): if not relative and level < 0: self.level = level = 0 - workspace = context.workspace - def set_object_subd(obj): for mod in obj.modifiers: if mod.type == 'MULTIRES': @@ -260,18 +257,18 @@ class SubdivisionSet(Operator): for i in range(sub): bpy.ops.object.multires_subdivide(modifier="Multires") - if workspace.object_mode == 'SCULPT': + if obj.mode == 'SCULPT': if mod.sculpt_levels != level: mod.sculpt_levels = level - elif workspace.object_mode == 'OBJECT': + elif obj.mode == 'OBJECT': if mod.levels != level: mod.levels = level return else: - if workspace.object_mode == 'SCULPT': + if obj.mode == 'SCULPT': if mod.sculpt_levels + level <= mod.total_levels: mod.sculpt_levels += level - elif workspace.object_mode == 'OBJECT': + elif obj.mode == 'OBJECT': if mod.levels + level <= mod.total_levels: mod.levels += level return @@ -287,7 +284,7 @@ class SubdivisionSet(Operator): # add a new modifier try: - if workspace.object_mode == 'SCULPT': + if obj.mode == 'SCULPT': mod = obj.modifiers.new("Multires", 'MULTIRES') if level > 0: for i in range(0, level): @@ -470,9 +467,8 @@ class ShapeTransfer(Operator): @classmethod def poll(cls, context): - workspace = context.workspace obj = context.active_object - return (obj and workspace.object_mode != 'EDIT') + return (obj and obj.mode != 'EDIT') def execute(self, context): ob_act = context.active_object @@ -512,11 +508,10 @@ class JoinUVs(Operator): def _main(self, context): import array - workspace = context.workspace obj = context.active_object mesh = obj.data - is_editmode = (workspace.object_mode == 'EDIT') + is_editmode = (obj.mode == 'EDIT') if is_editmode: bpy.ops.object.mode_set(mode='OBJECT', toggle=False) diff --git a/release/scripts/startup/bl_operators/object_quick_effects.py b/release/scripts/startup/bl_operators/object_quick_effects.py index 91a0120f6ac..27cc118d99d 100644 --- a/release/scripts/startup/bl_operators/object_quick_effects.py +++ b/release/scripts/startup/bl_operators/object_quick_effects.py @@ -73,10 +73,9 @@ class QuickFur(Operator): ) def execute(self, context): - workspace = context.workspace fake_context = context.copy() mesh_objects = [obj for obj in context.selected_objects - if obj.type == 'MESH' and workspace.object_mode == 'OBJECT'] + if obj.type == 'MESH' and obj.mode == 'OBJECT'] if not mesh_objects: self.report({'ERROR'}, "Select at least one mesh object") diff --git a/release/scripts/startup/bl_operators/uvcalc_lightmap.py b/release/scripts/startup/bl_operators/uvcalc_lightmap.py index dde98ce9013..61ceb3c04c4 100644 --- a/release/scripts/startup/bl_operators/uvcalc_lightmap.py +++ b/release/scripts/startup/bl_operators/uvcalc_lightmap.py @@ -558,8 +558,8 @@ def lightmap_uvpack(meshes, def unwrap(operator, context, **kwargs): - workspace = context.workspace - is_editmode = (workspace.object_mode == 'EDIT') + + is_editmode = (context.object.mode == 'EDIT') if is_editmode: bpy.ops.object.mode_set(mode='OBJECT', toggle=False) diff --git a/release/scripts/startup/bl_operators/uvcalc_smart_project.py b/release/scripts/startup/bl_operators/uvcalc_smart_project.py index f648bebed26..25783653414 100644 --- a/release/scripts/startup/bl_operators/uvcalc_smart_project.py +++ b/release/scripts/startup/bl_operators/uvcalc_smart_project.py @@ -748,8 +748,7 @@ def main(context, USER_FILL_HOLES_QUALITY = 50 # Only for hole filling. USER_VIEW_INIT = 0 # Only for hole filling. - workspace = context.workspace - is_editmode = (workspace.object_mode == 'EDIT') + is_editmode = (context.active_object.mode == 'EDIT') if is_editmode: obList = [ob for ob in [context.active_object] if ob and ob.type == 'MESH'] else: @@ -782,7 +781,7 @@ def main(context, # Toggle Edit mode - is_editmode = (workspace.object_mode == 'EDIT') + is_editmode = (context.active_object.mode == 'EDIT') if is_editmode: bpy.ops.object.mode_set(mode='OBJECT') # Assume face select mode! an annoying hack to toggle face select mode because Mesh doesn't like faceSelectMode. diff --git a/release/scripts/startup/bl_operators/view3d.py b/release/scripts/startup/bl_operators/view3d.py index e54ead6a5fc..18f91110053 100644 --- a/release/scripts/startup/bl_operators/view3d.py +++ b/release/scripts/startup/bl_operators/view3d.py @@ -30,9 +30,8 @@ class VIEW3D_OT_edit_mesh_extrude_individual_move(Operator): @classmethod def poll(cls, context): - workspace = context.workspace obj = context.active_object - return (obj is not None and workspace.object_mode == 'EDIT') + return (obj is not None and obj.mode == 'EDIT') def execute(self, context): mesh = context.object.data @@ -69,9 +68,8 @@ class VIEW3D_OT_edit_mesh_extrude_move(Operator): @classmethod def poll(cls, context): - workspace = context.workspace obj = context.active_object - return (obj is not None and workspace.object_mode == 'EDIT') + return (obj is not None and obj.mode == 'EDIT') @staticmethod def extrude_region(context, use_vert_normals): @@ -119,9 +117,8 @@ class VIEW3D_OT_edit_mesh_extrude_shrink_fatten(Operator): @classmethod def poll(cls, context): - workspace = context.workspace obj = context.active_object - return (obj is not None and workspace.object_mode == 'EDIT') + return (obj is not None and obj.mode == 'EDIT') def execute(self, context): return VIEW3D_OT_edit_mesh_extrude_move.extrude_region(context, True) @@ -176,8 +173,7 @@ class VIEW3D_OT_select_or_deselect_all(Operator): def poll(cls, context): active_object = context.active_object if active_object: - workspace = context.workspace - return workspace.object_mode in {'EDIT', 'OBJECT', 'POSE'} + return active_object.mode in {'EDIT', 'OBJECT', 'POSE'} return True def invoke(self, context, event): @@ -188,9 +184,7 @@ class VIEW3D_OT_select_or_deselect_all(Operator): active_object = context.active_object if active_object: - workspace = context.workspace - object_mode = workspace.object_mode - if object_mode == 'EDIT': + if active_object.mode == 'EDIT': if active_object.type == 'MESH': bpy.ops.mesh.select_all(action='DESELECT') elif active_object.type == 'CURVE': @@ -203,9 +197,9 @@ class VIEW3D_OT_select_or_deselect_all(Operator): bpy.ops.mball.select_all(action='DESELECT') elif active_object.type == 'ARMATURE': bpy.ops.armature.select_all(action='DESELECT') - elif object_mode == 'POSE': + elif active_object.mode == 'POSE': bpy.ops.pose.select_all(action='DESELECT') - elif object_mode == 'PARTICLE_EDIT': + elif active_object.mode == 'PARTICLE_EDIT': bpy.ops.particle.select_all(action='DESELECT') else: bpy.ops.object.select_all(action='DESELECT') diff --git a/release/scripts/startup/bl_ui/properties_constraint.py b/release/scripts/startup/bl_ui/properties_constraint.py index f374d95c493..9b61101778f 100644 --- a/release/scripts/startup/bl_ui/properties_constraint.py +++ b/release/scripts/startup/bl_ui/properties_constraint.py @@ -910,9 +910,8 @@ class OBJECT_PT_constraints(ConstraintButtonsPanel, Panel): layout = self.layout obj = context.object - workspace = context.workspace - if obj.type == 'ARMATURE' and workspace.object_mode == 'POSE': + if obj.type == 'ARMATURE' and obj.mode == 'POSE': box = layout.box() box.alert = True # XXX: this should apply to the box background box.label(icon='INFO', text="Constraints for active bone do not live here") diff --git a/release/scripts/startup/bl_ui/properties_data_bone.py b/release/scripts/startup/bl_ui/properties_data_bone.py index e8f290772d8..f0ef0032059 100644 --- a/release/scripts/startup/bl_ui/properties_data_bone.py +++ b/release/scripts/startup/bl_ui/properties_data_bone.py @@ -58,8 +58,7 @@ class BONE_PT_transform(BoneButtonsPanel, Panel): return True ob = context.object - workspace = context.workspace - return ob and workspace.object_mode == 'POSE' and context.bone + return ob and ob.mode == 'POSE' and context.bone def draw(self, context): layout = self.layout @@ -111,8 +110,7 @@ class BONE_PT_transform_locks(BoneButtonsPanel, Panel): @classmethod def poll(cls, context): ob = context.object - workspace = context.workspace - return ob and workspace.object_mode == 'POSE' and context.bone + return ob and ob.mode == 'POSE' and context.bone def draw(self, context): layout = self.layout @@ -313,8 +311,7 @@ class BONE_PT_inverse_kinematics(BoneButtonsPanel, Panel): @classmethod def poll(cls, context): ob = context.object - workspace = context.workspace - return ob and workspace.object_mode == 'POSE' and context.bone + return ob and ob.mode == 'POSE' and context.bone def draw(self, context): layout = self.layout @@ -442,8 +439,7 @@ class BONE_PT_custom_props(BoneButtonsPanel, PropertyPanel, Panel): @property def _context_path(self): obj = bpy.context.object - workspace = context.workspace - if obj and workspace.object_mode == 'POSE': + if obj and obj.mode == 'POSE': return "active_pose_bone" else: return "active_bone" diff --git a/release/scripts/startup/bl_ui/properties_data_mesh.py b/release/scripts/startup/bl_ui/properties_data_mesh.py index ee6e09039be..9f927fe3368 100644 --- a/release/scripts/startup/bl_ui/properties_data_mesh.py +++ b/release/scripts/startup/bl_ui/properties_data_mesh.py @@ -94,13 +94,10 @@ class MESH_UL_shape_keys(UIList): # key = data key_block = item if self.layout_type in {'DEFAULT', 'COMPACT'}: - workspace = context.workspace split = layout.split(0.66, False) split.prop(key_block, "name", text="", emboss=False, icon_value=icon) row = split.row(align=True) - if (key_block.mute or - (workspace.object_mode == 'EDIT' and not (obj.use_shape_key_edit_mode and obj.type == 'MESH')) - ): + if key_block.mute or (obj.mode == 'EDIT' and not (obj.use_shape_key_edit_mode and obj.type == 'MESH')): row.active = False if not item.id_data.use_relative: row.prop(key_block, "frame", text="", emboss=False) @@ -208,7 +205,6 @@ class DATA_PT_vertex_groups(MeshButtonsPanel, Panel): def draw(self, context): layout = self.layout - workspace = context.workspace ob = context.object group = ob.vertex_groups.active @@ -229,10 +225,7 @@ class DATA_PT_vertex_groups(MeshButtonsPanel, Panel): col.operator("object.vertex_group_move", icon='TRIA_UP', text="").direction = 'UP' col.operator("object.vertex_group_move", icon='TRIA_DOWN', text="").direction = 'DOWN' - if (ob.vertex_groups and - ((workspace.object_mode == 'EDIT') or - (workspace.object_mode == 'WEIGHT_PAINT' and ob.type == 'MESH' and ob.data.use_paint_mask_vertex)) - ): + if ob.vertex_groups and (ob.mode == 'EDIT' or (ob.mode == 'WEIGHT_PAINT' and ob.type == 'MESH' and ob.data.use_paint_mask_vertex)): row = layout.row() sub = row.row(align=True) @@ -258,7 +251,6 @@ class DATA_PT_face_maps(MeshButtonsPanel, Panel): def draw(self, context): layout = self.layout - workspace = context.workspace ob = context.object facemap = ob.face_maps.active @@ -277,7 +269,7 @@ class DATA_PT_face_maps(MeshButtonsPanel, Panel): col.operator("object.face_map_move", icon='TRIA_UP', text="").direction = 'UP' col.operator("object.face_map_move", icon='TRIA_DOWN', text="").direction = 'DOWN' - if ob.face_maps and (workspace.object_mode == 'EDIT' and ob.type == 'MESH'): + if ob.face_maps and (ob.mode == 'EDIT' and ob.type == 'MESH'): row = layout.row() sub = row.row(align=True) @@ -301,12 +293,11 @@ class DATA_PT_shape_keys(MeshButtonsPanel, Panel): def draw(self, context): layout = self.layout - workspace = context.workspace ob = context.object key = ob.data.shape_keys kb = ob.active_shape_key - enable_edit = workspace.object_mode != 'EDIT' + enable_edit = ob.mode != 'EDIT' enable_edit_value = False if ob.show_only_shape_key is False: @@ -428,7 +419,6 @@ class DATA_PT_customdata(MeshButtonsPanel, Panel): def draw(self, context): layout = self.layout - workspace = context.workspace obj = context.object me = context.mesh col = layout.column() @@ -443,7 +433,7 @@ class DATA_PT_customdata(MeshButtonsPanel, Panel): col = layout.column() - col.enabled = (workspace.object_mode != 'EDIT') + col.enabled = (obj.mode != 'EDIT') col.prop(me, "use_customdata_vertex_bevel") col.prop(me, "use_customdata_edge_bevel") col.prop(me, "use_customdata_edge_crease") diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py index cd29c3f10e7..4c2e8e03641 100644 --- a/release/scripts/startup/bl_ui/properties_data_modifier.py +++ b/release/scripts/startup/bl_ui/properties_data_modifier.py @@ -404,8 +404,6 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): layout.label(text="Settings are inside the Physics tab") def HOOK(self, layout, ob, md): - from bpy import context - workspace = context.workspace use_falloff = (md.falloff_type != 'NONE') split = layout.split() @@ -437,7 +435,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): col = split.column() col.prop(md, "use_falloff_uniform") - if workspace.object_mode == 'EDIT': + if ob.mode == 'EDIT': row = col.row(align=True) row.operator("object.hook_reset", text="Reset") row.operator("object.hook_recenter", text="Recenter") @@ -593,9 +591,6 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): col.prop(md, "mirror_object", text="") def MULTIRES(self, layout, ob, md): - from bpy import context - workspace = context.workspace - layout.row().prop(md, "subdivision_type", expand=True) split = layout.split() @@ -606,7 +601,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): col = split.column() - col.enabled = workspace.object_mode != 'EDIT' + col.enabled = ob.mode != 'EDIT' col.operator("object.multires_subdivide", text="Subdivide") col.operator("object.multires_higher_levels_delete", text="Delete Higher") col.operator("object.multires_reshape", text="Reshape") diff --git a/release/scripts/startup/bl_ui/properties_material.py b/release/scripts/startup/bl_ui/properties_material.py index dfbf3eab244..edbe6816e5b 100644 --- a/release/scripts/startup/bl_ui/properties_material.py +++ b/release/scripts/startup/bl_ui/properties_material.py @@ -148,7 +148,7 @@ class MATERIAL_PT_context_material(MaterialButtonsPanel, Panel): col.operator("object.material_slot_move", icon='TRIA_UP', text="").direction = 'UP' col.operator("object.material_slot_move", icon='TRIA_DOWN', text="").direction = 'DOWN' - if context.workspace.object_mode == 'EDIT': + if ob.mode == 'EDIT': row = layout.row(align=True) row.operator("object.material_slot_assign", text="Assign") row.operator("object.material_slot_select", text="Select") @@ -1094,7 +1094,7 @@ class EEVEE_MATERIAL_PT_context_material(MaterialButtonsPanel, Panel): col.operator("object.material_slot_move", icon='TRIA_UP', text="").direction = 'UP' col.operator("object.material_slot_move", icon='TRIA_DOWN', text="").direction = 'DOWN' - if context.workspace.object_mode == 'EDIT': + if ob.mode == 'EDIT': row = layout.row(align=True) row.operator("object.material_slot_assign", text="Assign") row.operator("object.material_slot_select", text="Select") diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py index 14ecb86e577..123e95c013c 100644 --- a/release/scripts/startup/bl_ui/space_image.py +++ b/release/scripts/startup/bl_ui/space_image.py @@ -1208,8 +1208,7 @@ class ImageScopesPanel: if sima.mode == 'PAINT': return False ob = context.active_object - workspace = context.workspace - if ob and workspace.object_mode in {'TEXTURE_PAINT', 'EDIT'}: + if ob and ob.mode in {'TEXTURE_PAINT', 'EDIT'}: return False return True diff --git a/release/scripts/startup/bl_ui/space_info.py b/release/scripts/startup/bl_ui/space_info.py index 96e8f9420d9..4bd7b3b1cb6 100644 --- a/release/scripts/startup/bl_ui/space_info.py +++ b/release/scripts/startup/bl_ui/space_info.py @@ -48,7 +48,7 @@ class INFO_HT_header(Header): layout.template_ID(window, "workspace", new="workspace.workspace_add_menu", unlink="workspace.workspace_delete") layout.template_search_preview(window, "screen", workspace, "screens", new="screen.new", unlink="screen.delete", rows=2, cols=6) - act_mode_item = bpy.types.WorkSpace.bl_rna.properties['object_mode'].enum_items[workspace.object_mode] + act_mode_item = bpy.types.Object.bl_rna.properties["mode"].enum_items[layer.objects.active.mode] layout.operator_menu_enum("object.mode_set", "mode", text=act_mode_item.name, icon=act_mode_item.icon) row = layout.row() @@ -84,7 +84,7 @@ class INFO_HT_header(Header): return row.operator("wm.splash", text="", icon='BLENDER', emboss=False) - row.label(text=scene.statistics(workspace, context.view_layer), translate=False) + row.label(text=scene.statistics(context.view_layer), translate=False) class INFO_MT_editor_menus(Menu): diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 41dfd360ff4..7f898cd065e 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -48,7 +48,7 @@ class VIEW3D_HT_header(Header): layout.template_header_3D() if obj: - mode = context.workspace.object_mode + mode = obj.mode # Particle edit if mode == 'PARTICLE_EDIT': row.prop(toolsettings.particle_edit, "select_mode", text="", expand=True) @@ -317,9 +317,8 @@ class VIEW3D_MT_transform_armature(VIEW3D_MT_transform_base): VIEW3D_MT_transform_base.draw(self, context) # armature specific extensions follow... - workspace = context.workspace obj = context.object - if obj.type == 'ARMATURE' and workspace.object_mode in {'EDIT', 'POSE'}: + if obj.type == 'ARMATURE' and obj.mode in {'EDIT', 'POSE'}: if obj.data.draw_type == 'BBONE': layout.separator() @@ -1956,10 +1955,7 @@ class VIEW3D_MT_vertex_group(Menu): layout.operator("object.vertex_group_assign_new") ob = context.active_object - workspace = context.workspace - if ((workspace.object_mode == 'EDIT') or - (workspace.object_mode == 'WEIGHT_PAINT' and ob.type == 'MESH' and ob.data.use_paint_mask_vertex) - ): + if ob.mode == 'EDIT' or (ob.mode == 'WEIGHT_PAINT' and ob.type == 'MESH' and ob.data.use_paint_mask_vertex): if ob.vertex_groups.active: layout.separator() @@ -3405,7 +3401,7 @@ class VIEW3D_PT_view3d_properties(Panel): if lock_object: if lock_object.type == 'ARMATURE': col.prop_search(view, "lock_bone", lock_object.data, - "edit_bones" if context.mode == 'EDIT_ARMATURE' + "edit_bones" if lock_object.mode == 'EDIT' else "bones", text="") else: @@ -3458,13 +3454,12 @@ class VIEW3D_PT_view3d_name(Panel): def draw(self, context): layout = self.layout - workspace = context.workspace ob = context.active_object row = layout.row() row.label(text="", icon='OBJECT_DATA') row.prop(ob, "name", text="") - if ob.type == 'ARMATURE' and workspace.object_mode in {'EDIT', 'POSE'}: + if ob.type == 'ARMATURE' and ob.mode in {'EDIT', 'POSE'}: bone = context.active_bone if bone: row = layout.row() @@ -3782,8 +3777,7 @@ class VIEW3D_PT_etch_a_ton(Panel): def poll(cls, context): scene = context.space_data ob = context.active_object - workspace = context.workspace - return scene and ob and (ob.type == 'ARMATURE') and (workspace.object_mode == 'EDIT') + return scene and ob and ob.type == 'ARMATURE' and ob.mode == 'EDIT' def draw_header(self, context): layout = self.layout @@ -3839,8 +3833,7 @@ class VIEW3D_PT_context_properties(Panel): def _active_context_member(context): obj = context.object if obj: - workspace = context.workspace - mode = workspace.object_mode + mode = obj.mode if mode == 'POSE': return "active_pose_bone" elif mode == 'EDIT' and obj.type == 'ARMATURE': diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index 060433b1f9c..e29971e1835 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -2051,7 +2051,7 @@ class VIEW3D_PT_tools_history(View3DPanel, Panel): row = col.row(align=True) row.operator("ed.undo") row.operator("ed.redo") - if obj is None or context.workspace.object_mode != 'SCULPT': + if obj is None or obj.mode != 'SCULPT': # Sculpt mode does not generate an undo menu it seems... col.operator("ed.undo_history") diff --git a/release/scripts/startup/keyingsets_builtins.py b/release/scripts/startup/keyingsets_builtins.py index 0a6ece6eb5a..390c043bb31 100644 --- a/release/scripts/startup/keyingsets_builtins.py +++ b/release/scripts/startup/keyingsets_builtins.py @@ -388,9 +388,8 @@ class BUILTIN_KSI_WholeCharacter(KeyingSetInfo): # poll - pose-mode on active object only def poll(ksi, context): - workspace = context.workspace - ob = context.active_object - return (ob and ob.pose and (workspace.object_mode == 'POSE')) + return ((context.active_object) and (context.active_object.pose) and + (context.active_object.mode == 'POSE')) # iterator - all bones regardless of selection def iterator(ksi, context, ks): |