Cleanup: Grease Pencil: Draw operations
All checks were successful
buildbot/vdev-code-daily-lint Build done.
buildbot/vdev-code-daily-darwin-x86_64 Build done.
buildbot/vdev-code-daily-linux-x86_64 Build done.
buildbot/vdev-code-daily-darwin-arm64 Build done.
buildbot/vdev-code-daily-windows-amd64 Build done.
buildbot/vdev-code-daily-coordinator Build done.

- `EraseOperation` reorder public and private sections.
 - Use default value of `false` for the `temp_eraser`.
 - `PaintOperation` constructor
This commit is contained in:
Falk David 2024-11-26 11:05:10 +01:00
parent 00f61f0913
commit e692c916f8
4 changed files with 11 additions and 15 deletions

View File

@ -105,7 +105,7 @@ static std::unique_ptr<GreasePencilStrokeOperation> get_stroke_operation(bContex
case GPAINT_BRUSH_TYPE_DRAW:
return greasepencil::new_paint_operation();
case GPAINT_BRUSH_TYPE_ERASE:
return greasepencil::new_erase_operation(false);
return greasepencil::new_erase_operation();
case GPAINT_BRUSH_TYPE_FILL:
/* Fill tool keymap uses the paint operator as alternative mode. */
return greasepencil::new_paint_operation(true);

View File

@ -36,15 +36,6 @@
namespace blender::ed::sculpt_paint::greasepencil {
class EraseOperation : public GreasePencilStrokeOperation {
public:
EraseOperation(bool temp_use_eraser) : temp_eraser_(temp_use_eraser) {}
~EraseOperation() override {}
void on_stroke_begin(const bContext &C, const InputSample &start_sample) override;
void on_stroke_extended(const bContext &C, const InputSample &extension_sample) override;
void on_stroke_done(const bContext &C) override;
friend struct EraseOperationExecutor;
private:
@ -58,6 +49,14 @@ class EraseOperation : public GreasePencilStrokeOperation {
bool active_layer_only_ = false;
Set<GreasePencilDrawing *> affected_drawings_;
public:
EraseOperation(bool temp_use_eraser = false) : temp_eraser_(temp_use_eraser) {}
~EraseOperation() override {}
void on_stroke_begin(const bContext &C, const InputSample &start_sample) override;
void on_stroke_extended(const bContext &C, const InputSample &extension_sample) override;
void on_stroke_done(const bContext &C) override;
};
struct SegmentCircleIntersection {

View File

@ -189,7 +189,7 @@ class GreasePencilStrokeOperationCommon : public GreasePencilStrokeOperation {
/* Operations */
std::unique_ptr<GreasePencilStrokeOperation> new_paint_operation(bool temp_draw = false);
std::unique_ptr<GreasePencilStrokeOperation> new_erase_operation(bool temp_eraser);
std::unique_ptr<GreasePencilStrokeOperation> new_erase_operation(bool temp_eraser = false);
std::unique_ptr<GreasePencilStrokeOperation> new_tint_operation();
std::unique_ptr<GreasePencilStrokeOperation> new_weight_paint_draw_operation(
const BrushStrokeMode &brush_mode);

View File

@ -278,10 +278,7 @@ class PaintOperation : public GreasePencilStrokeOperation {
void on_stroke_extended(const bContext &C, const InputSample &extension_sample) override;
void on_stroke_done(const bContext &C) override;
PaintOperation(const bool temp_draw = false)
{
temp_draw_ = temp_draw;
}
PaintOperation(const bool temp_draw = false) : temp_draw_(temp_draw) {}
};
/**