This should maybe use fcurves_all()
nowadays? Will let the animation team comment on this.
Nice! Code overall looks good, just commented about a few cleanup things.
I'd probably put this further down below ED_operatortypes_grease_pencil_trace
.
Use uint16_t
. See https://developer.blender.org/docs/handbook/guidelines/c_cpp/#integer-types.
Maybe instead of key
we could just use: if ((frame_start - frame) % step != 0 && frame != frame_end) {
?
This should use Drawing &target_drawing = *target.insert_frame(...)
. I'm trying to refactor existing code and make .add_frame
a private API (because it causes side-effects that the caller needs to deal with).
I think it might be nice to use fmt
here (to avoid the memory managment).
Vector<Object *> bake_targets = get_bake_targets(*C, depsgraph, scene);
Use std::optional<Set<int>> keyframes
and keyframes = get_selected_object_keyframes(...)
to write to the optional.
Note: frame_at
will return a GreasePencilFrame
that is visible at scene.r.cfra
. So for example if there is a keyframe at frame 10 and a keyframe at frame 20, the frame starting at frame 10 would also be returned if you query e.g. frame 15.
It's probably best to move this check outside the loop to avoid the branching for every point:
This should use multi-threading with a high grain size:
Instead of passing the vector as a mutable reference, just create it within the function and return the vector by value.