From 7f351d3b96356ca6cd57ecc4dec021ad2989f58d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 21 Sep 2012 21:43:56 +0000 Subject: [PATCH] add back clear skin operator, removed with sticky by mistake. --- source/blender/editors/mesh/mesh_data.c | 36 +++++++++++++++++++++++ source/blender/editors/mesh/mesh_intern.h | 1 + source/blender/editors/mesh/mesh_ops.c | 1 + 3 files changed, 38 insertions(+) diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index 7f45d3abcbc..60df657a436 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -810,6 +810,42 @@ void MESH_OT_customdata_clear_mask(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } +/* Clear Skin */ +static int mesh_customdata_clear_skin_poll(bContext *C) +{ + Object *ob = ED_object_context(C); + + if (ob && ob->type == OB_MESH) { + Mesh *me = ob->data; + if (me->id.lib == NULL) { + CustomData *data = GET_CD_DATA(me, vdata); + if (CustomData_has_layer(data, CD_MVERT_SKIN)) { + return TRUE; + } + } + } + return FALSE; +} +static int mesh_customdata_clear_skin_exec(bContext *C, wmOperator *UNUSED(op)) +{ + return mesh_customdata_clear_exec__internal(C, BM_VERT, CD_MVERT_SKIN); +} + +void MESH_OT_customdata_clear_skin(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Clear Skin Data"; + ot->idname = "MESH_OT_customdata_clear_skin"; + ot->description = "Clear vertex skin layer"; + + /* api callbacks */ + ot->exec = mesh_customdata_clear_skin_exec; + ot->poll = mesh_customdata_clear_skin_poll; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; +} + /************************** Add Geometry Layers *************************/ void ED_mesh_update(Mesh *mesh, bContext *C, int calc_edges, int calc_tessface) diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h index 786910dc938..de594b87e2c 100644 --- a/source/blender/editors/mesh/mesh_intern.h +++ b/source/blender/editors/mesh/mesh_intern.h @@ -189,6 +189,7 @@ void MESH_OT_vertex_color_add(struct wmOperatorType *ot); void MESH_OT_vertex_color_remove(struct wmOperatorType *ot); /* no create_mask yet */ void MESH_OT_customdata_clear_mask(struct wmOperatorType *ot); +void MESH_OT_customdata_clear_skin(struct wmOperatorType *ot); void MESH_OT_drop_named_image(struct wmOperatorType *ot); diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c index 3c92df3dc8e..3ac8719f304 100644 --- a/source/blender/editors/mesh/mesh_ops.c +++ b/source/blender/editors/mesh/mesh_ops.c @@ -143,6 +143,7 @@ void ED_operatortypes_mesh(void) WM_operatortype_append(MESH_OT_vertex_color_add); WM_operatortype_append(MESH_OT_vertex_color_remove); WM_operatortype_append(MESH_OT_customdata_clear_mask); + WM_operatortype_append(MESH_OT_customdata_clear_skin); WM_operatortype_append(MESH_OT_drop_named_image); WM_operatortype_append(MESH_OT_edgering_select);