Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2018-05-09 13:04:43 +0300
committerDalai Felinto <dfelinto@gmail.com>2018-05-09 13:13:09 +0300
commit5e915baec4ad657ac9655a9921425bfaec98ea66 (patch)
tree5fe200e40595fba82e0f99396c5c1a8abeeee9f0 /source/blender/editors/mesh/editmesh_tools.c
parent944054fbb61e0d0eb9df99205bfda6af811f694a (diff)
Multi-Object-Editing: MESH_OT_separate by Nick Milios
Patch description: - Reports "Nothing selected" only when all objects has no selection and it is in Separate type(Mode) - Tested all types (Seperate/By Material/By loose parts) - Instead of using ``` BKE_view_layer_array_from_objects_in_edit_mode_unique_data ``` I used ``` BKE_view_layer_array_from_bases_in_edit_mode_unique_data ``` Because it needs the "Base" not the "Object" itself. Maniphest Tasks: T54643 Differential Revision: https://developer.blender.org/D3267
Diffstat (limited to 'source/blender/editors/mesh/editmesh_tools.c')
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c65
1 files changed, 37 insertions, 28 deletions
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 6ee10da276b..be9519e4ba6 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -3786,38 +3786,47 @@ static int edbm_separate_exec(bContext *C, wmOperator *op)
int retval = 0;
if (ED_operator_editmesh(C)) {
- Base *base = CTX_data_active_base(C);
- BMEditMesh *em = BKE_editmesh_from_object(base->object);
-
- if (type == 0) {
- if ((em->bm->totvertsel == 0) &&
- (em->bm->totedgesel == 0) &&
- (em->bm->totfacesel == 0))
- {
- BKE_report(op->reports, RPT_ERROR, "Nothing selected");
- return OPERATOR_CANCELLED;
+ uint bases_len = 0;
+ uint empty_selection_len = 0;
+ Base **bases = BKE_view_layer_array_from_bases_in_edit_mode_unique_data(view_layer, &bases_len);
+ for (uint bs_index = 0; bs_index < bases_len; bs_index++) {
+ Base *base = bases[bs_index];
+ BMEditMesh *em = BKE_editmesh_from_object(base->object);
+
+ if (type == 0) {
+ if ((em->bm->totvertsel == 0) &&
+ (em->bm->totedgesel == 0) &&
+ (em->bm->totfacesel == 0))
+ {
+ /* when all objects has no selection */
+ if (++empty_selection_len == bases_len) {
+ BKE_report(op->reports, RPT_ERROR, "Nothing selected");
+ }
+ continue;
+ }
}
- }
- /* editmode separate */
- switch (type) {
- case MESH_SEPARATE_SELECTED:
- retval = mesh_separate_selected(bmain, scene, view_layer, base, em->bm);
- break;
- case MESH_SEPARATE_MATERIAL:
- retval = mesh_separate_material(bmain, scene, view_layer, base, em->bm);
- break;
- case MESH_SEPARATE_LOOSE:
- retval = mesh_separate_loose(bmain, scene, view_layer, base, em->bm);
- break;
- default:
- BLI_assert(0);
- break;
- }
+ /* editmode separate */
+ switch (type) {
+ case MESH_SEPARATE_SELECTED:
+ retval = mesh_separate_selected(bmain, scene, view_layer, base, em->bm);
+ break;
+ case MESH_SEPARATE_MATERIAL:
+ retval = mesh_separate_material(bmain, scene, view_layer, base, em->bm);
+ break;
+ case MESH_SEPARATE_LOOSE:
+ retval = mesh_separate_loose(bmain, scene, view_layer, base, em->bm);
+ break;
+ default:
+ BLI_assert(0);
+ break;
+ }
- if (retval) {
- EDBM_update_generic(em, true, true);
+ if (retval) {
+ EDBM_update_generic(em, true, true);
+ }
}
+ MEM_freeN(bases);
}
else {
if (type == MESH_SEPARATE_SELECTED) {