From 3e998b886080d3cd11137327356d1c861ae7ddb4 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 6 Apr 2018 18:31:32 +0200 Subject: [PATCH] Fix object mode workspace check --- intern/cycles/blender/addon/ui.py | 2 +- .../scripts/startup/bl_ui/properties_collection.py | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index c91efc36279..163131392e3 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -753,7 +753,7 @@ class CYCLES_PT_context_material(CyclesButtonsPanel, 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/properties_collection.py b/release/scripts/startup/bl_ui/properties_collection.py index f093b373251..e48df3a0a61 100644 --- a/release/scripts/startup/bl_ui/properties_collection.py +++ b/release/scripts/startup/bl_ui/properties_collection.py @@ -91,7 +91,8 @@ class COLLECTION_PT_object_mode_settings(CollectionButtonsPanel, Panel): @classmethod def poll(cls, context): - return context.workspace.object_mode == 'OBJECT' + ob = context.object + return ob and ob.mode == 'OBJECT' def draw(self, context): layout = self.layout @@ -109,7 +110,8 @@ class COLLECTION_PT_edit_mode_settings(CollectionButtonsPanel, Panel): @classmethod def poll(cls, context): - return context.workspace.object_mode == 'EDIT' + ob = context.object + return ob and ob.mode == 'EDIT' def draw(self, context): layout = self.layout @@ -132,7 +134,8 @@ class COLLECTION_PT_paint_weight_mode_settings(CollectionButtonsPanel, Panel): @classmethod def poll(cls, context): - return context.workspace.object_mode == 'WEIGHT_PAINT' + ob = context.object + return ob and ob.mode == 'WEIGHT_PAINT' def draw(self, context): layout = self.layout @@ -150,7 +153,8 @@ class COLLECTION_PT_paint_vertex_mode_settings(CollectionButtonsPanel, Panel): @classmethod def poll(cls, context): - return context.workspace.object_mode == 'VERTEX_PAINT' + ob = context.object + return ob and ob.mode == 'VERTEX_PAINT' def draw(self, context): layout = self.layout