Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonioya <blendergit@gmail.com>2019-04-05 12:26:04 +0300
committerAntonioya <blendergit@gmail.com>2019-04-05 12:26:04 +0300
commitd40581a71492c9d488dd68bb7fbd004881f9113d (patch)
tree2e6039576a2e6f7a2d2e16b023d05701b6e7da3e /source/blender/draw
parentb2e2db94bdae25b4505df563ae9e56a37d89cb7a (diff)
GPencil: Improve drawing feeling in big files
When drawing in big files, the first points of the stroke were not smooth because the system was doing a copy of the depsgraph datablock. Now, the depsgraph is not updated at the beginning and the feeling is far better, especially for big files. To avoid the copy, the original datablock is used while drawing, because it's faster the lookup of the original data, than a full datablock copy. Also some cleanup of the code.
Diffstat (limited to 'source/blender/draw')
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_engine.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 1cc493dd8f5..3a74e44836d 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -617,9 +617,20 @@ void GPENCIL_cache_populate(void *vedata, Object *ob)
}
/* draw current painting strokes
- * (only if region is equal to originated paint region) */
+ * (only if region is equal to originated paint region)
+ *
+ * Need to use original data because to use the copy of data, the paint
+ * operator must update depsgraph and this makes that first events of the
+ * mouse are missed if the datablock is very big due the time required to
+ * copy the datablock. The search of the original data is faster than a
+ * full datablock copy.
+ * Using the original data doesn't require a copy and the feel when drawing
+ * is far better.
+ */
+
+ bGPdata *gpd_orig = (bGPdata *)DEG_get_original_id(&gpd->id);
if ((draw_ctx->obact == ob) &&
- ((gpd->runtime.ar == NULL) || (gpd->runtime.ar == draw_ctx->ar)))
+ ((gpd_orig->runtime.ar == NULL) || (gpd_orig->runtime.ar == draw_ctx->ar)))
{
DRW_gpencil_populate_buffer_strokes(&e_data, vedata, ts, ob);
}