[Bf-blender-cvs] [f9b6f57] master: Fix crash clearing skin data on non mesh

Campbell Barton noreply at git.blender.org
Sun May 24 16:20:24 CEST 2015


Commit: f9b6f5756c05d1024f25951f71ebbe68c83296e1
Author: Campbell Barton
Date:   Mon May 25 00:02:35 2015 +1000
Branches: master
https://developer.blender.org/rBf9b6f5756c05d1024f25951f71ebbe68c83296e1

Fix crash clearing skin data on non mesh

===================================================================

M	source/blender/editors/mesh/mesh_data.c

===================================================================

diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c
index f497cd7..b9a9f70 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))




More information about the Bf-blender-cvs mailing list