[Bf-blender-cvs] [60a6b24] master: Modeling: add optional angle limit for beauty fill
Campbell Barton
noreply at git.blender.org
Sat Dec 14 13:28:37 CET 2013
Commit: 60a6b2422dc8459f0a46e071d549abac9af28f00
Author: Campbell Barton
Date: Sat Dec 14 23:22:35 2013 +1100
http://developer.blender.org/rB60a6b2422dc8459f0a46e071d549abac9af28f00
Modeling: add optional angle limit for beauty fill
Makes this tool more useful on an entire mesh by only applying
beautify to planar surfaces.
===================================================================
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 fd391a3..74812e5 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -3120,10 +3120,31 @@ static int edbm_beautify_fill_exec(bContext *C, wmOperator *op)
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BKE_editmesh_from_object(obedit);
+ const float angle_max = M_PI;
+ const float angle_limit = RNA_float_get(op->ptr, "angle_limit");
+ char hflag;
+
+ if (angle_limit >= angle_max) {
+ hflag = BM_ELEM_SELECT;
+ }
+ else {
+ BMIter iter;
+ BMEdge *e;
+
+ BM_ITER_MESH (e, &iter, em->bm, BM_EDGES_OF_MESH) {
+ BM_elem_flag_set(e, BM_ELEM_TAG,
+ (BM_elem_flag_test(e, BM_ELEM_SELECT) &&
+ BM_edge_calc_face_angle_ex(e, angle_max) < angle_limit));
+
+ }
+
+ hflag = BM_ELEM_TAG;
+ }
+
if (!EDBM_op_call_and_selectf(
em, op, "geom.out", true,
- "beautify_fill faces=%hf edges=ae",
- BM_ELEM_SELECT))
+ "beautify_fill faces=%hf edges=%he",
+ BM_ELEM_SELECT, hflag))
{
return OPERATOR_CANCELLED;
}
@@ -3135,6 +3156,8 @@ static int edbm_beautify_fill_exec(bContext *C, wmOperator *op)
void MESH_OT_beautify_fill(wmOperatorType *ot)
{
+ PropertyRNA *prop;
+
/* identifiers */
ot->name = "Beautify Faces";
ot->idname = "MESH_OT_beautify_fill";
@@ -3146,6 +3169,11 @@ void MESH_OT_beautify_fill(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ /* props */
+ prop = RNA_def_float_rotation(ot->srna, "angle_limit", 0, NULL, 0.0f, DEG2RADF(180.0f),
+ "Max Angle", "Angle limit", 0.0f, DEG2RADF(180.0f));
+ RNA_def_property_float_default(prop, DEG2RADF(180.0f));
}
More information about the Bf-blender-cvs
mailing list