[Bf-blender-cvs] [f0ccf0307ef] temp-workspace-changes: Collection Panel: Get mode from workspace

Dalai Felinto noreply at git.blender.org
Fri Sep 8 23:55:09 CEST 2017


Commit: f0ccf0307ef9dd92345656949c900b6b190b16aa
Author: Dalai Felinto
Date:   Fri Sep 8 22:39:44 2017 +0200
Branches: temp-workspace-changes
https://developer.blender.org/rBf0ccf0307ef9dd92345656949c900b6b190b16aa

Collection Panel: Get mode from workspace

Those overrides will change, and this panel may not exist in the future.
But meanwhile let's make things work as tey were supposed to.

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

M	release/scripts/startup/bl_ui/properties_collection.py

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

diff --git a/release/scripts/startup/bl_ui/properties_collection.py b/release/scripts/startup/bl_ui/properties_collection.py
index 9e7d29358a9..8c96ea0cda1 100644
--- a/release/scripts/startup/bl_ui/properties_collection.py
+++ b/release/scripts/startup/bl_ui/properties_collection.py
@@ -76,8 +76,8 @@ class COLLECTION_PT_object_mode_settings(CollectionButtonsPanel, Panel):
 
     @classmethod
     def poll(cls, context):
-        ob = context.object
-        return ob and (ob.mode == 'OBJECT')
+        workspace = context.workspace
+        return workspace and hasattr(workspace, 'object_mode') and (workspace.object_mode == 'OBJECT')
 
     def draw(self, context):
         layout = self.layout
@@ -95,8 +95,8 @@ class COLLECTION_PT_edit_mode_settings(CollectionButtonsPanel, Panel):
 
     @classmethod
     def poll(cls, context):
-        ob = context.object
-        return ob and (ob.mode == 'EDIT')
+        workspace = context.workspace
+        return workspace and hasattr(workspace, 'object_mode') and (workspace.object_mode == 'EDIT')
 
     def draw(self, context):
         layout = self.layout
@@ -119,8 +119,8 @@ class COLLECTION_PT_paint_weight_mode_settings(CollectionButtonsPanel, Panel):
 
     @classmethod
     def poll(cls, context):
-        ob = context.object
-        return ob and (ob.mode == 'WEIGHT_PAINT')
+        workspace = context.workspace
+        return workspace and hasattr(workspace, 'object_mode') and (workspace.object_mode == 'WEIGHT_PAINT')
 
     def draw(self, context):
         layout = self.layout
@@ -138,8 +138,8 @@ class COLLECTION_PT_paint_vertex_mode_settings(CollectionButtonsPanel, Panel):
 
     @classmethod
     def poll(cls, context):
-        ob = context.object
-        return ob and (ob.mode == 'VERTEX_PAINT')
+        workspace = context.workspace
+        return workspace and hasattr(workspace, 'object_mode') and (workspace.object_mode == 'VERTEX_PAINT')
 
     def draw(self, context):
         layout = self.layout



More information about the Bf-blender-cvs mailing list