[Bf-blender-cvs] [53ae9b10342] blender2.8: MESH_OT_blend_from_shape: Add error when no selected vertex

Dalai Felinto noreply at git.blender.org
Fri Aug 31 20:24:08 CEST 2018


Commit: 53ae9b10342e16a0a8767180f701af426e6922f7
Author: Dalai Felinto
Date:   Fri Aug 31 15:22:54 2018 -0300
Branches: blender2.8
https://developer.blender.org/rB53ae9b10342e16a0a8767180f701af426e6922f7

MESH_OT_blend_from_shape: Add error when no selected vertex

This is just something simple I caught while testing the patch for multi-object.

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

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

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

diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 9808f9f4a82..2de781e08e0 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -3152,6 +3152,7 @@ static int edbm_blend_from_shape_exec(bContext *C, wmOperator *op)
 		kb_ref = BLI_findlink(&key_ref->block, shape_ref);
 	}
 
+	int tot_selected_verts_objects = 0;
 	uint objects_len = 0;
 	Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, &objects_len);
 	for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
@@ -3165,6 +3166,7 @@ static int edbm_blend_from_shape_exec(bContext *C, wmOperator *op)
 		if (em->bm->totvertsel == 0) {
 			continue;
 		}
+		tot_selected_verts_objects++;
 
 		if (!key) {
 			continue;
@@ -3202,6 +3204,12 @@ static int edbm_blend_from_shape_exec(bContext *C, wmOperator *op)
 		}
 	}
 	MEM_freeN(objects);
+
+	if (tot_selected_verts_objects == 0) {
+		BKE_report(op->reports, RPT_ERROR, "No selected vertex");
+		return OPERATOR_CANCELLED;
+	}
+
 	return OPERATOR_FINISHED;
 }



More information about the Bf-blender-cvs mailing list