GPv3: Insert grease pencil keyframe from the dopesheet #110649

Merged
Amélie Fondevilla merged 23 commits from amelief/blender:gpv3-insert-keyframe into main 2023-08-02 14:56:24 +02:00
1 changed files with 15 additions and 9 deletions
Showing only changes of commit 9e1e4c8c45 - Show all commits

View File

@ -1430,16 +1430,22 @@ bool GreasePencil::insert_duplicate_frame(blender::bke::greasepencil::Layer &lay
duplicate_frame->type = frame.type;
const GreasePencilDrawingBase *drawing_base = this->drawings(frame.drawing_index);
BLI_assert_msg((drawing_base->type == GP_DRAWING),
"Drawing references cannot be duplicated yet.");
const GreasePencilDrawing *drawing = reinterpret_cast<const GreasePencilDrawing *>(drawing_base);
if (do_instance) {
/* TODO : add user to the drawing. */
switch (drawing_base->type) {
case GP_DRAWING: {
const GreasePencilDrawing *drawing = reinterpret_cast<const GreasePencilDrawing *>(
drawing_base);
if (do_instance) {
/* TODO : add user to the drawing. */
}
amelief marked this conversation as resolved Outdated

using namespace blender::bke::greasepencil; here so we can use Drawing below.

`using namespace blender::bke::greasepencil;` here so we can use `Drawing` below.
else {
this->add_duplicate_drawings(1, drawing->wrap());
amelief marked this conversation as resolved Outdated

Rather than asserting here, I think we can return false. I don't think we should crash here if the frame_number isn't found.

Rather than asserting here, I think we can return `false`. I don't think we should crash here if the `frame_number` isn't found.
}
break;
}
case GP_DRAWING_REFERENCE:
/* TODO: Duplicate drawing references. */
return false;
}
else {
this->add_duplicate_drawings(1, drawing->wrap());
}
return true;
}