diff options
author | Julian Eisel <julian@blender.org> | 2020-07-01 18:13:57 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2020-07-01 18:13:57 +0300 |
commit | 0829cebeb024095c268f190c34daa8ae9a5a224c (patch) | |
tree | 12ee5a4a1c2a32e12eff47c8eb9bb0ed217791c1 /source/blender/blenkernel/intern/gpencil.c | |
parent | cfde6ebf450594faa57c4bfeaecff10fe512c91b (diff) | |
parent | 42be3964eb201180f6b0fa1ff6ce43b8c3845bc2 (diff) |
Merge branch 'master' into asset-uuid--archivedasset-uuid--archived
Diffstat (limited to 'source/blender/blenkernel/intern/gpencil.c')
-rw-r--r-- | source/blender/blenkernel/intern/gpencil.c | 66 |
1 files changed, 41 insertions, 25 deletions
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c index b460e6d6dc0..dece833c00f 100644 --- a/source/blender/blenkernel/intern/gpencil.c +++ b/source/blender/blenkernel/intern/gpencil.c @@ -289,6 +289,16 @@ void BKE_gpencil_eval_delete(bGPdata *gpd_eval) MEM_freeN(gpd_eval); } +/** + * Tag data-block for depsgraph update. + * Wrapper to avoid include Depsgraph tag functions in other modules. + * \param gpd: Grease pencil data-block. + */ +void BKE_gpencil_tag(bGPdata *gpd) +{ + DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY); +} + /* ************************************************** */ /* Container Creation */ @@ -417,7 +427,7 @@ bGPDlayer *BKE_gpencil_layer_addnew(bGPdata *gpd, const char *name, bool setacti gpl_active = BKE_gpencil_layer_active_get(gpd); - /* add to datablock */ + /* Add to data-block. */ if (gpl_active == NULL) { BLI_addtail(&gpd->layers, gpl); } @@ -469,7 +479,9 @@ bGPDlayer *BKE_gpencil_layer_addnew(bGPdata *gpd, const char *name, bool setacti return gpl; } -/* add a new gp-datablock */ +/** + * Add a new grease pencil data-block. + */ bGPdata *BKE_gpencil_data_addnew(Main *bmain, const char name[]) { bGPdata *gpd; @@ -496,7 +508,7 @@ bGPdata *BKE_gpencil_data_addnew(Main *bmain, const char name[]) ARRAY_SET_ITEMS(gpd->grid.scale, 1.0f, 1.0f); /* Scale */ gpd->grid.lines = GP_DEFAULT_GRID_LINES; /* Number of lines */ - /* onion-skinning settings (datablock level) */ + /* Onion-skinning settings (data-block level) */ gpd->onion_flag |= (GP_ONION_GHOST_PREVCOL | GP_ONION_GHOST_NEXTCOL); gpd->onion_flag |= GP_ONION_FADE; gpd->onion_mode = GP_ONION_MODE_RELATIVE; @@ -516,8 +528,8 @@ bGPdata *BKE_gpencil_data_addnew(Main *bmain, const char name[]) /** * Populate stroke with point data from data buffers * - * \param array: Flat array of point data values. Each entry has GP_PRIM_DATABUF_SIZE values - * \param mat: 4x4 transform matrix to transform points into the right coordinate space + * \param array: Flat array of point data values. Each entry has #GP_PRIM_DATABUF_SIZE values. + * \param mat: 4x4 transform matrix to transform points into the right coordinate space. */ void BKE_gpencil_stroke_add_points(bGPDstroke *gps, const float *array, @@ -728,7 +740,9 @@ bGPDlayer *BKE_gpencil_layer_duplicate(const bGPDlayer *gpl_src) return gpl_dst; } -/* Standard API to make a copy of GP datablock, separate from copying its data */ +/** + * Standard API to make a copy of GP data-block, separate from copying its data. + */ bGPdata *BKE_gpencil_copy(Main *bmain, const bGPdata *gpd) { bGPdata *gpd_copy; @@ -736,8 +750,11 @@ bGPdata *BKE_gpencil_copy(Main *bmain, const bGPdata *gpd) return gpd_copy; } -/* make a copy of a given gpencil datablock */ -/* XXX: Should this be deprecated? */ +/** + * Make a copy of a given gpencil data-block. + * + * XXX: Should this be deprecated? + */ bGPdata *BKE_gpencil_data_duplicate(Main *bmain, const bGPdata *gpd_src, bool internal_copy) { bGPdata *gpd_dst; @@ -1319,7 +1336,7 @@ int BKE_gpencil_object_material_ensure(Main *bmain, Object *ob, Material *materi /** * Creates a new gpencil material and assigns it to object. * - * \param *r_index: value is set to zero based index of the new material if r_index is not NULL + * \param *r_index: value is set to zero based index of the new material if \a r_index is not NULL. */ Material *BKE_gpencil_object_material_new(Main *bmain, Object *ob, const char *name, int *r_index) { @@ -1491,9 +1508,9 @@ void BKE_gpencil_dvert_ensure(bGPDstroke *gps) * Get range of selected frames in layer. * Always the active frame is considered as selected, so if no more selected the range * will be equal to the current active frame. - * \param gpl: Layer - * \param r_initframe: Number of first selected frame - * \param r_endframe: Number of last selected frame + * \param gpl: Layer. + * \param r_initframe: Number of first selected frame. + * \param r_endframe: Number of last selected frame. */ void BKE_gpencil_frame_range_selected(bGPDlayer *gpl, int *r_initframe, int *r_endframe) { @@ -1514,11 +1531,11 @@ void BKE_gpencil_frame_range_selected(bGPDlayer *gpl, int *r_initframe, int *r_e /** * Get Falloff factor base on frame range - * \param gpf: Frame - * \param actnum: Number of active frame in layer - * \param f_init: Number of first selected frame - * \param f_end: Number of last selected frame - * \param cur_falloff: Curve with falloff factors + * \param gpf: Frame. + * \param actnum: Number of active frame in layer. + * \param f_init: Number of first selected frame. + * \param f_end: Number of last selected frame. + * \param cur_falloff: Curve with falloff factors. */ float BKE_gpencil_multiframe_falloff_calc( bGPDframe *gpf, int actnum, int f_init, int f_end, CurveMapping *cur_falloff) @@ -1803,7 +1820,7 @@ bool BKE_gpencil_from_image(SpaceImage *sima, bGPDframe *gpf, const float size, ibuf = BKE_image_acquire_ibuf(image, &iuser, &lock); - if (ibuf->rect) { + if (ibuf && ibuf->rect) { int img_x = ibuf->x; int img_y = ibuf->y; @@ -1848,10 +1865,10 @@ bool BKE_gpencil_from_image(SpaceImage *sima, bGPDframe *gpf, const float size, /** * Helper to check if a layers is used as mask - * \param view_layer Actual view layer - * \param gpd Grease pencil datablock - * \param gpl_mask Actual Layer - * \return True if the layer is used as mask + * \param view_layer: Actual view layer. + * \param gpd: Grease pencil data-block. + * \param gpl_mask: Actual Layer. + * \return True if the layer is used as mask. */ static bool gpencil_is_layer_mask(ViewLayer *view_layer, bGPdata *gpd, bGPDlayer *gpl_mask) { @@ -1874,8 +1891,7 @@ static bool gpencil_is_layer_mask(ViewLayer *view_layer, bGPdata *gpd, bGPDlayer /** \name Iterators * * Iterate over all visible stroke of all visible layers inside a gpObject. - * Also take into account onion skining. - * + * Also take into account onion-skinning. * \{ */ void BKE_gpencil_visible_stroke_iter(ViewLayer *view_layer, @@ -2081,7 +2097,7 @@ void BKE_gpencil_update_orig_pointers(const Object *ob_orig, const Object *ob_ev /* Assign pointers to the original stroke and points to the evaluated data. This must * be done before applying any modifier because at this moment the structure is equals, - * so we can assume the layer index is the same in both datablocks. + * so we can assume the layer index is the same in both data-blocks. * This data will be used by operators. */ bGPDlayer *gpl_eval = gpd_eval->layers.first; |