[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12024] trunk/blender/source/blender: Added UV face rotate and mirror to editmode and re arranged some of the editmode keys
Campbell Barton
cbarton at metavr.com
Wed Sep 12 12:35:48 CEST 2007
Revision: 12024
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12024
Author: campbellbarton
Date: 2007-09-12 12:35:48 +0200 (Wed, 12 Sep 2007)
Log Message:
-----------
Added UV face rotate and mirror to editmode and re arranged some of the editmode keys
The WKey menu was way too big and not well organized, re-arranged keys like this.
Ctrl+V - Vert Menu (remove doubles, smooth...)
Ctrl+E - Edge Menu - left as is
Ctrl+F - Face Menu - (flip normals, shading, Rotate and Mirror UV's/Colors)
Wkey menu only has subdivide in it now.
filesel.c - only show the relative paths option if the file is saved, (flag on by default caused the image to silently fail loading on my system, and gave permission errors on a users), also removed a warning.
Modified Paths:
--------------
trunk/blender/source/blender/include/BIF_editmesh.h
trunk/blender/source/blender/src/buttons_editing.c
trunk/blender/source/blender/src/drawobject.c
trunk/blender/source/blender/src/editface.c
trunk/blender/source/blender/src/editmesh.c
trunk/blender/source/blender/src/editmesh_mods.c
trunk/blender/source/blender/src/editmesh_tools.c
trunk/blender/source/blender/src/editobject.c
trunk/blender/source/blender/src/filelist.c
trunk/blender/source/blender/src/filesel.c
trunk/blender/source/blender/src/header_view3d.c
trunk/blender/source/blender/src/space.c
trunk/blender/source/blender/src/unwrapper.c
Modified: trunk/blender/source/blender/include/BIF_editmesh.h
===================================================================
--- trunk/blender/source/blender/include/BIF_editmesh.h 2007-09-12 07:33:18 UTC (rev 12023)
+++ trunk/blender/source/blender/include/BIF_editmesh.h 2007-09-12 10:35:48 UTC (rev 12024)
@@ -171,7 +171,9 @@
extern void editmesh_select_by_material(int index);
extern void editmesh_deselect_by_material(int index);
+extern void Vertex_Menu(void);
extern void Edge_Menu(void);
+extern void Face_Menu(void);
extern void select_mesh_group_menu(void);
extern void editmesh_mark_seam(int clear);
extern void loop_multiselect(int looptype);
@@ -219,6 +221,10 @@
extern void fill_mesh(void);
extern void bevel_menu();
extern void mesh_set_smooth_faces(short event);
+extern void mesh_rotate_uvs(void);
+extern void mesh_mirror_uvs(void);
+extern void mesh_rotate_colors(void);
+extern void mesh_mirror_colors(void);
void mesh_copy_menu(void);
void edge_rotate_selected(int dir);
int EdgeSlide(short immediate, float imperc);
@@ -247,5 +253,6 @@
void free_uv_vert_map_EM(UvVertMap *vmap);
int EM_texFaceCheck(void); /* can we edit UV's for this mesh?*/
+int EM_vertColorCheck(void); /* can we edit colors for this mesh?*/
#endif
Modified: trunk/blender/source/blender/src/buttons_editing.c
===================================================================
--- trunk/blender/source/blender/src/buttons_editing.c 2007-09-12 07:33:18 UTC (rev 12023)
+++ trunk/blender/source/blender/src/buttons_editing.c 2007-09-12 10:35:48 UTC (rev 12024)
@@ -4364,9 +4364,9 @@
if(uiNewPanel(curarea, block, "Mesh Tools 1", "Editing", 960, 0, 318, 204)==0) return;
uiBlockBeginAlign(block);
- uiDefBut(block, BUT,B_SELSWAP, "Select Swap", 955, 200, 106, 19, 0, 0, 0, 0, 0, "Selects unselected faces, and deselects selected faces");
- uiDefBut(block, BUT,B_HIDE, "Hide", 1061, 200, 106, 19, 0, 0, 0, 0, 0, "Hides selected faces");
- uiDefBut(block, BUT,B_REVEAL, "Reveal", 1167, 200, 107, 19, 0, 0, 0, 0, 0, "Reveals selected faces");
+ uiDefBut(block, BUT,B_SELSWAP, "Select Swap", 955, 200, 106, 19, 0, 0, 0, 0, 0, "Selects unselected faces, and deselects selected faces (Ctrl+I)");
+ uiDefBut(block, BUT,B_HIDE, "Hide", 1061, 200, 106, 19, 0, 0, 0, 0, 0, "Hides selected faces (H)");
+ uiDefBut(block, BUT,B_REVEAL, "Reveal", 1167, 200, 107, 19, 0, 0, 0, 0, 0, "Reveals selected faces (Alt H)");
uiBlockEndAlign(block);
uiBlockBeginAlign(block);
Modified: trunk/blender/source/blender/src/drawobject.c
===================================================================
--- trunk/blender/source/blender/src/drawobject.c 2007-09-12 07:33:18 UTC (rev 12023)
+++ trunk/blender/source/blender/src/drawobject.c 2007-09-12 10:35:48 UTC (rev 12024)
@@ -2082,7 +2082,7 @@
} else if(ese->type == EDITFACE) {
- EditFace *efa = (EditEdge*)ese->data;
+ EditFace *efa = (EditFace*)ese->data;
/* repeate this pattern
X000X000
Modified: trunk/blender/source/blender/src/editface.c
===================================================================
--- trunk/blender/source/blender/src/editface.c 2007-09-12 07:33:18 UTC (rev 12023)
+++ trunk/blender/source/blender/src/editface.c 2007-09-12 10:35:48 UTC (rev 12024)
@@ -766,153 +766,6 @@
object_tface_flags_changed(OBACT, 0);
}
-void rotate_uv_tface()
-{
- Mesh *me;
- MFace *mf;
- MCol *mcol;
- MTFace *tf;
- short mode;
- int a;
-
- me= get_mesh(OBACT);
- if(me==0 || me->mtface==0) return;
-
- mode= pupmenu("Rotate %t|UV Co-ordinates %x1|Vertex Colors %x2");
-
- if (mode == 1 && me->mtface) {
- tf= me->mtface;
- mf= me->mface;
- for(a=0; a<me->totface; a++, tf++, mf++) {
- if(mf->flag & ME_FACE_SEL) {
- float u1= tf->uv[0][0];
- float v1= tf->uv[0][1];
-
- tf->uv[0][0]= tf->uv[1][0];
- tf->uv[0][1]= tf->uv[1][1];
-
- tf->uv[1][0]= tf->uv[2][0];
- tf->uv[1][1]= tf->uv[2][1];
-
- if(mf->v4) {
- tf->uv[2][0]= tf->uv[3][0];
- tf->uv[2][1]= tf->uv[3][1];
-
- tf->uv[3][0]= u1;
- tf->uv[3][1]= v1;
- }
- else {
- tf->uv[2][0]= u1;
- tf->uv[2][1]= v1;
- }
- }
- }
-
- BIF_undo_push("Rotate UV face");
- object_uvs_changed(OBACT);
- }
- else if (mode == 2 && me->mcol) {
- tf= me->mtface;
- mcol= me->mcol;
- mf= me->mface;
- for(a=0; a<me->totface; a++, tf++, mf++, mcol+=4) {
- if(mf->flag & ME_FACE_SEL) {
- MCol tmpcol= mcol[0];
-
- mcol[0]= mcol[1];
- mcol[1]= mcol[2];
-
- if(mf->v4) {
- mcol[2]= mcol[3];
- mcol[3]= tmpcol;
- }
- else
- mcol[2]= tmpcol;
- }
- }
-
- BIF_undo_push("Rotate color face");
- object_uvs_changed(OBACT);
- }
-}
-
-void mirror_uv_tface()
-{
- Mesh *me;
- MFace *mf;
- MTFace *tf;
- MCol *mcol;
- short mode;
- int a;
-
- me= get_mesh(OBACT);
- if(me==0 || me->mtface==0) return;
-
- mode= pupmenu("Mirror %t|UV Co-ordinates %x1|Vertex Colors %x2");
-
- if (mode==1 && me->mtface) {
- mf= me->mface;
- tf= me->mtface;
-
- for (a=0; a<me->totface; a++, tf++, mf++) {
- if(mf->flag & ME_FACE_SEL) {
- float u1= tf->uv[0][0];
- float v1= tf->uv[0][1];
- if(mf->v4) {
- tf->uv[0][0]= tf->uv[3][0];
- tf->uv[0][1]= tf->uv[3][1];
-
- tf->uv[3][0]= u1;
- tf->uv[3][1]= v1;
-
- u1= tf->uv[1][0];
- v1= tf->uv[1][1];
-
- tf->uv[1][0]= tf->uv[2][0];
- tf->uv[1][1]= tf->uv[2][1];
-
- tf->uv[2][0]= u1;
- tf->uv[2][1]= v1;
- }
- else {
- tf->uv[0][0]= tf->uv[2][0];
- tf->uv[0][1]= tf->uv[2][1];
- tf->uv[2][0]= u1;
- tf->uv[2][1]= v1;
- }
- }
- }
- }
- else if(mode==2 && me->mcol) {
- mf= me->mface;
- tf= me->mtface;
- mcol= me->mcol;
-
- for (a=0; a<me->totface; a++, tf++, mf++, mcol+=4) {
- if(mf->flag & ME_FACE_SEL) {
- MCol tmpcol= mcol[0];
-
- if(mf->v4) {
- mcol[0]= mcol[3];
- mcol[3]= tmpcol;
-
- tmpcol = mcol[1];
- mcol[1]= mcol[2];
- mcol[2]= tmpcol;
- }
- else {
- mcol[0]= mcol[2];
- mcol[2]= tmpcol;
- }
- }
- }
- }
-
- BIF_undo_push("Mirror UV face");
-
- object_uvs_changed(OBACT);
-}
-
int minmax_tface(float *min, float *max)
{
Object *ob;
Modified: trunk/blender/source/blender/src/editmesh.c
===================================================================
--- trunk/blender/source/blender/src/editmesh.c 2007-09-12 07:33:18 UTC (rev 12023)
+++ trunk/blender/source/blender/src/editmesh.c 2007-09-12 10:35:48 UTC (rev 12024)
@@ -2177,3 +2177,17 @@
return 1;
return 0;
}
+
+/* can we edit colors for this mesh?*/
+int EM_vertColorCheck(void)
+{
+ /* some of these checks could be a touch overkill */
+ if ( (G.obedit) &&
+ (G.obedit->type == OB_MESH) &&
+ (G.editMesh) &&
+ (G.editMesh->faces.first) &&
+ (CustomData_has_layer(&G.editMesh->fdata, CD_MCOL)))
+ return 1;
+ return 0;
+}
+
Modified: trunk/blender/source/blender/src/editmesh_mods.c
===================================================================
--- trunk/blender/source/blender/src/editmesh_mods.c 2007-09-12 07:33:18 UTC (rev 12023)
+++ trunk/blender/source/blender/src/editmesh_mods.c 2007-09-12 10:35:48 UTC (rev 12024)
@@ -3175,6 +3175,38 @@
}
}
+
+
+void Vertex_Menu() {
+ short ret;
+ ret= pupmenu("Vertex Specials%t|Merge%x4|Remove Doubles%x5|Smooth %x10|Blend From Shape%x16|Propagate To All Shapes%x17|Select Vertex Path%x18");
+
+ switch(ret)
+ {
+ case 4:
+ mergemenu();
+ break;
+ case 5:
+ notice("Removed %d Vertices", removedoublesflag(1, G.scene->toolsettings->doublimit));
+ BIF_undo_push("Remove Doubles");
+ break;
+ case 10:
+ vertexsmooth();
+ break;
+ case 16:
+ shape_copy_select_from();
+ break;
+ case 17:
+ shape_propagate();
+ break;
+ case 18:
+ pathselect();
+ BIF_undo_push("Select Vertex Path");
+ break;
+ }
+}
+
+
void Edge_Menu() {
short ret;
@@ -3227,7 +3259,46 @@
}
}
+void Face_Menu() {
+ short ret;
+ ret= pupmenu(
+ "Face Specials%t|Flip Normals %x1|Bevel %x2|Shade Smooth %x3|Shade Flat %x4|%l|"
+ "UV Rotate (Shift - CCW)%x10|UV Mirror (Shift - Switch Axis)%x11|"
+ "Color Rotate (Shift - CCW)%x12|Color Mirror (Shift - Switch Axis)%x13");
+ switch(ret)
+ {
+ case 1:
+ flip_editnormals();
+ BIF_undo_push("Flip Normals");
+ break;
+ case 2:
+ bevel_menu();
+ break;
+ case 3:
+ mesh_set_smooth_faces(1);
+ break;
+ case 4:
+ mesh_set_smooth_faces(0);
+ break;
+
+ /* uv texface options */
+ case 10:
+ mesh_rotate_uvs();
+ break;
+ case 11:
+ mesh_mirror_uvs();
+ break;
+ case 12:
+ mesh_rotate_colors();
+ break;
+ case 13:
+ mesh_mirror_colors();
+ break;
+ }
+}
+
+
/* **************** NORMALS ************** */
void righthandfaces(int select) /* makes faces righthand turning */
Modified: trunk/blender/source/blender/src/editmesh_tools.c
===================================================================
--- trunk/blender/source/blender/src/editmesh_tools.c 2007-09-12 07:33:18 UTC (rev 12023)
+++ trunk/blender/source/blender/src/editmesh_tools.c 2007-09-12 10:35:48 UTC (rev 12024)
@@ -6500,3 +6500,172 @@
BIF_undo_push("Edge Loop to Face Region");
}
+
+/* texface and vertex color editmode tools for the face menu */
+
+void mesh_rotate_uvs(void)
+{
+ EditMesh *em = G.editMesh;
+ EditFace *efa;
+ short change;
+ MTFace *tf;
+ float u1, v1;
+
+ if (!EM_texFaceCheck()) {
+ error("mesh has no uv/image layers");
+ return;
+ }
+
+ for(efa=em->faces.first; efa; efa=efa->next) {
+ if (efa->f & SELECT) {
+ tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+ u1= tf->uv[0][0];
+ v1= tf->uv[0][1];
+
+ tf->uv[0][0]= tf->uv[1][0];
+ tf->uv[0][1]= tf->uv[1][1];
+
+ tf->uv[1][0]= tf->uv[2][0];
+ tf->uv[1][1]= tf->uv[2][1];
+
+ if(efa->v4) {
+ tf->uv[2][0]= tf->uv[3][0];
+ tf->uv[2][1]= tf->uv[3][1];
+
+ tf->uv[3][0]= u1;
+ tf->uv[3][1]= v1;
+ }
+ else {
+ tf->uv[2][0]= u1;
+ tf->uv[2][1]= v1;
+ }
+ change = 1;
+ }
+ }
+
+ if (change) {
+ allqueue(REDRAWVIEW3D, 0);
+ BIF_undo_push("Rotate UV face");
+ }
+}
+
+void mesh_mirror_uvs(void)
+{
+ EditMesh *em = G.editMesh;
+ EditFace *efa;
+ short change;
+ MTFace *tf;
+ float u1, v1;
+
+ if (!EM_texFaceCheck()) {
+ error("mesh has no uv/image layers");
+ return;
+ }
+
+ for(efa=em->faces.first; efa; efa=efa->next) {
+ if (efa->f & SELECT) {
+ tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+ u1= tf->uv[0][0];
+ v1= tf->uv[0][1];
+ if(efa->v4) {
+ tf->uv[0][0]= tf->uv[3][0];
+ tf->uv[0][1]= tf->uv[3][1];
+
+ tf->uv[3][0]= u1;
+ tf->uv[3][1]= v1;
+
+ u1= tf->uv[1][0];
+ v1= tf->uv[1][1];
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list