[Bf-blender-cvs] [5aa63f2bd4a] greasepencil-object: GPencil: Add icons for each type of Tool

Antonio Vazquez noreply at git.blender.org
Fri Nov 22 10:32:40 CET 2019


Commit: 5aa63f2bd4a74623e586beef9d28306ec959a633
Author: Antonio Vazquez
Date:   Fri Nov 22 10:31:54 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rB5aa63f2bd4a74623e586beef9d28306ec959a633

GPencil: Add icons for each type of Tool

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

M	release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M	release/scripts/startup/bl_ui/space_view3d_toolbar.py
M	source/blender/makesrna/intern/rna_brush.c

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

diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
index ffa62a3a668..44a47c3e41d 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -271,14 +271,29 @@ class GreasePencilAppearancePanel:
 
         tool_settings = context.tool_settings
         ob = context.active_object
-
+        brush = None
         if ob.mode == 'PAINT_GPENCIL':
             brush = tool_settings.gpencil_paint.brush
+        elif ob.mode == 'SCULPT_GPENCIL':
+            brush = tool_settings.gpencil_sculpt_paint.brush
+        elif ob.mode == 'WEIGHT_GPENCIL':
+            brush = tool_settings.gpencil_weight_paint.brush
+        elif ob.mode == 'VERTEX_GPENCIL':
+            brush = tool_settings.gpencil_vertex_paint.brush
+
+        if brush:
             gp_settings = brush.gpencil_settings
 
             sub = layout.column(align=True)
             sub.enabled = not brush.use_custom_icon
-            sub.prop(gp_settings, "gp_icon", text="Icon")
+            if ob.mode == 'PAINT_GPENCIL':
+                sub.prop(gp_settings, "gpencil_paint_icon", text="Icon")
+            elif ob.mode == 'SCULPT_GPENCIL':
+                sub.prop(gp_settings, "gpencil_sculpt_icon", text="Icon")
+            elif ob.mode == 'WEIGHT_GPENCIL':
+                sub.prop(gp_settings, "gpencil_weight_icon", text="Icon")
+            elif ob.mode == 'VERTEX_GPENCIL':
+                sub.prop(gp_settings, "gpencil_vertex_icon", text="Icon")
 
             layout.prop(brush, "use_custom_icon")
             sub = layout.column()
@@ -287,26 +302,12 @@ class GreasePencilAppearancePanel:
 
             layout.prop(gp_settings, "use_cursor", text="Show Brush")
 
-            if brush.gpencil_tool == 'DRAW':
-                layout.prop(gp_settings, "show_lasso", text="Show Fill Color While Drawing")
-
-            if brush.gpencil_tool == 'FILL':
-                layout.prop(brush, "cursor_color_add", text="Color")
-
-        elif ob.mode == 'SCULPT_GPENCIL':
-            brush = tool_settings.gpencil_sculpt_paint.brush
-            gp_settings = brush.gpencil_settings
-            tool = brush.gpencil_sculpt_tool
-
-            col = layout.column(align=True)
-            col.prop(gp_settings, "use_cursor", text="Show Brush")
+            if ob.mode == 'PAINT_GPENCIL': 
+                if brush.gpencil_tool == 'DRAW':
+                    layout.prop(gp_settings, "show_lasso", text="Show Fill Color While Drawing")
 
