GPv3: Frame All/Selected keyframes

Update the `ACTION_OT_view_all` and `ACTION_OT_view_selected`
operators to take into account grease pencil keyframes.

Pull Request: https://projects.blender.org/blender/blender/pulls/111480
This commit is contained in:
Amelie Fondevilla
2023-09-11 12:40:04 +02:00
committed by Falk David
parent 6221ff436f
commit 3ee7900775

View File

@@ -198,6 +198,19 @@ static bool get_keyframe_extents(bAnimContext *ac, float *min, float *max, const
found = true;
}
}
else if (ale->datatype == ALE_GREASE_PENCIL_CEL) {
const blender::bke::greasepencil::Layer &layer =
static_cast<GreasePencilLayer *>(ale->data)->wrap();
for (const auto [key, frame] : layer.frames().items()) {
if (onlySel && !frame.is_selected()) {
continue;
}
*min = min_ff(*min, float(key));
*max = max_ff(*max, float(key));
found = true;
}
}
else {
FCurve *fcu = (FCurve *)ale->key_data;
float tmin, tmax;