GPencil UI: Color swatches for both Stroke and Fill colors are now shown
[blender.git] / release / scripts / startup / bl_ui / properties_grease_pencil_common.py
index 789d0a10a9e11fa32b94aab5572c06f6c61a9700..75f6921b0c3bed36a171417f6609852eceee98ee 100644 (file)
@@ -19,7 +19,6 @@
 # <pep8 compliant>
 
 
-import bpy
 from bpy.types import Menu, UIList
 
 
@@ -38,7 +37,7 @@ def gpencil_stroke_placement_settings(context, layout, gpd):
         row.prop_enum(gpd, "draw_mode", 'STROKE')
 
         row = col.row(align=False)
-        row.active = gpd.draw_mode in ('SURFACE', 'STROKE')
+        row.active = gpd.draw_mode in {'SURFACE', 'STROKE'}
         row.prop(gpd, "use_stroke_endpoints")
 
 
@@ -64,16 +63,23 @@ class GreasePencilDrawingToolsPanel():
         row.operator("gpencil.draw", text="Line").mode = 'DRAW_STRAIGHT'
         row.operator("gpencil.draw", text="Poly").mode = 'DRAW_POLY'
 
-
         row = col.row(align=True)
         row.prop(context.tool_settings, "use_grease_pencil_sessions", text="Continuous Drawing")
 
+        if context.space_data.type in {'VIEW_3D', 'CLIP_EDITOR'}:
+            col.separator()
+            col.label("Data Source:")
+            row = col.row(align=True)
+            if context.space_data.type == 'VIEW_3D':
+                row.prop(context.tool_settings, "grease_pencil_source", expand=True)
+            elif context.space_data.type == 'CLIP_EDITOR':
+                row.prop(context.space_data, "grease_pencil_source", expand=True)
+
         gpd = context.gpencil_data
         if gpd:
             col.separator()
             gpencil_stroke_placement_settings(context, col, gpd)
 
-
         if context.space_data.type == 'VIEW_3D':
             col.separator()
             col.separator()
@@ -195,12 +201,14 @@ class GPENCIL_PIE_tool_palette(Menu):
                 # NW - Select (Non-Modal)
                 col = pie.column()
                 col.operator("gpencil.select_all", text="Select All", icon='PARTICLE_POINT')
+                col.operator("gpencil.select_all", text="Select Inverse", icon='BLANK1')
                 col.operator("gpencil.select_linked", text="Select Linked", icon='LINKED')
 
                 # NE - Select (Modal)
                 col = pie.column()
                 col.operator("gpencil.select_border", text="Border Select", icon='BORDER_RECT')
                 col.operator("gpencil.select_circle", text="Circle Select", icon='META_EMPTY')
+                col.operator("gpencil.select_lasso", text="Lasso Select", icon='BORDER_LASSO')
 
                 # SW - Edit Tools
                 col = pie.column()
@@ -226,7 +234,7 @@ class GPENCIL_PIE_settings_palette(Menu):
         layout = self.layout
 
         pie = layout.menu_pie()
-        gpd = context.gpencil_data
+        gpd = context.gpencil_data
         gpl = context.active_gpencil_layer
 
         # W - Stroke draw settings
@@ -244,7 +252,7 @@ class GPENCIL_PIE_settings_palette(Menu):
         # S - Layer settings
         col = pie.column()
         col.prop(gpl, "line_width", slider=True)
-        #col.prop(gpl, "use_volumetric_strokes")
+        # col.prop(gpl, "use_volumetric_strokes")
         col.prop(gpl, "use_onion_skinning")
 
         # N - Active Layer
@@ -252,12 +260,12 @@ class GPENCIL_PIE_settings_palette(Menu):
         col = pie.column()
         col.label("Active Layer:      ")
         col.prop(gpl, "info", text="")
-        #col.prop(gpd, "layers")
+        # col.prop(gpd, "layers")
         row = col.row()
         row.prop(gpl, "lock")
         row.prop(gpl, "hide")
 
