GP: New pressure option for sculpt brush radius

This commit is contained in:
Antonioya
2018-09-25 20:43:50 +02:00
parent 9df3467b4e
commit 0f7e858f06
4 changed files with 17 additions and 3 deletions

View File

@@ -1415,7 +1415,8 @@ static bool gpsculpt_brush_do_stroke(
{
GP_SpaceConversion *gsc = &gso->gsc;
rcti *rect = &gso->brush_rect;
const int radius = gso->brush->size;
GP_EditBrush_Data *brush = gso->brush;
const int radius = (brush->flag & GP_EDITBRUSH_FLAG_USE_PRESSURE) ? gso->brush->size * gso->pressure : gso->brush->size;
bGPDspoint *pt1, *pt2;
int pc1[2] = {0};
@@ -1707,7 +1708,8 @@ static bool gpsculpt_brush_apply_standard(bContext *C, tGP_BrushEditData *gso)
static void gpsculpt_brush_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
{
tGP_BrushEditData *gso = op->customdata;
const int radius = gso->brush->size;
GP_EditBrush_Data *brush = gso->brush;
const int radius = (brush->flag & GP_EDITBRUSH_FLAG_USE_PRESSURE) ? gso->brush->size * gso->pressure : gso->brush->size;
float mousef[2];
int mouse[2];
bool changed = false;

View File

@@ -984,6 +984,8 @@ typedef enum eGP_EditBrush_Flag {
GP_EDITBRUSH_FLAG_ENABLE_CURSOR = (1 << 4),
/* temporary invert action */
GP_EDITBRUSH_FLAG_TMP_INVERT = (1 << 5),
/* adjust radius using pen pressure */
GP_EDITBRUSH_FLAG_PRESSURE_RADIUS = (1 << 6),
} eGP_EditBrush_Flag;

View File

@@ -1217,6 +1217,13 @@ static void rna_def_gpencil_sculpt(BlenderRNA *brna)
RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
prop = RNA_def_property(srna, "use_pressure_radius", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_EDITBRUSH_FLAG_PRESSURE_RADIUS);
RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
RNA_def_property_ui_text(prop, "Radius Pressure", "Enable tablet pressure sensitivity for radius");
RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
prop = RNA_def_property(srna, "use_falloff", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_EDITBRUSH_FLAG_USE_FALLOFF);
RNA_def_property_ui_text(prop, "Use Falloff", "Strength of brush decays with distance from cursor");