diff options
author | Antonioya <blendergit@gmail.com> | 2018-08-07 17:41:38 +0300 |
---|---|---|
committer | Antonioya <blendergit@gmail.com> | 2018-08-07 17:42:20 +0300 |
commit | 035d827b5b132627d5ea73e3fa237d8fd2185b4f (patch) | |
tree | 2594f724f373bcd95f3997b2bd1733fabdd9ad91 | |
parent | 030297209f2508a704b8851fa5d7d9a6696561b5 (diff) |
Cleanup: Tag only objects of the scene collections
In previous commit the bmain loop updated all GP objects, but must tag only scene collection objects.
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 19 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_sculpt_paint.c | 20 |
2 files changed, 29 insertions, 10 deletions
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index bb87dde06c1..bdb905690f3 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -532,13 +532,22 @@ static const EnumPropertyItem transform_orientation_items[] = { #endif /* Grease Pencil update cache */ -static void rna_GPencil_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) +static void rna_GPencil_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) { - /* mark all grease pencil datablocks */ - for (bGPdata *gpd = bmain->gpencil.first; gpd; gpd = gpd->id.next) { - gpd->flag |= GP_DATA_CACHE_IS_DIRTY; - DEG_id_tag_update(&gpd->id, OB_RECALC_OB | OB_RECALC_DATA); + /* 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, OB_RECALC_OB | OB_RECALC_DATA); + } + } + FOREACH_COLLECTION_OBJECT_RECURSIVE_END; } + FOREACH_SCENE_COLLECTION_END; WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL); } diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index 37a5376f5d5..faa879b54b1 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -107,6 +107,7 @@ const EnumPropertyItem rna_enum_symmetrize_direction_items[] = { #ifdef RNA_RUNTIME #include "MEM_guardedalloc.h" +#include "BKE_collection.h" #include "BKE_context.h" #include "BKE_particle.h" #include "BKE_pbvh.h" @@ -119,13 +120,22 @@ const EnumPropertyItem rna_enum_symmetrize_direction_items[] = { #include "ED_particle.h" -static void rna_GPencil_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) +static void rna_GPencil_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) { - /* mark all grease pencil datablocks */ - for (bGPdata *gpd = bmain->gpencil.first; gpd; gpd = gpd->id.next) { - gpd->flag |= GP_DATA_CACHE_IS_DIRTY; - DEG_id_tag_update(&gpd->id, OB_RECALC_OB | OB_RECALC_DATA); + /* 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, OB_RECALC_OB | OB_RECALC_DATA); + } + } + FOREACH_COLLECTION_OBJECT_RECURSIVE_END; } + FOREACH_SCENE_COLLECTION_END; WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL); } |