diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2015-05-26 15:56:36 +0300 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2015-05-26 15:56:36 +0300 |
commit | 322380999ed91179ebce511c7b14e470b48bf993 (patch) | |
tree | c13a97f18bf388f0f4a2ad3f423764742b3f5bb9 /source/blender/editors/mesh | |
parent | 650fdcd74fecc14cdfdc0b2e17317f31807b6a40 (diff) | |
parent | a23fbc71a1886e9f83fd1d6782050d5a8c356d13 (diff) |
Merge branch 'master' into gooseberry
Conflicts:
source/blender/editors/object/object_ops.c
Diffstat (limited to 'source/blender/editors/mesh')
-rw-r--r-- | source/blender/editors/mesh/editmesh_tools.c | 46 | ||||
-rw-r--r-- | source/blender/editors/mesh/mesh_data.c | 17 |
2 files changed, 42 insertions, 21 deletions
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index fd7497542be..679d0173581 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -3759,32 +3759,45 @@ static int edbm_tris_convert_to_quads_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = BKE_editmesh_from_object(obedit); - int dosharp, douvs, dovcols, domaterials; - float limit; + bool do_seam, do_sharp, do_uvs, do_vcols, do_materials; + float angle_face_threshold, angle_shape_threshold; PropertyRNA *prop; /* When joining exactly 2 faces, no limit. * this is useful for one off joins while editing. */ - prop = RNA_struct_find_property(op->ptr, "limit"); + prop = RNA_struct_find_property(op->ptr, "face_threshold"); if ((em->bm->totfacesel == 2) && (RNA_property_is_set(op->ptr, prop) == false)) { - limit = DEG2RADF(180.0f); + angle_face_threshold = DEG2RADF(180.0f); } else { - limit = RNA_property_float_get(op->ptr, prop); + angle_face_threshold = RNA_property_float_get(op->ptr, prop); } - dosharp = RNA_boolean_get(op->ptr, "sharp"); - douvs = RNA_boolean_get(op->ptr, "uvs"); - dovcols = RNA_boolean_get(op->ptr, "vcols"); - domaterials = RNA_boolean_get(op->ptr, "materials"); + prop = RNA_struct_find_property(op->ptr, "shape_threshold"); + if ((em->bm->totfacesel == 2) && + (RNA_property_is_set(op->ptr, prop) == false)) + { + angle_shape_threshold = DEG2RADF(180.0f); + } + else { + angle_shape_threshold = RNA_property_float_get(op->ptr, prop); + } + + do_seam = RNA_boolean_get(op->ptr, "seam"); + do_sharp = RNA_boolean_get(op->ptr, "sharp"); + do_uvs = RNA_boolean_get(op->ptr, "uvs"); + do_vcols = RNA_boolean_get(op->ptr, "vcols"); + do_materials = RNA_boolean_get(op->ptr, "materials"); if (!EDBM_op_call_and_selectf( em, op, "faces.out", true, - "join_triangles faces=%hf limit=%f cmp_sharp=%b cmp_uvs=%b cmp_vcols=%b cmp_materials=%b", - BM_ELEM_SELECT, limit, dosharp, douvs, dovcols, domaterials)) + "join_triangles faces=%hf angle_face_threshold=%f angle_shape_threshold=%f " + "cmp_seam=%b cmp_sharp=%b cmp_uvs=%b cmp_vcols=%b cmp_materials=%b", + BM_ELEM_SELECT, angle_face_threshold, angle_shape_threshold, + do_seam, do_sharp, do_uvs, do_vcols, do_materials)) { return OPERATOR_CANCELLED; } @@ -3798,12 +3811,19 @@ static void join_triangle_props(wmOperatorType *ot) { PropertyRNA *prop; - prop = RNA_def_float_rotation(ot->srna, "limit", 0, NULL, 0.0f, DEG2RADF(180.0f), - "Max Angle", "Angle Limit", 0.0f, DEG2RADF(180.0f)); + prop = RNA_def_float_rotation( + ot->srna, "face_threshold", 0, NULL, 0.0f, DEG2RADF(180.0f), + "Max Face Angle", "Face angle limit", 0.0f, DEG2RADF(180.0f)); + RNA_def_property_float_default(prop, DEG2RADF(40.0f)); + + prop = RNA_def_float_rotation( + ot->srna, "shape_threshold", 0, NULL, 0.0f, DEG2RADF(180.0f), + "Max Shape Angle", "Shape angle limit", 0.0f, DEG2RADF(180.0f)); RNA_def_property_float_default(prop, DEG2RADF(40.0f)); RNA_def_boolean(ot->srna, "uvs", 0, "Compare UVs", ""); RNA_def_boolean(ot->srna, "vcols", 0, "Compare VCols", ""); + RNA_def_boolean(ot->srna, "seam", 0, "Compare Seam", ""); RNA_def_boolean(ot->srna, "sharp", 0, "Compare Sharp", ""); RNA_def_boolean(ot->srna, "materials", 0, "Compare Materials", ""); } diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index f497cd7a1aa..b9a9f708af7 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -803,8 +803,11 @@ void MESH_OT_customdata_mask_clear(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } -/* Clear Skin */ -static bool mesh_customdata_skin_has(bContext *C) +/** + * Clear Skin + * \return -1 invalid state, 0 no skin, 1 has skin. + */ +static int mesh_customdata_skin_state(bContext *C) { Object *ob = ED_object_context(C); @@ -812,17 +815,15 @@ static bool mesh_customdata_skin_has(bContext *C) Mesh *me = ob->data; if (me->id.lib == NULL) { CustomData *data = GET_CD_DATA(me, vdata); - if (CustomData_has_layer(data, CD_MVERT_SKIN)) { - return true; - } + return CustomData_has_layer(data, CD_MVERT_SKIN); } } - return false; + return -1; } static int mesh_customdata_skin_add_poll(bContext *C) { - return !mesh_customdata_skin_has(C); + return (mesh_customdata_skin_state(C) == 0); } static int mesh_customdata_skin_add_exec(bContext *C, wmOperator *UNUSED(op)) @@ -855,7 +856,7 @@ void MESH_OT_customdata_skin_add(wmOperatorType *ot) static int mesh_customdata_skin_clear_poll(bContext *C) { - return mesh_customdata_skin_has(C); + return (mesh_customdata_skin_state(C) == 1); } static int mesh_customdata_skin_clear_exec(bContext *C, wmOperator *UNUSED(op)) |