diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-09-26 01:10:58 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-09-26 01:18:30 +0300 |
commit | c9d0873e90acd8505ab984c5070f2f7890a29b5d (patch) | |
tree | ef507583a304c19f2a42ce71efd6ad991ccf58a6 /source/blender/editors/mesh/editmesh_select_similar.c | |
parent | 424bb2ebdc69c9c09f977b4527cc0de4688def5e (diff) |
Multi-Objects: Select similar face SIMFACE_FREESTYLE
Note: 2.7x seem to be checking for edge data instead of face, but I do not see why not to get FreestyleFace.
Diffstat (limited to 'source/blender/editors/mesh/editmesh_select_similar.c')
-rw-r--r-- | source/blender/editors/mesh/editmesh_select_similar.c | 58 |
1 files changed, 55 insertions, 3 deletions
diff --git a/source/blender/editors/mesh/editmesh_select_similar.c b/source/blender/editors/mesh/editmesh_select_similar.c index 2fa95d2085e..bd17b066d2e 100644 --- a/source/blender/editors/mesh/editmesh_select_similar.c +++ b/source/blender/editors/mesh/editmesh_select_similar.c @@ -210,8 +210,7 @@ static int similar_face_select_exec(bContext *C, wmOperator *op) if (ELEM(type, SIMFACE_COPLANAR, - SIMFACE_FACEMAP, - SIMFACE_FREESTYLE)) + SIMFACE_FACEMAP)) { BKE_report(op->reports, RPT_ERROR, "Select similar face mode not supported at the moment"); return OPERATOR_CANCELLED; @@ -270,6 +269,14 @@ static int similar_face_select_exec(bContext *C, wmOperator *op) material_array = give_matarar(ob); break; } + case SIMFACE_FREESTYLE: + { + if (!CustomData_has_layer(&bm->pdata, CD_FREESTYLE_FACE)) { + face_data_value |= SIMFACE_DATA_FALSE; + continue; + } + break; + } } BMFace *face; /* Mesh face. */ @@ -321,11 +328,28 @@ static int similar_face_select_exec(bContext *C, wmOperator *op) } break; } + case SIMFACE_FREESTYLE: + { + FreestyleFace *fface; + fface = CustomData_bmesh_get(&bm->pdata, face->head.data, CD_FREESTYLE_FACE); + if ((fface == NULL) || ((fface->flag & FREESTYLE_FACE_MARK) == 0)) { + face_data_value |= SIMFACE_DATA_FALSE; + } + else { + face_data_value |= SIMFACE_DATA_TRUE; + } + if (face_data_value == SIMFACE_DATA_ALL) { + goto face_select_all; + } + break; + } } } } } + BLI_assert((type != SIMFACE_FREESTYLE) || (face_data_value != SIMFACE_DATA_NONE)); + if (tree != NULL) { BLI_kdtree_balance(tree); } @@ -337,6 +361,7 @@ static int similar_face_select_exec(bContext *C, wmOperator *op) bool changed = false; Material ***material_array; + bool has_custom_data_layer; switch (type) { case SIMFACE_MATERIAL: { @@ -346,6 +371,14 @@ static int similar_face_select_exec(bContext *C, wmOperator *op) material_array = give_matarar(ob); break; } + case SIMFACE_FREESTYLE: + { + has_custom_data_layer = CustomData_has_layer(&bm->pdata, CD_FREESTYLE_FACE); + if ((face_data_value == SIMFACE_DATA_TRUE) && !has_custom_data_layer) { + continue; + } + break; + } } BMFace *face; /* Mesh face. */ @@ -428,6 +461,24 @@ static int similar_face_select_exec(bContext *C, wmOperator *op) select = true; } break; + case SIMFACE_FREESTYLE: + { + FreestyleFace *fface; + + if (!has_custom_data_layer) { + BLI_assert(face_data_value == SIMFACE_DATA_FALSE); + select = true; + break; + } + + fface = CustomData_bmesh_get(&bm->pdata, face->head.data, CD_FREESTYLE_FACE); + if (((fface != NULL) && (fface->flag & FREESTYLE_FACE_MARK)) == + ((face_data_value & SIMFACE_DATA_TRUE) != 0)) + { + select = true; + } + break; + } } if (select) { @@ -446,7 +497,8 @@ static int similar_face_select_exec(bContext *C, wmOperator *op) if (false) { face_select_all: BLI_assert(ELEM(type, - SIMFACE_SMOOTH + SIMFACE_SMOOTH, + SIMFACE_FREESTYLE )); for (uint ob_index = 0; ob_index < objects_len; ob_index++) { |