[Bf-blender-cvs] [6e2b594d98d] gpencil-new-data-proposal: adding is empty method for gpencil frame in the API

Amelie Fondevilla noreply at git.blender.org
Mon Dec 12 18:19:29 CET 2022


Commit: 6e2b594d98d00d3259b914f1ca35efa954fcf52c
Author: Amelie Fondevilla
Date:   Mon Dec 12 12:17:39 2022 +0100
Branches: gpencil-new-data-proposal
https://developer.blender.org/rB6e2b594d98d00d3259b914f1ca35efa954fcf52c

adding is empty method for gpencil frame in the API

===================================================================

M	source/blender/blenkernel/intern/gpencil_new_proposal.cc
M	source/blender/blenkernel/intern/gpencil_new_proposal.hh

===================================================================

diff --git a/source/blender/blenkernel/intern/gpencil_new_proposal.cc b/source/blender/blenkernel/intern/gpencil_new_proposal.cc
index f176c451040..551e0bd58fe 100644
--- a/source/blender/blenkernel/intern/gpencil_new_proposal.cc
+++ b/source/blender/blenkernel/intern/gpencil_new_proposal.cc
@@ -172,9 +172,14 @@ const CurvesGeometry &GPFrame::strokes_as_curves() const
   return CurvesGeometry::wrap(*this->strokes);
 }
 
+bool GPFrame::is_empty() const
+{
+  return (this->strokes == nullptr) || (this->strokes->curve_num == 0);
+}
+
 int GPFrame::strokes_num() const
 {
-  if (this->strokes == nullptr) {
+  if (this->is_empty()) {
     return 0;
   }
   return this->strokes->curve_num;
diff --git a/source/blender/blenkernel/intern/gpencil_new_proposal.hh b/source/blender/blenkernel/intern/gpencil_new_proposal.hh
index 0a15315172c..6c485b897e1 100644
--- a/source/blender/blenkernel/intern/gpencil_new_proposal.hh
+++ b/source/blender/blenkernel/intern/gpencil_new_proposal.hh
@@ -257,6 +257,7 @@ class GPFrame : public ::GPFrame {
   CurvesGeometry &strokes_as_curves();
   const CurvesGeometry &strokes_as_curves() const;
 
+  bool is_empty() const;
   int strokes_num() const;
   int points_num() const;



More information about the Bf-blender-cvs mailing list