diff options
author | Campbell Barton <ideasman42@gmail.com> | 2007-09-12 14:35:48 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2007-09-12 14:35:48 +0400 |
commit | b2b3b018948f2a5b14b888e386ba811d9e1236e0 (patch) | |
tree | c9c50bc73341c74cd8de09f29cb60d2fd93f6f11 /source/blender/src/editmesh_tools.c | |
parent | d1dcfd744a1c28e85a1e61b17782c2444fa14e8b (diff) |
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.
Diffstat (limited to 'source/blender/src/editmesh_tools.c')
-rw-r--r-- | source/blender/src/editmesh_tools.c | 169 |
1 files changed, 169 insertions, 0 deletions
diff --git a/source/blender/src/editmesh_tools.c b/source/blender/src/editmesh_tools.c index 6cdc393d2c5..7dd116d0fad 100644 --- a/source/blender/src/editmesh_tools.c +++ b/source/blender/src/editmesh_tools.c @@ -6500,3 +6500,172 @@ void loop_to_region(void) 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]; + + 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; + } + change = 1; + } + } + + if (change) { + allqueue(REDRAWVIEW3D, 0); + BIF_undo_push("Mirror UV face"); + } +} + +void mesh_rotate_colors(void) +{ + EditMesh *em = G.editMesh; + EditFace *efa; + short change; + MCol tmpcol, *mcol; + if (!EM_vertColorCheck()) { + error("mesh has no color layers"); + return; + } + + for(efa=em->faces.first; efa; efa=efa->next) { + if (efa->f & SELECT) { + mcol = CustomData_em_get(&em->fdata, efa->data, CD_MCOL); + tmpcol= mcol[0]; + + mcol[0]= mcol[1]; + mcol[1]= mcol[2]; + + if(efa->v4) { + mcol[2]= mcol[3]; + mcol[3]= tmpcol; + } + else + mcol[2]= tmpcol; + change = 1; + } + } + + if (change) { + allqueue(REDRAWVIEW3D, 0); + BIF_undo_push("Rotate Color face"); + } +} + +void mesh_mirror_colors(void) +{ + EditMesh *em = G.editMesh; + EditFace *efa; + short change; + MCol tmpcol, *mcol; + if (!EM_vertColorCheck()) { + error("mesh has no color layers"); + return; + } + + for(efa=em->faces.first; efa; efa=efa->next) { + if (efa->f & SELECT) { + mcol = CustomData_em_get(&em->fdata, efa->data, CD_MCOL); + tmpcol= mcol[0]; + + mcol[0]= mcol[1]; + mcol[1]= mcol[2]; + + if(efa->v4) { + mcol[2]= mcol[3]; + mcol[3]= tmpcol; + } + else { + mcol[2]= tmpcol; + } + change = 1; + } + } + + if (change) { + allqueue(REDRAWVIEW3D, 0); + BIF_undo_push("Mirror Color face"); + } +} |