Merge branch 'blender-v4.1-release'
This commit is contained in:
@@ -1155,7 +1155,6 @@ void BKE_gpencil_brush_preset_set(Main *bmain, Brush *brush, const short type)
|
||||
|
||||
brush->gpencil_settings->draw_strength = 0.3f;
|
||||
brush->gpencil_settings->flag |= GP_BRUSH_USE_STRENGTH_PRESSURE;
|
||||
brush->gpencil_settings->sculpt_flag = GP_SCULPT_FLAGMODE_APPLY_THICKNESS;
|
||||
brush->gpencil_settings->sculpt_mode_flag |= GP_SCULPT_FLAGMODE_APPLY_POSITION;
|
||||
|
||||
break;
|
||||
|
||||
@@ -595,6 +595,10 @@ PaintMode BKE_paintmode_get_active_from_context(const bContext *C)
|
||||
switch (obact->mode) {
|
||||
case OB_MODE_SCULPT:
|
||||
return PaintMode::Sculpt;
|
||||
case OB_MODE_SCULPT_GPENCIL_LEGACY:
|
||||
return PaintMode::SculptGPencil;
|
||||
case OB_MODE_WEIGHT_GPENCIL_LEGACY:
|
||||
return PaintMode::WeightGPencil;
|
||||
case OB_MODE_VERTEX_PAINT:
|
||||
return PaintMode::Vertex;
|
||||
case OB_MODE_WEIGHT_PAINT:
|
||||
|
||||
@@ -2887,6 +2887,16 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 401, 21)) {
|
||||
LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
|
||||
/* The `sculpt_flag` was used to store the `BRUSH_DIR_IN`
|
||||
* With the fix for #115313 this is now just using the `brush->flag`.*/
|
||||
if (brush->gpencil_settings && (brush->gpencil_settings->sculpt_flag & BRUSH_DIR_IN) != 0) {
|
||||
brush->flag |= BRUSH_DIR_IN;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Keep point/spot light soft falloff for files created before 4.0. */
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 400, 0)) {
|
||||
LISTBASE_FOREACH (Light *, light, &bmain->lights) {
|
||||
|
||||
@@ -226,7 +226,7 @@ static bool gpencil_brush_invert_check(tGP_BrushEditData *gso)
|
||||
{
|
||||
/* The basic setting is the brush's setting (from the panel) */
|
||||
bool invert = ((gso->brush->gpencil_settings->sculpt_flag & GP_SCULPT_FLAG_INVERT) != 0) ||
|
||||
(gso->brush->gpencil_settings->sculpt_flag & BRUSH_DIR_IN);
|
||||
(gso->brush->flag & BRUSH_DIR_IN);
|
||||
/* During runtime, the user can hold down the Ctrl key to invert the basic behavior */
|
||||
if (gso->flag & GP_SCULPT_FLAG_INVERT) {
|
||||
invert ^= true;
|
||||
|
||||
@@ -796,7 +796,7 @@ static bool gpencil_weightpaint_brush_init(bContext *C, wmOperator *op)
|
||||
}
|
||||
|
||||
/* Draw tool: add or subtract weight? */
|
||||
gso->subtract = (gso->brush->gpencil_settings->sculpt_flag & BRUSH_DIR_IN);
|
||||
gso->subtract = (gso->brush->flag & BRUSH_DIR_IN);
|
||||
|
||||
/* Setup auto-normalize. */
|
||||
gso->auto_normalize = (ts->auto_normalize && gso->vrgroup != -1);
|
||||
@@ -1521,7 +1521,7 @@ static int gpencil_weight_toggle_direction_invoke(bContext *C,
|
||||
Paint *paint = &ts->gp_weightpaint->paint;
|
||||
|
||||
/* Toggle Add/Subtract flag. */
|
||||
paint->brush->gpencil_settings->sculpt_flag ^= BRUSH_DIR_IN;
|
||||
paint->brush->flag ^= BRUSH_DIR_IN;
|
||||
|
||||
/* Update tool settings. */
|
||||
WM_main_add_notifier(NC_BRUSH | NA_EDITED, nullptr);
|
||||
|
||||
@@ -936,6 +936,18 @@ static const EnumPropertyItem *rna_Brush_direction_itemf(bContext *C,
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
/* gpencil sculpt */
|
||||
static const EnumPropertyItem prop_pinch_items[] = {
|
||||
{0, "ADD", ICON_ADD, "Pinch", "Add effect of brush"},
|
||||
{BRUSH_DIR_IN, "SUBTRACT", ICON_REMOVE, "Inflate", "Subtract effect of brush"},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
static const EnumPropertyItem prop_twist_items[] = {
|
||||
{0, "ADD", ICON_ADD, "Counter-Clockwise", "Add effect of brush"},
|
||||
{BRUSH_DIR_IN, "SUBTRACT", ICON_REMOVE, "Clockwise", "Subtract effect of brush"},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
Brush *me = (Brush *)(ptr->data);
|
||||
|
||||
switch (mode) {
|
||||
@@ -1000,6 +1012,25 @@ static const EnumPropertyItem *rna_Brush_direction_itemf(bContext *C,
|
||||
default:
|
||||
return rna_enum_dummy_DEFAULT_items;
|
||||
}
|
||||
case PaintMode::SculptGPencil:
|
||||
switch (me->gpencil_sculpt_tool) {
|
||||
case GPSCULPT_TOOL_THICKNESS:
|
||||
case GPSCULPT_TOOL_STRENGTH:
|
||||
return prop_direction_items;
|
||||
case GPSCULPT_TOOL_TWIST:
|
||||
return prop_twist_items;
|
||||
case GPSCULPT_TOOL_PINCH:
|
||||
return prop_pinch_items;
|
||||
default:
|
||||
return rna_enum_dummy_DEFAULT_items;
|
||||
}
|
||||
case PaintMode::WeightGPencil:
|
||||
switch (me->gpencil_weight_tool) {
|
||||
case GPWEIGHT_TOOL_DRAW:
|
||||
return prop_direction_items;
|
||||
default:
|
||||
return rna_enum_dummy_DEFAULT_items;
|
||||
}
|
||||
default:
|
||||
return rna_enum_dummy_DEFAULT_items;
|
||||
}
|
||||
@@ -1975,13 +2006,6 @@ static void rna_def_gpencil_options(BlenderRNA *brna)
|
||||
RNA_def_property_ui_text(prop, "Outline", "Convert stroke to perimeter");
|
||||
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
||||
|
||||
prop = RNA_def_property(srna, "direction", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_bitflag_sdna(prop, nullptr, "sculpt_flag");
|
||||
RNA_def_property_enum_items(prop, prop_direction_items);
|
||||
RNA_def_property_ui_text(prop, "Direction", "");
|
||||
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "use_edit_position", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(
|
||||
prop, nullptr, "sculpt_mode_flag", GP_SCULPT_FLAGMODE_APPLY_POSITION);
|
||||
|
||||
@@ -1562,14 +1562,6 @@ static void rna_def_gpencil_guides(BlenderRNA *brna)
|
||||
|
||||
static void rna_def_gpencil_sculpt(BlenderRNA *brna)
|
||||
{
|
||||
static const EnumPropertyItem prop_direction_items[] = {
|
||||
{0, "ADD", ICON_ADD, "Add", "Add effect of brush"},
|
||||
{GP_SCULPT_FLAG_INVERT, "SUBTRACT", ICON_REMOVE, "Subtract", "Subtract effect of brush"},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
UNUSED_VARS(prop_direction_items);
|
||||
|
||||
StructRNA *srna;
|
||||
PropertyRNA *prop;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user