Cleanup: GPv3: Use Layer::is_empty()

Also adds a docstring for the `is_empty()` method.
This commit is contained in:
Falk David
2024-05-16 14:38:20 +02:00
parent 23425ea83e
commit 82f509a1a4
2 changed files with 4 additions and 1 deletions

View File

@@ -420,6 +420,9 @@ class Layer : public ::GreasePencilLayer {
const Map<FramesMapKey, GreasePencilFrame> &frames() const;
Map<FramesMapKey, GreasePencilFrame> &frames_for_write();
/**
* \returns true, if the layer contains no keyframes.
*/
bool is_empty() const;
/**

View File

@@ -348,7 +348,7 @@ bool ensure_active_keyframe(const Scene &scene,
/* If auto-key is on and the drawing at the current frame starts before the current frame a new
* keyframe needs to be inserted. */
const bool is_first = active_layer.sorted_keys().is_empty() ||
const bool is_first = active_layer.is_empty() ||
(active_layer.sorted_keys().first() > current_frame);
const bool needs_new_drawing = is_first ||
(*active_layer.frame_key_at(current_frame) < current_frame);