[Bf-blender-cvs] [5c184c4fecc] blender2.8: Fix T56984: GP: Materials: Isolate (lock/visibility) buttons don't work.
Antonioya
noreply at git.blender.org
Sun Sep 30 17:36:17 CEST 2018
Commit: 5c184c4fecc4b0142727b160cbb5da0fc945e011
Author: Antonioya
Date: Sun Sep 30 17:35:41 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB5c184c4fecc4b0142727b160cbb5da0fc945e011
Fix T56984: GP: Materials: Isolate (lock/visibility) buttons don't work.
===================================================================
M source/blender/editors/gpencil/gpencil_data.c
===================================================================
diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c
index 99f5967274a..d2ad38fed3a 100644
--- a/source/blender/editors/gpencil/gpencil_data.c
+++ b/source/blender/editors/gpencil/gpencil_data.c
@@ -1465,6 +1465,7 @@ static int gp_stroke_lock_color_exec(bContext *C, wmOperator *UNUSED(op))
for (short i = 0; i < *totcol; i++) {
Material *tmp_ma = give_current_material(ob, i + 1);
tmp_ma->gp_style->flag |= GP_STYLE_COLOR_LOCKED;
+ DEG_id_tag_update(&tmp_ma->id, DEG_TAG_COPY_ON_WRITE);
}
/* loop all selected strokes and unlock any color */
@@ -1482,10 +1483,17 @@ static int gp_stroke_lock_color_exec(bContext *C, wmOperator *UNUSED(op))
Material *tmp_ma = give_current_material(ob, gps->mat_nr + 1);
tmp_ma->gp_style->flag &= ~GP_STYLE_COLOR_LOCKED;
+ DEG_id_tag_update(&tmp_ma->id, DEG_TAG_COPY_ON_WRITE);
}
}
}
}
+ /* updates */
+ DEG_id_tag_update(&gpd->id, OB_RECALC_DATA);
+
+ /* copy on write tag is needed, or else no refresh happens */
+ DEG_id_tag_update(&gpd->id, DEG_TAG_COPY_ON_WRITE);
+
/* notifiers */
DEG_id_tag_update(&gpd->id, OB_RECALC_OB | OB_RECALC_DATA);
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
@@ -2274,6 +2282,7 @@ static int gpencil_lock_layer_exec(bContext *C, wmOperator *UNUSED(op))
gp_style = ma->gp_style;
gp_style->flag |= GP_STYLE_COLOR_LOCKED;
gp_style->flag |= GP_STYLE_COLOR_HIDE;
+ DEG_id_tag_update(&ma->id, DEG_TAG_COPY_ON_WRITE);
}
/* loop all selected strokes and unlock any color used in active layer */
@@ -2285,7 +2294,10 @@ static int gpencil_lock_layer_exec(bContext *C, wmOperator *UNUSED(op))
if (ED_gpencil_stroke_can_use(C, gps) == false)
continue;
- gp_style = BKE_material_gpencil_settings_get(ob, gps->mat_nr + 1);
+ ma = give_current_material(ob, gps->mat_nr + 1);
+ DEG_id_tag_update(&ma->id, DEG_TAG_COPY_ON_WRITE);
+
+ gp_style = ma->gp_style;
/* unlock/unhide color if not unlocked before */
if (gp_style != NULL) {
gp_style->flag &= ~GP_STYLE_COLOR_LOCKED;
@@ -2294,6 +2306,12 @@ static int gpencil_lock_layer_exec(bContext *C, wmOperator *UNUSED(op))
}
}
}
+ /* updates */
+ DEG_id_tag_update(&gpd->id, OB_RECALC_DATA);
+
+ /* copy on write tag is needed, or else no refresh happens */
+ DEG_id_tag_update(&gpd->id, DEG_TAG_COPY_ON_WRITE);
+
/* notifiers */
DEG_id_tag_update(&gpd->id, OB_RECALC_OB | OB_RECALC_DATA);
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
@@ -2363,6 +2381,7 @@ static int gpencil_color_isolate_exec(bContext *C, wmOperator *op)
continue;
else
gp_style->flag |= flags;
+ DEG_id_tag_update(&ma->id, DEG_TAG_COPY_ON_WRITE);
}
}
else {
@@ -2371,11 +2390,16 @@ static int gpencil_color_isolate_exec(bContext *C, wmOperator *op)
ma = give_current_material(ob, i + 1);
gp_style = ma->gp_style;
gp_style->flag &= ~flags;
+ DEG_id_tag_update(&ma->id, DEG_TAG_COPY_ON_WRITE);
}
}
/* notifiers */
DEG_id_tag_update(&gpd->id, OB_RECALC_DATA);
+
+ /* copy on write tag is needed, or else no refresh happens */
+ DEG_id_tag_update(&gpd->id, DEG_TAG_COPY_ON_WRITE);
+
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
return OPERATOR_FINISHED;
@@ -2405,6 +2429,7 @@ void GPENCIL_OT_color_isolate(wmOperatorType *ot)
static int gpencil_color_hide_exec(bContext *C, wmOperator *op)
{
Object *ob = CTX_data_active_object(C);
+ bGPdata *gpd = (bGPdata *)ob->data;
MaterialGPencilStyle *active_color = BKE_material_gpencil_settings_get(ob, ob->actcol);
bool unselected = RNA_boolean_get(op->ptr, "unselected");
@@ -2422,6 +2447,7 @@ static int gpencil_color_hide_exec(bContext *C, wmOperator *op)
color = ma->gp_style;
if (active_color != color) {
color->flag |= GP_STYLE_COLOR_HIDE;
+ DEG_id_tag_update(&ma->id, DEG_TAG_COPY_ON_WRITE);
}
}
}
@@ -2430,6 +2456,12 @@ static int gpencil_color_hide_exec(bContext *C, wmOperator *op)
active_color->flag |= GP_STYLE_COLOR_HIDE;
}
+ /* updates */
+ DEG_id_tag_update(&gpd->id, OB_RECALC_OB | OB_RECALC_DATA);
+
+ /* copy on write tag is needed, or else no refresh happens */
+ DEG_id_tag_update(&gpd->id, DEG_TAG_COPY_ON_WRITE);
+
/* notifiers */
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
@@ -2459,6 +2491,7 @@ void GPENCIL_OT_color_hide(wmOperatorType *ot)
static int gpencil_color_reveal_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob = CTX_data_active_object(C);
+ bGPdata *gpd = (bGPdata *)ob->data;
Material *ma = NULL;
short *totcol = give_totcolp(ob);
@@ -2472,8 +2505,15 @@ static int gpencil_color_reveal_exec(bContext *C, wmOperator *UNUSED(op))
ma = give_current_material(ob, i + 1);
gp_style = ma->gp_style;
gp_style->flag &= ~GP_STYLE_COLOR_HIDE;
+ DEG_id_tag_update(&ma->id, DEG_TAG_COPY_ON_WRITE);
}
+ /* updates */
+ DEG_id_tag_update(&gpd->id, OB_RECALC_DATA);
+
+ /* copy on write tag is needed, or else no refresh happens */
+ DEG_id_tag_update(&gpd->id, DEG_TAG_COPY_ON_WRITE);
+
/* notifiers */
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
@@ -2501,6 +2541,7 @@ static int gpencil_color_lock_all_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob = CTX_data_active_object(C);
+ bGPdata *gpd = (bGPdata *)ob->data;
Material *ma = NULL;
short *totcol = give_totcolp(ob);
@@ -2514,8 +2555,15 @@ static int gpencil_color_lock_all_exec(bContext *C, wmOperator *UNUSED(op))
ma = give_current_material(ob, i + 1);
gp_style = ma->gp_style;
gp_style->flag |= GP_STYLE_COLOR_LOCKED;
+ DEG_id_tag_update(&ma->id, DEG_TAG_COPY_ON_WRITE);
}
+ /* updates */
+ DEG_id_tag_update(&gpd->id, OB_RECALC_DATA);
+
+ /* copy on write tag is needed, or else no refresh happens */
+ DEG_id_tag_update(&gpd->id, DEG_TAG_COPY_ON_WRITE);
+
/* notifiers */
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
@@ -2542,6 +2590,7 @@ void GPENCIL_OT_color_lock_all(wmOperatorType *ot)
static int gpencil_color_unlock_all_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob = CTX_data_active_object(C);
+ bGPdata *gpd = (bGPdata *)ob->data;
Material *ma = NULL;
short *totcol = give_totcolp(ob);
@@ -2555,8 +2604,15 @@ static int gpencil_color_unlock_all_exec(bContext *C, wmOperator *UNUSED(op))
ma = give_current_material(ob, i + 1);
gp_style = ma->gp_style;
gp_style->flag &= ~GP_STYLE_COLOR_LOCKED;
+ DEG_id_tag_update(&ma->id, DEG_TAG_COPY_ON_WRITE);
}
+ /* updates */
+ DEG_id_tag_update(&gpd->id, OB_RECALC_DATA);
+
+ /* copy on write tag is needed, or else no refresh happens */
+ DEG_id_tag_update(&gpd->id, DEG_TAG_COPY_ON_WRITE);
+
/* notifiers */
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
More information about the Bf-blender-cvs
mailing list