don't create empty mesh object when separating if nothing is selected.
authorCampbell Barton <ideasman42@gmail.com>
Sat, 16 Mar 2013 16:38:18 +0000 (16:38 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 16 Mar 2013 16:38:18 +0000 (16:38 +0000)
source/blender/editors/mesh/editmesh_tools.c

index 148c6c413d0e21869401261c49569379ddbcf0e2..e82176b058de54c22789eb9f7761c2b6fa7b38f0 100644 (file)
@@ -3394,6 +3394,16 @@ static int edbm_separate_exec(bContext *C, wmOperator *op)
                Base *base = CTX_data_active_base(C);
                BMEditMesh *em = BMEdit_FromObject(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;
+                       }
+               }
+
                /* editmode separate */
                if      (type == 0) retval = mesh_separate_selected(bmain, scene, base, em->bm);
                else if (type == 1) retval = mesh_separate_material(bmain, scene, base, em->bm);