Initial Grease Pencil 3.0 stage #106848
|
@ -273,8 +273,6 @@ void legacy_gpencil_to_grease_pencil(Main &main, GreasePencil &grease_pencil, bG
|
|||
|
||||
} // namespace convert
|
||||
|
||||
} // namespace greasepencil
|
||||
|
||||
/**
|
||||
|
||||
* A single point for a stroke that is currently being drawn.
|
||||
*/
|
||||
|
@ -301,6 +299,8 @@ struct StrokeCache {
|
|||
}
|
||||
};
|
||||
|
||||
} // namespace greasepencil
|
||||
|
||||
Hans Goudey
commented
Looks like this should be private maybe? It has a Looks like this should be private maybe? It has a `_` suffix.
|
||||
class GreasePencilDrawingRuntime {
|
||||
public:
|
||||
/**
|
||||
|
@ -308,7 +308,7 @@ class GreasePencilDrawingRuntime {
|
|||
*/
|
||||
mutable SharedCache<Vector<uint3>> triangles_cache;
|
||||
|
||||
Falk David
commented
Put out of line. Put out of line.
|
||||
StrokeCache stroke_cache;
|
||||
greasepencil::StrokeCache stroke_cache;
|
||||
};
|
||||
|
||||
class GreasePencilRuntime {
|
||||
|
|
|
@ -829,7 +829,7 @@ bool GreasePencilDrawing::has_stroke_buffer() const
|
|||
return this->runtime->stroke_cache.points.size() > 0;
|
||||
}
|
||||
|
||||
blender::Span<blender::bke::StrokePoint> GreasePencilDrawing::stroke_buffer() const
|
||||
blender::Span<blender::bke::greasepencil::StrokePoint> GreasePencilDrawing::stroke_buffer() const
|
||||
{
|
||||
return this->runtime->stroke_cache.points.as_span();
|
||||
}
|
||||
|
|
|
@ -388,7 +388,7 @@ static void grease_pencil_batches_ensure(GreasePencil &grease_pencil, int cfra)
|
|||
});
|
||||
|
||||
if (drawing.has_stroke_buffer()) {
|
||||
Span<bke::StrokePoint> points = drawing.stroke_buffer();
|
||||
Span<bke::greasepencil::StrokePoint> points = drawing.stroke_buffer();
|
||||
const int verts_start_offset = verts_start_offsets.last();
|
||||
const int num_verts = 1 + points.size() + 1;
|
||||
IndexRange verts_range = IndexRange(verts_start_offset, num_verts);
|
||||
|
@ -401,7 +401,7 @@ static void grease_pencil_batches_ensure(GreasePencil &grease_pencil, int cfra)
|
|||
const int idx = i + 1;
|
||||
GreasePencilStrokeVert &s_vert = verts_slice[idx];
|
||||
GreasePencilColorVert &c_vert = cols_slice[idx];
|
||||
const bke::StrokePoint &point = points[i];
|
||||
const bke::greasepencil::StrokePoint &point = points[i];
|
||||
|
||||
copy_v3_v3(s_vert.pos, point.position);
|
||||
s_vert.radius = point.radius;
|
||||
|
|
|
@ -67,7 +67,7 @@ struct PaintOperationExecutor {
|
|||
float3 proj_pos;
|
||||
ED_view3d_win_to_3d_on_plane(region, plane, stroke_extension.mouse_position, false, proj_pos);
|
||||
|
||||
StrokePoint new_point{proj_pos, stroke_extension.pressure * 100.0f, 1.0f, float4(1.0f)};
|
||||
bke::greasepencil::StrokePoint new_point{proj_pos, stroke_extension.pressure * 100.0f, 1.0f, float4(1.0f)};
|
||||
|
||||
drawing.runtime->stroke_cache.points.append(std::move(new_point));
|
||||
|
||||
|
@ -104,7 +104,7 @@ void PaintOperation::on_stroke_done(const bContext &C)
|
|||
GreasePencilDrawing &drawing_eval = *reinterpret_cast<GreasePencilDrawing *>(
|
||||
grease_pencil_eval.drawings()[index_eval]);
|
||||
|
||||
const Span<StrokePoint> stroke_points = drawing_eval.stroke_buffer();
|
||||
const Span<bke::greasepencil::StrokePoint> stroke_points = drawing_eval.stroke_buffer();
|
||||
CurvesGeometry &curves = drawing_orig.geometry.wrap();
|
||||
|
||||
int num_old_curves = curves.curves_num();
|
||||
|
@ -124,7 +124,7 @@ void PaintOperation::on_stroke_done(const bContext &C)
|
|||
SpanAttributeWriter<float> radii = attributes.lookup_for_write_span<float>("radius");
|
||||
SpanAttributeWriter<float> opacities = attributes.lookup_for_write_span<float>("opacity");
|
||||
for (const int i : IndexRange(stroke_points.size())) {
|
||||
const StrokePoint &point = stroke_points[i];
|
||||
const bke::greasepencil::StrokePoint &point = stroke_points[i];
|
||||
const int point_i = new_points_range[i];
|
||||
positions[point_i] = point.position;
|
||||
radii.span[point_i] = point.radius;
|
||||
|
|
|
@ -18,10 +18,10 @@
|
|||
namespace blender::bke {
|
||||
class GreasePencilRuntime;
|
||||
class GreasePencilDrawingRuntime;
|
||||
struct StrokePoint;
|
||||
namespace greasepencil {
|
||||
class Layer;
|
||||
class LayerGroup;
|
||||
struct StrokePoint;
|
||||
} // namespace greasepencil
|
||||
} // namespace blender::bke
|
||||
using GreasePencilRuntimeHandle = blender::bke::GreasePencilRuntime;
|
||||
|
@ -104,7 +104,7 @@ typedef struct GreasePencilDrawing {
|
|||
/**
|
||||
* A buffer for a single stroke while drawing.
|
||||
*/
|
||||
blender::Span<blender::bke::StrokePoint> stroke_buffer() const;
|
||||
blender::Span<blender::bke::greasepencil::StrokePoint> stroke_buffer() const;
|
||||
bool has_stroke_buffer() const;
|
||||
#endif
|
||||
} GreasePencilDrawing;
|
||||
|
|
Loading…
Reference in New Issue
Not sure why the
greasepencil
namespace ends up here? Also means that e.g. the fairly generically-namedStrokePoint
struct is in the fairly genericblender::bke
namespace, which does not sounds great to me? not to mention 'C-style' namespace in names likeGreasePencilDrawingRuntime
.