Initial Grease Pencil 3.0 stage #106848
|
@ -1,5 +1,5 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
* Copyright 2022 Blender Foundation. */
|
||||
* Copyright 2023 Blender Foundation. */
|
||||
filedescriptor marked this conversation as resolved
Outdated
|
||||
|
||||
/** \file
|
||||
* \ingroup draw
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
* Copyright 2022 Blender Foundation. */
|
||||
* Copyright 2023 Blender Foundation. */
|
||||
filedescriptor marked this conversation as resolved
Outdated
Sergey Sharybin
commented
2023 2023
|
||||
|
||||
/** \file
|
||||
* \ingroup draw
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
* Copyright 2022 Blender Foundation. */
|
||||
* Copyright 2023 Blender Foundation. */
|
||||
Sergey Sharybin
commented
Check everywhere else :) 2023.
Check everywhere else :)
|
||||
|
||||
/** \file
|
||||
* \ingroup draw
|
||||
|
@ -8,7 +8,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "BKE_grease_pencil.hh"
|
||||
#include "BKE_image.h"
|
||||
#include "DRW_gpu_wrapper.hh"
|
||||
filedescriptor marked this conversation as resolved
Sergey Sharybin
commented
I am not sure all of those are needed here. I am not sure all of those are needed here.
I.e. I do not see any `BKE_image` API used in this header. Might be missing something.
|
||||
#include "DRW_render.h"
|
||||
|
||||
|
@ -30,9 +29,10 @@ class LayerModule {
|
|||
layers_buf_.clear();
|
||||
}
|
||||
|
||||
void sync(const Object *object, const bke::greasepencil::Layer &layer, bool &do_layer_blending)
|
||||
void sync(const Object * /*object*/,
|
||||
const bke::greasepencil::Layer & /*layer*/,
|
||||
bool &do_layer_blending)
|
||||
{
|
||||
Sergey Sharybin
commented
In C++ use In C++ use `void sync(const Object * /*object*/, const bke::greasepencil::Layer & /*layer*/, bool &do_layer_blending)`
|
||||
UNUSED_VARS(object, layer);
|
||||
/* TODO(fclem): All of this is placeholder. */
|
||||
gpLayer gp_layer;
|
||||
gp_layer.vertex_color_opacity = 0.0f;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
* Copyright 2022 Blender Foundation. */
|
||||
* Copyright 2023 Blender Foundation. */
|
||||
|
||||
/** \file
|
||||
* \ingroup draw
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
* Copyright 2022 Blender Foundation. */
|
||||
* Copyright 2023 Blender Foundation. */
|
||||
|
||||
/** \file
|
||||
* \ingroup draw
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
/* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
* Copyright 2023 Blender Foundation. */
|
||||
|
||||
#ifndef GPU_SHADER
|
||||
# pragma once
|
||||
|
|
|
@ -685,11 +685,8 @@ static bool ED_object_editmode_load_free_ex(Main *bmain,
|
|||
ED_mball_editmball_free(obedit);
|
||||
}
|
||||
}
|
||||
else if (obedit->type == OB_CURVES) {
|
||||
/* Curves don't have specific edit mode data, so pass. */
|
||||
}
|
||||
else if (obedit->type == OB_GREASE_PENCIL) {
|
||||
/* Grease Pencil does not have specific edit mode data, so pass. */
|
||||
else if (ELEM(obedit->type, OB_CURVES, OB_GREASE_PENCIL)) {
|
||||
/* Object doesn't have specific edit mode data, so pass. */
|
||||
}
|
||||
else {
|
||||
Hans Goudey
commented
This could be added to the existing This could be added to the existing `OB_CURVES` check with `ELEM`
|
||||
return false;
|
||||
|
|
|
@ -46,8 +46,6 @@ static bool start_brush_operation(bContext &C,
|
|||
/* FIXME: Somehow store the unique_ptr in the PaintStroke. */
|
||||
operation = greasepencil::new_paint_operation().release();
|
||||
break;
|
||||
default:
|
||||
BLI_assert_unreachable();
|
||||
}
|
||||
|
||||
Sergey Sharybin
commented
I am not really sure what the goal is here. If the goal is to somehow ensure all cases are handled it is much better to not use I am not really sure what the goal is here. If the goal is to somehow ensure all cases are handled it is much better to not use `default` and let compiler tell you where cases are missing at the compile time.
|
||||
if (operation) {
|
||||
|
@ -122,16 +120,16 @@ static int grease_pencil_stroke_invoke(bContext *C, wmOperator *op, const wmEven
|
|||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
op->customdata = static_cast<void *>(paint_stroke_new(C,
|
||||
op,
|
||||
stroke_get_location,
|
||||
stroke_test_start,
|
||||
stroke_update_step,
|
||||
stroke_redraw,
|
||||
stroke_done,
|
||||
event->type));
|
||||
op->customdata = paint_stroke_new(C,
|
||||
op,
|
||||
stroke_get_location,
|
||||
filedescriptor marked this conversation as resolved
Outdated
Sergey Sharybin
commented
Is the explicit cast to Is the explicit cast to `void*` needed?
|
||||
stroke_test_start,
|
||||
stroke_update_step,
|
||||
stroke_redraw,
|
||||
stroke_done,
|
||||
event->type);
|
||||
|
||||
int return_value = op->type->modal(C, op, event);
|
||||
const int return_value = op->type->modal(C, op, event);
|
||||
if (return_value == OPERATOR_FINISHED) {
|
||||
return OPERATOR_FINISHED;
|
||||
filedescriptor marked this conversation as resolved
Sergey Sharybin
commented
`const int`
|
||||
}
|
||||
|
|
|
@ -109,7 +109,7 @@ void PaintOperation::on_stroke_done(const bContext &C)
|
|||
curves.offsets_for_write()[num_old_curves] = num_old_points;
|
||||
curves.offsets_for_write()[num_old_curves + 1] = num_old_points + stroke_points.size();
|
||||
|
||||
const offset_indices::OffsetIndices<int> points_by_curve = curves.points_by_curve();
|
||||
const OffsetIndices<int> points_by_curve = curves.points_by_curve();
|
||||
filedescriptor marked this conversation as resolved
Outdated
Hans Goudey
commented
`offset_indices::OffsetIndices` -> `OffsetIndices`
|
||||
const IndexRange new_points_range = points_by_curve[curves.curves_num() - 1];
|
||||
const IndexRange new_curves_range = IndexRange(num_old_curves, 1);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
2023