-        
+
 class GPENCIL_PIE_tools_more(Menu):
     """A pie menu for accessing more Grease Pencil tools"""
     bl_label = "More Grease Pencil Tools"
@@ -271,20 +279,19 @@ class GPENCIL_PIE_tools_more(Menu):
         layout = self.layout
 
         pie = layout.menu_pie()
-        gpd = context.gpencil_data
-        
+        gpd = context.gpencil_data
+
         pie.operator("gpencil.select_more", icon='ZOOMIN')
         pie.operator("gpencil.select_less", icon='ZOOMOUT')
-               
+
         pie.operator("transform.mirror", icon='MOD_MIRROR').gpencil_strokes = True
         pie.operator("transform.bend", icon='MOD_SIMPLEDEFORM').gpencil_strokes = True
         pie.operator("transform.shear", icon='MOD_TRIANGULATE').gpencil_strokes = True
         pie.operator("transform.tosphere", icon='MOD_MULTIRES').gpencil_strokes = True
-               
+
         pie.operator("gpencil.convert", icon='OUTLINER_OB_CURVE')
         pie.operator("wm.call_menu_pie", text="Back to Main Palette...").name = "GPENCIL_PIE_tool_palette"
 
-###############################
 
 class GPENCIL_UL_layer(UIList):
     def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
@@ -295,9 +302,11 @@ class GPENCIL_UL_layer(UIList):
             if gpl.lock:
                 layout.active = False
 
-            split = layout.split(percentage=0.2)
-            split.prop(gpl, "color", text="")
-            split.prop(gpl, "info", text="", emboss=False)
+            split = layout.split(percentage=0.25)
+            row = split.row(align=True)
+            row.prop(gpl, "color",      text="", emboss = gpl.is_stroke_visible)
+            row.prop(gpl, "fill_color", text="", emboss = gpl.is_fill_visible)
+            split.prop(gpl, "info",  text="", emboss=False)
 
             row = layout.row(align=True)
             row.prop(gpl, "lock", text="", emboss=False)
@@ -326,8 +335,9 @@ class GreasePencilDataPanel():
         gpd = context.gpencil_data
 
         # Owner Selector
-        # XXX: add this for 3D view too
-        if context.space_data.type == 'CLIP_EDITOR':
+        if context.space_data.type == 'VIEW_3D':
+            layout.prop(context.tool_settings, "grease_pencil_source", expand=True)
+        elif context.space_data.type == 'CLIP_EDITOR':
             layout.prop(context.space_data, "grease_pencil_source", expand=True)
 
         # Grease Pencil data selector
@@ -388,8 +398,8 @@ class GreasePencilDataPanel():
         col = split.column(align=True)
         col.prop(gpl, "show_x_ray")
 
-        #if debug:
-        #   layout.prop(gpl, "show_points")
+        # if debug:
+        #     layout.prop(gpl, "show_points")
 
         layout.separator()
 
@@ -415,7 +425,7 @@ class GreasePencilDataPanel():
         row.prop(gpl, "use_onion_skinning")
         row.prop(gpl, "use_ghost_custom_colors", text="", icon='COLOR')
 
-        split = col.split(percentage = 0.5)
+        split = col.split(percentage=0.5)
         split.active = gpl.use_onion_skinning
 
         # - Before Frames
@@ -425,7 +435,6 @@ class GreasePencilDataPanel():
         row.prop(gpl, "before_color", text="")
         sub.prop(gpl, "ghost_before_range", text="Before")
 
-
         # - After Frames
         sub = split.column(align=True)
         row = sub.row(align=True)
@@ -449,7 +458,7 @@ class GreasePencilToolsPanel():
     def draw(self, context):
         layout = self.layout
 
-        gpd_owner = context.gpencil_data_owner
+        gpd_owner = context.gpencil_data_owner
         gpd = context.gpencil_data
 
         layout.prop(gpd, "use_stroke_edit_mode", text="Enable Editing", icon='EDIT', toggle=True)