diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2014-04-16 17:18:14 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2014-04-16 17:26:48 +0400 |
commit | 7d45ddae33f41578e07970c95bac5f916819e27d (patch) | |
tree | cb95a514c82afb3655c572befcc5fc8e85f93a9f | |
parent | d1b1d194dc9cc741d87dc63e701402de0776c694 (diff) |
Add Edge sharp/smooth to 3DView shading panel, as well as new Vert sharp/smooth.
-rw-r--r-- | release/scripts/startup/bl_ui/space_view3d.py | 9 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_view3d_toolbar.py | 12 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_tools.c | 27 |
3 files changed, 32 insertions, 16 deletions
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 56f612abe3a..52f987be796 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 4e9dc1163e2..2e130a85aae 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 e57f6375a2a..90e1c916029 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); |