[Bf-blender-cvs] [e4c4e8566fd] blender2.8: Multi Object Smooth shading by Ethan Brierley

Dalai Felinto noreply at git.blender.org
Mon May 7 21:31:06 CEST 2018


Commit: e4c4e8566fdcf4b9c81a09d9559d358a9550d015
Author: Dalai Felinto
Date:   Mon May 7 21:30:29 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBe4c4e8566fdcf4b9c81a09d9559d358a9550d015

Multi Object Smooth shading by Ethan Brierley

With small changes by Dalai Felinto.

Differential Revision: https://developer.blender.org/D3213

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

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 90bd6bed47e..bb54cd21244 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -2240,12 +2240,21 @@ static void mesh_set_smooth_faces(BMEditMesh *em, short smooth)
 
 static int edbm_faces_shade_smooth_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Object *obedit = CTX_data_edit_object(C);
-	BMEditMesh *em = BKE_editmesh_from_object(obedit);
+	ViewLayer * view_layer = CTX_data_view_layer(C);
+	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++) {
+		Object * obedit = objects[ob_index];
+		BMEditMesh * em = BKE_editmesh_from_object(obedit);
 
-	mesh_set_smooth_faces(em, 1);
+		if (em->bm->totfacesel == 0) {
+			continue;
+		}
 
-	EDBM_update_generic(em, false, false);
+		mesh_set_smooth_faces(em, 1);
+		EDBM_update_generic(em, false, false);
+	}
+	MEM_freeN(objects);
 
 	return OPERATOR_FINISHED;
 }



More information about the Bf-blender-cvs mailing list