GPv3: Fix: Crash when drawing without a layer #109330

Closed
casey-bianco-davis wants to merge 11 commits from casey-bianco-davis:GPv3-draw-crash-no-layer into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
1 changed files with 2 additions and 2 deletions
Showing only changes of commit 6aa92da162 - Show all commits

View File

@ -59,7 +59,7 @@ struct PaintOperationExecutor {
grease_pencil.add_empty_drawings(1);
GreasePencilFrame frame{0, 0, BEZT_KEYTYPE_KEYFRAME};
GreasePencilFrame frame{int(grease_pencil.drawings().index_range().last()), 0, BEZT_KEYTYPE_KEYFRAME};
casey-bianco-davis marked this conversation as resolved Outdated

This is not right. The frame should point to the newly added empty drawing.
GreasePencilFrame frame{this->drawings().index_range().last(), 0, BEZT_KEYTYPE_KEYFRAME};

This is not right. The `frame` should point to the newly added empty drawing. `GreasePencilFrame frame{this->drawings().index_range().last(), 0, BEZT_KEYTYPE_KEYFRAME};`
new_layer.insert_frame(scene->r.cfra, frame);
}
const bke::greasepencil::Layer &active_layer = *grease_pencil.get_active_layer();
@ -104,7 +104,7 @@ void PaintOperation::on_stroke_done(const bContext &C)
grease_pencil_orig.add_empty_drawings(1);
GreasePencilFrame frame{0, 0, BEZT_KEYTYPE_KEYFRAME};
GreasePencilFrame frame{int(grease_pencil_orig.drawings().index_range().last()), 0, BEZT_KEYTYPE_KEYFRAME};
casey-bianco-davis marked this conversation as resolved Outdated

Same as above.

Same as above.
new_layer.insert_frame(scene->r.cfra, frame);
}
BLI_assert(grease_pencil_orig.has_active_layer() && grease_pencil_eval.has_active_layer());