diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2019-09-10 18:47:17 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2019-09-10 18:49:27 +0300 |
commit | 5ba0726bc1a7c7343e9d31e01c15bb3510256bb7 (patch) | |
tree | 1c76fe05b15317eb0e2d5a0c118c389ce291fa71 /source/blender/editors/gpencil | |
parent | 841df2b98e785649a6346d3c6e560a168186eef3 (diff) |
GPencil: Deduplicate function
The same code was duplicated and now it was moved to shared function.
Diffstat (limited to 'source/blender/editors/gpencil')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_utils.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c index d7492b5be4d..3ee7aed0a02 100644 --- a/source/blender/editors/gpencil/gpencil_utils.c +++ b/source/blender/editors/gpencil/gpencil_utils.c @@ -46,6 +46,7 @@ #include "BKE_action.h" #include "BKE_colortools.h" +#include "BKE_collection.h" #include "BKE_deform.h" #include "BKE_main.h" #include "BKE_brush.h" @@ -57,6 +58,7 @@ #include "BKE_tracking.h" #include "WM_api.h" +#include "WM_types.h" #include "WM_toolsystem.h" #include "RNA_access.h" @@ -2559,3 +2561,24 @@ tGPspoint *ED_gpencil_sbuffer_ensure(tGPspoint *buffer_array, return buffer_array; } + +/* Tag all scene grease pencil object to update. */ +void ED_gpencil_tag_scene_gpencil(Scene *scene) +{ + /* mark all grease pencil datablocks of the scene */ + FOREACH_SCENE_COLLECTION_BEGIN (scene, collection) { + FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN (collection, ob) { + if (ob->type == OB_GPENCIL) { + bGPdata *gpd = (bGPdata *)ob->data; + gpd->flag |= GP_DATA_CACHE_IS_DIRTY; + DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY); + } + } + FOREACH_COLLECTION_OBJECT_RECURSIVE_END; + } + FOREACH_SCENE_COLLECTION_END; + + DEG_id_tag_update(&scene->id, ID_RECALC_COPY_ON_WRITE); + + WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL); +} |