Refactor: GPv3: Remove get_eval_grease_pencil_layer_drawing* functions
As part of #121565. To avoid using drawing indices outside of the internal grease pencil API, this refactor adds the functions `GreasePencil::get_eval_drawing` to replace the `get_eval_grease_pencil_layer_drawing*` functions. Pull Request: https://projects.blender.org/blender/blender/pulls/121567
This commit is contained in:
@@ -150,10 +150,6 @@ class DrawingReference : public ::GreasePencilDrawingReference {
|
||||
~DrawingReference();
|
||||
};
|
||||
|
||||
const Drawing *get_eval_grease_pencil_layer_drawing(const GreasePencil &grease_pencil,
|
||||
int layer_index);
|
||||
Drawing *get_eval_grease_pencil_layer_drawing_for_write(GreasePencil &grease_pencil,
|
||||
int layer_index);
|
||||
/**
|
||||
* Copies the drawings from one array to another. Assumes that \a dst_drawings is allocated but not
|
||||
* initialized, e.g. it will allocate new drawings and store the pointers.
|
||||
@@ -916,6 +912,17 @@ inline GreasePencilDrawingBase *GreasePencil::drawing(const int64_t index)
|
||||
return this->drawings()[index];
|
||||
}
|
||||
|
||||
inline const blender::bke::greasepencil::Layer *GreasePencil::layer(const int64_t index) const
|
||||
{
|
||||
BLI_assert(index >= 0 && index < this->layers().size());
|
||||
return this->layers()[index];
|
||||
}
|
||||
inline blender::bke::greasepencil::Layer *GreasePencil::layer(const int64_t index)
|
||||
{
|
||||
BLI_assert(index >= 0 && index < this->layers().size());
|
||||
return this->layers_for_write()[index];
|
||||
}
|
||||
|
||||
inline const blender::bke::greasepencil::LayerGroup &GreasePencil::root_group() const
|
||||
{
|
||||
return this->root_group_ptr->wrap();
|
||||
|
||||
@@ -97,8 +97,8 @@ static void remember_deformed_grease_pencil_if_necessary(const GreasePencil *gre
|
||||
MutableSpan<GreasePencilDrawingEditHints> all_hints =
|
||||
*edit_component.grease_pencil_edit_hints_->drawing_hints;
|
||||
for (const int layer_index : layers.index_range()) {
|
||||
const greasepencil::Drawing *drawing = greasepencil::get_eval_grease_pencil_layer_drawing(
|
||||
*grease_pencil, layer_index);
|
||||
const greasepencil::Drawing *drawing = grease_pencil->get_eval_drawing(
|
||||
*grease_pencil->layer(layer_index));
|
||||
const greasepencil::Layer &orig_layer = *orig_layers[layer_index];
|
||||
const greasepencil::Drawing *orig_drawing = orig_grease_pencil.get_drawing_at(
|
||||
orig_layer, grease_pencil->runtime->eval_frame);
|
||||
|
||||
@@ -42,9 +42,8 @@ GVArray GreasePencilLayerFieldContext::get_varray_for_input(const fn::FieldInput
|
||||
if (const CurvesFieldInput *curves_field_input = dynamic_cast<const CurvesFieldInput *>(
|
||||
&field_input))
|
||||
{
|
||||
if (const bke::greasepencil::Drawing *drawing =
|
||||
bke::greasepencil::get_eval_grease_pencil_layer_drawing(this->grease_pencil(),
|
||||
this->layer_index()))
|
||||
if (const bke::greasepencil::Drawing *drawing = this->grease_pencil().get_eval_drawing(
|
||||
*this->grease_pencil().layer(this->layer_index())))
|
||||
{
|
||||
if (drawing->strokes().attributes().domain_supported(this->domain())) {
|
||||
const CurvesFieldContext context{drawing->strokes(), this->domain()};
|
||||
@@ -174,8 +173,8 @@ std::optional<AttributeAccessor> GeometryFieldContext::attributes() const
|
||||
if (domain_ == AttrDomain::Layer) {
|
||||
return grease_pencil->attributes();
|
||||
}
|
||||
if (const greasepencil::Drawing *drawing = greasepencil::get_eval_grease_pencil_layer_drawing(
|
||||
*grease_pencil, grease_pencil_layer_index_))
|
||||
if (const greasepencil::Drawing *drawing = grease_pencil->get_eval_drawing(
|
||||
*grease_pencil->layer(grease_pencil_layer_index_)))
|
||||
{
|
||||
return drawing->strokes().attributes();
|
||||
}
|
||||
@@ -216,8 +215,8 @@ const greasepencil::Drawing *GeometryFieldContext::grease_pencil_layer_drawing()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
return greasepencil::get_eval_grease_pencil_layer_drawing(*this->grease_pencil(),
|
||||
this->grease_pencil_layer_index_);
|
||||
return this->grease_pencil()->get_eval_drawing(
|
||||
*this->grease_pencil()->layer(this->grease_pencil_layer_index_));
|
||||
}
|
||||
const CurvesGeometry *GeometryFieldContext::curves_or_strokes() const
|
||||
{
|
||||
@@ -910,9 +909,8 @@ bool try_capture_field_on_geometry(GeometryComponent &component,
|
||||
bool any_success = false;
|
||||
threading::parallel_for(grease_pencil->layers().index_range(), 8, [&](const IndexRange range) {
|
||||
for (const int layer_index : range) {
|
||||
if (greasepencil::Drawing *drawing =
|
||||
greasepencil::get_eval_grease_pencil_layer_drawing_for_write(*grease_pencil,
|
||||
layer_index))
|
||||
if (greasepencil::Drawing *drawing = grease_pencil->get_eval_drawing(
|
||||
*grease_pencil->layer(layer_index)))
|
||||
{
|
||||
const GeometryFieldContext field_context{*grease_pencil, domain, layer_index};
|
||||
const bool success = try_capture_field_on_geometry(
|
||||
|
||||
@@ -731,29 +731,6 @@ DrawingReference::DrawingReference(const DrawingReference &other)
|
||||
|
||||
DrawingReference::~DrawingReference() = default;
|
||||
|
||||
const Drawing *get_eval_grease_pencil_layer_drawing(const GreasePencil &grease_pencil,
|
||||
const int layer_index)
|
||||
{
|
||||
BLI_assert(layer_index >= 0 && layer_index < grease_pencil.layers().size());
|
||||
const Layer &layer = *grease_pencil.layers()[layer_index];
|
||||
const int drawing_index = layer.drawing_index_at(grease_pencil.runtime->eval_frame);
|
||||
if (drawing_index == -1) {
|
||||
return nullptr;
|
||||
}
|
||||
const GreasePencilDrawingBase *drawing_base = grease_pencil.drawing(drawing_index);
|
||||
if (drawing_base->type != GP_DRAWING) {
|
||||
return nullptr;
|
||||
}
|
||||
const Drawing &drawing = reinterpret_cast<const GreasePencilDrawing *>(drawing_base)->wrap();
|
||||
return &drawing;
|
||||
}
|
||||
|
||||
Drawing *get_eval_grease_pencil_layer_drawing_for_write(GreasePencil &grease_pencil,
|
||||
const int layer)
|
||||
{
|
||||
return const_cast<Drawing *>(get_eval_grease_pencil_layer_drawing(grease_pencil, layer));
|
||||
}
|
||||
|
||||
void copy_drawing_array(Span<const GreasePencilDrawingBase *> src_drawings,
|
||||
MutableSpan<GreasePencilDrawingBase *> dst_drawings)
|
||||
{
|
||||
@@ -2431,6 +2408,23 @@ const blender::bke::greasepencil::Drawing *GreasePencil::get_drawing_at(
|
||||
return &drawing->wrap();
|
||||
}
|
||||
|
||||
blender::bke::greasepencil::Drawing *GreasePencil::get_drawing_at(
|
||||
const blender::bke::greasepencil::Layer &layer, const int frame_number)
|
||||
{
|
||||
const int drawing_index = layer.drawing_index_at(frame_number);
|
||||
if (drawing_index == -1) {
|
||||
/* No drawing found. */
|
||||
return nullptr;
|
||||
}
|
||||
GreasePencilDrawingBase *drawing_base = this->drawing(drawing_index);
|
||||
if (drawing_base->type != GP_DRAWING) {
|
||||
/* TODO: Get reference drawing. */
|
||||
return nullptr;
|
||||
}
|
||||
GreasePencilDrawing *drawing = reinterpret_cast<GreasePencilDrawing *>(drawing_base);
|
||||
return &drawing->wrap();
|
||||
}
|
||||
|
||||
blender::bke::greasepencil::Drawing *GreasePencil::get_editable_drawing_at(
|
||||
const blender::bke::greasepencil::Layer &layer, const int frame_number)
|
||||
{
|
||||
@@ -2452,6 +2446,18 @@ blender::bke::greasepencil::Drawing *GreasePencil::get_editable_drawing_at(
|
||||
return &drawing->wrap();
|
||||
}
|
||||
|
||||
const blender::bke::greasepencil::Drawing *GreasePencil::get_eval_drawing(
|
||||
const blender::bke::greasepencil::Layer &layer) const
|
||||
{
|
||||
return this->get_drawing_at(layer, this->runtime->eval_frame);
|
||||
}
|
||||
|
||||
blender::bke::greasepencil::Drawing *GreasePencil::get_eval_drawing(
|
||||
const blender::bke::greasepencil::Layer &layer)
|
||||
{
|
||||
return this->get_drawing_at(layer, this->runtime->eval_frame);
|
||||
}
|
||||
|
||||
std::optional<blender::Bounds<blender::float3>> GreasePencil::bounds_min_max(const int frame) const
|
||||
{
|
||||
using namespace blender;
|
||||
|
||||
@@ -466,8 +466,8 @@ std::optional<const bke::AttributeAccessor> GeometryDataSource::get_component_at
|
||||
return grease_pencil->attributes();
|
||||
}
|
||||
if (layer_index_ >= 0 && layer_index_ < grease_pencil->layers().size()) {
|
||||
if (const bke::greasepencil::Drawing *drawing =
|
||||
bke::greasepencil::get_eval_grease_pencil_layer_drawing(*grease_pencil, layer_index_))
|
||||
if (const bke::greasepencil::Drawing *drawing = grease_pencil->get_eval_drawing(
|
||||
*grease_pencil->layer(layer_index_)))
|
||||
{
|
||||
return drawing->strokes().attributes();
|
||||
}
|
||||
|
||||
@@ -285,9 +285,9 @@ std::optional<int> GeometryDataSetTreeViewItem::count() const
|
||||
}
|
||||
|
||||
if (component_type_ == bke::GeometryComponent::Type::GreasePencil && layer_index_) {
|
||||
if (const bke::greasepencil::Drawing *drawing =
|
||||
bke::greasepencil::get_eval_grease_pencil_layer_drawing(*geometry.get_grease_pencil(),
|
||||
*layer_index_))
|
||||
const GreasePencil *grease_pencil = geometry.get_grease_pencil();
|
||||
if (const bke::greasepencil::Drawing *drawing = grease_pencil->get_eval_drawing(
|
||||
*grease_pencil->layer(*layer_index_)))
|
||||
{
|
||||
return drawing->strokes().attributes().domain_size(*domain_);
|
||||
}
|
||||
|
||||
@@ -243,8 +243,7 @@ void separate_geometry(bke::GeometrySet &geometry_set,
|
||||
else if (ELEM(domain, AttrDomain::Point, AttrDomain::Curve)) {
|
||||
GreasePencil &grease_pencil = *geometry_set.get_grease_pencil_for_write();
|
||||
for (const int layer_index : grease_pencil.layers().index_range()) {
|
||||
Drawing *drawing = get_eval_grease_pencil_layer_drawing_for_write(grease_pencil,
|
||||
layer_index);
|
||||
Drawing *drawing = grease_pencil.get_eval_drawing(*grease_pencil.layer(layer_index));
|
||||
if (drawing == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -89,9 +89,7 @@ static void translate_greasepencil(GreasePencil &grease_pencil, const float3 tra
|
||||
{
|
||||
using namespace blender::bke::greasepencil;
|
||||
for (const int layer_index : grease_pencil.layers().index_range()) {
|
||||
if (Drawing *drawing = get_eval_grease_pencil_layer_drawing_for_write(grease_pencil,
|
||||
layer_index))
|
||||
{
|
||||
if (Drawing *drawing = grease_pencil.get_eval_drawing(*grease_pencil.layer(layer_index))) {
|
||||
drawing->strokes_for_write().translate(translation);
|
||||
}
|
||||
}
|
||||
@@ -101,9 +99,7 @@ static void transform_greasepencil(GreasePencil &grease_pencil, const float4x4 &
|
||||
{
|
||||
using namespace blender::bke::greasepencil;
|
||||
for (const int layer_index : grease_pencil.layers().index_range()) {
|
||||
if (Drawing *drawing = get_eval_grease_pencil_layer_drawing_for_write(grease_pencil,
|
||||
layer_index))
|
||||
{
|
||||
if (Drawing *drawing = grease_pencil.get_eval_drawing(*grease_pencil.layer(layer_index))) {
|
||||
drawing->strokes_for_write().transform(transform);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -492,6 +492,8 @@ typedef struct GreasePencil {
|
||||
/* Layers, layer groups and nodes read/write access. */
|
||||
blender::Span<const blender::bke::greasepencil::Layer *> layers() const;
|
||||
blender::Span<blender::bke::greasepencil::Layer *> layers_for_write();
|
||||
const blender::bke::greasepencil::Layer *layer(int64_t index) const;
|
||||
blender::bke::greasepencil::Layer *layer(int64_t index);
|
||||
|
||||
blender::Span<const blender::bke::greasepencil::LayerGroup *> layer_groups() const;
|
||||
blender::Span<blender::bke::greasepencil::LayerGroup *> layer_groups_for_write();
|
||||
@@ -618,6 +620,8 @@ typedef struct GreasePencil {
|
||||
*/
|
||||
const blender::bke::greasepencil::Drawing *get_drawing_at(
|
||||
const blender::bke::greasepencil::Layer &layer, int frame_number) const;
|
||||
blender::bke::greasepencil::Drawing *get_drawing_at(
|
||||
const blender::bke::greasepencil::Layer &layer, int frame_number);
|
||||
/**
|
||||
* Returns an editable drawing on \a layer at frame \a frame_number or `nullptr` if no such
|
||||
* drawing exists.
|
||||
@@ -625,6 +629,15 @@ typedef struct GreasePencil {
|
||||
blender::bke::greasepencil::Drawing *get_editable_drawing_at(
|
||||
const blender::bke::greasepencil::Layer &layer, int frame_number);
|
||||
|
||||
/**
|
||||
* Returns a drawing on \a layer at the frame this grease pencil was evaluated at or `nullptr` if
|
||||
* no such drawing exists.
|
||||
*/
|
||||
const blender::bke::greasepencil::Drawing *get_eval_drawing(
|
||||
const blender::bke::greasepencil::Layer &layer) const;
|
||||
blender::bke::greasepencil::Drawing *get_eval_drawing(
|
||||
const blender::bke::greasepencil::Layer &layer);
|
||||
|
||||
std::optional<blender::Bounds<blender::float3>> bounds_min_max(int frame) const;
|
||||
std::optional<blender::Bounds<blender::float3>> bounds_min_max_eval() const;
|
||||
|
||||
|
||||
@@ -215,7 +215,7 @@ static void convex_hull_grease_pencil(GeometrySet &geometry_set)
|
||||
Array<Mesh *> mesh_by_layer(grease_pencil.layers().size(), nullptr);
|
||||
|
||||
for (const int layer_index : grease_pencil.layers().index_range()) {
|
||||
const Drawing *drawing = get_eval_grease_pencil_layer_drawing(grease_pencil, layer_index);
|
||||
const Drawing *drawing = grease_pencil.get_eval_drawing(*grease_pencil.layer(layer_index));
|
||||
if (drawing == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -266,7 +266,7 @@ static void curve_fill_calculate(GeometrySet &geometry_set,
|
||||
const GreasePencil &grease_pencil = *geometry_set.get_grease_pencil();
|
||||
Vector<Mesh *> mesh_by_layer(grease_pencil.layers().size(), nullptr);
|
||||
for (const int layer_index : grease_pencil.layers().index_range()) {
|
||||
const Drawing *drawing = get_eval_grease_pencil_layer_drawing(grease_pencil, layer_index);
|
||||
const Drawing *drawing = grease_pencil.get_eval_drawing(*grease_pencil.layer(layer_index));
|
||||
if (drawing == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ static void fillet_grease_pencil(GreasePencil &grease_pencil,
|
||||
{
|
||||
using namespace blender::bke::greasepencil;
|
||||
for (const int layer_index : grease_pencil.layers().index_range()) {
|
||||
Drawing *drawing = get_eval_grease_pencil_layer_drawing_for_write(grease_pencil, layer_index);
|
||||
Drawing *drawing = grease_pencil.get_eval_drawing(*grease_pencil.layer(layer_index));
|
||||
if (drawing == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ static void node_geo_exec(GeoNodeExecParams params)
|
||||
using namespace bke::greasepencil;
|
||||
const GreasePencil &grease_pencil = *geometry_set.get_grease_pencil();
|
||||
for (const int layer_index : grease_pencil.layers().index_range()) {
|
||||
const Drawing *drawing = get_eval_grease_pencil_layer_drawing(grease_pencil, layer_index);
|
||||
const Drawing *drawing = grease_pencil.get_eval_drawing(*grease_pencil.layer(layer_index));
|
||||
if (drawing == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -84,8 +84,8 @@ static void node_geo_exec(GeoNodeExecParams params)
|
||||
if (GreasePencil *grease_pencil = geometry_set.get_grease_pencil_for_write()) {
|
||||
using namespace blender::bke::greasepencil;
|
||||
for (const int layer_index : grease_pencil->layers().index_range()) {
|
||||
Drawing *drawing = get_eval_grease_pencil_layer_drawing_for_write(*grease_pencil,
|
||||
layer_index);
|
||||
Drawing *drawing = grease_pencil->get_eval_drawing(*grease_pencil->layer(layer_index));
|
||||
|
||||
if (drawing == nullptr) {
|
||||
continue;
|
||||
}
|
||||
@@ -116,8 +116,7 @@ static void node_geo_exec(GeoNodeExecParams params)
|
||||
if (GreasePencil *grease_pencil = geometry_set.get_grease_pencil_for_write()) {
|
||||
using namespace blender::bke::greasepencil;
|
||||
for (const int layer_index : grease_pencil->layers().index_range()) {
|
||||
Drawing *drawing = get_eval_grease_pencil_layer_drawing_for_write(*grease_pencil,
|
||||
layer_index);
|
||||
Drawing *drawing = grease_pencil->get_eval_drawing(*grease_pencil->layer(layer_index));
|
||||
if (drawing == nullptr) {
|
||||
continue;
|
||||
}
|
||||
@@ -147,8 +146,7 @@ static void node_geo_exec(GeoNodeExecParams params)
|
||||
if (GreasePencil *grease_pencil = geometry_set.get_grease_pencil_for_write()) {
|
||||
using namespace blender::bke::greasepencil;
|
||||
for (const int layer_index : grease_pencil->layers().index_range()) {
|
||||
Drawing *drawing = get_eval_grease_pencil_layer_drawing_for_write(*grease_pencil,
|
||||
layer_index);
|
||||
Drawing *drawing = grease_pencil->get_eval_drawing(*grease_pencil->layer(layer_index));
|
||||
if (drawing == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ static void reverse_grease_pencil(GreasePencil &grease_pencil, const Field<bool>
|
||||
{
|
||||
using namespace blender::bke::greasepencil;
|
||||
for (const int layer_index : grease_pencil.layers().index_range()) {
|
||||
Drawing *drawing = get_eval_grease_pencil_layer_drawing_for_write(grease_pencil, layer_index);
|
||||
Drawing *drawing = grease_pencil.get_eval_drawing(*grease_pencil.layer(layer_index));
|
||||
if (drawing == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ static void subdivide_grease_pencil_curves(
|
||||
{
|
||||
using namespace bke::greasepencil;
|
||||
for (const int layer_index : grease_pencil.layers().index_range()) {
|
||||
Drawing *drawing = get_eval_grease_pencil_layer_drawing_for_write(grease_pencil, layer_index);
|
||||
Drawing *drawing = grease_pencil.get_eval_drawing(*grease_pencil.layer(layer_index));
|
||||
|
||||
if (drawing == nullptr) {
|
||||
continue;
|
||||
|
||||
@@ -58,7 +58,7 @@ static void grease_pencil_to_mesh(GeometrySet &geometry_set,
|
||||
Array<Mesh *> mesh_by_layer(grease_pencil.layers().size(), nullptr);
|
||||
|
||||
for (const int layer_index : grease_pencil.layers().index_range()) {
|
||||
const Drawing *drawing = get_eval_grease_pencil_layer_drawing(grease_pencil, layer_index);
|
||||
const Drawing *drawing = grease_pencil.get_eval_drawing(*grease_pencil.layer(layer_index));
|
||||
if (drawing == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -236,7 +236,7 @@ static void grease_pencil_to_points(GeometrySet &geometry_set,
|
||||
const GreasePencil &grease_pencil = *geometry.get_grease_pencil();
|
||||
Vector<PointCloud *> pointcloud_by_layer(grease_pencil.layers().size(), nullptr);
|
||||
for (const int layer_index : grease_pencil.layers().index_range()) {
|
||||
const Drawing *drawing = get_eval_grease_pencil_layer_drawing(grease_pencil, layer_index);
|
||||
const Drawing *drawing = grease_pencil.get_eval_drawing(*grease_pencil.layer(layer_index));
|
||||
if (drawing == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -175,8 +175,7 @@ static void geometry_set_curve_trim(GeometrySet &geometry_set,
|
||||
using namespace bke::greasepencil;
|
||||
GreasePencil &grease_pencil = *geometry_set.get_grease_pencil_for_write();
|
||||
for (const int layer_index : grease_pencil.layers().index_range()) {
|
||||
Drawing *drawing = get_eval_grease_pencil_layer_drawing_for_write(grease_pencil,
|
||||
layer_index);
|
||||
Drawing *drawing = grease_pencil.get_eval_drawing(*grease_pencil.layer(layer_index));
|
||||
if (drawing == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -227,7 +227,7 @@ static void node_geo_exec(GeoNodeExecParams params)
|
||||
using namespace bke::greasepencil;
|
||||
const GreasePencil &grease_pencil = *geometry_set.get_grease_pencil();
|
||||
for (const int layer_index : grease_pencil.layers().index_range()) {
|
||||
const Drawing *drawing = get_eval_grease_pencil_layer_drawing(grease_pencil, layer_index);
|
||||
const Drawing *drawing = grease_pencil.get_eval_drawing(*grease_pencil.layer(layer_index));
|
||||
if (drawing == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ static void set_grease_pencil_normal(GreasePencil &grease_pencil,
|
||||
{
|
||||
using namespace blender::bke::greasepencil;
|
||||
for (const int layer_index : grease_pencil.layers().index_range()) {
|
||||
Drawing *drawing = get_eval_grease_pencil_layer_drawing_for_write(grease_pencil, layer_index);
|
||||
Drawing *drawing = grease_pencil.get_eval_drawing(*grease_pencil.layer(layer_index));
|
||||
if (drawing == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -50,8 +50,7 @@ static void node_geo_exec(GeoNodeExecParams params)
|
||||
if (GreasePencil *grease_pencil = geometry_set.get_grease_pencil_for_write()) {
|
||||
using namespace blender::bke::greasepencil;
|
||||
for (const int layer_index : grease_pencil->layers().index_range()) {
|
||||
Drawing *drawing = get_eval_grease_pencil_layer_drawing_for_write(*grease_pencil,
|
||||
layer_index);
|
||||
Drawing *drawing = grease_pencil->get_eval_drawing(*grease_pencil->layer(layer_index));
|
||||
if (drawing == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ static void set_grease_pencil_tilt(GreasePencil &grease_pencil,
|
||||
{
|
||||
using namespace blender::bke::greasepencil;
|
||||
for (const int layer_index : grease_pencil.layers().index_range()) {
|
||||
Drawing *drawing = get_eval_grease_pencil_layer_drawing_for_write(grease_pencil, layer_index);
|
||||
Drawing *drawing = grease_pencil.get_eval_drawing(*grease_pencil.layer(layer_index));
|
||||
if (drawing == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -116,8 +116,7 @@ static void node_geo_exec(GeoNodeExecParams params)
|
||||
using namespace blender::bke::greasepencil;
|
||||
Vector<Mesh *> mesh_by_layer(grease_pencil->layers().size(), nullptr);
|
||||
for (const int layer_index : grease_pencil->layers().index_range()) {
|
||||
Drawing *drawing = get_eval_grease_pencil_layer_drawing_for_write(*grease_pencil,
|
||||
layer_index);
|
||||
Drawing *drawing = grease_pencil->get_eval_drawing(*grease_pencil->layer(layer_index));
|
||||
if (drawing == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ static void set_material_index_in_grease_pencil(GreasePencil &grease_pencil,
|
||||
{
|
||||
using namespace blender::bke::greasepencil;
|
||||
for (const int layer_index : grease_pencil.layers().index_range()) {
|
||||
Drawing *drawing = get_eval_grease_pencil_layer_drawing_for_write(grease_pencil, layer_index);
|
||||
Drawing *drawing = grease_pencil.get_eval_drawing(*grease_pencil.layer(layer_index));
|
||||
if (drawing == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -82,8 +82,7 @@ static void set_position_in_grease_pencil(GreasePencil &grease_pencil,
|
||||
{
|
||||
using namespace blender::bke::greasepencil;
|
||||
for (const int layer_index : grease_pencil.layers().index_range()) {
|
||||
Drawing *drawing = bke::greasepencil::get_eval_grease_pencil_layer_drawing_for_write(
|
||||
grease_pencil, layer_index);
|
||||
Drawing *drawing = grease_pencil.get_eval_drawing(*grease_pencil.layer(layer_index));
|
||||
if (drawing == nullptr || drawing->strokes().points_num() == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ static void set_grease_pencil_cyclic(GreasePencil &grease_pencil,
|
||||
{
|
||||
using namespace blender::bke::greasepencil;
|
||||
for (const int layer_index : grease_pencil.layers().index_range()) {
|
||||
Drawing *drawing = get_eval_grease_pencil_layer_drawing_for_write(grease_pencil, layer_index);
|
||||
Drawing *drawing = grease_pencil.get_eval_drawing(*grease_pencil.layer(layer_index));
|
||||
if (drawing == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ static void set_grease_pencil_resolution(GreasePencil &grease_pencil,
|
||||
{
|
||||
using namespace blender::bke::greasepencil;
|
||||
for (const int layer_index : grease_pencil.layers().index_range()) {
|
||||
Drawing *drawing = get_eval_grease_pencil_layer_drawing_for_write(grease_pencil, layer_index);
|
||||
Drawing *drawing = grease_pencil.get_eval_drawing(*grease_pencil.layer(layer_index));
|
||||
if (drawing == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user