Commit: 7d45ddae33f41578e07970c95bac5f916819e27d
Author: Bastien Montagne
Date:   Wed Apr 16 15:18:14 2014 +0200
https://developer.blender.org/rB7d45ddae33f41578e07970c95bac5f916819e27d

Add Edge sharp/smooth to 3DView shading panel, as well as new Vert sharp/smooth.

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

M       release/scripts/startup/bl_ui/space_view3d.py
M       release/scripts/startup/bl_ui/space_view3d_toolbar.py
M       source/blender/editors/mesh/editmesh_tools.c

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

diff --git a/release/scripts/startup/bl_ui/space_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index 56f612a..52f987b 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -2168,6 +2168,13 @@ class VIEW3D_MT_edit_mesh_vertices(Menu):
 
         layout.separator()
 
+        op = layout.operator("mesh.mark_sharp", text="Shade Smooth")
+        op.use_verts = True
+        op.clear = True
+        layout.operator("mesh.mark_sharp", text="Shade Sharp").use_verts = True
+
+        layout.separator()
+
         layout.operator("mesh.bevel").vertex_only = True
         layout.operator("mesh.convex_hull")
         layout.operator("mesh.vertices_smooth")
@@ -2211,7 +2218,7 @@ class VIEW3D_MT_edit_mesh_edges(Menu):
 
         layout.separator()
 
-        layout.operator("mesh.mark_sharp").clear = False
+        layout.operator("mesh.mark_sharp")
         layout.operator("mesh.mark_sharp", text="Clear Sharp").clear = True
 
         layout.separator()
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py 
b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 4e9dc11..2e130a8 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -385,10 +385,20 @@ class VIEW3D_PT_tools_shading(View3DPanel, Panel):
         layout = self.layout
 
         col = layout.column(align=True)
-        col.label(text="Shading:")
+        col.label(text="Faces:")
         row = col.row(align=True)
         row.operator("mesh.faces_shade_smooth", text="Smooth")
         row.operator("mesh.faces_shade_flat", text="Flat")
+        col.label(text="Edges:")
+        row = col.row(align=True)
+        row.operator("mesh.mark_sharp", text="Smooth").clear = True
+        row.operator("mesh.mark_sharp", text="Sharp")
+        col.label(text="Vertices:")
+        row = col.row(align=True)
+        op = row.operator("mesh.mark_sharp", text="Smooth")
+        op.use_verts = True
+        op.clear = True
+        row.operator("mesh.mark_sharp", text="Sharp").use_verts = True
 
         col = layout.column(align=True)
         col.label(text="Normals:")
diff --git a/source/blender/editors/mesh/editmesh_tools.c 
b/source/blender/editors/mesh/editmesh_tools.c
index e57f637..90e1c91 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -823,27 +823,24 @@ static int edbm_mark_sharp_exec(bContext *C, wmOperator 
*op)
        BMEdge *eed;
        BMIter iter;
        const bool clear = RNA_boolean_get(op->ptr, "clear");
+       const bool use_verts = RNA_boolean_get(op->ptr, "use_verts");
 
        /* auto-enable sharp edge drawing */
        if (clear == 0) {
                me->drawflag |= ME_DRAWSHARP;
        }
 
-       if (!clear) {
-               BM_ITER_MESH (eed, &iter, bm, BM_EDGES_OF_MESH) {
-                       if (!BM_elem_flag_test(eed, BM_ELEM_SELECT) || 
BM_elem_flag_test(eed, BM_ELEM_HIDDEN))
+       BM_ITER_MESH (eed, &iter, bm, BM_EDGES_OF_MESH) {
+               if (use_verts) {
+                       if (!(BM_elem_flag_test(eed->v1, BM_ELEM_SELECT) || 
BM_elem_flag_test(eed->v2, BM_ELEM_SELECT))) {
                                continue;
-                       
-                       BM_elem_flag_disable(eed, BM_ELEM_SMOOTH);
+                       }
                }
-       }
-       else {
-               BM_ITER_MESH (eed, &iter, bm, BM_EDGES_OF_MESH) {
-                       if (!BM_elem_flag_test(eed, BM_ELEM_SELECT) || 
BM_elem_flag_test(eed, BM_ELEM_HIDDEN))
-                               continue;
-                       
-                       BM_elem_flag_enable(eed, BM_ELEM_SMOOTH);
+               else if (!BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
+                       continue;
                }
+
+               BM_elem_flag_set(eed, BM_ELEM_SMOOTH, clear);
        }
 
        EDBM_update_generic(em, true, false);
@@ -867,11 +864,13 @@ void MESH_OT_mark_sharp(wmOperatorType *ot)
        /* flags */
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
        
-       prop = RNA_def_boolean(ot->srna, "clear", 0, "Clear", "");
+       prop = RNA_def_boolean(ot->srna, "clear", false, "Clear", "");
+       RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+       prop = RNA_def_boolean(ot->srna, "use_verts", false, "Vertices",
+                              "Consider vertices instead of edges to select 
which edges to (un)tag as sharp");
        RNA_def_property_flag(prop, PROP_SKIP_SAVE);
 }
 
-
 static int edbm_vert_connect_exec(bContext *C, wmOperator *op)
 {
        Object *obedit = CTX_data_edit_object(C);

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

Reply via email to