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/editors/gpencil/gpencil_paint.c
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/editors/gpencil/gpencil_paint.c')
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index b66956b090d..d544bd8f9b6 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1708,6 +1708,9 @@ static void gp_session_validatebuffer(tGPsdata *p)
/* reset flags */
gpd->runtime.sbuffer_sflag = 0;
+ /* reset region */
+ gpd->runtime.ar = NULL;
+
/* reset inittime */
p->inittime = 0.0;
@@ -1784,11 +1787,12 @@ static void gp_init_drawing_brush(bContext *C, tGPsdata *p)
ToolSettings *ts = CTX_data_tool_settings(C);
Paint *paint = &ts->gp_paint->paint;
-
+ bool changed = false;
/* if not exist, create a new one */
if (paint->brush == NULL) {
/* create new brushes */
BKE_brush_gpencil_presets(C);
+ changed = true;
}
/* be sure curves are initializated */
curvemapping_initialize(paint->brush->gpencil_settings->curve_sensitivity);
@@ -1813,7 +1817,9 @@ static void gp_init_drawing_brush(bContext *C, tGPsdata *p)
* Maybe this update can be removed when the new tool system
* will be in place, but while, we need this to keep drawing working.
*/
- DEG_id_tag_update(&scene->id, ID_RECALC_COPY_ON_WRITE);
+ if (changed) {
+ DEG_id_tag_update(&scene->id, ID_RECALC_COPY_ON_WRITE);
+ }
}
@@ -1946,13 +1952,6 @@ static bool gp_session_initdata(bContext *C, wmOperator *op, tGPsdata *p)
p->gpd = *gpd_ptr;
}
- if (ED_gpencil_session_active() == 0) {
- /* initialize undo stack,
- * also, existing undo stack would make buffer drawn
- */
- gpencil_undo_init(p->gpd);
- }
-
/* clear out buffer (stored in gp-data), in case something contaminated it */
gp_session_validatebuffer(p);
@@ -1961,6 +1960,9 @@ static bool gp_session_initdata(bContext *C, wmOperator *op, tGPsdata *p)
/* setup active color */
if (curarea->spacetype == SPACE_VIEW3D) {
+ /* region where paint was originated */
+ p->gpd->runtime.ar = CTX_wm_region(C);
+
/* NOTE: This is only done for 3D view, as Materials aren't used for
* annotations in 2D editors
*/
@@ -1984,9 +1986,6 @@ static bool gp_session_initdata(bContext *C, wmOperator *op, tGPsdata *p)
p->lock_axis = 0;
}
- /* region where paint was originated */
- p->gpd->runtime.ar = CTX_wm_region(C);
-
return 1;
}
@@ -2134,8 +2133,6 @@ static void gp_paint_initstroke(tGPsdata *p, eGPencil_PaintModes paintmode, Deps
add_frame_mode = GP_GETFRAME_ADD_NEW;
p->gpf = BKE_gpencil_layer_getframe(p->gpl, cfra_eval, add_frame_mode);
- /* set as dirty draw manager cache */
- gp_update_cache(p->gpd);
if (p->gpf == NULL) {
p->status = GP_STATUS_ERROR;