Commit: 9a0e1950eae744bde5f00d4799be5448bf14122b Author: Sergey Sharybin Date: Tue Mar 29 11:25:13 2022 +0200 Branches: master https://developer.blender.org/rB9a0e1950eae744bde5f00d4799be5448bf14122b
Cover DNA_gpencil_types.h with C++ structure methods Ref T96847 Maniphest Tasks: T96847 Differential Revision: https://developer.blender.org/D14487 =================================================================== M source/blender/blenkernel/intern/gpencil_geom.cc M source/blender/makesdna/DNA_gpencil_types.h =================================================================== diff --git a/source/blender/blenkernel/intern/gpencil_geom.cc b/source/blender/blenkernel/intern/gpencil_geom.cc index a0b6ab2d654..6130d71e030 100644 --- a/source/blender/blenkernel/intern/gpencil_geom.cc +++ b/source/blender/blenkernel/intern/gpencil_geom.cc @@ -1302,7 +1302,7 @@ void BKE_gpencil_stroke_smooth(bGPDstroke *gps, } /* Make a copy of the point data to avoid directionality of the smooth operation. */ - bGPDstroke gps_old = *gps; + bGPDstroke gps_old = blender::dna::shallow_copy(*gps); gps_old.points = (bGPDspoint *)MEM_dupallocN(gps->points); /* Smooth stroke. */ @@ -1930,7 +1930,7 @@ void BKE_gpencil_dissolve_points(bGPdata *gpd, bGPDframe *gpf, bGPDstroke *gps, (gps->dvert != nullptr) ? dvert = gps->dvert : nullptr; for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) { if ((pt->flag & tag) == 0) { - *npt = *pt; + *npt = blender::dna::shallow_copy(*pt); npt++; if (gps->dvert != nullptr) { @@ -3471,13 +3471,13 @@ void BKE_gpencil_stroke_join(bGPDstroke *gps_a, /* don't visibly link the first and last points? */ if (leave_gaps) { /* 1st: add one tail point to start invisible area */ - point = gps_a->points[gps_a->totpoints - 1]; + point = blender::dna::shallow_copy(gps_a->points[gps_a->totpoints - 1]); deltatime = point.time; gpencil_stroke_copy_point(gps_a, nullptr, &point, delta, 0.0f, 0.0f, 0.0f); /* 2nd: add one head point to finish invisible area */ - point = gps_b->points[0]; + point = blender::dna::shallow_copy(gps_b->points[0]); gpencil_stroke_copy_point(gps_a, nullptr, &point, delta, 0.0f, 0.0f, deltatime); } diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h index 8a30a7e8c99..4a1b639122a 100644 --- a/source/blender/makesdna/DNA_gpencil_types.h +++ b/source/blender/makesdna/DNA_gpencil_types.h @@ -48,6 +48,8 @@ typedef struct bGPDcontrolpoint { } bGPDcontrolpoint; typedef struct bGPDspoint_Runtime { + DNA_DEFINE_CXX_METHODS(bGPDspoint_Runtime) + /** Original point (used to dereference evaluated data) */ struct bGPDspoint *pt_orig; /** Original index array position */ @@ -61,6 +63,8 @@ typedef struct bGPDspoint_Runtime { * This assumes that the bottom-left corner is (0,0) */ typedef struct bGPDspoint { + DNA_DEFINE_CXX_METHODS(bGPDspoint) + /** Co-ordinates of point (usually 2d, but can be 3d as well). */ float x, y, z; /** Pressure of input device (from 0 to 1) at this point. */ @@ -120,6 +124,8 @@ typedef struct bGPDtriangle { /* color of palettes */ typedef struct bGPDpalettecolor { + DNA_DEFINE_CXX_METHODS(bGPDpalettecolor) + struct bGPDpalettecolor *next, *prev; /** Color name. Must be unique. */ char info[64]; @@ -148,6 +154,8 @@ typedef enum eGPDpalettecolor_Flag { /* palette of colors */ typedef struct bGPDpalette { + DNA_DEFINE_CXX_METHODS(bGPDpalette) + struct bGPDpalette *next, *prev; /** Pointer to individual colors. */ @@ -203,6 +211,8 @@ typedef enum eGPDcurve_point_Flag { /* Curve for Bezier Editing. */ typedef struct bGPDcurve { + DNA_DEFINE_CXX_METHODS(bGPDcurve) + /** Array of BezTriple. */ bGPDcurve_point *curve_points; /** Total number of curve points. */ @@ -225,6 +235,8 @@ typedef enum bGPDcurve_Flag { /* Runtime temp data for bGPDstroke */ typedef struct bGPDstroke_Runtime { + DNA_DEFINE_CXX_METHODS(bGPDstroke_Runtime) + /** temporary layer name only used during copy/paste to put the stroke in the original layer */ char tmp_layerinfo[128]; @@ -248,6 +260,8 @@ typedef struct bGPDstroke_Runtime { * drawn by the user in one 'mouse-down'->'mouse-up' operation */ typedef struct bGPDstroke { + DNA_DEFINE_CXX_METHODS(bGPDstroke) + struct bGPDstroke *next, *prev; /** Array of data-points for stroke. */ @@ -369,6 +383,8 @@ typedef enum eGPDstroke_Arrowstyle { /* Runtime temp data for bGPDframe */ typedef struct bGPDframe_Runtime { + DNA_DEFINE_CXX_METHODS(bGPDframe_Runtime) + /** Index of this frame in the listbase of frames. */ int frameid; /** Onion offset from active frame. 0 if not onion. INT_MAX to bypass frame. */ @@ -382,6 +398,8 @@ typedef struct bGPDframe_Runtime { * -> Acts as storage for the 'image' formed by strokes */ typedef struct bGPDframe { + DNA_DEFINE_CXX_METHODS(bGPDframe) + struct bGPDframe *next, *prev; /** List of the simplified 'strokes' that make up the frame's data. */ @@ -416,6 +434,8 @@ typedef enum eGPDframe_Flag { /* List of masking layers. */ typedef struct bGPDlayer_Mask { + DNA_DEFINE_CXX_METHODS(bGPDlayer_Mask) + struct bGPDlayer_Mask *next, *prev; char name[128]; short flag; @@ -434,6 +454,8 @@ typedef enum ebGPDlayer_Mask_Flag { /* Runtime temp data for bGPDlayer */ typedef struct bGPDlayer_Runtime { + DNA_DEFINE_CXX_METHODS(bGPDlayer_Runtime) + /** Id for dynamic icon used to show annotation color preview for layer. */ int icon_id; char _pad[4]; @@ -443,6 +465,8 @@ typedef struct bGPDlayer_Runtime { /* Grease-Pencil Annotations - 'Layer' */ typedef struct bGPDlayer { + DNA_DEFINE_CXX_METHODS(bGPDlayer) + struct bGPDlayer *next, *prev; /** List of annotations to display for frames (bGPDframe list). */ @@ -580,6 +604,8 @@ typedef enum eGPLayerBlendModes { /* Runtime temp data for bGPdata */ typedef struct bGPdata_Runtime { + DNA_DEFINE_CXX_METHODS(bGPdata_Runtime) + /** Stroke buffer. */ void *sbuffer; /** Temp batches cleared after drawing. */ @@ -642,6 +668,8 @@ typedef struct bGPgrid { /* Grease-Pencil Annotations - 'DataBlock' */ typedef struct bGPdata { + DNA_DEFINE_CXX_METHODS(bGPdata) + /** Grease Pencil data is a data-block. */ ID id; /** Animation data - for animating draw settings. */ _______________________________________________ Bf-blender-cvs mailing list [email protected] List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
