diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-02-08 13:14:26 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-02-08 13:14:26 +0300 |
commit | 345c6298e995ea618c34282ba6d7ab5af032f191 (patch) | |
tree | f4fbc4798e17d0f19efc28b51a41425d0c552be8 /release/scripts/startup/bl_ui/properties_data_mesh.py | |
parent | 14a19fed788af0cf3695eb5def92510841056e08 (diff) |
Object Mode: move to workspace struct
- Read-only access can often use EvaluationContext.object_mode
- Write access to go to WorkSpace.object_mode.
- Some TODO's remain (marked as "TODO/OBMODE")
- Add-ons will need updating
(context.active_object.mode -> context.workspace.object_mode)
- There will be small/medium issues that still need resolving
this does work on a basic level though.
See D3037
Diffstat (limited to 'release/scripts/startup/bl_ui/properties_data_mesh.py')
-rw-r--r-- | release/scripts/startup/bl_ui/properties_data_mesh.py | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/release/scripts/startup/bl_ui/properties_data_mesh.py b/release/scripts/startup/bl_ui/properties_data_mesh.py index 9f927fe3368..ee6e09039be 100644 --- a/release/scripts/startup/bl_ui/properties_data_mesh.py +++ b/release/scripts/startup/bl_ui/properties_data_mesh.py @@ -94,10 +94,13 @@ 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 (obj.mode == 'EDIT' and not (obj.use_shape_key_edit_mode and obj.type == 'MESH')): + if (key_block.mute or + (workspace.object_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) @@ -205,6 +208,7 @@ 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 @@ -225,7 +229,10 @@ 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 (ob.mode == 'EDIT' or (ob.mode == 'WEIGHT_PAINT' and ob.type == 'MESH' and ob.data.use_paint_mask_vertex)): + 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)) + ): row = layout.row() sub = row.row(align=True) @@ -251,6 +258,7 @@ 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 @@ -269,7 +277,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 (ob.mode == 'EDIT' and ob.type == 'MESH'): + if ob.face_maps and (workspace.object_mode == 'EDIT' and ob.type == 'MESH'): row = layout.row() sub = row.row(align=True) @@ -293,11 +301,12 @@ 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 = ob.mode != 'EDIT' + enable_edit = workspace.object_mode != 'EDIT' enable_edit_value = False if ob.show_only_shape_key is False: @@ -419,6 +428,7 @@ 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() @@ -433,7 +443,7 @@ class DATA_PT_customdata(MeshButtonsPanel, Panel): col = layout.column() - col.enabled = (obj.mode != 'EDIT') + col.enabled = (workspace.object_mode != 'EDIT') col.prop(me, "use_customdata_vertex_bevel") col.prop(me, "use_customdata_edge_bevel") col.prop(me, "use_customdata_edge_crease") |