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:
authorCampbell Barton <ideasman42@gmail.com>2018-04-05 19:20:27 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-04-05 19:21:14 +0300
commit1c24c04e6023f2d2a328dfcdc9f86cd381d029a3 (patch)
tree7a5af59ce078cb66fb17ec33cf111ffc8d5fb328 /release/scripts/startup/bl_ui
parent57329304b061efe756e3a4ce1b828e9a7c7f7030 (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/startup/bl_ui')
-rw-r--r--release/scripts/startup/bl_ui/properties_constraint.py3
-rw-r--r--release/scripts/startup/bl_ui/properties_data_bone.py12
-rw-r--r--release/scripts/startup/bl_ui/properties_data_mesh.py20
-rw-r--r--release/scripts/startup/bl_ui/properties_data_modifier.py9
-rw-r--r--release/scripts/startup/bl_ui/properties_material.py4
-rw-r--r--release/scripts/startup/bl_ui/space_image.py3
-rw-r--r--release/scripts/startup/bl_ui/space_info.py4
-rw-r--r--release/scripts/startup/bl_ui/space_view3d.py21
-rw-r--r--release/scripts/startup/bl_ui/space_view3d_toolbar.py2
9 files changed, 25 insertions, 53 deletions
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")