[Bf-blender-cvs] [8e96d7f3d68] gpencil-new-data-proposal: WIP: refine structure

Falk David noreply at git.blender.org
Tue May 10 12:25:31 CEST 2022


Commit: 8e96d7f3d6821b6379cc9359beb6ab90d9385ac5
Author: Falk David
Date:   Wed Apr 13 15:05:56 2022 +0200
Branches: gpencil-new-data-proposal
https://developer.blender.org/rB8e96d7f3d6821b6379cc9359beb6ab90d9385ac5

WIP: refine structure

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

M	source/blender/blenkernel/intern/gpencil_new_proposal_test.cc

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

diff --git a/source/blender/blenkernel/intern/gpencil_new_proposal_test.cc b/source/blender/blenkernel/intern/gpencil_new_proposal_test.cc
index 8d690bd0f15..a2c51f3d00b 100644
--- a/source/blender/blenkernel/intern/gpencil_new_proposal_test.cc
+++ b/source/blender/blenkernel/intern/gpencil_new_proposal_test.cc
@@ -10,11 +10,9 @@
 
 namespace blender::bke::gpencil {
 
-typedef struct bGPdata bGPdata;
-
 class GPencilFrame : public CurvesGeometry {
-  public:
-  GPencilFrame() {};
+ public:
+  GPencilFrame(){};
   ~GPencilFrame() = default;
 
   CurvesGeometry &as_curves_geometry()
@@ -23,42 +21,94 @@ class GPencilFrame : public CurvesGeometry {
     return *geometry;
   }
 
-  bool bounds_min_max(float3 &min, float3 &max) 
+  bool bounds_min_max(float3 &min, float3 &max)
   {
     return as_curves_geometry().bounds_min_max(min, max);
   }
 };
 
-// class GPencilData : bGPdata {
-// public:
-//   GPencilData();
-//   ~GPencilData();
-// };
+class GPDataRuntime {
+ public:
+  /* Runtime Data */
+  /* void *stroke_painting_buffer; */
+};
 
-struct bGPdata {
-  ID id;
-  /* Animation data (must be immediately after id). */
-  struct AnimData *adt;
+class GPencilData : blender::dna::gpencil::GPData {
+ public:
+  GPencilData();
+  ~GPencilData();
+};
+
+}  // namespace blender::bke::gpencil
+
+namespace blender::dna::gpencil {
+
+#ifdef __cplusplus
+class GPDataRuntime;
+using GPDataRuntimeHandle = blender::bke::gpencil::GPDataRuntime;
+#else
+typedef struct GPDataRuntimeHandle GPDataRuntimeHandle;
+#endif
+
+typedef struct GPLayerGroup {
+  struct GPLayerGroup *children;
+  int children_size;
+
+  int *layer_indices;
+  int layer_indices_size;
+
+  char name[128];
+} GPLayerGroup;
 
+typedef struct GPLayer {
+  char name[128];
+  int flag;
+} GPLayer;
+
+typedef struct GPData {
   CurvesGeometry *frames;
   int frames_size;
   CustomData frame_data;
+  int active_frame_index;
+
+  GPLayer *layers;
+  int layers_size;
+  CustomData layer_data;
+  int active_layer_index;
+
+  GPLayerGroup default_group;
+
+  GPDataRuntimeHandle *runtime;
+} GPData;
+
+typedef struct GreasePencil {
+  ID id;
+  /* Animation data (must be immediately after id). */
+  struct AnimData *adt;
+
+  /**/
+  GPData grease_pencil_data;
 
+  int flag;
 
   /** Materials array. */
   struct Material **mat;
   /** Total materials. */
   short totcol;
-};
 
-namespace tests {
+  /* ... */
+} GreasePencil;
+
+}  // namespace blender::dna::gpencil
+
+namespace blender::bke::gpencil::tests {
 
-TEST(gpencil_proposal, Foo) {
+TEST(gpencil_proposal, Foo)
+{
   using namespace blender::bke::gpencil;
   GPencilFrame my_frame;
   float3 min, max;
   EXPECT_FALSE(my_frame.bounds_min_max(min, max));
 }
 
-} // namespace tests
-} // namespace blender::bke::gpencil
\ No newline at end of file
+}  // namespace blender::bke::gpencil::tests
\ No newline at end of file



More information about the Bf-blender-cvs mailing list