[Bf-blender-cvs] [5e915baec4a] blender2.8: Multi-Object-Editing: MESH_OT_separate by Nick Milios
Dalai Felinto
noreply at git.blender.org
Wed May 9 12:13:25 CEST 2018
Commit: 5e915baec4ad657ac9655a9921425bfaec98ea66
Author: Dalai Felinto
Date: Wed May 9 12:04:43 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB5e915baec4ad657ac9655a9921425bfaec98ea66
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
===================================================================
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 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) {
More information about the Bf-blender-cvs
mailing list