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:
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c13
-rw-r--r--source/blender/editors/gpencil/gpencil_sculpt_paint.c17
2 files changed, 26 insertions, 4 deletions
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 79dda480a0a..082deab823b 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -56,6 +56,7 @@
#include "BKE_gpencil.h"
#include "BKE_gpencil_curve.h"
#include "BKE_gpencil_geom.h"
+#include "BKE_gpencil_update_cache.h"
#include "BKE_layer.h"
#include "BKE_main.h"
#include "BKE_material.h"
@@ -1341,6 +1342,7 @@ static void gpencil_stroke_newfrombuffer(tGPsdata *p)
}
gpencil_update_cache(p->gpd);
+ BKE_gpencil_tag_full_update(p->gpd, gpl, p->gpf, NULL);
}
/* --- 'Eraser' for 'Paint' Tool ------ */
@@ -2108,6 +2110,9 @@ static void gpencil_session_cleanup(tGPsdata *p)
gpd->runtime.sbuffer_used = 0;
gpd->runtime.sbuffer_size = 0;
gpd->runtime.sbuffer_sflag = 0;
+ /* This update is required for update-on-write because the sbuffer data is not longer overwritten
+ * by a copy-on-write. */
+ ED_gpencil_sbuffer_update_eval(gpd, p->ob_eval);
p->inittime = 0.0;
}
@@ -2136,6 +2141,7 @@ static void gpencil_paint_initstroke(tGPsdata *p,
p->gpl = BKE_gpencil_layer_active_get(p->gpd);
if (p->gpl == NULL) {
p->gpl = BKE_gpencil_layer_addnew(p->gpd, DATA_("GP_Layer"), true, false);
+ BKE_gpencil_tag_full_update(p->gpd, NULL, NULL, NULL);
changed = true;
if (p->custom_color[3]) {
copy_v3_v3(p->gpl->color, p->custom_color);
@@ -2218,10 +2224,15 @@ static void gpencil_paint_initstroke(tGPsdata *p,
}
bool need_tag = p->gpl->actframe == NULL;
+ bGPDframe *actframe = p->gpl->actframe;
+
p->gpf = BKE_gpencil_layer_frame_get(p->gpl, CFRA, add_frame_mode);
/* Only if there wasn't an active frame, need update. */
if (need_tag) {
- DEG_id_tag_update(&p->gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
+ DEG_id_tag_update(&p->gpd->id, ID_RECALC_GEOMETRY);
+ }
+ if (actframe != p->gpl->actframe) {
+ BKE_gpencil_tag_full_update(p->gpd, p->gpl, NULL, NULL);
}
if (p->gpf == NULL) {
diff --git a/source/blender/editors/gpencil/gpencil_sculpt_paint.c b/source/blender/editors/gpencil/gpencil_sculpt_paint.c
index 0cd4efb10d6..66b7f260f28 100644
--- a/source/blender/editors/gpencil/gpencil_sculpt_paint.c
+++ b/source/blender/editors/gpencil/gpencil_sculpt_paint.c
@@ -56,6 +56,7 @@
#include "BKE_gpencil.h"
#include "BKE_gpencil_geom.h"
#include "BKE_gpencil_modifier.h"
+#include "BKE_gpencil_update_cache.h"
#include "BKE_main.h"
#include "BKE_material.h"
#include "BKE_object_deform.h"
@@ -297,6 +298,8 @@ static void gpencil_update_geometry(bGPdata *gpd)
return;
}
+ bool changed = false;
+
LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) {
if ((gpl->actframe != gpf) && ((gpf->flag & GP_FRAME_SELECT) == 0)) {
@@ -306,13 +309,17 @@ static void gpencil_update_geometry(bGPdata *gpd)
LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) {
if (gps->flag & GP_STROKE_TAG) {
BKE_gpencil_stroke_geometry_update(gpd, gps);
+ BKE_gpencil_tag_full_update(gpd, gpl, gpf, gps);
gps->flag &= ~GP_STROKE_TAG;
+ changed = true;
}
}
}
}
- DEG_id_tag_update(&gpd->id, ID_RECALC_GEOMETRY | ID_RECALC_COPY_ON_WRITE);
- WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
+ if (changed) {
+ DEG_id_tag_update(&gpd->id, ID_RECALC_GEOMETRY);
+ WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
+ }
}
/* ************************************************ */
@@ -1351,8 +1358,9 @@ static void gpencil_sculpt_brush_init_stroke(bContext *C, tGP_BrushEditData *gso
*/
if (IS_AUTOKEY_ON(scene) && (gpf->framenum != cfra)) {
BKE_gpencil_frame_addcopy(gpl, cfra);
+ BKE_gpencil_tag_full_update(gpd, gpl, NULL, NULL);
/* Need tag to recalculate evaluated data to avoid crashes. */
- DEG_id_tag_update(&gso->gpd->id, ID_RECALC_GEOMETRY | ID_RECALC_COPY_ON_WRITE);
+ DEG_id_tag_update(&gso->gpd->id, ID_RECALC_GEOMETRY);
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
}
}
@@ -1696,6 +1704,9 @@ static bool gpencil_sculpt_brush_do_frame(bContext *C,
/* Delay a full recalculation for other frames. */
gpencil_recalc_geometry_tag(gps_active);
}
+ bGPDlayer *gpl_active = (gpl->runtime.gpl_orig) ? gpl->runtime.gpl_orig : gpl;
+ bGPDframe *gpf_active = (gpf->runtime.gpf_orig) ? gpf->runtime.gpf_orig : gpf;
+ BKE_gpencil_tag_full_update(gpd, gpl_active, gpf_active, gps_active);
}
}