[Bf-blender-cvs] [d1d5c99d123] greasepencil-object: Add new property Default Eraser
Antonio Vazquez
noreply at git.blender.org
Sat Mar 3 00:07:31 CET 2018
Commit: d1d5c99d123f597d6e2c45fa3061d57cdab1494a
Author: Antonio Vazquez
Date: Sat Mar 3 00:07:16 2018 +0100
Branches: greasepencil-object
https://developer.blender.org/rBd1d5c99d123f597d6e2c45fa3061d57cdab1494a
Add new property Default Eraser
This property will be used when the eraser is enabled using fast switch key while drawing with other type of brush.
===================================================================
M release/scripts/startup/bl_ui/space_view3d_toolbar.py
M source/blender/makesdna/DNA_gpencil_types.h
M source/blender/makesrna/intern/rna_scene.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 54bb5261f55..37c903065a4 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -2128,6 +2128,8 @@ class VIEW3D_PT_tools_grease_pencil_brush(Panel):
row = col.row()
row.prop(brush, "eraser_mode", expand=True)
+ col.prop(brush, "default_eraser")
+
if brush.type != 'ERASE':
layout.separator()
layout.prop(context.tool_settings, "use_gpencil_draw_onback", text="Draw on Back")
diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h
index 702f6051d3e..b547adab550 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -170,6 +170,8 @@ typedef enum eGPDbrush_Flag {
GP_BRUSH_STABILIZE_MOUSE = (1 << 11),
/* lazy mouse override (internal only) */
GP_BRUSH_STABILIZE_MOUSE_TEMP = (1 << 12),
+ /* default eraser brush for quick switch */
+ GP_BRUSH_DEFAULT_ERASER = (1 << 13),
} eGPDbrush_Flag;
/* ***************************************** */
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index bc42f237088..908de6cc97b 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -545,6 +545,20 @@ static void rna_GPencilInterpolateSettings_type_set(PointerRNA *ptr, int value)
}
/* Grease pencil Drawing Brushes */
+static void rna_GPencil_brush_default_eraser(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
+{
+ ToolSettings *ts = scene->toolsettings;
+ bGPDbrush *brush_cur = BKE_gpencil_brush_getactive(ts);
+
+ /* disable default eraser in all brushes */
+ for (bGPDbrush *brush = ts->gp_brushes.first; brush; brush = brush->next) {
+ if ((brush != brush_cur) && (brush->type == GP_BRUSH_TYPE_ERASE)) {
+ brush->flag &= ~GP_BRUSH_DEFAULT_ERASER;
+ }
+ }
+}
+
+
static bGPDbrush *rna_GPencil_brush_new(ToolSettings *ts, const char *name, int setactive)
{
bGPDbrush *brush = BKE_gpencil_brush_addnew(ts, name, setactive != 0);
@@ -2484,6 +2498,12 @@ static void rna_def_gpencil_brush(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSH_FILL_HIDE);
RNA_def_property_boolean_default(prop, true);
RNA_def_property_ui_text(prop, "Hide", "Hide transparent lines to use as boundary for filling");
+
+ prop = RNA_def_property(srna, "default_eraser", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSH_DEFAULT_ERASER);
+ RNA_def_property_boolean_default(prop, true);
+ RNA_def_property_ui_text(prop, "Default Eraser", "Use this brush when enable eraser with fast switch key");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_brush_default_eraser");
}
/* Grease Pencil Drawing Brushes API */
More information about the Bf-blender-cvs
mailing list