[Bf-blender-cvs] [9d47e56e47a] greasepencil-object: UI: Move some panels to toolbar

Antonio Vazquez noreply at git.blender.org
Wed May 30 20:33:21 CEST 2018


Commit: 9d47e56e47ac35f72f1d2ffdd3bd914ff5bc3c1f
Author: Antonio Vazquez
Date:   Wed May 30 20:33:12 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rB9d47e56e47ac35f72f1d2ffdd3bd914ff5bc3c1f

UI: Move some panels to toolbar

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

M	release/scripts/startup/bl_ui/space_topbar.py
M	release/scripts/startup/bl_ui/space_view3d_toolbar.py

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

diff --git a/release/scripts/startup/bl_ui/space_topbar.py b/release/scripts/startup/bl_ui/space_topbar.py
index 53acc29dfad..5a3fe2ae60d 100644
--- a/release/scripts/startup/bl_ui/space_topbar.py
+++ b/release/scripts/startup/bl_ui/space_topbar.py
@@ -142,6 +142,14 @@ class TOPBAR_HT_lower_bar(Header):
             layout.popover_group(space_type='VIEW_3D', region_type='TOOLS', context=".posemode", category="")
         elif mode == 'PARTICLE':
             layout.popover_group(space_type='VIEW_3D', region_type='TOOLS', context=".paint_common", category="")
+        elif mode == 'GPENCIL_PAINT':
+            layout.popover_group(space_type='VIEW_3D', region_type='TOOLS', context=".greasepencil_paint", category="")
+        elif mode == 'GPENCIL_EDIT':
+            layout.popover_group(space_type='VIEW_3D', region_type='TOOLS', context=".greasepencil_edit", category="")
+        elif mode == 'GPENCIL_SCULPT':
+            layout.popover_group(space_type='VIEW_3D', region_type='TOOLS', context=".greasepencil_sculpt", category="")
+        elif mode == 'GPENCIL_WEIGHT':
+            layout.popover_group(space_type='VIEW_3D', region_type='TOOLS', context=".greasepencil_weight", category="")
 
     def draw_right(self, context):
         layout = self.layout
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 1416cfaff05..c918eb1a55a 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -1303,12 +1303,10 @@ class VIEW3D_PT_tools_particlemode(View3DPanel, Panel):
 # ********** grease pencil object tool panels ****************
 
 # Grease Pencil drawing brushes
-class VIEW3D_PT_tools_grease_pencil_brush(Panel):
-    bl_space_type = 'VIEW_3D'
-    
-    bl_label = "Drawing Brushes"
+class VIEW3D_PT_tools_grease_pencil_brush(View3DPanel, Panel):
+    bl_context = ".greasepencil_paint"
     bl_category = "Tools"
-    bl_region_type = 'TOOLS'
+    bl_label = "Drawing Brushes"
 
     @classmethod
     def poll(cls, context):
@@ -1392,21 +1390,12 @@ class VIEW3D_PT_tools_grease_pencil_brush(Panel):
 
 
 # Grease Pencil drawing brushes options
-class VIEW3D_PT_tools_grease_pencil_brush_option(Panel):
-    bl_space_type = 'VIEW_3D'
-    bl_label = "Strokes"
+class VIEW3D_PT_tools_grease_pencil_brush_option(View3DPanel, Panel):
+    bl_context = ".greasepencil_paint"
     bl_category = "Tools"
-    bl_region_type = 'TOOLS'
+    bl_label = "Options"
     bl_options = {'DEFAULT_CLOSED'}
 
-    @classmethod
-    def poll(cls, context):
-        if context.gpencil_data is None:
-            return False
-
-        gpd = context.gpencil_data
-        return gpd.is_stroke_paint_mode
-
     @staticmethod
     def draw(self, context):
         layout = self.layout
@@ -1467,26 +1456,12 @@ class VIEW3D_PT_tools_grease_pencil_brush_option(Panel):
 
 
 # Grease Pencil drawingcurves
-class VIEW3D_PT_tools_grease_pencil_brushcurves(Panel):
-    bl_space_type = 'VIEW_3D'
-    bl_label = "Brush Curves"
+class VIEW3D_PT_tools_grease_pencil_brushcurves(View3DPanel, Panel):
+    bl_context = ".greasepencil_paint"
     bl_category = "Tools"
-    bl_region_type = 'TOOLS'
+    bl_label = "Brush Curves"
     bl_options = {'DEFAULT_CLOSED'}
 
-    @classmethod
-    def poll(cls, context):
-        if context.active_gpencil_brush is None:
-            return False
-
-        is_3d_view = context.space_data.type == 'VIEW_3D'
-        brush = context.active_gpencil_brush
-        if context.gpencil_data is None:
-            return False
-
-        gpd = context.gpencil_data
-        return gpd.is_stroke_paint_mode
-
     @staticmethod
     def draw(self, context):
         layout = self.layout
@@ -1623,26 +1598,10 @@ class VIEW3D_PT_tools_grease_pencil_sculpt(GreasePencilStrokeSculptPanel, Panel)
 
 
 # Grease Pencil weight painting tools
-class VIEW3D_PT_tools_grease_pencil_weight_paint(Panel):
-    bl_space_type = 'VIEW_3D'
-    bl_label = "Weight Paint"
+class VIEW3D_PT_tools_grease_pencil_weight_paint(View3DPanel, Panel):
+    bl_context = ".greasepencil_weight"
     bl_category = "Tools"
-    bl_region_type = 'TOOLS'
-
-    @classmethod
-    def poll(cls, context):
-        if context.gpencil_data is None:
-            return False
-
-        gpd = context.gpencil_data
-        if context.editable_gpencil_strokes:
-            is_3d_view = context.space_data.type == 'VIEW_3D'
-            if not is_3d_view:
-                return bool(gpd.use_stroke_edit_mode)
-            else:
-                return bool(gpd.is_stroke_weight_mode)
-
-        return False
+    bl_label = "Weight Paint"
 
     @staticmethod
     def draw(self, context):
@@ -1663,22 +1622,10 @@ class VIEW3D_PT_tools_grease_pencil_weight_paint(Panel):
 
 
 # Grease Pencil weight painting operators
-class VIEW3D_PT_tools_grease_pencil_weight_tools(Panel):
-    bl_space_type = 'VIEW_3D'
-    bl_label = "Weight Tools"
+class VIEW3D_PT_tools_grease_pencil_weight_tools(View3DPanel, Panel):
+    bl_context = ".greasepencil_weight"
     bl_category = "Tools"
-    bl_region_type = 'TOOLS'
-
-    @classmethod
-    def poll(cls, context):
-        if context.gpencil_data is None:
-            return False
-
-        gpd = context.gpencil_data
-        if context.editable_gpencil_strokes:
-            return bool(gpd.is_stroke_weight_mode)
-
-        return False
+    bl_label = "Weight Tools"
 
     @staticmethod
     def draw(self, context):



More information about the Bf-blender-cvs mailing list