Commit: 3e998b886080d3cd11137327356d1c861ae7ddb4
Author: Campbell Barton
Date:   Fri Apr 6 18:31:32 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB3e998b886080d3cd11137327356d1c861ae7ddb4

Fix object mode workspace check

===================================================================

M       intern/cycles/blender/addon/ui.py
M       release/scripts/startup/bl_ui/properties_collection.py

===================================================================

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

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to