Fix #129849: Remove redundant 'GreasePencil' references in PaintMode
As established in issue #129849 , there are references to older versions of Grease Pencil that aren't needed. This PR is meant to remove such references or, in places where otherwise `GreasePencil` is referenced but `GPencil` is not, it changes the reference as for it to reference the v3 implementations in PaintMode. It also removes `GreasePencil` from the list of options when declaring `PaintMode`. Pull Request: https://projects.blender.org/blender/blender/pulls/131065
This commit is contained in:
@@ -105,11 +105,9 @@ enum class PaintMode : int8_t {
|
||||
WeightGPencil = 9,
|
||||
/** Curves. */
|
||||
SculptCurves = 10,
|
||||
/** Grease Pencil. */
|
||||
SculptGreasePencil = 11,
|
||||
|
||||
/** Keep last. */
|
||||
Invalid = 12,
|
||||
Invalid = 11,
|
||||
};
|
||||
|
||||
/* overlay invalidation */
|
||||
|
||||
@@ -355,9 +355,6 @@ bool BKE_paint_ensure_from_paintmode(Scene *sce, PaintMode mode)
|
||||
case PaintMode::SculptCurves:
|
||||
paint_ptr = (Paint **)&ts->curves_sculpt;
|
||||
break;
|
||||
case PaintMode::SculptGreasePencil:
|
||||
paint_ptr = (Paint **)&ts->gp_sculptpaint;
|
||||
break;
|
||||
case PaintMode::Invalid:
|
||||
break;
|
||||
}
|
||||
@@ -393,8 +390,6 @@ Paint *BKE_paint_get_active_from_paintmode(Scene *sce, PaintMode mode)
|
||||
return &ts->gp_weightpaint->paint;
|
||||
case PaintMode::SculptCurves:
|
||||
return &ts->curves_sculpt->paint;
|
||||
case PaintMode::SculptGreasePencil:
|
||||
return &ts->gp_sculptpaint->paint;
|
||||
case PaintMode::Invalid:
|
||||
return nullptr;
|
||||
default:
|
||||
@@ -426,8 +421,6 @@ const EnumPropertyItem *BKE_paint_get_tool_enum_from_paintmode(const PaintMode m
|
||||
case PaintMode::WeightGPencil:
|
||||
return rna_enum_brush_gpencil_weight_types_items;
|
||||
case PaintMode::SculptCurves:
|
||||
return rna_enum_brush_curves_sculpt_brush_type_items;
|
||||
case PaintMode::SculptGreasePencil:
|
||||
return rna_enum_brush_gpencil_sculpt_types_items;
|
||||
case PaintMode::Invalid:
|
||||
break;
|
||||
@@ -529,7 +522,7 @@ PaintMode BKE_paintmode_get_active_from_context(const bContext *C)
|
||||
return PaintMode::Sculpt;
|
||||
case OB_MODE_SCULPT_GREASE_PENCIL:
|
||||
if (obact->type == OB_GREASE_PENCIL) {
|
||||
return PaintMode::SculptGreasePencil;
|
||||
return PaintMode::SculptGPencil;
|
||||
}
|
||||
return PaintMode::Invalid;
|
||||
case OB_MODE_PAINT_GREASE_PENCIL:
|
||||
@@ -586,7 +579,7 @@ PaintMode BKE_paintmode_get_from_tool(const bToolRef *tref)
|
||||
case CTX_MODE_PAINT_GREASE_PENCIL:
|
||||
return PaintMode::GPencil;
|
||||
case CTX_MODE_SCULPT_GREASE_PENCIL:
|
||||
return PaintMode::SculptGreasePencil;
|
||||
return PaintMode::SculptGPencil;
|
||||
}
|
||||
}
|
||||
else if (tref->space_type == SPACE_IMAGE) {
|
||||
@@ -1266,8 +1259,6 @@ uint BKE_paint_get_brush_type_offset_from_paintmode(const PaintMode mode)
|
||||
return offsetof(Brush, gpencil_weight_brush_type);
|
||||
case PaintMode::SculptCurves:
|
||||
return offsetof(Brush, curves_sculpt_brush_type);
|
||||
case PaintMode::SculptGreasePencil:
|
||||
return offsetof(Brush, gpencil_sculpt_brush_type);
|
||||
case PaintMode::Invalid:
|
||||
break; /* We don't use these yet. */
|
||||
}
|
||||
@@ -1325,8 +1316,6 @@ std::optional<int> BKE_paint_get_brush_type_from_paintmode(const Brush *brush,
|
||||
return brush->gpencil_weight_brush_type;
|
||||
case PaintMode::SculptCurves:
|
||||
return brush->curves_sculpt_brush_type;
|
||||
case PaintMode::SculptGreasePencil:
|
||||
return brush->gpencil_sculpt_brush_type;
|
||||
case PaintMode::Invalid:
|
||||
default:
|
||||
return {};
|
||||
@@ -1666,8 +1655,6 @@ eObjectMode BKE_paint_object_mode_from_paintmode(const PaintMode mode)
|
||||
return OB_MODE_SCULPT_CURVES;
|
||||
case PaintMode::GPencil:
|
||||
return OB_MODE_PAINT_GREASE_PENCIL;
|
||||
case PaintMode::SculptGreasePencil:
|
||||
return OB_MODE_SCULPT_GREASE_PENCIL;
|
||||
case PaintMode::Invalid:
|
||||
default:
|
||||
return OB_MODE_OBJECT;
|
||||
|
||||
@@ -179,8 +179,8 @@ static int sculptmode_toggle_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
else {
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
BKE_paint_init(bmain, scene, PaintMode::SculptGreasePencil, PAINT_CURSOR_SCULPT_GREASE_PENCIL);
|
||||
Paint *paint = BKE_paint_get_active_from_paintmode(scene, PaintMode::SculptGreasePencil);
|
||||
BKE_paint_init(bmain, scene, PaintMode::SculptGPencil, PAINT_CURSOR_SCULPT_GREASE_PENCIL);
|
||||
Paint *paint = BKE_paint_get_active_from_paintmode(scene, PaintMode::SculptGPencil);
|
||||
ED_paint_cursor_start(paint, sculpt_poll_view3d);
|
||||
mode = OB_MODE_SCULPT_GREASE_PENCIL;
|
||||
}
|
||||
|
||||
@@ -116,7 +116,8 @@ static std::unique_ptr<GreasePencilStrokeOperation> get_stroke_operation(bContex
|
||||
return greasepencil::new_tint_operation();
|
||||
}
|
||||
}
|
||||
else if (mode == PaintMode::SculptGreasePencil) {
|
||||
else if (mode == PaintMode::SculptGPencil) {
|
||||
|
||||
if (stroke_mode == BRUSH_STROKE_SMOOTH) {
|
||||
return greasepencil::new_smooth_operation(stroke_mode, true);
|
||||
}
|
||||
|
||||
@@ -1229,7 +1229,6 @@ static bool paint_use_2d_cursor(PaintMode mode)
|
||||
case PaintMode::SculptGPencil:
|
||||
case PaintMode::WeightGPencil:
|
||||
case PaintMode::SculptCurves:
|
||||
case PaintMode::SculptGreasePencil:
|
||||
case PaintMode::GPencil:
|
||||
return true;
|
||||
case PaintMode::Invalid:
|
||||
|
||||
@@ -702,9 +702,6 @@ static int paintcurve_draw_exec(bContext *C, wmOperator * /*op*/)
|
||||
case PaintMode::GPencil:
|
||||
name = "GREASE_PENCIL_OT_brush_stroke";
|
||||
break;
|
||||
case PaintMode::SculptGreasePencil:
|
||||
name = "GREASE_PENCIL_OT_sculpt_paint";
|
||||
break;
|
||||
default:
|
||||
return OPERATOR_PASS_THROUGH;
|
||||
}
|
||||
|
||||
@@ -1058,7 +1058,7 @@ bool paint_space_stroke_enabled(const Brush &br, const PaintMode mode)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ELEM(mode, PaintMode::GPencil, PaintMode::SculptGreasePencil)) {
|
||||
if (ELEM(mode, PaintMode::GPencil, PaintMode::SculptGPencil)) {
|
||||
/* No spacing needed for now. */
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -964,7 +964,6 @@ static const EnumPropertyItem *rna_Brush_direction_itemf(bContext *C,
|
||||
return rna_enum_dummy_DEFAULT_items;
|
||||
}
|
||||
case PaintMode::SculptGPencil:
|
||||
case PaintMode::SculptGreasePencil:
|
||||
switch (me->gpencil_sculpt_brush_type) {
|
||||
case GPSCULPT_BRUSH_TYPE_THICKNESS:
|
||||
case GPSCULPT_BRUSH_TYPE_STRENGTH:
|
||||
|
||||
Reference in New Issue
Block a user