[Bf-blender-cvs] [7ac4a31ab12] greasepencil-object: UI: Add icon selector

Antonio Vazquez noreply at git.blender.org
Wed Mar 14 10:10:53 CET 2018


Commit: 7ac4a31ab1244b21d0ec3646ff06cb794b30bfc1
Author: Antonio Vazquez
Date:   Wed Mar 14 10:10:35 2018 +0100
Branches: greasepencil-object
https://developer.blender.org/rB7ac4a31ab1244b21d0ec3646ff06cb794b30bfc1

UI: Add icon selector

Now it's possible to select the standard icon used by brush. This can be required when change the brush type and want to back to old icon.

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

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/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index e112ad96853..193c5f33f5a 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -2517,8 +2517,13 @@ class VIEW3D_PT_tools_grease_pencil_appearance(Panel):
                 row = col.row(align=True)
                 row.prop(drawingbrush, "cursor_color_add", text="Color")
 
-            col.separator()
+            col.label("Icon:")
+            subcol = col.column(align=True)
+            subcol.enabled = drawingbrush.use_custom_icon is False and drawingbrush.gpencil_brush_type == 'DRAW'
+            subcol.prop(drawingbrush, "gp_icon", text="")
+
             col = col.column(align=True)
+            col.separator()
             col.prop(drawingbrush, "use_custom_icon")
             sub = col.column()
             sub.active = drawingbrush.use_custom_icon
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index ad96b5f20f1..19c13544daa 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -147,6 +147,21 @@ static EnumPropertyItem rna_enum_gpencil_fill_draw_modes_items[] = {
 	{ 0, NULL, 0, NULL, NULL }
 };
 
+static EnumPropertyItem rna_enum_gpencil_brush_icons_items[] = {
+	{ GPBRUSH_CUSTOM, "CUSTOM", ICON_GPBRUSH_CUSTOM, "Custom", "" },
+	{ GPBRUSH_PENCIL, "PENCIL", ICON_GPBRUSH_PENCIL, "Pencil", "" },
+	{ GPBRUSH_PEN, "PEN", ICON_GPBRUSH_PEN, "Pen", "" },
+	{ GPBRUSH_INK, "INK", ICON_GPBRUSH_INK, "Ink", "" },
+	{ GPBRUSH_INKNOISE, "INKNOISE", ICON_GPBRUSH_INKNOISE, "Ink Noise", "" },
+	{ GPBRUSH_BLOCK, "BLOCK", ICON_GPBRUSH_BLOCK, "Block", "" },
+	{ GPBRUSH_MARKER, "MARKER", ICON_GPBRUSH_MARKER, "Marker", "" },
+	{ GPBRUSH_FILL, "FILL", ICON_GPBRUSH_FILL, "Fill", "" },
+	{ GPBRUSH_ERASE_SOFT, "SOFT", ICON_GPBRUSH_ERASE_SOFT, "Eraser Soft", "" },
+	{ GPBRUSH_ERASE_HARD, "HARD", ICON_GPBRUSH_ERASE_HARD, "Eraser Hard", "" },
+	{ GPBRUSH_ERASE_STROKE, "STROKE", ICON_GPBRUSH_ERASE_STROKE, "Eraser Stroke", "" },
+	{ 0, NULL, 0, NULL, NULL }
+};
+
 #ifdef RNA_RUNTIME
 
 #include "MEM_guardedalloc.h"
@@ -1747,6 +1762,12 @@ static void rna_def_brush(BlenderRNA *brna)
 		"Amount of smoothing while drawing ");
 	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
 
+	/* brush standard icon */
+	prop = RNA_def_property(srna, "gp_icon", PROP_ENUM, PROP_NONE);
+	RNA_def_property_enum_sdna(prop, NULL, "gp_icon_id");
+	RNA_def_property_enum_items(prop, rna_enum_gpencil_brush_icons_items);
+	RNA_def_property_ui_text(prop, "Grease Pencil Icon", "");
+
 	/* Flags */
 	prop = RNA_def_property(srna, "use_pressure", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "gp_flag", GP_BRUSH_USE_PRESSURE);



More information about the Bf-blender-cvs mailing list