diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2007-03-22 23:32:20 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2007-03-22 23:32:20 +0300 |
commit | 5219812f55ce37a2bd0cb6461084963019e013b6 (patch) | |
tree | 190b9f6382dde48c0f23a28ec4d576ff47d4dcc0 /source | |
parent | 8aafed560a71a76c1c784bda3f8851725c9ec10b (diff) |
Added "Pack Charts" function in the UV editor, using Campbell's new box
packing code.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/include/BDR_unwrapper.h | 1 | ||||
-rw-r--r-- | source/blender/src/header_image.c | 6 | ||||
-rw-r--r-- | source/blender/src/parametrizer.c | 2 | ||||
-rw-r--r-- | source/blender/src/space.c | 4 | ||||
-rw-r--r-- | source/blender/src/unwrapper.c | 21 |
5 files changed, 31 insertions, 3 deletions
diff --git a/source/blender/include/BDR_unwrapper.h b/source/blender/include/BDR_unwrapper.h index f83c8aa3f8c..6a2b54409c3 100644 --- a/source/blender/include/BDR_unwrapper.h +++ b/source/blender/include/BDR_unwrapper.h @@ -40,6 +40,7 @@ void select_linked_tfaces_with_seams(int mode, struct Mesh *me, unsigned int ind void unwrap_lscm(short seamcut); /* unwrap faces selected in 3d view */ void minimize_stretch_tface_uv(void); /* optimize faces selected in uv editor */ +void pack_charts_tface_uv(void); /* for live mode: no undo pushes, caching for quicky re-unwrap */ void unwrap_lscm_live_begin(void); diff --git a/source/blender/src/header_image.c b/source/blender/src/header_image.c index 2fad10f0e39..4222fa24c3a 100644 --- a/source/blender/src/header_image.c +++ b/source/blender/src/header_image.c @@ -998,6 +998,9 @@ static void do_image_uvsmenu(void *arg, int event) case 12: minimize_stretch_tface_uv(); break; + case 13: + pack_charts_tface_uv(); + break; } } @@ -1030,13 +1033,14 @@ static uiBlock *image_uvsmenu(void *arg_unused) uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Pack Charts|Ctrl P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 13, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Minimize Stretch|Ctrl V", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 12, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Limit Stitch...|Shift V", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Stitch|V", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, ""); - uiDefIconTextBlockBut(block, image_uvs_transformmenu, NULL, ICON_RIGHTARROW_THIN, "Transform", 0, yco-=20, 120, 19, ""); uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); + uiDefIconTextBlockBut(block, image_uvs_transformmenu, NULL, ICON_RIGHTARROW_THIN, "Transform", 0, yco-=20, 120, 19, ""); uiDefIconTextBlockBut(block, image_uvs_mirrormenu, NULL, ICON_RIGHTARROW_THIN, "Mirror", 0, yco-=20, 120, 19, ""); uiDefIconTextBlockBut(block, image_uvs_weldalignmenu, NULL, ICON_RIGHTARROW_THIN, "Weld/Align", 0, yco-=20, 120, 19, ""); diff --git a/source/blender/src/parametrizer.c b/source/blender/src/parametrizer.c index d47925a97cd..8c3ac6394f9 100644 --- a/source/blender/src/parametrizer.c +++ b/source/blender/src/parametrizer.c @@ -4136,7 +4136,7 @@ void param_pack(ParamHandle *handle) if (tot_height>tot_width) scale = 1.0/tot_height; else - scale = 1.0/tot_height; + scale = 1.0/tot_width; for (i = 0; i < phandle->ncharts-unpacked; i++) { box = boxarray+i; diff --git a/source/blender/src/space.c b/source/blender/src/space.c index 8404e997486..9e3cb9a6520 100644 --- a/source/blender/src/space.c +++ b/source/blender/src/space.c @@ -4745,7 +4745,9 @@ static void winqreadimagespace(ScrArea *sa, void *spacedata, BWinEvent *evt) break; case PKEY: if(G.f & G_FACESELECT) { - if(G.qual==LR_SHIFTKEY) + if(G.qual==LR_CTRLKEY) + pack_charts_tface_uv(); + else if(G.qual==LR_SHIFTKEY) select_pinned_tface_uv(); else if(G.qual==LR_ALTKEY) pin_tface_uv(0); diff --git a/source/blender/src/unwrapper.c b/source/blender/src/unwrapper.c index b0716b81b91..3b6d3eaf91a 100644 --- a/source/blender/src/unwrapper.c +++ b/source/blender/src/unwrapper.c @@ -398,6 +398,27 @@ void minimize_stretch_tface_uv(void) allqueue(REDRAWIMAGE, 0); } +void pack_charts_tface_uv(void) +{ + Mesh *me; + ParamHandle *handle; + + me = get_mesh(OBACT); + if(me==0 || me->mtface==0) return; + + handle = construct_param_handle(me, 1, 0, 1); + param_pack(handle); + param_flush(handle); + param_delete(handle); + + BIF_undo_push("UV pack charts"); + + object_uvs_changed(OBACT); + + allqueue(REDRAWVIEW3D, 0); + allqueue(REDRAWIMAGE, 0); +} + /* LSCM live mode */ static ParamHandle *liveHandle = NULL; |