GP: Harmonize Sculpt Struct and field names

Changed the following names:

- GP_EditBrush_Data->GP_Sculpt_Data
- eGP_EditBrush_Types->eGP_Sculpt_Types
- eGP_EditBrush_Flag->eGP_Sculpt_Flag
- eGP_BrushEdit_SettingsFlag->eGP_Sculpt_SettingsFlag
- GP_BrushEdit_Settings->GP_Sculpt_Settings
- GP_EDITBRUSH_FLAG*->GP_SCULPT_FLAG*
- GP_EDITBRUSH_TYPE*->GP_SCULPT_TYPE*
- GP_BRUSHEDIT_FLAG_*->GP_SCULPT_SETT_FLAG_*
This commit is contained in:
Antonio Vazquez 2018-11-18 19:28:54 +01:00
parent 991bb00762
commit 64920a8feb
Notes: blender-bot 2023-02-14 09:19:09 +01:00
Referenced by issue #57818, Grease Pencil: various issues
10 changed files with 238 additions and 220 deletions

View File

@ -775,65 +775,65 @@ void BKE_scene_init(Scene *sce)
/* GP Sculpt brushes */
{
GP_BrushEdit_Settings *gset = &sce->toolsettings->gp_sculpt;
GP_EditBrush_Data *gp_brush;
GP_Sculpt_Settings *gset = &sce->toolsettings->gp_sculpt;
GP_Sculpt_Data *gp_brush;
float curcolor_add[3], curcolor_sub[3];
ARRAY_SET_ITEMS(curcolor_add, 1.0f, 0.6f, 0.6f);
ARRAY_SET_ITEMS(curcolor_sub, 0.6f, 0.6f, 1.0f);
gp_brush = &gset->brush[GP_EDITBRUSH_TYPE_SMOOTH];
gp_brush = &gset->brush[GP_SCULPT_TYPE_SMOOTH];
gp_brush->size = 25;
gp_brush->strength = 0.3f;
gp_brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF | GP_EDITBRUSH_FLAG_SMOOTH_PRESSURE | GP_EDITBRUSH_FLAG_ENABLE_CURSOR;
gp_brush->flag = GP_SCULPT_FLAG_USE_FALLOFF | GP_SCULPT_FLAG_SMOOTH_PRESSURE | GP_SCULPT_FLAG_ENABLE_CURSOR;
copy_v3_v3(gp_brush->curcolor_add, curcolor_add);
copy_v3_v3(gp_brush->curcolor_sub, curcolor_sub);
gp_brush = &gset->brush[GP_EDITBRUSH_TYPE_THICKNESS];
gp_brush = &gset->brush[GP_SCULPT_TYPE_THICKNESS];
gp_brush->size = 25;
gp_brush->strength = 0.5f;
gp_brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF | GP_EDITBRUSH_FLAG_ENABLE_CURSOR;
gp_brush->flag = GP_SCULPT_FLAG_USE_FALLOFF | GP_SCULPT_FLAG_ENABLE_CURSOR;
copy_v3_v3(gp_brush->curcolor_add, curcolor_add);
copy_v3_v3(gp_brush->curcolor_sub, curcolor_sub);
gp_brush = &gset->brush[GP_EDITBRUSH_TYPE_STRENGTH];
gp_brush = &gset->brush[GP_SCULPT_TYPE_STRENGTH];
gp_brush->size = 25;
gp_brush->strength = 0.5f;
gp_brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF | GP_EDITBRUSH_FLAG_ENABLE_CURSOR;
gp_brush->flag = GP_SCULPT_FLAG_USE_FALLOFF | GP_SCULPT_FLAG_ENABLE_CURSOR;
copy_v3_v3(gp_brush->curcolor_add, curcolor_add);
copy_v3_v3(gp_brush->curcolor_sub, curcolor_sub);
gp_brush = &gset->brush[GP_EDITBRUSH_TYPE_GRAB];
gp_brush = &gset->brush[GP_SCULPT_TYPE_GRAB];
gp_brush->size = 50;
gp_brush->strength = 0.3f;
gp_brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF | GP_EDITBRUSH_FLAG_ENABLE_CURSOR;
gp_brush->flag = GP_SCULPT_FLAG_USE_FALLOFF | GP_SCULPT_FLAG_ENABLE_CURSOR;
copy_v3_v3(gp_brush->curcolor_add, curcolor_add);
copy_v3_v3(gp_brush->curcolor_sub, curcolor_sub);
gp_brush = &gset->brush[GP_EDITBRUSH_TYPE_PUSH];
gp_brush = &gset->brush[GP_SCULPT_TYPE_PUSH];
gp_brush->size = 25;
gp_brush->strength = 0.3f;
gp_brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF | GP_EDITBRUSH_FLAG_ENABLE_CURSOR;
gp_brush->flag = GP_SCULPT_FLAG_USE_FALLOFF | GP_SCULPT_FLAG_ENABLE_CURSOR;
copy_v3_v3(gp_brush->curcolor_add, curcolor_add);
copy_v3_v3(gp_brush->curcolor_sub, curcolor_sub);
gp_brush = &gset->brush[GP_EDITBRUSH_TYPE_TWIST];
gp_brush = &gset->brush[GP_SCULPT_TYPE_TWIST];
gp_brush->size = 50;
gp_brush->strength = 0.3f; // XXX?
gp_brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF | GP_EDITBRUSH_FLAG_ENABLE_CURSOR;
gp_brush->strength = 0.3f;
gp_brush->flag = GP_SCULPT_FLAG_USE_FALLOFF | GP_SCULPT_FLAG_ENABLE_CURSOR;
copy_v3_v3(gp_brush->curcolor_add, curcolor_add);
copy_v3_v3(gp_brush->curcolor_sub, curcolor_sub);
gp_brush = &gset->brush[GP_EDITBRUSH_TYPE_PINCH];
gp_brush = &gset->brush[GP_SCULPT_TYPE_PINCH];
gp_brush->size = 50;
gp_brush->strength = 0.5f; // XXX?
gp_brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF | GP_EDITBRUSH_FLAG_ENABLE_CURSOR;
gp_brush->strength = 0.5f;
gp_brush->flag = GP_SCULPT_FLAG_USE_FALLOFF | GP_SCULPT_FLAG_ENABLE_CURSOR;
copy_v3_v3(gp_brush->curcolor_add, curcolor_add);
copy_v3_v3(gp_brush->curcolor_sub, curcolor_sub);
gp_brush = &gset->brush[GP_EDITBRUSH_TYPE_RANDOMIZE];
gp_brush = &gset->brush[GP_SCULPT_TYPE_RANDOMIZE];
gp_brush->size = 25;
gp_brush->strength = 0.5f;
gp_brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF | GP_EDITBRUSH_FLAG_ENABLE_CURSOR;
gp_brush->flag = GP_SCULPT_FLAG_USE_FALLOFF | GP_SCULPT_FLAG_ENABLE_CURSOR;
copy_v3_v3(gp_brush->curcolor_add, curcolor_add);
copy_v3_v3(gp_brush->curcolor_sub, curcolor_sub);
}

View File

