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:
authorCampbell Barton <ideasman42@gmail.com>2012-09-24 14:57:44 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-09-24 14:57:44 +0400
commit5a5b37a4fadee5ce2c44b097a50986e0b70ca898 (patch)
treee264a31a0310cac8272fd59947ebef36303b126c
parent953e2321ddc03a5483a2db4b0ef881d32da5aa0e (diff)
deleting mask data wasn't deleting loop data. also return OPERATOR_CANCELLED when nothing was done.
-rw-r--r--source/blender/editors/mesh/mesh_data.c29
1 files changed, 24 insertions, 5 deletions
diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c
index a52c8d47ecd..4637d926a62 100644
--- a/source/blender/editors/mesh/mesh_data.c
+++ b/source/blender/editors/mesh/mesh_data.c
@@ -760,12 +760,17 @@ static int mesh_customdata_clear_exec__internal(bContext *C,
BLI_assert(CustomData_layertype_is_singleton(type) == TRUE);
- CustomData_free_layers(data, type, tot);
+ if (CustomData_has_layer(data, type)) {
+ CustomData_free_layers(data, type, tot);
- DAG_id_tag_update(&me->id, 0);
- WM_event_add_notifier(C, NC_GEOM | ND_DATA, me);
+ DAG_id_tag_update(&me->id, 0);
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, me);
- return OPERATOR_FINISHED;
+ return OPERATOR_FINISHED;
+ }
+ else {
+ return OPERATOR_CANCELLED;
+ }
}
/* Clear Mask */
@@ -785,13 +790,27 @@ static int mesh_customdata_clear_mask_poll(bContext *C)
if (CustomData_has_layer(data, CD_PAINT_MASK)) {
return TRUE;
}
+ data = GET_CD_DATA(me, ldata);
+ if (CustomData_has_layer(data, CD_GRID_PAINT_MASK)) {
+ return TRUE;
+ }
}
}
return FALSE;
}
static int mesh_customdata_clear_mask_exec(bContext *C, wmOperator *UNUSED(op))
{
- return mesh_customdata_clear_exec__internal(C, BM_VERT, CD_PAINT_MASK);
+ int ret_a = mesh_customdata_clear_exec__internal(C, BM_VERT, CD_PAINT_MASK);
+ int ret_b = mesh_customdata_clear_exec__internal(C, BM_LOOP, CD_GRID_PAINT_MASK);
+
+ if (ret_a == OPERATOR_FINISHED ||
+ ret_b == OPERATOR_FINISHED)
+ {
+ return OPERATOR_FINISHED;
+ }
+ else {
+ return OPERATOR_CANCELLED;
+ }
}
void MESH_OT_customdata_clear_mask(wmOperatorType *ot)