diff options
-rw-r--r-- | source/blender/include/BDR_unwrapper.h | 1 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_space_types.h | 1 | ||||
-rw-r--r-- | source/blender/src/header_image.c | 8 | ||||
-rwxr-xr-x | source/blender/src/transform_generics.c | 1 | ||||
-rw-r--r-- | source/blender/src/unwrapper.c | 32 |
5 files changed, 42 insertions, 1 deletions
diff --git a/source/blender/include/BDR_unwrapper.h b/source/blender/include/BDR_unwrapper.h index d1e6caaa58b..176bf8c8e68 100644 --- a/source/blender/include/BDR_unwrapper.h +++ b/source/blender/include/BDR_unwrapper.h @@ -35,6 +35,7 @@ void set_seamtface(void); /* set TF_SEAM flags in tfaces */ void unwrap_lscm(void); /* unwrap selected tfaces */ +void unwrap_lscm_live(void); /* unwrap selected tfaces (for live mode, with no undo pushes) */ void select_linked_tfaces_with_seams(int mode, Mesh *me, unsigned int index); #endif /* BDR_UNWRAPPER_H */ diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index 4d63e14ac87..7007981ff64 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -444,6 +444,7 @@ typedef struct SpaceImaSel { #define SI_LOCALSTICKY 256 #define SI_COORDFLOATS 512 #define SI_PIXELSNAP 1024 +#define SI_LSCM_LIVE 2048 /* SpaceText flags (moved from DNA_text_types.h) */ diff --git a/source/blender/src/header_image.c b/source/blender/src/header_image.c index d839323dd83..8a4603ec532 100644 --- a/source/blender/src/header_image.c +++ b/source/blender/src/header_image.c @@ -1007,6 +1007,10 @@ static void do_image_uvsmenu(void *arg, int event) case 10: unwrap_lscm(); break; + case 11: + if(G.sima->flag & SI_LSCM_LIVE) G.sima->flag &= ~SI_LSCM_LIVE; + else G.sima->flag |= SI_LSCM_LIVE; + break; } } @@ -1033,9 +1037,11 @@ static uiBlock *image_uvsmenu(void *arg_unused) uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); + if(G.sima->flag & SI_LSCM_LIVE) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "LSCM Live Transform", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 11, ""); + else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "LSCM Live Transform", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 11, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "LSCM Unwrap|E", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 10, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Unpin|Alt P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 9, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Pin|P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 8, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "LSCM Unwrap|E", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 10, ""); uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); diff --git a/source/blender/src/transform_generics.c b/source/blender/src/transform_generics.c index 99b9c3d021a..edad524e383 100755 --- a/source/blender/src/transform_generics.c +++ b/source/blender/src/transform_generics.c @@ -272,6 +272,7 @@ void recalcData(TransInfo *t) } else if(t->spacetype==SPACE_IMAGE) { flushTransUVs(t); + if (G.sima->flag & SI_LSCM_LIVE) unwrap_lscm_live(); } else { for(base= FIRSTBASE; base; base= base->next) { diff --git a/source/blender/src/unwrapper.c b/source/blender/src/unwrapper.c index c1bf0d3fa3f..045eea31625 100644 --- a/source/blender/src/unwrapper.c +++ b/source/blender/src/unwrapper.c @@ -1164,6 +1164,38 @@ void unwrap_lscm(void) allqueue(REDRAWIMAGE, 0); } +/* note; to make it quick work, brecht/jens: you can make it nice later! (ton) */ +void unwrap_lscm_live(void) +{ + int dopack = 1; + int res; + Mesh *me; + int totgroup, *groups=NULL, a; + + me= get_mesh(OBACT); + if(me==0 || me->tface==0) return; + + totgroup= make_seam_groups(me, &groups); + + if(totgroup==0) return; + + for(a=totgroup; a>0; a--) { + res= unwrap_lscm_face_group(me, groups, a); + if((res < 3) && (res > -1)) { + seam_group_normalize(me, groups, a); + } + else { + dopack = 0; + } + + } + + if(dopack) pack_seam_groups(me, groups, totgroup); + + MEM_freeN(groups); + +} + /* Set tface seams based on edge data, uses hash table to find seam edges. */ void set_seamtface() |