Fix object mode workspace check

This commit is contained in:
Campbell Barton 2018-04-06 18:31:32 +02:00
parent 4a2b64e43d
commit 3e998b8860
2 changed files with 9 additions and 5 deletions

View File

@ -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")

View File

@ -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