From ee4ec69b28047629a1c153af356757a8fac5cee9 Mon Sep 17 00:00:00 2001 From: Antonio Vazquez Date: Fri, 23 Aug 2019 23:10:41 +0200 Subject: Fix T66924 : Move GPencil Modifiers evaluation to Depsgraph Before, the evaluation of modifers were done in draw manager. The reason of the old design was grease pencil was designed before depsgraph was in place. This commit moves this logic to depsgraph to follow general design and reduce Draw Manager complexity. Also, this is required in order to use modifiers in Edit modes. Really, there is nothing really new in the creation of derived data, only the logic has been moved to depsgraph, but the main logic is the same. In order to get a reference to the original stroke and points, a pointer is added to Runtime data as part of the evaluated data. These pointers allow to know and use the original data. As the modifiers now are evaluated in Depsgraph, the evaluated stroke is usable in Edit modes, so now it's possible to work with the evaluated version instead to use a "ghost" of the final image over the original geometry as work today. Reviewed By: brecht Differential Revision: https://developer.blender.org/D5470 --- source/blender/blenkernel/BKE_gpencil.h | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'source/blender/blenkernel/BKE_gpencil.h') diff --git a/source/blender/blenkernel/BKE_gpencil.h b/source/blender/blenkernel/BKE_gpencil.h index 997f1fc82e1..d9c46cdfd10 100644 --- a/source/blender/blenkernel/BKE_gpencil.h +++ b/source/blender/blenkernel/BKE_gpencil.h @@ -24,6 +24,7 @@ * \ingroup bke */ +struct Scene; struct ArrayGpencilModifierData; struct BoundBox; struct Brush; @@ -49,6 +50,23 @@ struct bGPdata; struct MDeformVert; struct MDeformWeight; +#define GPENCIL_SIMPLIFY(scene) ((scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_ENABLE)) +#define GPENCIL_SIMPLIFY_ONPLAY(playing) \ + (((playing == true) && (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_ON_PLAY)) || \ + ((scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_ON_PLAY) == 0)) +#define GPENCIL_SIMPLIFY_FILL(scene, playing) \ + ((GPENCIL_SIMPLIFY_ONPLAY(playing) && (GPENCIL_SIMPLIFY(scene)) && \ + (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_FILL))) +#define GPENCIL_SIMPLIFY_MODIF(scene, playing) \ + ((GPENCIL_SIMPLIFY_ONPLAY(playing) && (GPENCIL_SIMPLIFY(scene)) && \ + (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_MODIFIER))) +#define GPENCIL_SIMPLIFY_FX(scene, playing) \ + ((GPENCIL_SIMPLIFY_ONPLAY(playing) && (GPENCIL_SIMPLIFY(scene)) && \ + (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_FX))) +#define GPENCIL_SIMPLIFY_BLEND(scene, playing) \ + ((GPENCIL_SIMPLIFY_ONPLAY(playing) && (GPENCIL_SIMPLIFY(scene)) && \ + (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_BLEND))) + /* ------------ Grease-Pencil API ------------------ */ void BKE_gpencil_free_point_weights(struct MDeformVert *dvert); @@ -57,7 +75,7 @@ void BKE_gpencil_free_stroke(struct bGPDstroke *gps); bool BKE_gpencil_free_strokes(struct bGPDframe *gpf); void BKE_gpencil_free_frames(struct bGPDlayer *gpl); void BKE_gpencil_free_layers(struct ListBase *list); -bool BKE_gpencil_free_frame_runtime_data(struct bGPDframe *derived_gpf); +bool BKE_gpencil_free_frame_runtime_data(struct bGPDframe *eval_gpf); void BKE_gpencil_free(struct bGPdata *gpd, bool free_all); void BKE_gpencil_batch_cache_dirty_tag(struct bGPdata *gpd); -- cgit v1.2.3