-        elif ob.mode == 'WEIGHT_GPENCIL':
-            brush = tool_settings.gpencil_weight_paint.brush
-            gp_settings = brush.gpencil_settings
-
-            col = layout.column(align=True)
-            col.prop(gp_settings, "use_cursor", text="Show Brush")
+                if brush.gpencil_tool == 'FILL':
+                    layout.prop(brush, "cursor_color_add", text="Color")
 
 
 class GPENCIL_MT_snap(Menu):
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index c127636aeaf..26fff4537e0 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -2572,6 +2572,12 @@ class VIEW3D_PT_tools_grease_pencil_weight_appearance(GreasePencilAppearancePane
     bl_category = "Tool"
 
 
+class VIEW3D_PT_tools_grease_pencil_vertex_appearance(GreasePencilAppearancePanel, View3DPanel, Panel):
+    bl_context = ".greasepencil_vertex"
+    bl_label = "Display"
+    bl_category = "Tool"
+
+
 class VIEW3D_PT_gpencil_brush_presets(PresetPanel, Panel):
     """Brush settings"""
     bl_label = "Brush Presets"
@@ -2658,6 +2664,7 @@ classes = (
     VIEW3D_PT_tools_grease_pencil_brush_vertex,
     VIEW3D_PT_tools_grease_pencil_brush_vertex_palette,
     VIEW3D_PT_tools_grease_pencil_brush_vertex_falloff,
+    VIEW3D_PT_tools_grease_pencil_vertex_appearance,
 )
 
 if __name__ == "__main__":  # only for live edit.
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index 995f1018489..7188ef9af1f 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -234,7 +234,7 @@ static EnumPropertyItem rna_enum_gpencil_fill_draw_modes_items[] = {
     {GP_FILL_DMODE_CONTROL, "CONTROL", 0, "Edit Lines", "Use edit lines as fill boundary limits"},
     {0, NULL, 0, NULL, NULL}};
 
-static EnumPropertyItem rna_enum_gpencil_brush_icons_items[] = {
+static EnumPropertyItem rna_enum_gpencil_brush_paint_icons_items[] = {
     {GP_BRUSH_ICON_PENCIL, "PENCIL", ICON_GPBRUSH_PENCIL, "Pencil", ""},
     {GP_BRUSH_ICON_PEN, "PEN", ICON_GPBRUSH_PEN, "Pen", ""},
     {GP_BRUSH_ICON_INK, "INK", ICON_GPBRUSH_INK, "Ink", ""},
@@ -249,6 +249,32 @@ static EnumPropertyItem rna_enum_gpencil_brush_icons_items[] = {
     {GP_BRUSH_ICON_ERASE_STROKE, "STROKE", ICON_GPBRUSH_ERASE_STROKE, "Eraser Stroke", ""},
     {0, NULL, 0, NULL, NULL},
 };
+
+static EnumPropertyItem rna_enum_gpencil_brush_sculpt_icons_items[] = {
+    {GP_BRUSH_ICON_GPBRUSH_SMOOTH, "SMOOTH", ICON_GPBRUSH_SMOOTH, "Smooth", ""},
+    {GP_BRUSH_ICON_GPBRUSH_THICKNESS, "THICKNESS", ICON_GPBRUSH_THICKNESS, "Thickness", ""},
+    {GP_BRUSH_ICON_GPBRUSH_STRENGTH, "STRENGTH", ICON_GPBRUSH_STRENGTH, "Strength", ""},
+    {GP_BRUSH_ICON_GPBRUSH_RANDOMIZE, "RANDOMIZE", ICON_GPBRUSH_RANDOMIZE, "Randomize", ""},
+    {GP_BRUSH_ICON_GPBRUSH_GRAB, "GRAB", ICON_GPBRUSH_GRAB, "Grab", ""},
+    {GP_BRUSH_ICON_GPBRUSH_PUSH, "PUSH", ICON_GPBRUSH_PUSH, "Push", ""},
+    {GP_BRUSH_ICON_GPBRUSH_TWIST, "TWIST", ICON_GPBRUSH_TWIST, "Twist", ""},
+    {GP_BRUSH_ICON_GPBRUSH_PINCH, "PINCH", ICON_GPBRUSH_PINCH, "Pinch", ""},
+    {GP_BRUSH_ICON_GPBRUSH_CLONE, "CLONE", ICON_GPBRUSH_CLONE, "Clone", ""},
+    {0, NULL, 0, NULL, NULL},
+};
+
+static EnumPropertyItem rna_enum_gpencil_brush_weight_icons_items[] = {
+    {GP_BRUSH_ICON_GPBRUSH_WEIGHT, "DRAW", ICON_GPBRUSH_WEIGHT, "Draw", ""},
+    {0, NULL, 0, NULL, NULL},
+};
+static EnumPropertyItem rna_enum_gpencil_brush_vertex_icons_items[] = {
+    {GP_BRUSH_ICON_VERTEX_DRAW, "DRAW", ICON_BRUSH_MIX, "Draw", ""},
+    {GP_BRUSH_ICON_VERTEX_BLUR, "BLUR", ICON_BRUSH_BLUR, "Blur", ""},
+    {GP_BRUSH_ICON_VERTEX_AVERAGE, "AVERAGE", ICON_BRUSH_BLUR, "Average", ""},
+    {GP_BRUSH_ICON_VERTEX_SMEAR, "SMEAR", ICON_BRUSH_BLUR, "Smear", ""},
+    {GP_BRUSH_ICON_VERTEX_REPLACE, "REPLACE", ICON_BRUSH_MIX, "Replace", ""},
+    {0, NULL, 0, NULL, NULL},
+};
 #endif
 
 #ifdef RNA_RUNTIME
@@ -1360,9 +1386,27 @@ static void rna_def_gpencil_options(BlenderRNA *brna)
   RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
 
   /* brush standard icon */
-  prop = RNA_def_property(srna, "gp_icon", PROP_ENUM, PROP_NONE);
+  prop = RNA_def_property(srna, "gpencil_paint_icon", PROP_ENUM, PROP_NONE);
+  RNA_def_property_enum_sdna(prop, NULL, "icon_id");
+  RNA_def_property_enum_items(prop, rna_enum_gpencil_brush_paint_icons_items);
+  RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+  RNA_def_property_ui_text(prop, "Grease Pencil Icon", "");
+
+  prop = RNA_def_property(srna, "gpencil_sculpt_icon", PROP_ENUM, PROP_NONE);
+  RNA_def_property_enum_sdna(prop, NULL, "icon_id");
+  RNA_def_property_enum_items(prop, rna_enum_gpencil_brush_sculpt_icons_items);
+  RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+  RNA_def_property_ui_text(prop, "Grease Pencil Icon", "");
+
+  prop = RNA_def_property(srna, "gpencil_weight_icon", PROP_ENUM, PROP_NONE);
+  RNA_def_property_enum_sdna(prop, NULL, "icon_id");
+  RNA_def_property_enum_items(prop, rna_enum_gpencil_brush_weight_icons_items);
+  RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+  RNA_def_property_ui_text(prop, "Grease Pencil Icon", "");
+
+  prop = RNA_def_property(srna, "gpencil_vertex_icon", PROP_ENUM, PROP_NONE);
   RNA_def_property_enum_sdna(prop, NULL, "icon_id");
-  RNA_def_property_enum_items(prop, rna_enum_gpencil_brush_icons_items);
+  RNA_def_property_enum_items(prop, rna_enum_gpencil_brush_vertex_icons_items);
   RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
   RNA_def_property_ui_text(prop, "Grease Pencil Icon", "");



More information about the Bf-blender-cvs mailing list