diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2004-07-13 15:48:52 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2004-07-13 15:48:52 +0400 |
commit | e0773281220c5af56585b0e07ccdbfc6ee485b4f (patch) | |
tree | 4b06de628461f5822cb31c59eb6c6768ae06cc6f /source/blender/src/editface.c | |
parent | 4f1c674ee02e07a6986a54a312d7fb9e2547e950 (diff) |
Added LSCM UV Unwrapping:
http://www.loria.fr/~levy/Galleries/LSCM/index.html
http://www.loria.fr/~levy/Papers/2002/s2002_lscm.pdf
Implementation Least Squares Conformal Maps parameterization, based on
chapter 2 of:
Bruno Levy, Sylvain Petitjean, Nicolas Ray, Jerome Maillot. Least Squares
Conformal Maps for Automatic Texture Atlas Generation. In Siggraph 2002,
July 2002.
Seams: Stored as a flag (ME_SEAM) in the new MEdge struct, these seams define
where a mesh will be cut when executing LSCM unwrapping. Seams can be marked
and cleared in Edit Mode. Ctrl+EKEY will pop up a menu allowing to Clear or Mark
the selected edges as seams.
Select Linked in Face Select Mode now only selects linked faces if no seams
separate them. So if seams are defined, this will now select the 'face group'
defined by the seams. Hotkey is still LKEY.
LSCM Unwrap: unwrap UV's by calculating a conformal mapping (preserving local
angles). Based on seams, the selected faces will be 'cut'. If multiple
'face groups' are selected, they will be unwrapped separately and packed in
the image rectangle in the UV Editor. Packing uses a simple and fast
algorithm, only designed to avoid having overlapping faces.
LSCM can be found in the Unwrap menu (UKEY), and the UV Calculation panel.
Pinning: UV's can be pinned in the UV Editor. When LSCM Unwrap is then
executed, these UV's will stay in place, allowing to tweak the solution.
PKEY and ALT+PKEY will respectively pin and unpin selected UV's.
Face Select Mode Drawing Changes:
- Draw Seams option to enable disable drawing of seams
- Draw Faces option to enable drawing of selected faces in transparent purple
- Draw Hidden Edges option to enable drawing of edges of hidden faces
- Draw Edges option to enable drawing of edges of visible faces
The colors for these seams, faces and edges are themeable.
Diffstat (limited to 'source/blender/src/editface.c')
-rw-r--r-- | source/blender/src/editface.c | 50 |
1 files changed, 35 insertions, 15 deletions
diff --git a/source/blender/src/editface.c b/source/blender/src/editface.c index f2c6585d51e..5fe27735e12 100644 --- a/source/blender/src/editface.c +++ b/source/blender/src/editface.c @@ -96,7 +96,9 @@ #include "BSE_trans_types.h" #endif /* NAN_TPT */ -TFace *lasttface=0; +#include "BDR_unwrapper.h" + +TFace *lasttface=NULL; static void uv_calc_center_vector(float *result, Object *ob, Mesh *me) { @@ -651,7 +653,7 @@ void select_linked_tfaces() Mesh *me; TFace *tface; MFace *mface; - int a, doit=1; + int a, doit=1, mark=0; char *cpmain; me= get_mesh(OBACT); @@ -669,7 +671,7 @@ void select_linked_tfaces() while(a--) { if(tface->flag & TF_HIDE); else if(tface->flag & TF_SELECT) { - if( mface->v3) { + if(mface->v3) { cpmain[mface->v1]= 1; cpmain[mface->v2]= 1; cpmain[mface->v3]= 1; @@ -686,18 +688,30 @@ void select_linked_tfaces() a= me->totface; while(a--) { if(tface->flag & TF_HIDE); - else if((tface->flag & TF_SELECT)==0) { - if( mface->v3) { + else if(mface->v3 && ((tface->flag & TF_SELECT)==0)) { + mark= 0; + + if(!(tface->unwrap & TF_SEAM1)) + if(cpmain[mface->v1] && cpmain[mface->v2]) + mark= 1; + if(!(tface->unwrap & TF_SEAM2)) + if(cpmain[mface->v2] && cpmain[mface->v3]) + mark= 1; + if(!(tface->unwrap & TF_SEAM3)) { if(mface->v4) { - if(cpmain[mface->v4]) { - tface->flag |= TF_SELECT; - doit= 1; - } - } - if( cpmain[mface->v1] || cpmain[mface->v2] || cpmain[mface->v3] ) { - tface->flag |= TF_SELECT; - doit= 1; + if(cpmain[mface->v3] && cpmain[mface->v4]) + mark= 1; } + else if(cpmain[mface->v3] && cpmain[mface->v1]) + mark= 1; + } + if(mface->v4 && !(tface->unwrap & TF_SEAM4)) + if(cpmain[mface->v4] && cpmain[mface->v1]) + mark= 1; + + if(mark) { + tface->flag |= TF_SELECT; + doit= 1; } } tface++; mface++; @@ -708,7 +722,6 @@ void select_linked_tfaces() allqueue(REDRAWVIEW3D, 0); allqueue(REDRAWIMAGE, 0); - } void deselectall_tface() @@ -1024,6 +1037,7 @@ float CalcNormUV(float *a, float *b, float *c) #define UV_STD2_MAPPING 129 #define UV_STD1_MAPPING 128 #define UV_WINDOW_MAPPING 5 +#define UV_LSCM_MAPPING 6 #define UV_CYL_EX 32 #define UV_SPHERE_EX 34 @@ -1043,6 +1057,7 @@ void uv_autocalc_tface() MENUSTRING("Cube", UV_CUBE_MAPPING) "|" MENUSTRING("Cylinder", UV_CYL_MAPPING) "|" MENUSTRING("Sphere", UV_SPHERE_MAPPING) "|" + MENUSTRING("LSCM", UV_LSCM_MAPPING) "|" MENUSTRING("Bounds to 1/8", UV_BOUNDS8_MAPPING) "|" MENUSTRING("Bounds to 1/4", UV_BOUNDS4_MAPPING) "|" MENUSTRING("Bounds to 1/2", UV_BOUNDS2_MAPPING) "|" @@ -1079,6 +1094,8 @@ void uv_autocalc_tface() calculate_uv_map(B_UVAUTO_STD1); break; case UV_WINDOW_MAPPING: calculate_uv_map(B_UVAUTO_WINDOW); break; + case UV_LSCM_MAPPING: + unwrap_lscm(); break; } } @@ -1104,7 +1121,10 @@ void set_faceselect() /* toggle */ if(G.f & G_FACESELECT) { setcursor_space(SPACE_VIEW3D, CURSOR_FACESEL); - if(me) set_lasttface(); + if(me) { + set_lasttface(); + set_seamtface(); /* set TF_SEAM flags in tface */ + } } else if((G.f & (G_WEIGHTPAINT|G_VERTEXPAINT|G_TEXTUREPAINT))==0) { if(me) reveal_tface(); |