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:
authorGeoffrey Bantle <hairbat@yahoo.com>2006-11-07 03:34:48 +0300
committerGeoffrey Bantle <hairbat@yahoo.com>2006-11-07 03:34:48 +0300
commite144a05114428804fe4ab004adb6d5129e8f0634 (patch)
treea73328b80abe4acb210bcffe5e802968a4e792c4 /source/blender/src/editmesh.c
parent2ef6c48a65b61a07b86b1b79c8abd578701079c7 (diff)
->Commit of patch #5132: Separate by material
This patch adds a new option to the separate menu in editmode, 'By Material'. It simply loops through all materials in the mesh selects the faces associated with them and calls separate(). Thanks to Andrea Weikert for the patch!
Diffstat (limited to 'source/blender/src/editmesh.c')
-rw-r--r--source/blender/src/editmesh.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/source/blender/src/editmesh.c b/source/blender/src/editmesh.c
index a45f413928e..e138631e548 100644
--- a/source/blender/src/editmesh.c
+++ b/source/blender/src/editmesh.c
@@ -1382,7 +1382,7 @@ void separatemenu(void)
if(G.editMesh->verts.first==NULL) return;
- event = pupmenu("Separate %t|Selected%x1|All Loose Parts%x2");
+ event = pupmenu("Separate %t|Selected%x1|All Loose Parts%x2|By Material%x3");
if (event==0) return;
waitcursor(1);
@@ -1394,10 +1394,43 @@ void separatemenu(void)
case 2:
separate_mesh_loose();
break;
+ case 3:
+ separate_material();
+ break;
}
waitcursor(0);
}
+void separate_material(void)
+{
+ EditMesh *em = G.editMesh;
+ unsigned char curr_mat;
+ Mesh *me;
+
+ me= get_mesh(G.obedit);
+ if(me->key) {
+ error("Can't separate with vertex keys");
+ return;
+ }
+
+ if(G.obedit && em) {
+ if(G.obedit->type == OB_MESH) {
+ for (curr_mat = 1; curr_mat < G.obedit->totcol; ++curr_mat) {
+ /* clear selection, we're going to use that to select material group */
+ EM_clear_flag_all(SELECT);
+ /* select the material */
+ editmesh_select_by_material(curr_mat);
+ /* and now separate */
+ separate_mesh();
+ }
+ }
+ }
+
+ countall();
+ allqueue(REDRAWVIEW3D, 0);
+ DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
+
+}
void separate_mesh(void)
{