Commit: c79c48cc93b53f7fff35822b125915220ca78806
Author: Bastien Montagne
Date:   Sun Dec 28 19:08:30 2014 +0100
Branches: master
https://developer.blender.org/rBc79c48cc93b53f7fff35822b125915220ca78806

Fix T40930: Add a new option to select faces by smooth/flat shading.

Org code by robschia (Roberto Schiavone), first review by campbellbarton 
(Campbell Barton),
final review and minor changes by mont29 (Bastien Montagne).

Reviewers: cambellbarton, mont29

Subscribers: mont29, campbellbarton

Maniphest Tasks: T40930

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

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

M       source/blender/bmesh/intern/bmesh_operators.h
M       source/blender/bmesh/operators/bmo_similar.c
M       source/blender/editors/mesh/editmesh_select.c

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

diff --git a/source/blender/bmesh/intern/bmesh_operators.h 
b/source/blender/bmesh/intern/bmesh_operators.h
index 8557bcd..f39fe29 100644
--- a/source/blender/bmesh/intern/bmesh_operators.h
+++ b/source/blender/bmesh/intern/bmesh_operators.h
@@ -82,6 +82,7 @@ enum {
        SIMFACE_PERIMETER,
        SIMFACE_NORMAL,
        SIMFACE_COPLANAR,
+       SIMFACE_SMOOTH,
 #ifdef WITH_FREESTYLE
        SIMFACE_FREESTYLE
 #endif
diff --git a/source/blender/bmesh/operators/bmo_similar.c 
b/source/blender/bmesh/operators/bmo_similar.c
index 4b5eebb..1405d87 100644
--- a/source/blender/bmesh/operators/bmo_similar.c
+++ b/source/blender/bmesh/operators/bmo_similar.c
@@ -245,6 +245,13 @@ void bmo_similar_faces_exec(BMesh *bm, BMOperator *op)
                                                        cont = false;
                                                }
                                                break;
+
+                                       case SIMFACE_SMOOTH:
+                                               if(BM_elem_flag_test(fm, 
BM_ELEM_SMOOTH) == BM_elem_flag_test(fs, BM_ELEM_SMOOTH)) {
+                                                       
BMO_elem_flag_enable(bm, fm, FACE_MARK);
+                                                       cont = false;
+                                               }
+                                               break;
 #ifdef WITH_FREESTYLE
                                        case SIMFACE_FREESTYLE:
                                                if 
(CustomData_has_layer(&bm->pdata, CD_FREESTYLE_FACE)) {
diff --git a/source/blender/editors/mesh/editmesh_select.c 
b/source/blender/editors/mesh/editmesh_select.c
index 79a47cb..bd17631 100644
--- a/source/blender/editors/mesh/editmesh_select.c
+++ b/source/blender/editors/mesh/editmesh_select.c
@@ -706,6 +706,7 @@ static EnumPropertyItem prop_similar_types[] = {
        {SIMFACE_PERIMETER, "PERIMETER", 0, "Perimeter", ""},
        {SIMFACE_NORMAL, "NORMAL", 0, "Normal", ""},
        {SIMFACE_COPLANAR, "COPLANAR", 0, "Co-planar", ""},
+       {SIMFACE_SMOOTH, "SMOOTH", 0, "Flat/Smooth", ""},
 #ifdef WITH_FREESTYLE
        {SIMFACE_FREESTYLE, "FREESTYLE_FACE", 0, "Freestyle Face Marks", ""},
 #endif
@@ -883,7 +884,7 @@ static EnumPropertyItem *select_similar_type_itemf(bContext 
*C, PointerRNA *UNUS
 #ifdef WITH_FREESTYLE
                        const int a_end = SIMFACE_FREESTYLE;
 #else
-                       const int a_end = SIMFACE_COPLANAR;
+                       const int a_end = SIMFACE_SMOOTH;
 #endif
                        for (a = SIMFACE_MATERIAL; a <= a_end; a++) {
                                RNA_enum_items_add_value(&item, &totitem, 
prop_similar_types, a);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to