@ -1103,45 +1103,45 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
ToolSettings *ts = scene->toolsettings;
if (ts->gp_sculpt.brush[0].size == 0) {
GP_BrushEdit_Settings *gset = &ts->gp_sculpt;
GP_EditBrush_Data *brush;
GP_Sculpt_Settings *gset = &ts->gp_sculpt;
GP_Sculpt_Data *brush;
brush = &gset->brush[GP_EDITBRUSH_TYPE_SMOOTH];
brush = &gset->brush[GP_SCULPT_TYPE_SMOOTH];
brush->size = 25;
brush->strength = 0.3f;
brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF | GP_EDITBRUSH_FLAG_SMOOTH_PRESSURE;
brush->flag = GP_SCULPT_FLAG_USE_FALLOFF | GP_SCULPT_FLAG_SMOOTH_PRESSURE;
brush = &gset->brush[GP_EDITBRUSH_TYPE_THICKNESS];
brush = &gset->brush[GP_SCULPT_TYPE_THICKNESS];
brush->size = 25;
brush->strength = 0.5f;
brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF;
brush->flag = GP_SCULPT_FLAG_USE_FALLOFF;
brush = &gset->brush[GP_EDITBRUSH_TYPE_GRAB];
brush = &gset->brush[GP_SCULPT_TYPE_GRAB];
brush->size = 50;
brush->strength = 0.3f;
brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF;
brush->flag = GP_SCULPT_FLAG_USE_FALLOFF;
brush = &gset->brush[GP_EDITBRUSH_TYPE_PUSH];
brush = &gset->brush[GP_SCULPT_TYPE_PUSH];
brush->size = 25;
brush->strength = 0.3f;
brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF;
brush->flag = GP_SCULPT_FLAG_USE_FALLOFF;
brush = &gset->brush[GP_EDITBRUSH_TYPE_TWIST];
brush = &gset->brush[GP_SCULPT_TYPE_TWIST];
brush->size = 50;
brush->strength = 0.3f; // XXX?
brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF;
brush->flag = GP_SCULPT_FLAG_USE_FALLOFF;
brush = &gset->brush[GP_EDITBRUSH_TYPE_PINCH];
brush = &gset->brush[GP_SCULPT_TYPE_PINCH];
brush->size = 50;
brush->strength = 0.5f; // XXX?
brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF;
brush->flag = GP_SCULPT_FLAG_USE_FALLOFF;
brush = &gset->brush[GP_EDITBRUSH_TYPE_RANDOMIZE];
brush = &gset->brush[GP_SCULPT_TYPE_RANDOMIZE];
brush->size = 25;
brush->strength = 0.5f;
brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF;
brush->flag = GP_SCULPT_FLAG_USE_FALLOFF;
brush = &gset->brush[GP_EDITBRUSH_TYPE_CLONE];
brush = &gset->brush[GP_SCULPT_TYPE_CLONE];
brush->size = 50;
brush->strength = 1.0f;
}
@ -1404,17 +1404,17 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
ToolSettings *ts = scene->toolsettings;
/* initialize use position for sculpt brushes */
ts->gp_sculpt.flag |= GP_BRUSHEDIT_FLAG_APPLY_POSITION;
ts->gp_sculpt.flag |= GP_SCULPT_SETT_FLAG_APPLY_POSITION;
/* new strength sculpt brush */
if (ts->gp_sculpt.brush[0].size >= 11) {
GP_BrushEdit_Settings *gset = &ts->gp_sculpt;
GP_EditBrush_Data *brush;
GP_Sculpt_Settings *gset = &ts->gp_sculpt;
GP_Sculpt_Data *brush;
brush = &gset->brush[GP_EDITBRUSH_TYPE_STRENGTH];
brush = &gset->brush[GP_SCULPT_TYPE_STRENGTH];
brush->size = 25;
brush->strength = 0.5f;
brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF;
brush->flag = GP_SCULPT_FLAG_USE_FALLOFF;
}
}
/* Convert Grease Pencil to new palettes/brushes

View File

@ -1078,12 +1078,12 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
{
/* Grease pencil sculpt and paint cursors */
if (!DNA_struct_elem_find(fd->filesdna, "GP_BrushEdit_Settings", "int", "weighttype")) {
if (!DNA_struct_elem_find(fd->filesdna, "GP_Sculpt_Settings", "int", "weighttype")) {
for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
/* sculpt brushes */
GP_BrushEdit_Settings *gset = &scene->toolsettings->gp_sculpt;
GP_Sculpt_Settings *gset = &scene->toolsettings->gp_sculpt;
if (gset) {
gset->weighttype = GP_EDITBRUSH_TYPE_WEIGHT;
gset->weighttype = GP_SCULPT_TYPE_WEIGHT;
}
}
}
@ -1092,15 +1092,15 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
float curcolor_add[3], curcolor_sub[3];
ARRAY_SET_ITEMS(curcolor_add, 1.0f, 0.6f, 0.6f);
ARRAY_SET_ITEMS(curcolor_sub, 0.6f, 0.6f, 1.0f);
GP_EditBrush_Data *gp_brush;
GP_Sculpt_Data *gp_brush;
for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
ToolSettings *ts = scene->toolsettings;
/* sculpt brushes */
GP_BrushEdit_Settings *gset = &ts->gp_sculpt;
for (int i = 0; i < GP_EDITBRUSH_TYPE_MAX; ++i) {
GP_Sculpt_Settings *gset = &ts->gp_sculpt;
for (int i = 0; i < GP_SCULPT_TYPE_MAX; ++i) {
gp_brush = &gset->brush[i];
gp_brush->flag |= GP_EDITBRUSH_FLAG_ENABLE_CURSOR;
gp_brush->flag |= GP_SCULPT_FLAG_ENABLE_CURSOR;
copy_v3_v3(gp_brush->curcolor_add, curcolor_add);
copy_v3_v3(gp_brush->curcolor_sub, curcolor_sub);
}
@ -1122,10 +1122,10 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
/* Grease pencil multiframe falloff curve */
if (!DNA_struct_elem_find(fd->filesdna, "GP_BrushEdit_Settings", "CurveMapping", "cur_falloff")) {
if (!DNA_struct_elem_find(fd->filesdna, "GP_Sculpt_Settings", "CurveMapping", "cur_falloff")) {
for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
/* sculpt brushes */
GP_BrushEdit_Settings *gset = &scene->toolsettings->gp_sculpt;
GP_Sculpt_Settings *gset = &scene->toolsettings->gp_sculpt;
if ((gset) && (gset->cur_falloff == NULL)) {
gset->cur_falloff = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
curvemapping_initialize(gset->cur_falloff);
@ -1962,10 +1962,10 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
/* default loc axis */
if (!DNA_struct_elem_find(fd->filesdna, "GP_BrushEdit_Settings", "int", "lock_axis")) {
if (!DNA_struct_elem_find(fd->filesdna, "GP_Sculpt_Settings", "int", "lock_axis")) {
for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
/* lock axis */
GP_BrushEdit_Settings *gset = &scene->toolsettings->gp_sculpt;
GP_Sculpt_Settings *gset = &scene->toolsettings->gp_sculpt;
if (gset) {
gset->lock_axis = GP_LOCKAXIS_Y;
}
@ -2252,6 +2252,28 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
{
/* Grease pencil reset sculpt brushes after struct rename */
if (!DNA_struct_elem_find(fd->filesdna, "GP_Sculpt_Settings", "int", "weighttype")) {
float curcolor_add[3], curcolor_sub[3];
ARRAY_SET_ITEMS(curcolor_add, 1.0f, 0.6f, 0.6f);
ARRAY_SET_ITEMS(curcolor_sub, 0.6f, 0.6f, 1.0f);
for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
/* sculpt brushes */
GP_Sculpt_Settings *gset = &scene->toolsettings->gp_sculpt;
if (gset) {
for (int i = 0; i < GP_SCULPT_TYPE_MAX; i++) {
GP_Sculpt_Data *gp_brush = &gset->brush[i];
gp_brush->size = 30;
gp_brush->strength = 0.5f;
gp_brush->flag = GP_SCULPT_FLAG_USE_FALLOFF | GP_SCULPT_FLAG_ENABLE_CURSOR;
copy_v3_v3(gp_brush->curcolor_add, curcolor_add);
copy_v3_v3(gp_brush->curcolor_sub, curcolor_sub);
}
}
}
}
if (!DNA_struct_elem_find(fd->filesdna, "SceneEEVEE", "float", "overscan")) {
for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
scene->eevee.overscan = 3.0f;

View File

@ -1221,7 +1221,7 @@ static void gp_paint_initstroke(tGPsdata *p, eGPencil_PaintModes paintmode, Deps
* (though this is only available in editmode)
*/
if (p->gpd->flag & GP_DATA_STROKE_EDITMODE) {
if (ts->gp_sculpt.flag & GP_BRUSHEDIT_FLAG_SELECT_MASK) {
if (ts->gp_sculpt.flag & GP_SCULPT_SETT_FLAG_SELECT_MASK) {
p->flags |= GP_PAINTFLAG_SELECTMASK;
}
}

View File

@ -107,11 +107,11 @@ typedef struct tGP_BrushEditData {
bGPdata *gpd;
/* Brush Settings */
GP_BrushEdit_Settings *settings;
GP_EditBrush_Data *gp_brush;
GP_Sculpt_Settings *settings;
GP_Sculpt_Data *gp_brush;
eGP_EditBrush_Types brush_type;
eGP_EditBrush_Flag flag;
eGP_Sculpt_Types brush_type;
eGP_Sculpt_Flag flag;
/* Space Conversion Data */
GP_SpaceConversion gsc;
@ -199,16 +199,16 @@ static void gpsculpt_compute_lock_axis(tGP_BrushEditData *gso, bGPDspoint *pt, c
/* Context ---------------------------------------- */
/* Get the sculpting settings */
static GP_BrushEdit_Settings *gpsculpt_get_settings(Scene *scene)
static GP_Sculpt_Settings *gpsculpt_get_settings(Scene *scene)
{
return &scene->toolsettings->gp_sculpt;
}
/* Get the active brush */
static GP_EditBrush_Data *gpsculpt_get_brush(Scene *scene, bool is_weight_mode)
static GP_Sculpt_Data *gpsculpt_get_brush(Scene *scene, bool is_weight_mode)
{
GP_BrushEdit_Settings *gset = &scene->toolsettings->gp_sculpt;
GP_EditBrush_Data *gp_brush = NULL;
GP_Sculpt_Settings *gset = &scene->toolsettings->gp_sculpt;
GP_Sculpt_Data *gp_brush = NULL;
if (is_weight_mode) {
gp_brush = &gset->brush[gset->weighttype];
}
@ -225,19 +225,19 @@ static GP_EditBrush_Data *gpsculpt_get_brush(Scene *scene, bool is_weight_mode)
static bool gp_brush_invert_check(tGP_BrushEditData *gso)
{
/* The basic setting is the brush's setting (from the panel) */
bool invert = ((gso->gp_brush->flag & GP_EDITBRUSH_FLAG_INVERT) != 0);
bool invert = ((gso->gp_brush->flag & GP_SCULPT_FLAG_INVERT) != 0);
/* During runtime, the user can hold down the Ctrl key to invert the basic behaviour */
if (gso->flag & GP_EDITBRUSH_FLAG_INVERT) {
if (gso->flag & GP_SCULPT_FLAG_INVERT) {
invert ^= true;
}
/* set temporary status */
if (invert) {
gso->gp_brush->flag |= GP_EDITBRUSH_FLAG_TMP_INVERT;
gso->gp_brush->flag |= GP_SCULPT_FLAG_TMP_INVERT;
}
else {
gso->gp_brush->flag &= ~GP_EDITBRUSH_FLAG_TMP_INVERT;
gso->gp_brush->flag &= ~GP_SCULPT_FLAG_TMP_INVERT;
}
return invert;
@ -246,18 +246,18 @@ static bool gp_brush_invert_check(tGP_BrushEditData *gso)
/* Compute strength of effect */
static float gp_brush_influence_calc(tGP_BrushEditData *gso, const int radius, const int co[2])
{
GP_EditBrush_Data *gp_brush = gso->gp_brush;
GP_Sculpt_Data *gp_brush = gso->gp_brush;
/* basic strength factor from brush settings */
float influence = gp_brush->strength;
/* use pressure? */
if (gp_brush->flag & GP_EDITBRUSH_FLAG_USE_PRESSURE) {
if (gp_brush->flag & GP_SCULPT_FLAG_USE_PRESSURE) {
influence *= gso->pressure;
}
/* distance fading */
if (gp_brush->flag & GP_EDITBRUSH_FLAG_USE_FALLOFF) {
if (gp_brush->flag & GP_SCULPT_FLAG_USE_FALLOFF) {
float distance = (float)len_v2v2_int(gso->mval, co);
float fac;
@ -288,29 +288,29 @@ static bool gp_brush_smooth_apply(
tGP_BrushEditData *gso, bGPDstroke *gps, int pt_index,
const int radius, const int co[2])
{
// GP_EditBrush_Data *gp_brush = gso->brush;
// GP_Sculpt_Data *gp_brush = gso->brush;
float inf = gp_brush_influence_calc(gso, radius, co);
/* need one flag enabled by default */
if ((gso->settings->flag &
(GP_BRUSHEDIT_FLAG_APPLY_POSITION |
GP_BRUSHEDIT_FLAG_APPLY_STRENGTH |
GP_BRUSHEDIT_FLAG_APPLY_THICKNESS |
GP_BRUSHEDIT_FLAG_APPLY_UV)) == 0)
(GP_SCULPT_SETT_FLAG_APPLY_POSITION |
GP_SCULPT_SETT_FLAG_APPLY_STRENGTH |
GP_SCULPT_SETT_FLAG_APPLY_THICKNESS |
GP_SCULPT_SETT_FLAG_APPLY_UV)) == 0)
{
gso->settings->flag |= GP_BRUSHEDIT_FLAG_APPLY_POSITION;
gso->settings->flag |= GP_SCULPT_SETT_FLAG_APPLY_POSITION;
}
/* perform smoothing */
if (gso->settings->flag & GP_BRUSHEDIT_FLAG_APPLY_POSITION) {
if (gso->settings->flag & GP_SCULPT_SETT_FLAG_APPLY_POSITION) {
BKE_gpencil_smooth_stroke(gps, pt_index, inf);
}
if (gso->settings->flag & GP_BRUSHEDIT_FLAG_APPLY_STRENGTH) {
if (gso->settings->flag & GP_SCULPT_SETT_FLAG_APPLY_STRENGTH) {
BKE_gpencil_smooth_stroke_strength(gps, pt_index, inf);
}
if (gso->settings->flag & GP_BRUSHEDIT_FLAG_APPLY_THICKNESS) {
if (gso->settings->flag & GP_SCULPT_SETT_FLAG_APPLY_THICKNESS) {
BKE_gpencil_smooth_stroke_thickness(gps, pt_index, inf);
}
if (gso->settings->flag & GP_BRUSHEDIT_FLAG_APPLY_UV) {
if (gso->settings->flag & GP_SCULPT_SETT_FLAG_APPLY_UV) {
BKE_gpencil_smooth_stroke_uv(gps, pt_index, inf);
}
@ -766,16 +766,16 @@ static bool gp_brush_randomize_apply(
const float fac = BLI_rng_get_float(gso->rng) * inf;
/* need one flag enabled by default */
if ((gso->settings->flag &
(GP_BRUSHEDIT_FLAG_APPLY_POSITION |
GP_BRUSHEDIT_FLAG_APPLY_STRENGTH |
GP_BRUSHEDIT_FLAG_APPLY_THICKNESS |
GP_BRUSHEDIT_FLAG_APPLY_UV)) == 0)
(GP_SCULPT_SETT_FLAG_APPLY_POSITION |
GP_SCULPT_SETT_FLAG_APPLY_STRENGTH |
GP_SCULPT_SETT_FLAG_APPLY_THICKNESS |
GP_SCULPT_SETT_FLAG_APPLY_UV)) == 0)
{
gso->settings->flag |= GP_BRUSHEDIT_FLAG_APPLY_POSITION;
gso->settings->flag |= GP_SCULPT_SETT_FLAG_APPLY_POSITION;
}
/* apply random to position */
if (gso->settings->flag & GP_BRUSHEDIT_FLAG_APPLY_POSITION) {
if (gso->settings->flag & GP_SCULPT_SETT_FLAG_APPLY_POSITION) {
/* Jitter is applied perpendicular to the mouse movement vector
* - We compute all effects in screenspace (since it's easier)
* and then project these to get the points/distances in
@ -832,7 +832,7 @@ static bool gp_brush_randomize_apply(
}
}
/* apply random to strength */
if (gso->settings->flag & GP_BRUSHEDIT_FLAG_APPLY_STRENGTH) {
if (gso->settings->flag & GP_SCULPT_SETT_FLAG_APPLY_STRENGTH) {
if (BLI_rng_get_float(gso->rng) > 0.5f) {
pt->strength += fac;
}
@ -843,7 +843,7 @@ static bool gp_brush_randomize_apply(
CLAMP_MAX(pt->strength, 1.0f);
}
/* apply random to thickness (use pressure) */
if (gso->settings->flag & GP_BRUSHEDIT_FLAG_APPLY_THICKNESS) {
if (gso->settings->flag & GP_SCULPT_SETT_FLAG_APPLY_THICKNESS) {
if (BLI_rng_get_float(gso->rng) > 0.5f) {
pt->pressure += fac;
}
@ -854,7 +854,7 @@ static bool gp_brush_randomize_apply(
CLAMP_MIN(pt->pressure, 0.0f);
}
/* apply random to UV (use pressure) */
if (gso->settings->flag & GP_BRUSHEDIT_FLAG_APPLY_UV) {
if (gso->settings->flag & GP_SCULPT_SETT_FLAG_APPLY_UV) {
if (BLI_rng_get_float(gso->rng) > 0.5f) {
pt->uv_rot += fac;
}
@ -1108,7 +1108,7 @@ static void gp_brush_clone_adjust(tGP_BrushEditData *gso)
int i;
for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
if (gso->gp_brush->flag & GP_EDITBRUSH_FLAG_USE_FALLOFF) {
if (gso->gp_brush->flag & GP_SCULPT_FLAG_USE_FALLOFF) {
/* "Smudge" Effect when falloff is enabled */
float delta[3] = {0.0f};
int sco[2] = {0};
@ -1189,8 +1189,8 @@ static bool gpsculpt_brush_init(bContext *C, wmOperator *op)
const bool is_weight_mode = ob->mode == OB_MODE_GPENCIL_WEIGHT;
/* set the brush using the tool */
#if 0
GP_BrushEdit_Settings *gset = &ts->gp_sculpt;
eGP_EditBrush_Types mode = is_weight_mode ? gset->weighttype : gset->brushtype;
GP_Sculpt_Settings *gset = &ts->gp_sculpt;
eGP_Sculpt_Types mode = is_weight_mode ? gset->weighttype : gset->brushtype;
#endif
tGP_BrushEditData *gso;
@ -1222,8 +1222,8 @@ static bool gpsculpt_brush_init(bContext *C, wmOperator *op)
gso->cfra = INT_MAX; /* NOTE: So that first stroke will get handled in init_stroke() */
/* some brushes cannot use pressure for radius */
if (ELEM(gso->brush_type, GP_EDITBRUSH_TYPE_GRAB, GP_EDITBRUSH_TYPE_CLONE)) {
gso->gp_brush->flag &= ~GP_EDITBRUSH_FLAG_PRESSURE_RADIUS;
if (ELEM(gso->brush_type, GP_SCULPT_TYPE_GRAB, GP_SCULPT_TYPE_CLONE)) {
gso->gp_brush->flag &= ~GP_SCULPT_FLAG_PRESSURE_RADIUS;
}
gso->scene = scene;
@ -1243,7 +1243,7 @@ static bool gpsculpt_brush_init(bContext *C, wmOperator *op)
/* multiframe settings */
gso->is_multiframe = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gso->gpd);
gso->use_multiframe_falloff = (ts->gp_sculpt.flag & GP_BRUSHEDIT_FLAG_FRAME_FALLOFF) != 0;
gso->use_multiframe_falloff = (ts->gp_sculpt.flag & GP_SCULPT_SETT_FLAG_FRAME_FALLOFF) != 0;
/* init multiedit falloff curve data before doing anything,
* so we won't have to do it again later
@ -1254,7 +1254,7 @@ static bool gpsculpt_brush_init(bContext *C, wmOperator *op)
/* initialise custom data for brushes */
switch (gso->brush_type) {
case GP_EDITBRUSH_TYPE_CLONE:
case GP_SCULPT_TYPE_CLONE:
{
bGPDstroke *gps;
bool found = false;
@ -1283,7 +1283,7 @@ static bool gpsculpt_brush_init(bContext *C, wmOperator *op)
break;
}
case GP_EDITBRUSH_TYPE_GRAB:
case GP_SCULPT_TYPE_GRAB:
{
/* initialise the cache needed for this brush */
gso->stroke_customdata = BLI_ghash_ptr_new("GP Grab Brush - Strokes Hash");
@ -1317,7 +1317,7 @@ static void gpsculpt_brush_exit(bContext *C, wmOperator *op)
/* free brush-specific data */
switch (gso->brush_type) {
case GP_EDITBRUSH_TYPE_GRAB:
case GP_SCULPT_TYPE_GRAB:
{
/* Free per-stroke customdata
* - Keys don't need to be freed, as those are the strokes
@ -1327,7 +1327,7 @@ static void gpsculpt_brush_exit(bContext *C, wmOperator *op)
break;
}
case GP_EDITBRUSH_TYPE_CLONE:
case GP_SCULPT_TYPE_CLONE:
{
/* Free customdata */
gp_brush_clone_free(gso);
@ -1355,7 +1355,7 @@ static void gpsculpt_brush_exit(bContext *C, wmOperator *op)
}
/* disable temp invert flag */
gso->gp_brush->flag &= ~GP_EDITBRUSH_FLAG_TMP_INVERT;
gso->gp_brush->flag &= ~GP_SCULPT_FLAG_TMP_INVERT;
/* free operator data */
MEM_freeN(gso);
@ -1412,8 +1412,8 @@ static bool gpsculpt_brush_do_stroke(
{
GP_SpaceConversion *gsc = &gso->gsc;
rcti *rect = &gso->brush_rect;
GP_EditBrush_Data *gp_brush = gso->gp_brush;
const int radius = (gp_brush->flag & GP_EDITBRUSH_FLAG_PRESSURE_RADIUS) ? gso->gp_brush->size * gso->pressure : gso->gp_brush->size;
GP_Sculpt_Data *gp_brush = gso->gp_brush;
const int radius = (gp_brush->flag & GP_SCULPT_FLAG_PRESSURE_RADIUS) ? gso->gp_brush->size * gso->pressure : gso->gp_brush->size;
bGPDspoint *pt1, *pt2;
int pc1[2] = {0};
@ -1446,7 +1446,7 @@ static bool gpsculpt_brush_do_stroke(
pt2 = gps->points + i + 1;
/* Skip if neither one is selected (and we are only allowed to edit/consider selected points) */
if (gso->settings->flag & GP_BRUSHEDIT_FLAG_SELECT_MASK) {
if (gso->settings->flag & GP_SCULPT_SETT_FLAG_SELECT_MASK) {
if (!(pt1->flag & GP_SPOINT_SELECT) && !(pt2->flag & GP_SPOINT_SELECT)) {
include_last = false;
continue;
@ -1527,25 +1527,25 @@ static bool gpsculpt_brush_do_frame(
}
switch (gso->brush_type) {
case GP_EDITBRUSH_TYPE_SMOOTH: /* Smooth strokes */
case GP_SCULPT_TYPE_SMOOTH: /* Smooth strokes */
{
changed |= gpsculpt_brush_do_stroke(gso, gps, diff_mat, gp_brush_smooth_apply);
break;
}
case GP_EDITBRUSH_TYPE_THICKNESS: /* Adjust stroke thickness */
case GP_SCULPT_TYPE_THICKNESS: /* Adjust stroke thickness */
{
changed |= gpsculpt_brush_do_stroke(gso, gps, diff_mat, gp_brush_thickness_apply);
break;
}
case GP_EDITBRUSH_TYPE_STRENGTH: /* Adjust stroke color strength */
case GP_SCULPT_TYPE_STRENGTH: /* Adjust stroke color strength */
{
changed |= gpsculpt_brush_do_stroke(gso, gps, diff_mat, gp_brush_strength_apply);
break;
}
case GP_EDITBRUSH_TYPE_GRAB: /* Grab points */
case GP_SCULPT_TYPE_GRAB: /* Grab points */
{
if (gso->first) {
/* First time this brush stroke is being applied:
@ -1563,31 +1563,31 @@ static bool gpsculpt_brush_do_frame(
break;
}
case GP_EDITBRUSH_TYPE_PUSH: /* Push points */
case GP_SCULPT_TYPE_PUSH: /* Push points */
{
changed |= gpsculpt_brush_do_stroke(gso, gps, diff_mat, gp_brush_push_apply);
break;
}
case GP_EDITBRUSH_TYPE_PINCH: /* Pinch points */
case GP_SCULPT_TYPE_PINCH: /* Pinch points */
{
changed |= gpsculpt_brush_do_stroke(gso, gps, diff_mat, gp_brush_pinch_apply);
break;
}
case GP_EDITBRUSH_TYPE_TWIST: /* Twist points around midpoint */
case GP_SCULPT_TYPE_TWIST: /* Twist points around midpoint */
{
changed |= gpsculpt_brush_do_stroke(gso, gps, diff_mat, gp_brush_twist_apply);
break;
}
case GP_EDITBRUSH_TYPE_RANDOMIZE: /* Apply jitter */
case GP_SCULPT_TYPE_RANDOMIZE: /* Apply jitter */
{
changed |= gpsculpt_brush_do_stroke(gso, gps, diff_mat, gp_brush_randomize_apply);
break;
}
case GP_EDITBRUSH_TYPE_WEIGHT: /* Adjust vertex group weight */
case GP_SCULPT_TYPE_WEIGHT: /* Adjust vertex group weight */
{
changed |= gpsculpt_brush_do_stroke(gso, gps, diff_mat, gp_brush_weight_apply);
break;
@ -1619,23 +1619,23 @@ static bool gpsculpt_brush_apply_standard(bContext *C, tGP_BrushEditData *gso)
/* Calculate brush-specific data which applies equally to all points */
switch (gso->brush_type) {
case GP_EDITBRUSH_TYPE_GRAB: /* Grab points */
case GP_EDITBRUSH_TYPE_PUSH: /* Push points */
case GP_SCULPT_TYPE_GRAB: /* Grab points */
case GP_SCULPT_TYPE_PUSH: /* Push points */
{
/* calculate amount of displacement to apply */
gp_brush_grab_calc_dvec(gso);
break;
}
case GP_EDITBRUSH_TYPE_PINCH: /* Pinch points */
case GP_EDITBRUSH_TYPE_TWIST: /* Twist points around midpoint */
case GP_SCULPT_TYPE_PINCH: /* Pinch points */
case GP_SCULPT_TYPE_TWIST: /* Twist points around midpoint */
{
/* calculate midpoint of the brush (in data space) */
gp_brush_calc_midpoint(gso);
break;
}
case GP_EDITBRUSH_TYPE_RANDOMIZE: /* Random jitter */
case GP_SCULPT_TYPE_RANDOMIZE: /* Random jitter */
{
/* compute the displacement vector for the cursor (in data space) */
gp_brush_grab_calc_dvec(gso);
@ -1705,9 +1705,9 @@ 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;
GP_EditBrush_Data *gp_brush = gso->gp_brush;
GP_Sculpt_Data *gp_brush = gso->gp_brush;
const int radius = (
(gp_brush->flag & GP_EDITBRUSH_FLAG_PRESSURE_RADIUS) ?
(gp_brush->flag & GP_SCULPT_FLAG_PRESSURE_RADIUS) ?
gso->gp_brush->size * gso->pressure : gso->gp_brush->size);
float mousef[2];
int mouse[2];
@ -1721,9 +1721,9 @@ static void gpsculpt_brush_apply(bContext *C, wmOperator *op, PointerRNA *itempt
gso->pressure = RNA_float_get(itemptr, "pressure");
if (RNA_boolean_get(itemptr, "pen_flip"))
gso->flag |= GP_EDITBRUSH_FLAG_INVERT;
gso->flag |= GP_SCULPT_FLAG_INVERT;
else
gso->flag &= ~GP_EDITBRUSH_FLAG_INVERT;
gso->flag &= ~GP_SCULPT_FLAG_INVERT;
/* Store coordinates as reference, if operator just started running */
@ -1741,7 +1741,7 @@ static void gpsculpt_brush_apply(bContext *C, wmOperator *op, PointerRNA *itempt
/* Apply brush */
if (gso->brush_type == GP_EDITBRUSH_TYPE_CLONE) {
if (gso->brush_type == GP_SCULPT_TYPE_CLONE) {
changed = gpsculpt_brush_apply_clone(C, gso);
}
else {
@ -1849,22 +1849,22 @@ static int gpsculpt_brush_invoke(bContext *C, wmOperator *op, const wmEvent *eve
/* initialise type-specific data (used for the entire session) */
switch (gso->brush_type) {
/* Brushes requiring timer... */
case GP_EDITBRUSH_TYPE_THICKNESS:
case GP_SCULPT_TYPE_THICKNESS:
brush_rate = 0.01f; // XXX: hardcoded
needs_timer = true;
break;
case GP_EDITBRUSH_TYPE_STRENGTH:
case GP_SCULPT_TYPE_STRENGTH:
brush_rate = 0.01f; // XXX: hardcoded
needs_timer = true;
break;
case GP_EDITBRUSH_TYPE_PINCH:
case GP_SCULPT_TYPE_PINCH:
brush_rate = 0.001f; // XXX: hardcoded
needs_timer = true;
break;
case GP_EDITBRUSH_TYPE_TWIST:
case GP_SCULPT_TYPE_TWIST:
brush_rate = 0.01f; // XXX: hardcoded
needs_timer = true;
break;

View File

@ -2012,7 +2012,7 @@ static void gp_paint_initstroke(tGPsdata *p, eGPencil_PaintModes paintmode, Deps
* (though this is only available in editmode)
*/
if (p->gpd->flag & GP_DATA_STROKE_EDITMODE) {
if (ts->gp_sculpt.flag & GP_BRUSHEDIT_FLAG_SELECT_MASK) {
if (ts->gp_sculpt.flag & GP_SCULPT_SETT_FLAG_SELECT_MASK) {
p->flags |= GP_PAINTFLAG_SELECTMASK;
}
}

View File

@ -1516,9 +1516,9 @@ static void gp_brush_drawcursor(bContext *C, int x, int y, void *customdata)
Object *ob = CTX_data_active_object(C);
ARegion *ar = CTX_wm_region(C);
GP_BrushEdit_Settings *gset = &scene->toolsettings->gp_sculpt;
GP_Sculpt_Settings *gset = &scene->toolsettings->gp_sculpt;
bGPdata *gpd = ED_gpencil_data_get_active(C);
GP_EditBrush_Data *gp_brush = NULL;
GP_Sculpt_Data *gp_brush = NULL;
Brush *brush = NULL;
Material *ma = NULL;
MaterialGPencilStyle *gp_style = NULL;
@ -1599,12 +1599,12 @@ static void gp_brush_drawcursor(bContext *C, int x, int y, void *customdata)
/* for sculpt use sculpt brush size */
if (GPENCIL_SCULPT_OR_WEIGHT_MODE(gpd)) {
if (gp_brush) {
if ((gp_brush->flag & GP_EDITBRUSH_FLAG_ENABLE_CURSOR) == 0) {
if ((gp_brush->flag & GP_SCULPT_FLAG_ENABLE_CURSOR) == 0) {
return;
}
radius = gp_brush->size;
if (gp_brush->flag & (GP_EDITBRUSH_FLAG_INVERT | GP_EDITBRUSH_FLAG_TMP_INVERT)) {
if (gp_brush->flag & (GP_SCULPT_FLAG_INVERT | GP_SCULPT_FLAG_TMP_INVERT)) {
copy_v3_v3(color, gp_brush->curcolor_sub);
}
else {
@ -1671,7 +1671,7 @@ static void gp_brush_drawcursor(bContext *C, int x, int y, void *customdata)
void ED_gpencil_toggle_brush_cursor(bContext *C, bool enable, void *customdata)
{
Scene *scene = CTX_data_scene(C);
GP_BrushEdit_Settings *gset = &scene->toolsettings->gp_sculpt;
GP_Sculpt_Settings *gset = &scene->toolsettings->gp_sculpt;
int *lastpost = customdata;
if (gset->paintcursor && !enable) {
@ -1700,19 +1700,19 @@ void ED_gpencil_toggle_brush_cursor(bContext *C, bool enable, void *customdata)
static void gpencil_verify_brush_type(bContext *C, int newmode)
{
ToolSettings *ts = CTX_data_tool_settings(C);
GP_BrushEdit_Settings *gset = &ts->gp_sculpt;
GP_Sculpt_Settings *gset = &ts->gp_sculpt;
switch (newmode) {
case OB_MODE_GPENCIL_SCULPT:
gset->flag &= ~GP_BRUSHEDIT_FLAG_WEIGHT_MODE;
if ((gset->brushtype < 0) || (gset->brushtype >= GP_EDITBRUSH_TYPE_WEIGHT)) {
gset->brushtype = GP_EDITBRUSH_TYPE_PUSH;
gset->flag &= ~GP_SCULPT_SETT_FLAG_WEIGHT_MODE;
if ((gset->brushtype < 0) || (gset->brushtype >= GP_SCULPT_TYPE_WEIGHT)) {
gset->brushtype = GP_SCULPT_TYPE_PUSH;
}
break;
case OB_MODE_GPENCIL_WEIGHT:
gset->flag |= GP_BRUSHEDIT_FLAG_WEIGHT_MODE;
if ((gset->weighttype < GP_EDITBRUSH_TYPE_WEIGHT) || (gset->weighttype >= GP_EDITBRUSH_TYPE_MAX)) {
gset->weighttype = GP_EDITBRUSH_TYPE_WEIGHT;
gset->flag |= GP_SCULPT_SETT_FLAG_WEIGHT_MODE;
if ((gset->weighttype < GP_SCULPT_TYPE_WEIGHT) || (gset->weighttype >= GP_SCULPT_TYPE_MAX)) {
gset->weighttype = GP_SCULPT_TYPE_WEIGHT;
}
break;
default:

View File

@ -8146,7 +8146,7 @@ static void createTransGPencil(bContext *C, TransInfo *t)
ToolSettings *ts = CTX_data_tool_settings(C);
bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd);
bool use_multiframe_falloff = (ts->gp_sculpt.flag & GP_BRUSHEDIT_FLAG_FRAME_FALLOFF) != 0;
bool use_multiframe_falloff = (ts->gp_sculpt.flag & GP_SCULPT_SETT_FLAG_FRAME_FALLOFF) != 0;
Object *obact = CTX_data_active_object(C);
bGPDlayer *gpl;

View File

@ -959,28 +959,28 @@ enum {
/* ------------------------------------------- */
/* GPencil Stroke Sculpting */
/* GP_BrushEdit_Settings.brushtype */
typedef enum eGP_EditBrush_Types {
GP_EDITBRUSH_TYPE_SMOOTH = 0,
GP_EDITBRUSH_TYPE_THICKNESS = 1,
GP_EDITBRUSH_TYPE_STRENGTH = 2,
GP_EDITBRUSH_TYPE_GRAB = 3,
GP_EDITBRUSH_TYPE_PUSH = 4,
GP_EDITBRUSH_TYPE_TWIST = 5,
GP_EDITBRUSH_TYPE_PINCH = 6,
GP_EDITBRUSH_TYPE_RANDOMIZE = 7,
GP_EDITBRUSH_TYPE_CLONE = 8,
GP_EDITBRUSH_TYPE_SUBDIVIDE = 9,
GP_EDITBRUSH_TYPE_SIMPLIFY = 10,
/* GP_Sculpt_Settings.brushtype */
typedef enum eGP_Sculpt_Types {
GP_SCULPT_TYPE_SMOOTH = 0,
GP_SCULPT_TYPE_THICKNESS = 1,
GP_SCULPT_TYPE_STRENGTH = 2,
GP_SCULPT_TYPE_GRAB = 3,
GP_SCULPT_TYPE_PUSH = 4,
GP_SCULPT_TYPE_TWIST = 5,
GP_SCULPT_TYPE_PINCH = 6,
GP_SCULPT_TYPE_RANDOMIZE = 7,
GP_SCULPT_TYPE_CLONE = 8,
GP_SCULPT_TYPE_SUBDIVIDE = 9,
GP_SCULPT_TYPE_SIMPLIFY = 10,
/* add any sculpt brush above this value */
GP_EDITBRUSH_TYPE_WEIGHT = 11,
GP_SCULPT_TYPE_WEIGHT = 11,
/* add any weight paint brush below this value. Do no mix brushes */
/* !!! Update GP_EditBrush_Data brush[###]; below !!! */
GP_EDITBRUSH_TYPE_MAX,
} eGP_EditBrush_Types;
/* !!! Update GP_Sculpt_Data brush[###]; below !!! */
GP_SCULPT_TYPE_MAX,
} eGP_Sculpt_Types;
/* GP_BrushEdit_Settings.lock_axis */
/* GP_Sculpt_Settings.lock_axis */
typedef enum eGP_Lockaxis_Types {
GP_LOCKAXIS_VIEW = 0,
GP_LOCKAXIS_X = 1,
@ -989,73 +989,69 @@ typedef enum eGP_Lockaxis_Types {
} eGP_Lockaxis_Types;
/* Settings for a GPencil Stroke Sculpting Brush */
typedef struct GP_EditBrush_Data {
typedef struct GP_Sculpt_Data {
short size; /* radius of brush */
short flag; /* eGP_EditBrush_Flag */
short flag; /* eGP_Sculpt_Flag */
float strength; /* strength of effect */
float curcolor_add[3]; /* cursor color for add */
float curcolor_sub[3]; /* cursor color for sub */
} GP_EditBrush_Data;
} GP_Sculpt_Data;
/* GP_EditBrush_Data.flag */
typedef enum eGP_EditBrush_Flag {
/* GP_Sculpt_Data.flag */
typedef enum eGP_Sculpt_Flag {
/* invert the effect of the brush */
GP_EDITBRUSH_FLAG_INVERT = (1 << 0),
GP_SCULPT_FLAG_INVERT = (1 << 0),
/* adjust strength using pen pressure */
GP_EDITBRUSH_FLAG_USE_PRESSURE = (1 << 1),
GP_SCULPT_FLAG_USE_PRESSURE = (1 << 1),
/* strength of brush falls off with distance from cursor */
GP_EDITBRUSH_FLAG_USE_FALLOFF = (1 << 2),
GP_SCULPT_FLAG_USE_FALLOFF = (1 << 2),
/* XXX: currently unused. */
/* smooth brush affects pressure values as well */
GP_EDITBRUSH_FLAG_SMOOTH_PRESSURE = (1 << 3),
GP_SCULPT_FLAG_SMOOTH_PRESSURE = (1 << 3),
/* enable screen cursor */
GP_EDITBRUSH_FLAG_ENABLE_CURSOR = (1 << 4),
GP_SCULPT_FLAG_ENABLE_CURSOR = (1 << 4),
/* temporary invert action */
GP_EDITBRUSH_FLAG_TMP_INVERT = (1 << 5),
GP_SCULPT_FLAG_TMP_INVERT = (1 << 5),
/* adjust radius using pen pressure */
GP_EDITBRUSH_FLAG_PRESSURE_RADIUS = (1 << 6),
} eGP_EditBrush_Flag;
GP_SCULPT_FLAG_PRESSURE_RADIUS = (1 << 6),
} eGP_Sculpt_Flag;
/* GPencil Stroke Sculpting Settings */
typedef struct GP_BrushEdit_Settings {
GP_EditBrush_Data brush[12]; /* GP_EDITBRUSH_TYPE_MAX */
typedef struct GP_Sculpt_Settings {
GP_Sculpt_Data brush[12]; /* GP_SCULPT_TYPE_MAX */
void *paintcursor; /* runtime */
int brushtype; /* eGP_EditBrush_Types (sculpt) */
int flag; /* eGP_BrushEdit_SettingsFlag */
int brushtype; /* eGP_Sculpt_Types (sculpt) */
int flag; /* eGP_Sculpt_SettingsFlag */
int lock_axis; /* eGP_Lockaxis_Types lock drawing to one axis */
char pad1[4];
/* weight paint is a submode of sculpt but use its own index. All weight paint
* brushes must be defined at the end of the brush array.
*/
int weighttype; /* eGP_EditBrush_Types (weight paint) */
int weighttype; /* eGP_Sculpt_Types (weight paint) */
char pad[4];
struct CurveMapping *cur_falloff; /* multiframe edit falloff effect by frame */
} GP_BrushEdit_Settings;
} GP_Sculpt_Settings;
/* GP_BrushEdit_Settings.flag */
typedef enum eGP_BrushEdit_SettingsFlag {
/* GP_Sculpt_Settings.flag */
typedef enum eGP_Sculpt_SettingsFlag {
/* only affect selected points */
GP_BRUSHEDIT_FLAG_SELECT_MASK = (1 << 0),
GP_SCULPT_SETT_FLAG_SELECT_MASK = (1 << 0),
/* apply brush to position */
GP_BRUSHEDIT_FLAG_APPLY_POSITION = (1 << 1),
GP_SCULPT_SETT_FLAG_APPLY_POSITION = (1 << 1),
/* apply brush to strength */
GP_BRUSHEDIT_FLAG_APPLY_STRENGTH = (1 << 2),
GP_SCULPT_SETT_FLAG_APPLY_STRENGTH = (1 << 2),
/* apply brush to thickness */
GP_BRUSHEDIT_FLAG_APPLY_THICKNESS = (1 << 3),
GP_SCULPT_SETT_FLAG_APPLY_THICKNESS = (1 << 3),
/* apply brush to thickness */
GP_BRUSHEDIT_FLAG_WEIGHT_MODE = (1 << 4),
GP_SCULPT_SETT_FLAG_WEIGHT_MODE = (1 << 4),
/* enable falloff for multiframe editing */
GP_BRUSHEDIT_FLAG_FRAME_FALLOFF = (1 << 5),
GP_SCULPT_SETT_FLAG_FRAME_FALLOFF = (1 << 5),
/* apply brush to uv data */
GP_BRUSHEDIT_FLAG_APPLY_UV = (1 << 6),
} eGP_BrushEdit_SettingsFlag;
GP_SCULPT_SETT_FLAG_APPLY_UV = (1 << 6),
} eGP_Sculpt_SettingsFlag;
/* Settings for GP Interpolation Operators */
typedef struct GP_Interpolate_Settings {
@ -1311,7 +1307,7 @@ typedef struct ToolSettings {
short gpencil_selectmode; /* stroke selection mode */
/* Grease Pencil Sculpt */
struct GP_BrushEdit_Settings gp_sculpt;
struct GP_Sculpt_Settings gp_sculpt;
/* Grease Pencil Interpolation Tool(s) */
struct GP_Interpolate_Settings gp_interpolate;

View File

@ -66,20 +66,20 @@ const EnumPropertyItem rna_enum_particle_edit_hair_brush_items[] = {
};
const EnumPropertyItem rna_enum_gpencil_sculpt_brush_items[] = {
{GP_EDITBRUSH_TYPE_SMOOTH, "SMOOTH", ICON_GPBRUSH_SMOOTH, "Smooth", "Smooth stroke points"},
{GP_EDITBRUSH_TYPE_THICKNESS, "THICKNESS", ICON_GPBRUSH_THICKNESS, "Thickness", "Adjust thickness of strokes"},
{GP_EDITBRUSH_TYPE_STRENGTH, "STRENGTH", ICON_GPBRUSH_STRENGTH, "Strength", "Adjust color strength of strokes" },
{GP_EDITBRUSH_TYPE_GRAB, "GRAB", ICON_GPBRUSH_GRAB, "Grab", "Translate the set of points initially within the brush circle" },
{GP_EDITBRUSH_TYPE_PUSH, "PUSH", ICON_GPBRUSH_PUSH, "Push", "Move points out of the way, as if combing them"},
{GP_EDITBRUSH_TYPE_TWIST, "TWIST", ICON_GPBRUSH_TWIST, "Twist", "Rotate points around the midpoint of the brush"},
{GP_EDITBRUSH_TYPE_PINCH, "PINCH", ICON_GPBRUSH_PINCH, "Pinch", "Pull points towards the midpoint of the brush"},
{GP_EDITBRUSH_TYPE_RANDOMIZE, "RANDOMIZE", ICON_GPBRUSH_RANDOMIZE, "Randomize", "Introduce jitter/randomness into strokes"},
{GP_EDITBRUSH_TYPE_CLONE, "CLONE", ICON_GPBRUSH_CLONE, "Clone", "Paste copies of the strokes stored on the clipboard"},
{GP_SCULPT_TYPE_SMOOTH, "SMOOTH", ICON_GPBRUSH_SMOOTH, "Smooth", "Smooth stroke points"},
{GP_SCULPT_TYPE_THICKNESS, "THICKNESS", ICON_GPBRUSH_THICKNESS, "Thickness", "Adjust thickness of strokes"},
{GP_SCULPT_TYPE_STRENGTH, "STRENGTH", ICON_GPBRUSH_STRENGTH, "Strength", "Adjust color strength of strokes" },
{GP_SCULPT_TYPE_GRAB, "GRAB", ICON_GPBRUSH_GRAB, "Grab", "Translate the set of points initially within the brush circle" },
{GP_SCULPT_TYPE_PUSH, "PUSH", ICON_GPBRUSH_PUSH, "Push", "Move points out of the way, as if combing them"},
{GP_SCULPT_TYPE_TWIST, "TWIST", ICON_GPBRUSH_TWIST, "Twist", "Rotate points around the midpoint of the brush"},
{GP_SCULPT_TYPE_PINCH, "PINCH", ICON_GPBRUSH_PINCH, "Pinch", "Pull points towards the midpoint of the brush"},
{GP_SCULPT_TYPE_RANDOMIZE, "RANDOMIZE", ICON_GPBRUSH_RANDOMIZE, "Randomize", "Introduce jitter/randomness into strokes"},
{GP_SCULPT_TYPE_CLONE, "CLONE", ICON_GPBRUSH_CLONE, "Clone", "Paste copies of the strokes stored on the clipboard"},
{ 0, NULL, 0, NULL, NULL }
};
const EnumPropertyItem rna_enum_gpencil_weight_brush_items[] = {
{GP_EDITBRUSH_TYPE_WEIGHT, "WEIGHT", ICON_GPBRUSH_WEIGHT, "Weight", "Weight Paint for Vertex Groups"},
{GP_SCULPT_TYPE_WEIGHT, "WEIGHT", ICON_GPBRUSH_WEIGHT, "Weight", "Weight Paint for Vertex Groups"},
{0, NULL, 0, NULL, NULL}
};
@ -518,15 +518,15 @@ static bool rna_ImaPaint_detect_data(ImagePaintSettings *imapaint)
static PointerRNA rna_GPencilSculptSettings_brush_get(PointerRNA *ptr)
{
GP_BrushEdit_Settings *gset = (GP_BrushEdit_Settings *)ptr->data;
GP_EditBrush_Data *brush = NULL;
GP_Sculpt_Settings *gset = (GP_Sculpt_Settings *)ptr->data;
GP_Sculpt_Data *brush = NULL;
if ((gset) && (gset->flag & GP_BRUSHEDIT_FLAG_WEIGHT_MODE)) {
if ((gset->weighttype >= GP_EDITBRUSH_TYPE_WEIGHT) && (gset->weighttype < GP_EDITBRUSH_TYPE_MAX))
if ((gset) && (gset->flag & GP_SCULPT_SETT_FLAG_WEIGHT_MODE)) {
if ((gset->weighttype >= GP_SCULPT_TYPE_WEIGHT) && (gset->weighttype < GP_SCULPT_TYPE_MAX))
brush = &gset->brush[gset->weighttype];
}
else {
if ((gset->brushtype >= 0) && (gset->brushtype < GP_EDITBRUSH_TYPE_WEIGHT))
if ((gset->brushtype >= 0) && (gset->brushtype < GP_SCULPT_TYPE_WEIGHT))
brush = &gset->brush[gset->brushtype];
}
return rna_pointer_inherit_refine(ptr, &RNA_GPencilSculptBrush, brush);
@ -1181,7 +1181,7 @@ static void rna_def_gpencil_sculpt(BlenderRNA *brna)
{
static const EnumPropertyItem prop_direction_items[] = {
{0, "ADD", ICON_ADD, "Add", "Add effect of brush"},
{GP_EDITBRUSH_FLAG_INVERT, "SUBTRACT", ICON_REMOVE, "Subtract", "Subtract effect of brush"},
{GP_SCULPT_FLAG_INVERT, "SUBTRACT", ICON_REMOVE, "Subtract", "Subtract effect of brush"},
{0, NULL, 0, NULL, NULL}};
StructRNA *srna;
@ -1189,7 +1189,7 @@ static void rna_def_gpencil_sculpt(BlenderRNA *brna)
/* == Settings == */
srna = RNA_def_struct(brna, "GPencilSculptSettings", NULL);
RNA_def_struct_sdna(srna, "GP_BrushEdit_Settings");
RNA_def_struct_sdna(srna, "GP_Sculpt_Settings");
RNA_def_struct_path_func(srna, "rna_GPencilSculptSettings_path");
RNA_def_struct_ui_text(srna, "GPencil Sculpt Settings", "Properties for Grease Pencil stroke sculpting tool");
@ -1214,38 +1214,38 @@ static void rna_def_gpencil_sculpt(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Brush", "");
prop = RNA_def_property(srna, "use_select_mask", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSHEDIT_FLAG_SELECT_MASK);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SCULPT_SETT_FLAG_SELECT_MASK);
RNA_def_property_ui_text(prop, "Selection Mask", "Only sculpt selected stroke points");
RNA_def_property_ui_icon(prop, ICON_GP_ONLY_SELECTED, 0);
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_edit_position", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSHEDIT_FLAG_APPLY_POSITION);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SCULPT_SETT_FLAG_APPLY_POSITION);
RNA_def_property_ui_text(prop, "Affect Position", "The brush affects the position of the point");
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_edit_strength", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSHEDIT_FLAG_APPLY_STRENGTH);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SCULPT_SETT_FLAG_APPLY_STRENGTH);
RNA_def_property_ui_text(prop, "Affect Strength", "The brush affects the color strength of the point");
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_edit_thickness", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSHEDIT_FLAG_APPLY_THICKNESS);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SCULPT_SETT_FLAG_APPLY_THICKNESS);
RNA_def_property_ui_text(prop, "Affect Thickness", "The brush affects the thickness of the point");
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_edit_uv", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSHEDIT_FLAG_APPLY_UV);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SCULPT_SETT_FLAG_APPLY_UV);
RNA_def_property_ui_text(prop, "Affect UV", "The brush affects the UV rotation of the point");
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_multiframe_falloff", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSHEDIT_FLAG_FRAME_FALLOFF);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SCULPT_SETT_FLAG_FRAME_FALLOFF);
RNA_def_property_ui_text(prop, "Use Falloff", "Use falloff effect when edit in multiframe mode to compute brush effect by frame");
RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
@ -1269,7 +1269,7 @@ static void rna_def_gpencil_sculpt(BlenderRNA *brna)
/* brush */
srna = RNA_def_struct(brna, "GPencilSculptBrush", NULL);
RNA_def_struct_sdna(srna, "GP_EditBrush_Data");
RNA_def_struct_sdna(srna, "GP_Sculpt_Data");
RNA_def_struct_path_func(srna, "rna_GPencilSculptBrush_path");
RNA_def_struct_ui_text(srna, "GPencil Sculpt Brush", "Stroke editing brush");
RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
@ -1288,27 +1288,27 @@ static void rna_def_gpencil_sculpt(BlenderRNA *brna)
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
prop = RNA_def_property(srna, "use_pressure_strength", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_EDITBRUSH_FLAG_USE_PRESSURE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SCULPT_FLAG_USE_PRESSURE);
RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
RNA_def_property_ui_text(prop, "Strength Pressure", "Enable tablet pressure sensitivity for strength");
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_boolean_sdna(prop, NULL, "flag", GP_SCULPT_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_boolean_sdna(prop, NULL, "flag", GP_SCULPT_FLAG_USE_FALLOFF);
RNA_def_property_ui_text(prop, "Use Falloff", "Strength of brush decays with distance from cursor");
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_edit_pressure", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_EDITBRUSH_FLAG_SMOOTH_PRESSURE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SCULPT_FLAG_SMOOTH_PRESSURE);
RNA_def_property_ui_text(prop, "Affect Pressure", "Affect pressure values as well when smoothing strokes");
RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
@ -1341,7 +1341,7 @@ static void rna_def_gpencil_sculpt(BlenderRNA *brna)
RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
prop = RNA_def_property(srna, "use_cursor", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_EDITBRUSH_FLAG_ENABLE_CURSOR);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SCULPT_FLAG_ENABLE_CURSOR);
RNA_def_property_boolean_default(prop, true);
RNA_def_property_ui_text(prop, "Enable Cursor", "Enable cursor on screen");
RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);