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>2015-05-24 17:02:35 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-05-24 17:08:43 +0300
commitf9b6f5756c05d1024f25951f71ebbe68c83296e1 (patch)
tree851372cf64ecc456368f272546b184836d42b654 /source/blender/editors
parent0305e9604bcbf30e48f4a7f707c65459dbea6d67 (diff)
Fix crash clearing skin data on non mesh
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/mesh/mesh_data.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c
index f497cd7a1aa..b9a9f708af7 100644
--- a/source/blender/editors/mesh/mesh_data.c
+++ b/source/blender/editors/mesh/mesh_data.c
@@ -803,8 +803,11 @@ void MESH_OT_customdata_mask_clear(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
-/* Clear Skin */
-static bool mesh_customdata_skin_has(bContext *C)
+/**
+ * Clear Skin
+ * \return -1 invalid state, 0 no skin, 1 has skin.
+ */
+static int mesh_customdata_skin_state(bContext *C)
{
Object *ob = ED_object_context(C);
@@ -812,17 +815,15 @@ static bool mesh_customdata_skin_has(bContext *C)
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 CustomData_has_layer(data, CD_MVERT_SKIN);
}
}
- return false;
+ return -1;
}
static int mesh_customdata_skin_add_poll(bContext *C)
{
- return !mesh_customdata_skin_has(C);
+ return (mesh_customdata_skin_state(C) == 0);
}
static int mesh_customdata_skin_add_exec(bContext *C, wmOperator *UNUSED(op))
@@ -855,7 +856,7 @@ void MESH_OT_customdata_skin_add(wmOperatorType *ot)
static int mesh_customdata_skin_clear_poll(bContext *C)
{
- return mesh_customdata_skin_has(C);
+ return (mesh_customdata_skin_state(C) == 1);
}
static int mesh_customdata_skin_clear_exec(bContext *C, wmOperator *UNUSED(op))