From c471b6db74d95d1a7a3a759e1597330129e64c9e Mon Sep 17 00:00:00 2001 From: Jiri Hnidek Date: Mon, 12 May 2008 16:22:49 +0000 Subject: [PATCH 01/19] Bug fix of #10999. mbproc->start was useless. --- source/blender/blenkernel/BKE_mball.h | 1 - source/blender/blenkernel/intern/mball.c | 14 ++++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/source/blender/blenkernel/BKE_mball.h b/source/blender/blenkernel/BKE_mball.h index 00a53b3f16e..d4fb2dbc8bf 100644 --- a/source/blender/blenkernel/BKE_mball.h +++ b/source/blender/blenkernel/BKE_mball.h @@ -91,7 +91,6 @@ typedef struct process { /* parameters, function, storage */ float (*function)(float, float, float); float size, delta; /* cube size, normal delta */ int bounds; /* cube range within lattice */ - MB_POINT start; /* start point on surface */ CUBES *cubes; /* active cubes */ VERTICES vertices; /* surface vertices */ CENTERLIST **centers; /* cube center hash table */ diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c index 0cd7736f6c3..242bcbf66d8 100644 --- a/source/blender/blenkernel/intern/mball.c +++ b/source/blender/blenkernel/intern/mball.c @@ -375,7 +375,7 @@ Object *find_basis_mball(Object *basis) #define RTF 7 /* right top far corner */ /* the LBN corner of cube (i, j, k), corresponds with location - * (start.x+(i-0.5)*size, start.y+(j-0.5)*size, start.z+(k-0.5)*size) */ + * (i-0.5)*size, (j-0.5)*size, (k-0.5)*size) */ #define HASHBIT (5) #define HASHSIZE (size_t)(1<<(3*HASHBIT)) /*! < hash table size (32768) */ @@ -836,11 +836,11 @@ CORNER *setcorner (PROCESS* p, int i, int j, int k) c = (CORNER *) new_pgn_element(sizeof(CORNER)); c->i = i; - c->x = p->start.x+((float)i-0.5f)*p->size; + c->x = ((float)i-0.5f)*p->size; c->j = j; - c->y = p->start.y+((float)j-0.5f)*p->size; + c->y = ((float)j-0.5f)*p->size; c->k = k; - c->z = p->start.z+((float)k-0.5f)*p->size; + c->z = ((float)k-0.5f)*p->size; c->value = p->function(c->x, c->y, c->z); c->next = p->corners[index]; @@ -1393,7 +1393,7 @@ void find_first_points(PROCESS *mbproc, MetaBall *mb, int a) c_i= (int)floor(workp.x/mbproc->size); c_j= (int)floor(workp.y/mbproc->size); c_k= (int)floor(workp.z/mbproc->size); - + /* add CUBE (with indexes c_i, c_j, c_k) to the stack, * this cube includes found point of Implicit Surface */ if (ml->flag & MB_NEGATIVE) @@ -1403,10 +1403,8 @@ void find_first_points(PROCESS *mbproc, MetaBall *mb, int a) } len = sqrt((workp.x-in.x)*(workp.x-in.x) + (workp.y-in.y)*(workp.y-in.y) + (workp.z-in.z)*(workp.z-in.z)); workp_v = tmp_v; + } - - mbproc->start.x= mbproc->start.y= mbproc->start.z= 0.0; - } } } From d2fcba7f65366440017178bcf21d4a8ad439fbcf Mon Sep 17 00:00:00 2001 From: Peter Schlaile Date: Mon, 12 May 2008 17:16:54 +0000 Subject: [PATCH 02/19] == Ipo == This fixes [#11118] Record Mouse in IPO Curve Editor 2.46rc3 and adds thereby a new feature: correct audio sync to IPO mouse recording :) --- source/blender/include/BSE_drawview.h | 2 +- source/blender/src/drawview.c | 8 +++--- source/blender/src/editipo.c | 35 +++++++++++++++++++++------ 3 files changed, 32 insertions(+), 13 deletions(-) diff --git a/source/blender/include/BSE_drawview.h b/source/blender/include/BSE_drawview.h index be1f5581be7..83031ff3bad 100644 --- a/source/blender/include/BSE_drawview.h +++ b/source/blender/include/BSE_drawview.h @@ -59,7 +59,7 @@ void drawview3d_render(struct View3D *v3d, int winx, int winy, float winmat[][4] void draw_depth(struct ScrArea *sa, void *spacedata); void view3d_update_depths(struct View3D *v3d); -int update_time(void); +int update_time(int cfra); void calc_viewborder(struct View3D *v3d, struct rctf *viewborder_r); void view3d_set_1_to_1_viewborder(struct View3D *v3d); diff --git a/source/blender/src/drawview.c b/source/blender/src/drawview.c index 15b7f3dbe67..52e0d3d6f05 100644 --- a/source/blender/src/drawview.c +++ b/source/blender/src/drawview.c @@ -3398,12 +3398,12 @@ static float redrawtimes_fps[REDRAW_FRAME_AVERAGE]; static short redrawtime_index; -int update_time(void) +int update_time(int cfra) { static double ltime; double time; - if ((audiostream_pos() != CFRA) + if ((audiostream_pos() != cfra) && (G.scene->audio.flag & AUDIO_SYNC)) { return 0; } @@ -3641,7 +3641,7 @@ void inner_play_anim_loop(int init, int mode) /* make sure that swaptime passed by */ tottime -= swaptime; - while (update_time()) { + while (update_time(CFRA)) { PIL_sleep_ms(1); } @@ -3700,7 +3700,7 @@ int play_anim(int mode) inner_play_prefetch_startup(mode); - update_time(); + update_time(CFRA); inner_play_anim_loop(1, mode); /* 1==init */ diff --git a/source/blender/src/editipo.c b/source/blender/src/editipo.c index a8b2ff761e5..c5dd41e16d5 100644 --- a/source/blender/src/editipo.c +++ b/source/blender/src/editipo.c @@ -116,6 +116,7 @@ #include "BSE_headerbuttons.h" #include "BSE_node.h" #include "BSE_sequence.h" +#include "BSE_seqaudio.h" #include "BSE_time.h" #include "blendef.h" @@ -5643,7 +5644,7 @@ void ipo_record(void) if(poin) ei1->icu->curval= read_ipo_poin(poin, type); or1= ei1->icu->curval; ei1->icu->flag |= IPO_LOCK; - + if(ei2) { if(ei2->icu==NULL) ei2->icu= verify_ipocurve(G.sipo->from, G.sipo->blocktype, G.sipo->actname, G.sipo->constname, G.sipo->bonename, ei2->adrcode); @@ -5671,8 +5672,9 @@ void ipo_record(void) } sa= sa->next; } + if(sa) areawinset(sa->win); - + /* can we? */ while(get_mbut()&L_MOUSE) BIF_wait_for_statechange(); data1= MEM_callocN(sizeof(float)*(EFRA-SFRA+1), "data1"); @@ -5681,14 +5683,18 @@ void ipo_record(void) getmouseco_areawin(mvalo); xn= mvalo[0]; yn= mvalo[1]; waitcursor(1); - + tottime= 0.0; swaptime= 1.0/FPS; cfrao= CFRA; cfra=efra= SFRA; sfra= EFRA; - + + if (G.scene->audio.flag & AUDIO_SYNC) { + audiostream_start(cfra); + } + while(afbreek==0) { getmouseco_areawin(mval); @@ -5698,7 +5704,7 @@ void ipo_record(void) else firsttime= 0; set_timecursor(cfra); - + /* do ipo: first all, then the specific ones */ if(anim==2) { do_ob_ipo(ob); @@ -5729,7 +5735,7 @@ void ipo_record(void) /* minimal wait swaptime */ tottime -= swaptime; - while (update_time()) PIL_sleep_ms(1); + while (update_time(cfra)) PIL_sleep_ms(1); screen_swapbuffers(); @@ -5739,8 +5745,18 @@ void ipo_record(void) mvalo[1]= mval[1]; if(anim || (G.qual & LR_CTRLKEY)) { - cfra++; - if(cfra>EFRA) cfra= SFRA; + if (G.scene->audio.flag & AUDIO_SYNC) { + cfra = audiostream_pos(); + } else { + cfra++; + } + if(cfra>EFRA) { + cfra= SFRA; + if (G.scene->audio.flag & AUDIO_SYNC) { + audiostream_stop(); + audiostream_start( cfra ); + } + } } } @@ -5793,6 +5809,9 @@ void ipo_record(void) editipo_changed(G.sipo, 0); do_ipo(G.sipo->ipo); waitcursor(0); + if (G.scene->audio.flag & AUDIO_SYNC) { + audiostream_stop(); + } allqueue(REDRAWVIEW3D, 0); if(sa) scrarea_queue_headredraw(sa); /* headerprint */ From 916120b98cb3477bbe0b1e84003ca1cdecf95e30 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 12 May 2008 17:30:32 +0000 Subject: [PATCH 03/19] Fix for bug #11114: boids physics went wrong when the distance between particles was exactly 0.0, for example with emission from verts. --- source/blender/blenkernel/intern/particle_system.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 596c381b896..5112fb08fe6 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -3770,10 +3770,12 @@ static void boid_brain(BoidVecFunc *bvf, ParticleData *pa, Object *ob, ParticleS near=0; for(n=1; nsize){ - bvf->Subf(dvec,pa->state.co,pars[ptn[n].index].state.co); - bvf->Mulf(dvec,(2.0f*pa->size-ptn[n].dist)/ptn[n].dist); - bvf->Addf(avoid,avoid,dvec); - near++; + if(ptn[n].dist!=0.0f) { + bvf->Subf(dvec,pa->state.co,pars[ptn[n].index].state.co); + bvf->Mulf(dvec,(2.0f*pa->size-ptn[n].dist)/ptn[n].dist); + bvf->Addf(avoid,avoid,dvec); + near++; + } } /* ptn[] is distance ordered so no need to check others */ else break; From f44c22e69c2bd386cda67b400e6351b9457e988c Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 12 May 2008 17:41:03 +0000 Subject: [PATCH 04/19] Fix for bug #11128: render window shows undithered image. --- source/blender/blenkernel/intern/image.c | 20 ++++-- source/blender/src/renderwin.c | 90 ++++++++++++------------ 2 files changed, 58 insertions(+), 52 deletions(-) diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index ff0b2e6db0a..bc44bfa988d 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -1728,31 +1728,38 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser) { RenderResult *rr= RE_GetResult(RE_GetRender(G.scene->id.name)); - if(rr && iuser) { + if(rr) { RenderResult rres; float *rectf; unsigned int *rect; - int channels= 4, layer= iuser->layer; + float dither; + int channels, layer, pass; + + channels= 4; + layer= (iuser)? iuser->layer: 0; + pass= (iuser)? iuser->pass: 0; /* this gives active layer, composite or seqence result */ RE_GetResultImage(RE_GetRender(G.scene->id.name), &rres); rect= (unsigned int *)rres.rect32; rectf= rres.rectf; - + dither= G.scene->r.dither_intensity; + /* get compo/seq result by default */ if(rr->rectf && layer==0); else if(rr->layers.first) { - RenderLayer *rl= BLI_findlink(&rr->layers, iuser->layer-(rr->rectf?1:0)); + RenderLayer *rl= BLI_findlink(&rr->layers, layer-(rr->rectf?1:0)); if(rl) { /* there's no combined pass, is in renderlayer itself */ - if(iuser->pass==0) { + if(pass==0) { rectf= rl->rectf; } else { - RenderPass *rpass= BLI_findlink(&rl->passes, iuser->pass-1); + RenderPass *rpass= BLI_findlink(&rl->passes, pass-1); if(rpass) { channels= rpass->channels; rectf= rpass->rect; + dither= 0.0f; /* don't dither passes */ } } } @@ -1779,6 +1786,7 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser) ibuf->channels= channels; ibuf->zbuf_float= rres.rectz; ibuf->flags |= IB_zbuffloat; + ibuf->dither= dither; ima->ok= IMA_OK_LOADED; return ibuf; diff --git a/source/blender/src/renderwin.c b/source/blender/src/renderwin.c index 7699de41381..6c150f3d30f 100644 --- a/source/blender/src/renderwin.c +++ b/source/blender/src/renderwin.c @@ -311,6 +311,8 @@ static void renderwin_draw_render_info(RenderWin *rw) static void renderwin_draw(RenderWin *rw, int just_clear) { + Image *ima; + ImBuf *ibuf; float fullrect[2][2]; int set_back_mainwindow; rcti rect; @@ -340,50 +342,45 @@ static void renderwin_draw(RenderWin *rw, int just_clear) glColor3ub(0, 0, 0); glRectfv(fullrect[0], fullrect[1]); } else { - RenderResult rres; RenderSpare *rspare= render_spare; if(rspare && rspare->showspare) { - if(rspare->ibuf) { - rres.rectx= rspare->ibuf->x; - rres.recty= rspare->ibuf->y; - rres.rect32= (int *)rspare->ibuf->rect; - rres.rectf= rspare->ibuf->rect_float; - rres.rectz= rspare->ibuf->zbuf_float; - } - else - memset(&rres, 0, sizeof(rres)); + ibuf= rspare->ibuf; + } + else { + ima= BKE_image_verify_viewer(IMA_TYPE_R_RESULT, "Render Result"); + ibuf= BKE_image_get_ibuf(ima, NULL); } - else - RE_GetResultImage(RE_GetRender(G.scene->id.name), &rres); - if(rres.rectf || rres.rect32) { + if(ibuf) { + if(!ibuf->rect) + IMB_rect_from_float(ibuf); glPixelZoom(rw->zoom, rw->zoom); if(rw->flags & RW_FLAGS_ALPHA) { - if(rres.rect32) { + if(ibuf->rect) { /* swap bytes, so alpha is most significant one, then just draw it as luminance int */ if(G.order==B_ENDIAN) glPixelStorei(GL_UNPACK_SWAP_BYTES, 1); - glaDrawPixelsSafe(fullrect[0][0], fullrect[0][1], rres.rectx, rres.recty, rres.rectx, GL_LUMINANCE, GL_UNSIGNED_INT, rres.rect32); + glaDrawPixelsSafe(fullrect[0][0], fullrect[0][1], ibuf->x, ibuf->y, ibuf->x, GL_LUMINANCE, GL_UNSIGNED_INT, ibuf->rect); glPixelStorei(GL_UNPACK_SWAP_BYTES, 0); } else { - float *trectf= MEM_mallocN(rres.rectx*rres.recty*4, "temp"); + float *trectf= MEM_mallocN(ibuf->x*ibuf->y*4, "temp"); int a, b; - for(a= rres.rectx*rres.recty -1, b= 4*a+3; a>=0; a--, b-=4) - trectf[a]= rres.rectf[b]; + for(a= ibuf->x*ibuf->y -1, b= 4*a+3; a>=0; a--, b-=4) + trectf[a]= ibuf->rect_float[b]; - glaDrawPixelsSafe(fullrect[0][0], fullrect[0][1], rres.rectx, rres.recty, rres.rectx, GL_LUMINANCE, GL_FLOAT, trectf); + glaDrawPixelsSafe(fullrect[0][0], fullrect[0][1], ibuf->x, ibuf->y, ibuf->x, GL_LUMINANCE, GL_FLOAT, trectf); MEM_freeN(trectf); } } else { - if(rres.rect32) - glaDrawPixelsSafe(fullrect[0][0], fullrect[0][1], rres.rectx, rres.recty, rres.rectx, GL_RGBA, GL_UNSIGNED_BYTE, rres.rect32); - else if(rres.rectf) - glaDrawPixelsSafe_to32(fullrect[0][0], fullrect[0][1], rres.rectx, rres.recty, rres.rectx, rres.rectf); + if(ibuf->rect) + glaDrawPixelsSafe(fullrect[0][0], fullrect[0][1], ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect); + else if(ibuf->rect_float) + glaDrawPixelsSafe_to32(fullrect[0][0], fullrect[0][1], ibuf->x, ibuf->y, ibuf->x, ibuf->rect_float); } glPixelZoom(1.0, 1.0); } @@ -431,22 +428,20 @@ static void renderwin_zoom(RenderWin *rw, int ZoomIn) { static void renderwin_mouse_moved(RenderWin *rw) { - RenderResult rres; + Image *ima; + ImBuf *ibuf; RenderSpare *rspare= render_spare; if(rspare && rspare->showspare) { - if(rspare->ibuf) { - rres.rectx= rspare->ibuf->x; - rres.recty= rspare->ibuf->y; - rres.rect32= (int *)rspare->ibuf->rect; - rres.rectf= rspare->ibuf->rect_float; - rres.rectz= rspare->ibuf->zbuf_float; - } - else - memset(&rres, 0, sizeof(rres)); + ibuf= rspare->ibuf; } - else - RE_GetResultImage(RE_GetRender(G.scene->id.name), &rres); + else { + ima= BKE_image_verify_viewer(IMA_TYPE_R_RESULT, "Render Result"); + ibuf= BKE_image_get_ibuf(ima, NULL); + } + + if(!ibuf) + return; if (rw->flags & RW_FLAGS_PIXEL_EXAMINING) { int imgco[2], ofs=0; @@ -455,19 +450,19 @@ static void renderwin_mouse_moved(RenderWin *rw) if (renderwin_win_to_image_co(rw, rw->lmouse, imgco)) { ofs= sprintf(buf, "X: %d Y: %d ", imgco[0], imgco[1]); - if (rres.rect32) { - pxl= (char*) &rres.rect32[rres.rectx*imgco[1] + imgco[0]]; + if (ibuf->rect) { + pxl= (char*) &ibuf->rect[ibuf->x*imgco[1] + imgco[0]]; ofs+= sprintf(buf+ofs, " | R: %d G: %d B: %d A: %d", pxl[0], pxl[1], pxl[2], pxl[3]); } - if (rres.rectf) { - float *pxlf= rres.rectf + 4*(rres.rectx*imgco[1] + imgco[0]); - if(!rres.rect32){ + if (ibuf->rect_float) { + float *pxlf= ibuf->rect_float + 4*(ibuf->x*imgco[1] + imgco[0]); + if(!ibuf->rect) { ofs+= sprintf(buf+ofs, " | R: %d G: %d B: %d A: %d", FTOCHAR(pxlf[0]), FTOCHAR(pxlf[1]), FTOCHAR(pxlf[2]), FTOCHAR(pxlf[3])); } ofs+= sprintf(buf+ofs, " | R: %.3f G: %.3f B: %.3f A: %.3f ", pxlf[0], pxlf[1], pxlf[2], pxlf[3]); } - if (rres.rectz) { - float *pxlz= &rres.rectz[rres.rectx*imgco[1] + imgco[0]]; + if (ibuf->zbuf_float) { + float *pxlz= &ibuf->zbuf_float[ibuf->x*imgco[1] + imgco[0]]; sprintf(buf+ofs, "| Z: %.3f", *pxlz ); } @@ -484,8 +479,8 @@ static void renderwin_mouse_moved(RenderWin *rw) rw->zoomofs[0]= rw->pan_ofs_start[0] - delta_x/rw->zoom; rw->zoomofs[1]= rw->pan_ofs_start[1] - delta_y/rw->zoom; - rw->zoomofs[0]= CLAMPIS(rw->zoomofs[0], -rres.rectx/2, rres.rectx/2); - rw->zoomofs[1]= CLAMPIS(rw->zoomofs[1], -rres.recty/2, rres.recty/2); + rw->zoomofs[0]= CLAMPIS(rw->zoomofs[0], -ibuf->x/2, ibuf->x/2); + rw->zoomofs[1]= CLAMPIS(rw->zoomofs[1], -ibuf->y/2, ibuf->y/2); renderwin_queue_redraw(rw); } @@ -497,8 +492,8 @@ static void renderwin_mouse_moved(RenderWin *rw) h-= RW_HEADERY; renderwin_win_to_ndc(rw, rw->lmouse, ndc); - rw->zoomofs[0]= -0.5*ndc[0]*(w-rres.rectx*rw->zoom)/rw->zoom; - rw->zoomofs[1]= -0.5*ndc[1]*(h-rres.recty*rw->zoom)/rw->zoom; + rw->zoomofs[0]= -0.5*ndc[0]*(w-ibuf->x*rw->zoom)/rw->zoom; + rw->zoomofs[1]= -0.5*ndc[1]*(h-ibuf->y*rw->zoom)/rw->zoom; renderwin_queue_redraw(rw); } @@ -1186,6 +1181,7 @@ static int render_store_spare(void) RE_GetResultImage(RE_GetRender(G.scene->id.name), &rres); rspare->ibuf= IMB_allocImBuf(rres.rectx, rres.recty, 32, 0, 0); + rspare->ibuf->dither= G.scene->r.dither_intensity; if(rres.rect32) { rspare->ibuf->rect= MEM_dupallocN(rres.rect32); @@ -1291,6 +1287,8 @@ void BIF_do_render(int anim) allqueue(REDRAWNODE, 1); allqueue(REDRAWIMAGE, 1); } + if(G.scene->r.dither_intensity != 0.0f) + BIF_redraw_render_rect(); if (slink_flag) G.f |= G_DOSCRIPTLINKS; if (G.f & G_DOSCRIPTLINKS) BPY_do_all_scripts(SCRIPT_POSTRENDER); } From 4903751c4de3dff2a7ac9aae5ab6559b974c3714 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 12 May 2008 18:30:50 +0000 Subject: [PATCH 05/19] mirror face UVs and color was rotating, shift for alternate axis also wasnt implimented --- source/blender/src/editmesh_tools.c | 107 +++++++++++++++++++--------- 1 file changed, 75 insertions(+), 32 deletions(-) diff --git a/source/blender/src/editmesh_tools.c b/source/blender/src/editmesh_tools.c index 7d589e160c8..d4ebe181218 100644 --- a/source/blender/src/editmesh_tools.c +++ b/source/blender/src/editmesh_tools.c @@ -6758,7 +6758,7 @@ void mesh_mirror_uvs(void) { EditMesh *em = G.editMesh; EditFace *efa; - short change = 0; + short change = 0, altaxis; MTFace *tf; float u1, v1; @@ -6767,32 +6767,64 @@ void mesh_mirror_uvs(void) return; } + altaxis = (G.qual == LR_SHIFTKEY); + 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; - + if (altaxis) { 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]; + if(efa->v4) { + + 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; + tf->uv[2][0]= u1; + tf->uv[2][1]= v1; + + u1= tf->uv[3][0]; + v1= tf->uv[3][1]; + + tf->uv[3][0]= tf->uv[0][0]; + tf->uv[3][1]= tf->uv[0][1]; + + tf->uv[0][0]= u1; + tf->uv[0][1]= v1; + } + else { + 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 { + u1= tf->uv[0][0]; + v1= tf->uv[0][1]; + if(efa->v4) { + + tf->uv[0][0]= tf->uv[1][0]; + tf->uv[0][1]= tf->uv[1][1]; + + tf->uv[1][0]= u1; + tf->uv[1][1]= v1; + + u1= tf->uv[3][0]; + v1= tf->uv[3][1]; + + tf->uv[3][0]= tf->uv[2][0]; + tf->uv[3][1]= tf->uv[2][1]; + + tf->uv[2][0]= u1; + tf->uv[2][1]= v1; + } + else { + tf->uv[0][0]= tf->uv[1][0]; + tf->uv[0][1]= tf->uv[1][1]; + tf->uv[1][0]= u1; + tf->uv[1][1]= v1; + } } change = 1; } @@ -6858,27 +6890,38 @@ void mesh_mirror_colors(void) { EditMesh *em = G.editMesh; EditFace *efa; - short change = 0; + short change = 0, altaxis; MCol tmpcol, *mcol; if (!EM_vertColorCheck()) { error("mesh has no color layers"); return; } + altaxis = (G.qual == LR_SHIFTKEY); + 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 { + if (altaxis) { + tmpcol= mcol[1]; + mcol[1]= mcol[2]; mcol[2]= tmpcol; + + if(efa->v4) { + tmpcol= mcol[0]; + mcol[0]= mcol[3]; + mcol[3]= tmpcol; + } + } else { + tmpcol= mcol[0]; + mcol[0]= mcol[1]; + mcol[1]= tmpcol; + + if(efa->v4) { + tmpcol= mcol[2]; + mcol[2]= mcol[3]; + mcol[3]= tmpcol; + } } change = 1; } From a0cd3d67ed6d26abbba98e85511448d808e3c275 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 12 May 2008 20:59:46 +0000 Subject: [PATCH 06/19] confined unprofessional print to debug mode ;) --- source/blender/src/interface_icons.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/src/interface_icons.c b/source/blender/src/interface_icons.c index 641669e2168..ae9dc2b0dc5 100644 --- a/source/blender/src/interface_icons.c +++ b/source/blender/src/interface_icons.c @@ -938,8 +938,8 @@ static void icon_draw_rect(float x, float y, int w, int h, float aspect, int rw, { ui_rasterpos_safe(x, y, aspect); - if(w<1 || h<1) { - printf("what the heck!\n"); + if((w<1 || h<1) && G.f & G_DEBUG) { + printf("what the heck! - icons are %i x %i zero pixels?\n", w, h); } /* rect contains image in 'rendersize', we only scale if needed */ else if(rw!=w && rh!=h) { From ac71783e8dccdb42afb8e68ae077902185bb42c0 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 12 May 2008 21:12:10 +0000 Subject: [PATCH 07/19] last commit had a typo, also adjusted teh and colour instances --- source/blender/blenlib/intern/boxpack2d.c | 2 +- source/blender/python/api2_2x/doc/Image.py | 2 +- source/blender/python/api2_2x/doc/Texture.py | 8 ++++---- source/blender/render/intern/source/rayshade.c | 8 ++++---- source/blender/src/buttons_editing.c | 4 ++-- source/blender/src/buttons_shading.c | 6 +++--- source/blender/src/drawaction.c | 4 ++-- source/blender/src/drawarmature.c | 10 +++++----- source/blender/src/editaction.c | 4 ++-- source/blender/src/editview.c | 2 +- source/blender/src/interface_icons.c | 2 +- source/blender/src/usiblender.c | 4 ++-- source/blender/src/view.c | 2 +- source/gameengine/Ketsji/KX_Light.cpp | 2 +- 14 files changed, 30 insertions(+), 30 deletions(-) diff --git a/source/blender/blenlib/intern/boxpack2d.c b/source/blender/blenlib/intern/boxpack2d.c index 21810613c7f..acd53e5d516 100644 --- a/source/blender/blenlib/intern/boxpack2d.c +++ b/source/blender/blenlib/intern/boxpack2d.c @@ -130,7 +130,7 @@ static int vertex_sort(const void *p1, const void *p2) * 'box->index' is not used at all, the only reason its there * is that the box array is sorted by area and programs need to be able * to have some way of writing the boxes back to the original data. - * len - the number of boxes in teh array. + * len - the number of boxes in the array. * tot_width and tot_height are set so you can normalize the data. * */ void boxPack2D(boxPack *boxarray, int len, float *tot_width, float *tot_height) diff --git a/source/blender/python/api2_2x/doc/Image.py b/source/blender/python/api2_2x/doc/Image.py index 92a05c2604d..564cac3ef9b 100644 --- a/source/blender/python/api2_2x/doc/Image.py +++ b/source/blender/python/api2_2x/doc/Image.py @@ -48,7 +48,7 @@ def New (name, width, height, depth): @type height: int @param height: The height of the new Image object, between 1 and 5000. @type depth: int - @param depth: The colour depth of the new Image object. (32:RGBA 8bit channels, 128:RGBA 32bit high dynamic range float channels). + @param depth: The color depth of the new Image object. (32:RGBA 8bit channels, 128:RGBA 32bit high dynamic range float channels). @rtype: Blender Image @return: A new Blender Image object. """ diff --git a/source/blender/python/api2_2x/doc/Texture.py b/source/blender/python/api2_2x/doc/Texture.py index 5161ac5ea56..7f42d06240b 100644 --- a/source/blender/python/api2_2x/doc/Texture.py +++ b/source/blender/python/api2_2x/doc/Texture.py @@ -80,7 +80,7 @@ Example:: @type ExtendModes: readonly dictionary @var ExtendModes: Extend, clip, repeat or checker modes for image textures - - EXTEND - Extends the colour of the edge + - EXTEND - Extends the color of the edge - CLIP - Return alpha 0.0 outside image - CLIPCUBE - Return alpha 0.0 around cube-shaped area around image - REPEAT - Repeat image vertically and horizontally @@ -209,10 +209,10 @@ Example:: @type TexCo: readonly dictionary @var MapTo: Flags for MTex.mapto. - - COL - Make the texture affect the basic colour of the material + - COL - Make the texture affect the basic color of the material - NOR - Make the texture affect the rendered normal - - CSP - Make the texture affect the specularity colour - - CMIR - Make the texture affect the mirror colour + - CSP - Make the texture affect the specularity color + - CMIR - Make the texture affect the mirror color - REF - Make the texture affect the diffuse reflectivity value - SPEC - Make the texture affect the specularity value - HARD - Make the texture affect the hardness value diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c index 6aee1d2a883..8fd07001bd1 100644 --- a/source/blender/render/intern/source/rayshade.c +++ b/source/blender/render/intern/source/rayshade.c @@ -384,7 +384,7 @@ static float shade_by_transmission(Isect *is, ShadeInput *shi, ShadeResult *shr) static void ray_fadeout_endcolor(float *col, ShadeInput *origshi, ShadeInput *shi, ShadeResult *shr, Isect *isec, float *vec) { - /* un-intersected rays get either rendered material colour or sky colour */ + /* un-intersected rays get either rendered material color or sky color */ if (origshi->mat->fadeto_mir == MA_RAYMIR_FADETOMAT) { VECCOPY(col, shr->combined); } else if (origshi->mat->fadeto_mir == MA_RAYMIR_FADETOSKY) { @@ -397,7 +397,7 @@ static void ray_fadeout_endcolor(float *col, ShadeInput *origshi, ShadeInput *sh static void ray_fadeout(Isect *is, ShadeInput *shi, float *col, float *blendcol, float dist_mir) { - /* if fading out, linear blend against fade colour */ + /* if fading out, linear blend against fade color */ float blendfac; blendfac = 1.0 - VecLenf(shi->co, is->start)/dist_mir; @@ -544,8 +544,8 @@ static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, flo if (dist_mir > 0.0) { float blendcol[3]; - /* max ray distance set, but found an intersection, so fade this colour - * out towards the sky/material colour for a smooth transition */ + /* max ray distance set, but found an intersection, so fade this color + * out towards the sky/material color for a smooth transition */ ray_fadeout_endcolor(blendcol, origshi, &shi, origshr, &isec, vec); ray_fadeout(&isec, &shi, col, blendcol, dist_mir); } diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c index 376d89389ee..2ffec207e84 100644 --- a/source/blender/src/buttons_editing.c +++ b/source/blender/src/buttons_editing.c @@ -5333,7 +5333,7 @@ static void editing_panel_links(Object *ob) uiDefBut(block, BUT, B_POSEGRP_ADD, "Add Group", xco,110,140,20, 0, 21, 0, 0, 0, "Add a new Bone Group for the Pose"); uiBlockEndAlign(block); - /* colour set for 'active' group */ + /* color set for 'active' group */ if (pose->active_group && grp) { uiBlockBeginAlign(block); menustr= build_colorsets_menustr(); @@ -5350,7 +5350,7 @@ static void editing_panel_links(Object *ob) memcpy(&grp->cs, col_set, sizeof(ThemeWireColor)); } else { - /* init custom colours with a generic multi-colour rgb set, if not initialised already */ + /* init custom colors with a generic multi-color rgb set, if not initialised already */ if (grp->cs.solid[0] == 0) { /* define for setting colors in theme below */ #define SETCOL(col, r, g, b, a) col[0]=r; col[1]=g; col[2]= b; col[3]= a; diff --git a/source/blender/src/buttons_shading.c b/source/blender/src/buttons_shading.c index 69b1121da84..a4ddd55d2f0 100644 --- a/source/blender/src/buttons_shading.c +++ b/source/blender/src/buttons_shading.c @@ -3298,10 +3298,10 @@ static void material_panel_map_to(Object *ob, Material *ma, int from_nodes) uiBlockSetCol(block, TH_AUTO); } else { - uiDefButBitS(block, TOG, MAP_COL, B_MATPRV, "Col", 10,180,40,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect basic colour of the material"); + uiDefButBitS(block, TOG, MAP_COL, B_MATPRV, "Col", 10,180,40,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect basic color of the material"); uiDefButBitS(block, TOG3, MAP_NORM, B_MATPRV, "Nor", 50,180,40,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the rendered normal"); - uiDefButBitS(block, TOG, MAP_COLSPEC, B_MATPRV, "Csp", 90,180,40,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the specularity colour"); - uiDefButBitS(block, TOG, MAP_COLMIR, B_MATPRV, "Cmir", 130,180,50,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the mirror colour"); + uiDefButBitS(block, TOG, MAP_COLSPEC, B_MATPRV, "Csp", 90,180,40,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the specularity color"); + uiDefButBitS(block, TOG, MAP_COLMIR, B_MATPRV, "Cmir", 130,180,50,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the mirror color"); uiDefButBitS(block, TOG3, MAP_REF, B_MATPRV, "Ref", 180,180,40,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the value of the materials reflectivity"); uiDefButBitS(block, TOG3, MAP_SPEC, B_MATPRV, "Spec", 220,180,50,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the value of specularity"); uiDefButBitS(block, TOG3, MAP_AMB, B_MATPRV, "Amb", 270,180,40,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the value of ambient"); diff --git a/source/blender/src/drawaction.c b/source/blender/src/drawaction.c index 1a742440e9b..65221dceaf9 100644 --- a/source/blender/src/drawaction.c +++ b/source/blender/src/drawaction.c @@ -634,7 +634,7 @@ static void draw_channel_names(void) } else { /* for normal channels - * - use 3 shades of color group/standard colour for 3 indention level + * - use 3 shades of color group/standard color for 3 indention level * - only use group colors if allowed to, and if actually feasible */ if ( !(G.saction->flag & SACTION_NODRAWGCOLORS) && @@ -1254,7 +1254,7 @@ static void draw_key_but(int x, int y, short w, short h, int sel) int xmax= x+w-1, ymax= y+h-1; int xc= (xmin+xmax)/2, yc= (ymin+ymax)/2; - /* interior - hardcoded colours (for selected and unselected only) */ + /* interior - hardcoded colors (for selected and unselected only) */ if (sel) glColor3ub(0xF1, 0xCA, 0x13); else glColor3ub(0xE9, 0xE9, 0xE9); diff --git a/source/blender/src/drawarmature.c b/source/blender/src/drawarmature.c index 9b8905b782b..99de2c1583d 100644 --- a/source/blender/src/drawarmature.c +++ b/source/blender/src/drawarmature.c @@ -96,7 +96,7 @@ static ThemeWireColor *bcolor= NULL; /* values of colCode for set_pchan_glcolor */ enum { PCHAN_COLOR_NORMAL = 0, /* normal drawing */ - PCHAN_COLOR_SOLID, /* specific case where "solid" colour is needed */ + PCHAN_COLOR_SOLID, /* specific case where "solid" color is needed */ PCHAN_COLOR_CONSTS, /* "constraint" colors (which may/may-not be suppressed) */ PCHAN_COLOR_SPHEREBONE_BASE, /* for the 'stick' of sphere (envelope) bones */ @@ -1186,7 +1186,7 @@ static void draw_b_bone(int dt, int armflag, int boneflag, int constflag, unsign /* wire */ if (armflag & ARM_POSEMODE) { if (constflag) { - /* set constraint colours */ + /* set constraint colors */ if (set_pchan_glColor(PCHAN_COLOR_CONSTS, armflag, boneflag, constflag)) { glEnable(GL_BLEND); @@ -1645,7 +1645,7 @@ static void draw_pose_channels(Base *base, int dt) glPushMatrix(); glMultMatrixf(pchan->pose_mat); - /* prepare colours */ + /* prepare colors */ if (arm->flag & ARM_POSEMODE) set_pchan_colorset(ob, pchan); else { @@ -2090,7 +2090,7 @@ static void draw_pose_paths(Object *ob) for (a=0, fp=fp_start; acs, col_set, sizeof(ThemeWireColor)); } else { - /* init custom colours with a generic multi-colour rgb set, if not initialised already */ + /* init custom colors with a generic multi-color rgb set, if not initialised already */ if (agrp->cs.solid[0] == 0) { /* define for setting colors in theme below */ #define SETCOL(col, r, g, b, a) col[0]=r; col[1]=g; col[2]= b; col[3]= a; @@ -1221,7 +1221,7 @@ void sync_pchan2achan_grouping () achan->grp = NULL; BLI_freelistN(&act->groups); - /* loop through all achans, reassigning them to groups (colours are resyncronised) */ + /* loop through all achans, reassigning them to groups (colors are resyncronised) */ last= act->chanbase.last; for (achan= act->chanbase.first; achan && achan!=last; achan= next) { next= achan->next; diff --git a/source/blender/src/editview.c b/source/blender/src/editview.c index b7fbddc520f..e3ec69975de 100644 --- a/source/blender/src/editview.c +++ b/source/blender/src/editview.c @@ -2764,7 +2764,7 @@ void fly(void) do_screenhandlers(G.curscreen); /* advance the next frame */ - /* we are in camera view so apply the view ofs and quat to the view matrix and set the camera to teh view */ + /* we are in camera view so apply the view ofs and quat to the view matrix and set the camera to the view */ if (G.vd->persp==V3D_CAMOB) { G.vd->persp= V3D_PERSP; /*set this so setviewmatrixview3d uses the ofs and quat instead of the camera */ setviewmatrixview3d(); diff --git a/source/blender/src/interface_icons.c b/source/blender/src/interface_icons.c index ae9dc2b0dc5..bd06e461745 100644 --- a/source/blender/src/interface_icons.c +++ b/source/blender/src/interface_icons.c @@ -939,7 +939,7 @@ static void icon_draw_rect(float x, float y, int w, int h, float aspect, int rw, ui_rasterpos_safe(x, y, aspect); if((w<1 || h<1) && G.f & G_DEBUG) { - printf("what the heck! - icons are %i x %i zero pixels?\n", w, h); + printf("what the heck! - icons are %i x %i pixels?\n", w, h); } /* rect contains image in 'rendersize', we only scale if needed */ else if(rw!=w && rh!=h) { diff --git a/source/blender/src/usiblender.c b/source/blender/src/usiblender.c index 8d6bf830dbf..6c0838288b8 100644 --- a/source/blender/src/usiblender.c +++ b/source/blender/src/usiblender.c @@ -389,7 +389,7 @@ static void init_userdef_file(void) if ((G.main->versionfile < 245) || (G.main->versionfile == 245 && G.main->subversionfile < 11)) { bTheme *btheme; for (btheme= U.themes.first; btheme; btheme= btheme->next) { - /* these should all use the same colour */ + /* these should all use the same color */ SETCOL(btheme->tv3d.cframe, 0x60, 0xc0, 0x40, 255); SETCOL(btheme->tipo.cframe, 0x60, 0xc0, 0x40, 255); SETCOL(btheme->tact.cframe, 0x60, 0xc0, 0x40, 255); @@ -402,7 +402,7 @@ static void init_userdef_file(void) if ((G.main->versionfile < 245) || (G.main->versionfile == 245 && G.main->subversionfile < 13)) { bTheme *btheme; for (btheme= U.themes.first; btheme; btheme= btheme->next) { - /* action channel groups (recolour anyway) */ + /* action channel groups (recolor anyway) */ SETCOL(btheme->tact.group, 0x39, 0x7d, 0x1b, 255); SETCOL(btheme->tact.group_active, 0x7d, 0xe9, 0x60, 255); diff --git a/source/blender/src/view.c b/source/blender/src/view.c index 163a116371d..3dae0118bf4 100644 --- a/source/blender/src/view.c +++ b/source/blender/src/view.c @@ -2111,7 +2111,7 @@ void smooth_view(View3D *v3d, float *ofs, float *quat, float *dist, float *lens) changed = 1; } - /* The new view is different from teh old one + /* The new view is different from the old one * so animate the view */ if (changed) { diff --git a/source/gameengine/Ketsji/KX_Light.cpp b/source/gameengine/Ketsji/KX_Light.cpp index 3ae09c01270..7decc5bc769 100644 --- a/source/gameengine/Ketsji/KX_Light.cpp +++ b/source/gameengine/Ketsji/KX_Light.cpp @@ -223,7 +223,7 @@ char KX_LightObject::doc[] = "Module KX_LightObject\n\n" "\t\tThe effect radius of the light.\n" "\tcolour -> list [r, g, b].\n" "\tcolor -> list [r, g, b].\n" -"\t\tThe colour of the light.\n" +"\t\tThe color of the light.\n" "\tlin_attenuation -> float.\n" "\t\tThe attenuation factor for the light.\n" "\tspotsize -> float.\n" From af30d9b2b045a84d3ceaabee6ae1f31bdc8763cd Mon Sep 17 00:00:00 2001 From: Geoffrey Bantle Date: Tue, 13 May 2008 02:22:57 +0000 Subject: [PATCH 08/19] -> Fix for bug in 'Select Non-Manifold' Select non-manifold would select stray vertices even when in non-vertex modes. Fixed. --- source/blender/src/editmesh_mods.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/source/blender/src/editmesh_mods.c b/source/blender/src/editmesh_mods.c index 81d79de08c5..15a678e0ecc 100644 --- a/source/blender/src/editmesh_mods.c +++ b/source/blender/src/editmesh_mods.c @@ -3187,12 +3187,14 @@ void select_non_manifold(void) } /* select isolated verts */ - eve= em->verts.first; - while(eve) { - if (eve->f1 == 0) { - if (!eve->h) eve->f |= SELECT; + if(G.scene->selectmode & SCE_SELECT_VERTEX) { + eve= em->verts.first; + while(eve) { + if (eve->f1 == 0) { + if (!eve->h) eve->f |= SELECT; + } + eve= eve->next; } - eve= eve->next; } countall(); From 4e59c3ec5347fa11b34d3795c0da3acc900a6594 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 13 May 2008 06:12:33 +0000 Subject: [PATCH 09/19] [#11152] [C] key shortcut is broken in UV/Image Editor Only allow this inside paint mode. --- source/blender/src/drawimage.c | 6 +++++- source/blender/src/header_image.c | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/source/blender/src/drawimage.c b/source/blender/src/drawimage.c index 09ba518565f..d8e94bd2ff7 100644 --- a/source/blender/src/drawimage.c +++ b/source/blender/src/drawimage.c @@ -1485,7 +1485,11 @@ static void image_panel_paint(short cntrl) // IMAGE_HANDLER_PAINT uiBlock *block; ID *id; int yco, xco, butw; - + + if ((G.sima->image && (G.sima->flag & SI_DRAWTOOL))==0) { + return; + } + block= uiNewBlock(&curarea->uiblocks, "image_panel_paint", UI_EMBOSS, UI_HELV, curarea->win); uiPanelControl(UI_PNL_SOLID | UI_PNL_CLOSE | cntrl); uiSetPanelHandler(IMAGE_HANDLER_PAINT); // for close and esc diff --git a/source/blender/src/header_image.c b/source/blender/src/header_image.c index a93e79fa773..341cce30c4e 100644 --- a/source/blender/src/header_image.c +++ b/source/blender/src/header_image.c @@ -476,7 +476,9 @@ static uiBlock *image_viewmenu(void *arg_unused) uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "View Properties...", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, ""); uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Image Properties...|N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 7, ""); uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Real-time Properties...", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 13, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Paint Tool...|C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 8, ""); + if (G.sima->image && (G.sima->flag & SI_DRAWTOOL)) { + uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Paint Tool...|C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 8, ""); + } uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Curves Tool...", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 11, ""); uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Composite Preview...|Shift P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 12, ""); From 33120a18250ab088be663305ff8542a729f00cb4 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 13 May 2008 10:04:04 +0000 Subject: [PATCH 10/19] disabled drawing the 2d image cursor when painting, added copy bevel weight to the edge copy menu. --- source/blender/src/drawimage.c | 5 ++++- source/blender/src/editmesh_mods.c | 12 ++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/source/blender/src/drawimage.c b/source/blender/src/drawimage.c index d8e94bd2ff7..547de85e856 100644 --- a/source/blender/src/drawimage.c +++ b/source/blender/src/drawimage.c @@ -367,7 +367,10 @@ static void drawcursor_sima(float xuser_asp, float yuser_asp) int wi, hi; float w, h; - if (!G.obedit || !CustomData_has_layer(&G.editMesh->fdata, CD_MTFACE)) return; + if ( !G.obedit || /* only draw cursor in editmode */ + !CustomData_has_layer(&G.editMesh->fdata, CD_MTFACE) || /* must have UV's */ + (G.sima->image && G.sima->flag & SI_DRAWTOOL) /* cant be painting */ + ) return; transform_width_height_tface_uv(&wi, &hi); w = (((float)wi)/256.0f)*G.sima->zoom * xuser_asp; diff --git a/source/blender/src/editmesh_mods.c b/source/blender/src/editmesh_mods.c index 15a678e0ecc..d5e34779173 100644 --- a/source/blender/src/editmesh_mods.c +++ b/source/blender/src/editmesh_mods.c @@ -1458,7 +1458,7 @@ void mesh_copy_menu(void) eed_act = (EditEdge*)ese->data; - ret= pupmenu("Copy Active Edge to Selected%t|Crease%x1|Length%x2"); + ret= pupmenu("Copy Active Edge to Selected%t|Crease%x1|Bevel Weight%x2|Length%x3"); if (ret<1) return; eed_len_act = VecLenf(eed_act->v1->co, eed_act->v2->co); @@ -1472,8 +1472,16 @@ void mesh_copy_menu(void) } } break; + case 2: /* copy bevel weight */ + for(eed=em->edges.first; eed; eed=eed->next) { + if (eed->f & SELECT && eed != eed_act && eed->bweight != eed_act->bweight) { + eed->bweight = eed_act->bweight; + change = 1; + } + } + break; - case 2: /* copy length */ + case 3: /* copy length */ for(eed=em->edges.first; eed; eed=eed->next) { if (eed->f & SELECT && eed != eed_act) { From f4a20f4cc1a70cb9b208b2b44c3d28f39ce8ef11 Mon Sep 17 00:00:00 2001 From: Martin Poirier Date: Tue, 13 May 2008 10:17:46 +0000 Subject: [PATCH 11/19] [#8146] Objects rotate in wrong direction when using numeric input (R x ) Don't flip axis to face camera on num input. --- source/blender/src/transform_constraints.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/blender/src/transform_constraints.c b/source/blender/src/transform_constraints.c index 1b85962a768..769ebd2ea97 100644 --- a/source/blender/src/transform_constraints.c +++ b/source/blender/src/transform_constraints.c @@ -412,7 +412,8 @@ static void applyAxisConstraintRot(TransInfo *t, TransData *td, float vec[3]) VECCOPY(vec, t->con.mtx[2]); break; } - if (!(mode & CON_NOFLIP)) { + /* don't flip axis if asked to or if num input */ + if (!(mode & CON_NOFLIP) && hasNumInput(&t->num) == 0) { if (Inpf(vec, t->viewinv[2]) > 0.0f) { VecMulf(vec, -1.0f); } From b303fa96accd62c76fc8182c4a542965d406a814 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 13 May 2008 10:19:28 +0000 Subject: [PATCH 12/19] canceling UV transform would still run the be_square function --- source/blender/src/transform_conversions.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/src/transform_conversions.c b/source/blender/src/transform_conversions.c index 9a9a454ef3d..6636c435b8c 100644 --- a/source/blender/src/transform_conversions.c +++ b/source/blender/src/transform_conversions.c @@ -2306,7 +2306,7 @@ void flushTransUVs(TransInfo *t) } /* always call this, also for cancel (it transforms non-selected vertices...) */ - if((G.sima->flag & SI_BE_SQUARE)) + if((G.sima->flag & SI_BE_SQUARE) && (t->state != TRANS_CANCEL)) be_square_tface_uv(em); /* this is overkill if G.sima->lock is not set, but still needed */ From 2c4fd39142fee49a0b83e4fa04c72abc1a3eb709 Mon Sep 17 00:00:00 2001 From: Martin Poirier Date: Tue, 13 May 2008 13:20:47 +0000 Subject: [PATCH 13/19] Todo [#5743] Rotate dosnt work at high zoom Fixed by only conditionally resetting the start of the triangle used to calculate the angle to when an angle is actually measured (so really small angle don't result in continuous deltas of 0 degree). However, the smallest rotation angle is still limited by the precision of the acos function (here: 0.02 degrees, 0.02 / 30 with Shift pressed). --- source/blender/src/transform.c | 120 +++++++++++---------------------- 1 file changed, 38 insertions(+), 82 deletions(-) diff --git a/source/blender/src/transform.c b/source/blender/src/transform.c index 6e4641a4d12..0b3cd92c565 100644 --- a/source/blender/src/transform.c +++ b/source/blender/src/transform.c @@ -243,6 +243,41 @@ float InputVerticalAbsolute(TransInfo *t, short mval[2]) { return Inpf(t->viewinv[1], vec) * 2.0f; } +float InputDeltaAngle(TransInfo *t, short mval[2]) +{ + double dx2 = t->center2d[0] - mval[0]; + double dy2 = t->center2d[1] - mval[1]; + double B = sqrt(dx2*dx2+dy2*dy2); + + double dx1 = t->center2d[0] - t->imval[0]; + double dy1 = t->center2d[1] - t->imval[1]; + double A = sqrt(dx1*dx1+dy1*dy1); + + double dx3 = mval[0] - t->imval[0]; + double dy3 = mval[1] - t->imval[1]; + + /* use doubles here, to make sure a "1.0" (no rotation) doesnt become 9.999999e-01, which gives 0.02 for acos */ + double deler = ((dx1*dx1+dy1*dy1)+(dx2*dx2+dy2*dy2)-(dx3*dx3+dy3*dy3)) + / (2.0 * (A*B?A*B:1.0)); + /* (A*B?A*B:1.0f) this takes care of potential divide by zero errors */ + + float dphi; + + dphi = saacos((float)deler); + if( (dx1*dy2-dx2*dy1)>0.0 ) dphi= -dphi; + + if(t->flag & T_SHIFT_MOD) dphi = dphi/30.0f; + + /* if no delta angle, don't update initial position */ + if (dphi != 0) + { + t->imval[0] = mval[0]; + t->imval[1] = mval[1]; + } + + return dphi; +} + /* ************************** SPACE DEPENDANT CODE **************************** */ void setTransformViewMatrices(TransInfo *t) @@ -2584,23 +2619,6 @@ int Rotation(TransInfo *t, short mval[2]) float final; - double dx2 = t->center2d[0] - mval[0]; - double dy2 = t->center2d[1] - mval[1]; - double B = sqrt(dx2*dx2+dy2*dy2); - - double dx1 = t->center2d[0] - t->imval[0]; - double dy1 = t->center2d[1] - t->imval[1]; - double A = sqrt(dx1*dx1+dy1*dy1); - - double dx3 = mval[0] - t->imval[0]; - double dy3 = mval[1] - t->imval[1]; - /* use doubles here, to make sure a "1.0" (no rotation) doesnt become 9.999999e-01, which gives 0.02 for acos */ - double deler= ((double)((dx1*dx1+dy1*dy1)+(dx2*dx2+dy2*dy2)-(dx3*dx3+dy3*dy3) )) - / (2.0 * (A*B?A*B:1.0)); - /* (A*B?A*B:1.0f) this takes care of potential divide by zero errors */ - - float dphi; - float axis[3]; float mat[3][3]; @@ -2608,19 +2626,7 @@ int Rotation(TransInfo *t, short mval[2]) VecMulf(axis, -1.0f); Normalize(axis); - dphi = saacos((float)deler); - if( (dx1*dy2-dx2*dy1)>0.0 ) dphi= -dphi; - - if(t->flag & T_SHIFT_MOD) t->fac += dphi/30.0f; - else t->fac += dphi; - - /* - clamping angle between -2 PI and 2 PI (not sure if useful so commented out - theeth) - if (t->fac >= 2 * M_PI) - t->fac -= 2 * M_PI; - else if (t->fac <= -2 * M_PI) - t->fac -= -2 * M_PI; - */ + t->fac += InputDeltaAngle(t, mval); final = t->fac; @@ -2628,9 +2634,6 @@ int Rotation(TransInfo *t, short mval[2]) snapGrid(t, &final); - t->imval[0] = mval[0]; - t->imval[1] = mval[1]; - if (t->con.applyRot) { t->con.applyRot(t, NULL, axis); } @@ -3097,27 +3100,7 @@ int Tilt(TransInfo *t, short mval[2]) float final; - double dx2 = t->center2d[0] - mval[0]; - double dy2 = t->center2d[1] - mval[1]; - double B = (float)sqrt(dx2*dx2+dy2*dy2); - - double dx1 = t->center2d[0] - t->imval[0]; - double dy1 = t->center2d[1] - t->imval[1]; - double A = (float)sqrt(dx1*dx1+dy1*dy1); - - double dx3 = mval[0] - t->imval[0]; - double dy3 = mval[1] - t->imval[1]; - - double deler= ((dx1*dx1+dy1*dy1)+(dx2*dx2+dy2*dy2)-(dx3*dx3+dy3*dy3)) - / (2 * A * B); - - float dphi; - - dphi = saacos((float)deler); - if( (dx1*dy2-dx2*dy1)>0.0 ) dphi= -dphi; - - if(G.qual & LR_SHIFTKEY) t->fac += dphi/30.0f; - else t->fac += dphi; + t->fac += InputDeltaAngle(t, mval); final = t->fac; @@ -3125,9 +3108,6 @@ int Tilt(TransInfo *t, short mval[2]) snapGrid(t, &final); - t->imval[0] = mval[0]; - t->imval[1] = mval[1]; - if (hasNumInput(&t->num)) { char c[20]; @@ -3899,36 +3879,12 @@ int BoneRoll(TransInfo *t, short mval[2]) float final; - double dx2 = t->center2d[0] - mval[0]; - double dy2 = t->center2d[1] - mval[1]; - double B = sqrt(dx2*dx2+dy2*dy2); - - double dx1 = t->center2d[0] - t->imval[0]; - double dy1 = t->center2d[1] - t->imval[1]; - double A = sqrt(dx1*dx1+dy1*dy1); - - double dx3 = mval[0] - t->imval[0]; - double dy3 = mval[1] - t->imval[1]; - /* use doubles here, to make sure a "1.0" (no rotation) doesnt become 9.999999e-01, which gives 0.02 for acos */ - double deler= ((double)((dx1*dx1+dy1*dy1)+(dx2*dx2+dy2*dy2)-(dx3*dx3+dy3*dy3) )) - / (2.0 * (A*B?A*B:1.0)); - /* (A*B?A*B:1.0f) this takes care of potential divide by zero errors */ - - float dphi; - - dphi = saacos((float)deler); - if( (dx1*dy2-dx2*dy1)>0.0 ) dphi= -dphi; - - if(G.qual & LR_SHIFTKEY) t->fac += dphi/30.0f; - else t->fac += dphi; + t->fac += InputDeltaAngle(t, mval); final = t->fac; snapGrid(t, &final); - t->imval[0] = mval[0]; - t->imval[1] = mval[1]; - if (hasNumInput(&t->num)) { char c[20]; From f98085bd7ec3aba6775df4ab25c2c5475e37cae3 Mon Sep 17 00:00:00 2001 From: Peter Schlaile Date: Tue, 13 May 2008 20:32:52 +0000 Subject: [PATCH 14/19] == FFMPEG == Not all versions of ffmpeg seem to have av_find_opt. Added my own version... grmbl. --- source/blender/src/buttons_scene.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/source/blender/src/buttons_scene.c b/source/blender/src/buttons_scene.c index 239710ed785..d6d77fc9f6f 100644 --- a/source/blender/src/buttons_scene.c +++ b/source/blender/src/buttons_scene.c @@ -2372,6 +2372,22 @@ static IDProperty * ffmpeg_property_add( return prop; } +/* not all versions of ffmpeg include that, so here we go ... */ + +static const AVOption *my_av_find_opt(void *v, const char *name, + const char *unit, int mask, int flags){ + AVClass *c= *(AVClass**)v; + const AVOption *o= c->option; + + for(;o && o->name; o++){ + if(!strcmp(o->name, name) && + (!unit || (o->unit && !strcmp(o->unit, unit))) && + (o->flags & mask) == flags ) + return o; + } + return NULL; +} + static int ffmpeg_property_add_string(const char * type, const char * str) { AVCodecContext c; @@ -2395,7 +2411,7 @@ static int ffmpeg_property_add_string(const char * type, const char * str) while (*param == ' ') param++; } - o = av_find_opt(&c, name, NULL, 0, 0); + o = my_av_find_opt(&c, name, NULL, 0, 0); if (!o) { return FALSE; } @@ -2403,7 +2419,7 @@ static int ffmpeg_property_add_string(const char * type, const char * str) return FALSE; } if (param && o->type != FF_OPT_TYPE_CONST && o->unit) { - p = av_find_opt(&c, param, o->unit, 0, 0); + p = my_av_find_opt(&c, param, o->unit, 0, 0); prop = ffmpeg_property_add( (char*) type, p - c.av_class->option, o - c.av_class->option); @@ -2598,7 +2614,7 @@ static int render_panel_ffmpeg_property_option( avcodec_get_context_defaults(&c); - o = av_find_opt(&c, param ? param : name, NULL, 0, 0); + o = my_av_find_opt(&c, param ? param : name, NULL, 0, 0); if (!o) { return yofs; } From 9fdb4965a32fdc5fbfe6ad169630672e70d85470 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Wed, 14 May 2008 09:00:22 +0000 Subject: [PATCH 15/19] NLA and IPO now have the "AfterTrans Keyframe" option that prevents the creation of duplicate keyframes after transform. --- source/blender/makesdna/DNA_space_types.h | 4 +- source/blender/src/header_ipo.c | 6 ++ source/blender/src/header_nla.c | 6 ++ source/blender/src/transform_conversions.c | 115 ++++++++++++++++++++- 4 files changed, 127 insertions(+), 4 deletions(-) diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index 86f6e4bcbe4..619dfbb43a0 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -524,7 +524,8 @@ typedef struct SpaceImaSel { #define SI_DRAW_STRETCH 1<<21 /* SpaceIpo->flag */ -#define SIPO_LOCK_VIEW 1<<0 +#define SIPO_LOCK_VIEW 1<<0 +#define SIPO_NOTRANSKEYCULL 1<<1 /* SpaceText flags (moved from DNA_text_types.h) */ @@ -616,6 +617,7 @@ typedef struct SpaceImaSel { #define SNLA_ALLKEYED 1 #define SNLA_ACTIVELAYERS 2 #define SNLA_DRAWTIME 4 +#define SNLA_NOTRANSKEYCULL 8 /* time->flag */ /* show timing in frames instead of in seconds */ diff --git a/source/blender/src/header_ipo.c b/source/blender/src/header_ipo.c index 81d94725a90..15caf325ec6 100644 --- a/source/blender/src/header_ipo.c +++ b/source/blender/src/header_ipo.c @@ -751,6 +751,9 @@ static void do_ipo_viewmenu(void *arg, int event) case 14: /* Clear Preview Range */ anim_previewrange_clear(); break; + case 15: /* AutoMerge Keyframes */ + G.sipo->flag ^= SIPO_NOTRANSKEYCULL; + break; } } @@ -772,6 +775,9 @@ static uiBlock *ipo_viewmenu(void *arg_unused) else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Show Keys|K", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, ""); + uiDefIconTextBut(block, BUTM, 1, (G.sipo->flag & SIPO_NOTRANSKEYCULL)?ICON_CHECKBOX_DEHLT:ICON_CHECKBOX_HLT, + "AutoMerge Keyframes|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 15, ""); + uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Zoom Out|NumPad -", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 5, ""); diff --git a/source/blender/src/header_nla.c b/source/blender/src/header_nla.c index ef4b79c0537..13bbf0a3999 100644 --- a/source/blender/src/header_nla.c +++ b/source/blender/src/header_nla.c @@ -128,6 +128,9 @@ static void do_nla_viewmenu(void *arg, int event) case 9: /* Clear Preview Range */ anim_previewrange_clear(); break; + case 10: /* AutoMerge Keyframes */ + G.snla->flag ^= SNLA_NOTRANSKEYCULL; + break; } } @@ -148,6 +151,9 @@ static uiBlock *nla_viewmenu(void *arg_unused) } else { uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Seconds|Ctrl T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, ""); } + + uiDefIconTextBut(block, BUTM, 1, (G.snla->flag & SNLA_NOTRANSKEYCULL)?ICON_CHECKBOX_DEHLT:ICON_CHECKBOX_HLT, + "AutoMerge Keyframes|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 10, ""); uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); diff --git a/source/blender/src/transform_conversions.c b/source/blender/src/transform_conversions.c index 6636c435b8c..e42eedee1f7 100644 --- a/source/blender/src/transform_conversions.c +++ b/source/blender/src/transform_conversions.c @@ -144,6 +144,8 @@ extern ListBase editelems; /* local function prototype - for Object/Bone Constraints */ static short constraints_list_needinv(TransInfo *t, ListBase *list); +/* local function prototype - for finding number of keyframes that are selected for editing */ +static int count_ipo_keys(Ipo *ipo, char side, float cfra); /* ************************** Functions *************************** */ @@ -2490,6 +2492,93 @@ static void posttrans_action_clean (bAction *act) BLI_freelistN(&act_data); } +/* Called by special_aftertrans_update to make sure selected keyframes replace + * any other keyframes which may reside on that frame (that is not selected). + * remake_all_ipos should have already been called + */ +static void posttrans_nla_clean (TransInfo *t) +{ + Base *base; + Object *ob; + bActionStrip *strip; + bActionChannel *achan; + bConstraintChannel *conchan; + float cfra; + char side; + int i; + + /* which side of the current frame should be allowed */ + if (t->mode == TFM_TIME_EXTEND) { + /* only side on which mouse is gets transformed */ + float xmouse, ymouse; + + areamouseco_to_ipoco(G.v2d, t->imval, &xmouse, &ymouse); + side = (xmouse > CFRA) ? 'R' : 'L'; + } + else { + /* normal transform - both sides of current frame are considered */ + side = 'B'; + } + + /* only affect keyframes */ + for (base=G.scene->base.first; base; base=base->next) { + ob= base->object; + + /* Check object ipos */ + i= count_ipo_keys(ob->ipo, side, CFRA); + if (i) posttrans_ipo_clean(ob->ipo); + + /* Check object constraint ipos */ + for (conchan=ob->constraintChannels.first; conchan; conchan=conchan->next) { + i= count_ipo_keys(conchan->ipo, side, CFRA); + if (i) posttrans_ipo_clean(ob->ipo); + } + + /* skip actions and nlastrips if object is collapsed */ + if (ob->nlaflag & OB_NLA_COLLAPSED) + continue; + + /* Check action ipos */ + if (ob->action) { + /* exclude if strip is selected too */ + for (strip=ob->nlastrips.first; strip; strip=strip->next) { + if (strip->flag & ACTSTRIP_SELECT) { + if (strip->act == ob->action) + break; + } + } + if (strip==NULL) { + cfra = get_action_frame(ob, CFRA); + + for (achan=ob->action->chanbase.first; achan; achan=achan->next) { + if (EDITABLE_ACHAN(achan)) { + i= count_ipo_keys(achan->ipo, side, cfra); + if (i) { + actstrip_map_ipo_keys(ob, achan->ipo, 0, 1); + posttrans_ipo_clean(achan->ipo); + actstrip_map_ipo_keys(ob, achan->ipo, 1, 1); + } + + /* Check action constraint ipos */ + if (EXPANDED_ACHAN(achan) && FILTER_CON_ACHAN(achan)) { + for (conchan=achan->constraintChannels.first; conchan; conchan=conchan->next) { + if (EDITABLE_CONCHAN(conchan)) { + i = count_ipo_keys(conchan->ipo, side, cfra); + if (i) { + actstrip_map_ipo_keys(ob, conchan->ipo, 0, 1); + posttrans_ipo_clean(conchan->ipo); + actstrip_map_ipo_keys(ob, conchan->ipo, 1, 1); + } + } + } + } + } + } + } + } + } +} + /* ----------------------------- */ /* This function tests if a point is on the "mouse" side of the cursor/frame-marking */ @@ -3487,8 +3576,6 @@ void special_aftertrans_update(TransInfo *t) if (key->ipo) { IpoCurve *icu; - - if ( (G.saction->flag & SACTION_NOTRANSKEYCULL)==0 && (cancelled == 0) ) { @@ -3507,17 +3594,39 @@ void special_aftertrans_update(TransInfo *t) G.saction->flag &= ~SACTION_MOVING; } else if (t->spacetype == SPACE_NLA) { + recalc_all_ipos(); // bad synchronize_action_strips(); /* cleanup */ for (base=G.scene->base.first; base; base=base->next) base->flag &= ~(BA_HAS_RECALC_OB|BA_HAS_RECALC_DATA); - recalc_all_ipos(); // bad + /* after transform, remove duplicate keyframes on a frame that resulted from transform */ + if ( (G.snla->flag & SNLA_NOTRANSKEYCULL)==0 && + (cancelled == 0) ) + { + posttrans_nla_clean(t); + } } else if (t->spacetype == SPACE_IPO) { // FIXME! is there any code from the old transform_ipo that needs to be added back? + /* after transform, remove duplicate keyframes on a frame that resulted from transform */ + if (G.sipo->ipo) + { + if ( (G.sipo->flag & SIPO_NOTRANSKEYCULL)==0 && + (cancelled == 0) ) + { + if (NLA_IPO_SCALED) { + actstrip_map_ipo_keys(OBACT, G.sipo->ipo, 0, 1); + posttrans_ipo_clean(G.sipo->ipo); + actstrip_map_ipo_keys(OBACT, G.sipo->ipo, 1, 1); + } + else + posttrans_ipo_clean(G.sipo->ipo); + } + } + /* resetting slow-parents isn't really necessary when editing sequence ipo's */ if (G.sipo->blocktype==ID_SEQ) resetslowpar= 0; From c56f484da84f2f70c5198cd2ebeae288ab9cf02a Mon Sep 17 00:00:00 2001 From: Martin Poirier Date: Wed, 14 May 2008 09:30:27 +0000 Subject: [PATCH 16/19] == Transform orientation bugfix == Fallback to global if the selected orientation doesn't exists. This only happens when switching between scenes or screens(orientations are per view3d) --- source/blender/src/header_view3d.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/blender/src/header_view3d.c b/source/blender/src/header_view3d.c index cb3cfce62c3..26f5f3af888 100644 --- a/source/blender/src/header_view3d.c +++ b/source/blender/src/header_view3d.c @@ -5639,6 +5639,10 @@ void view3d_buttons(void) xco+= XIC; } + if (G.vd->twmode > (BIF_countTransformOrientation() - 1) + V3D_MANIP_CUSTOM) { + G.vd->twmode = 0; + } + str_menu = BIF_menustringTransformOrientation("Orientation"); uiDefButS(block, MENU, B_MAN_MODE, str_menu,xco,0,70,YIC, &G.vd->twmode, 0, 0, 0, 0, "Transform Orientation (ALT+Space)"); MEM_freeN(str_menu); From d1e1332e071edf346e85bb2c69c066458f6848c5 Mon Sep 17 00:00:00 2001 From: Martin Poirier Date: Wed, 14 May 2008 12:24:38 +0000 Subject: [PATCH 17/19] Final fix fo revision 14827 Fixing UV Quad Constraint when cancelling transform. Also, transdata conversion is a bit faster for all UV transforms. Patch by Cambo, reviewed and revised. --- source/blender/src/transform_conversions.c | 132 ++++++++++++++++----- 1 file changed, 104 insertions(+), 28 deletions(-) diff --git a/source/blender/src/transform_conversions.c b/source/blender/src/transform_conversions.c index e42eedee1f7..963a1027f28 100644 --- a/source/blender/src/transform_conversions.c +++ b/source/blender/src/transform_conversions.c @@ -2217,9 +2217,9 @@ static void UVsToTransData(TransData *td, TransData2D *td2d, float *uv, int sele td->flag |= TD_SELECTED; td->dist= 0.0; } - else + else { td->dist= MAXFLOAT; - + } Mat3One(td->mtx); Mat3One(td->smtx); } @@ -2231,25 +2231,57 @@ static void createTransUVs(TransInfo *t) MTFace *tf; int count=0, countsel=0; int propmode = t->flag & T_PROP_EDIT; - + int efa_s1,efa_s2,efa_s3,efa_s4; + EditMesh *em = G.editMesh; EditFace *efa; if(is_uv_tface_editing_allowed()==0) return; /* count */ - for (efa= em->faces.first; efa; efa= efa->next) { - tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE); - if (simaFaceDraw_Check(efa, tf)) { - if (simaUVSel_Check(efa, tf, 0)) countsel++; - if (simaUVSel_Check(efa, tf, 1)) countsel++; - if (simaUVSel_Check(efa, tf, 2)) countsel++; - if (efa->v4 && simaUVSel_Check(efa, tf, 3)) countsel++; - if(propmode) - count += (efa->v4)? 4: 3; + if (G.sima->flag & SI_BE_SQUARE && !propmode) { + for (efa= em->faces.first; efa; efa= efa->next) { + /* store face pointer for second loop, prevent second lookup */ + tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE); + if (simaFaceDraw_Check(efa, tf)) { + efa->tmp.p = tf; + + efa_s1 = simaUVSel_Check(efa, tf, 0); + efa_s2 = simaUVSel_Check(efa, tf, 1); + efa_s3 = simaUVSel_Check(efa, tf, 2); + if (efa->v4) { + efa_s4 = simaUVSel_Check(efa, tf, 3); + if ( efa_s1 || efa_s2 || efa_s3 || efa_s4 ) { + countsel += 4; /* all corners of this quad need their edges moved. so we must store TD for each */ + } + } else { + /* tri's are delt with normally when SI_BE_SQUARE's enabled */ + if (efa_s1) countsel++; + if (efa_s2) countsel++; + if (efa_s3) countsel++; + } + } else { + efa->tmp.p = NULL; + } + } + } else { + for (efa= em->faces.first; efa; efa= efa->next) { + tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE); + if (simaFaceDraw_Check(efa, tf)) { + efa->tmp.p = tf; + + if (simaUVSel_Check(efa, tf, 0)) countsel++; + if (simaUVSel_Check(efa, tf, 1)) countsel++; + if (simaUVSel_Check(efa, tf, 2)) countsel++; + if (efa->v4 && simaUVSel_Check(efa, tf, 3)) countsel++; + if(propmode) + count += (efa->v4)? 4: 3; + } else { + efa->tmp.p = NULL; + } } } - + /* note: in prop mode we need at least 1 selected */ if (countsel==0) return; @@ -2264,21 +2296,66 @@ static void createTransUVs(TransInfo *t) td= t->data; td2d= t->data2d; - for (efa= em->faces.first; efa; efa= efa->next) { - tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE); - if (simaFaceDraw_Check(efa, tf)) { - if(propmode || simaUVSel_Check(efa, tf, 0)) - UVsToTransData(td++, td2d++, tf->uv[0], simaUVSel_Check(efa, tf, 0)); - if(propmode || simaUVSel_Check(efa, tf, 1)) - UVsToTransData(td++, td2d++, tf->uv[1], simaUVSel_Check(efa, tf, 1)); - if(propmode || simaUVSel_Check(efa, tf, 2)) - UVsToTransData(td++, td2d++, tf->uv[2], simaUVSel_Check(efa, tf, 2)); + + if (G.sima->flag & SI_BE_SQUARE && !propmode) { + for (efa= em->faces.first; efa; efa= efa->next) { + tf=(MTFace *)efa->tmp.p; + if (tf) { + efa_s1 = simaUVSel_Check(efa, tf, 0); + efa_s2 = simaUVSel_Check(efa, tf, 1); + efa_s3 = simaUVSel_Check(efa, tf, 2); + + if (efa->v4) { + efa_s4 = simaUVSel_Check(efa, tf, 3); + + if ( efa_s1 || efa_s2 || efa_s3 || efa_s4 ) { + /* all corners of this quad need their edges moved. so we must store TD for each */ - if(efa->v4 && (propmode || simaUVSel_Check(efa, tf, 3))) - UVsToTransData(td++, td2d++, tf->uv[3], simaUVSel_Check(efa, tf, 3)); + UVsToTransData(td, td2d, tf->uv[0], efa_s1); + if (!efa_s1) td->flag |= TD_SKIP; + td++; td2d++; + + UVsToTransData(td, td2d, tf->uv[1], efa_s2); + if (!efa_s2) td->flag |= TD_SKIP; + td++; td2d++; + + UVsToTransData(td, td2d, tf->uv[2], efa_s3); + if (!efa_s3) td->flag |= TD_SKIP; + td++; td2d++; + + UVsToTransData(td, td2d, tf->uv[3], efa_s4); + if (!efa_s4) td->flag |= TD_SKIP; + td++; td2d++; + } + } else { + /* tri's are delt with normally when SI_BE_SQUARE's enabled */ + if (efa_s1) UVsToTransData(td++, td2d++, tf->uv[0], 1); + if (efa_s2) UVsToTransData(td++, td2d++, tf->uv[1], 1); + if (efa_s3) UVsToTransData(td++, td2d++, tf->uv[2], 1); + } + } + } + } else { + for (efa= em->faces.first; efa; efa= efa->next) { + /*tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE); + if (simaFaceDraw_Check(efa, tf)) {*/ + if ((tf=(MTFace *)efa->tmp.p)) { + if (propmode) { + UVsToTransData(td++, td2d++, tf->uv[0], simaUVSel_Check(efa, tf, 0)); + UVsToTransData(td++, td2d++, tf->uv[1], simaUVSel_Check(efa, tf, 1)); + UVsToTransData(td++, td2d++, tf->uv[2], simaUVSel_Check(efa, tf, 2)); + if(efa->v4) + UVsToTransData(td++, td2d++, tf->uv[3], simaUVSel_Check(efa, tf, 3)); + } else { + if(simaUVSel_Check(efa, tf, 0)) UVsToTransData(td++, td2d++, tf->uv[0], 1); + if(simaUVSel_Check(efa, tf, 1)) UVsToTransData(td++, td2d++, tf->uv[1], 1); + if(simaUVSel_Check(efa, tf, 2)) UVsToTransData(td++, td2d++, tf->uv[2], 1); + if(efa->v4 && simaUVSel_Check(efa, tf, 3)) UVsToTransData(td++, td2d++, tf->uv[3], 1); + } + } } } - + if (G.sima->flag & SI_LIVE_UNWRAP) unwrap_lscm_live_begin(); } @@ -2306,9 +2383,8 @@ void flushTransUVs(TransInfo *t) td->loc2d[1]= floor(height*td->loc2d[1] + 0.5f)/height; } } - - /* always call this, also for cancel (it transforms non-selected vertices...) */ - if((G.sima->flag & SI_BE_SQUARE) && (t->state != TRANS_CANCEL)) + + if((G.sima->flag & SI_BE_SQUARE) && (t->flag & T_PROP_EDIT)==0 && (t->state != TRANS_CANCEL)) be_square_tface_uv(em); /* this is overkill if G.sima->lock is not set, but still needed */ From 7806a44134b64fe17bdd8bca53a836b59aad9f7e Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 14 May 2008 13:30:36 +0000 Subject: [PATCH 18/19] Minor particle system fixes: - Changed some tooltips. - Refresh with reactors and shared particle settings. - Copying of child particles. --- source/blender/blenkernel/intern/object.c | 1 + source/blender/src/buttons_object.c | 24 +++++++++++++++++++++-- source/blender/src/buttons_shading.c | 2 +- source/blender/src/header_view3d.c | 6 +++--- 4 files changed, 27 insertions(+), 6 deletions(-) diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index a2a7894e3ce..ab1bc5a2265 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1056,6 +1056,7 @@ ParticleSystem *copy_particlesystem(ParticleSystem *psys) psysn->effectors.first= psysn->effectors.last= 0; psysn->pathcachebufs.first = psysn->pathcachebufs.last = NULL; + psysn->childcachebufs.first = psysn->childcachebufs.last = NULL; psysn->reactevents.first = psysn->reactevents.last = NULL; psysn->renderdata = NULL; diff --git a/source/blender/src/buttons_object.c b/source/blender/src/buttons_object.c index 8fcd55fd6f9..13b4bf01850 100644 --- a/source/blender/src/buttons_object.c +++ b/source/blender/src/buttons_object.c @@ -3013,9 +3013,14 @@ void do_effects_panels(unsigned short event) case B_PART_INIT_CHILD: case B_PART_RECALC_CHILD: if(psys) { + Base *base; + Object *bob; + ParticleSystem *bpsys; + int flush; + nr=0; - for(psys=ob->particlesystem.first; psys; psys=psys->next){ - if(ELEM(psys->part->draw_as,PART_DRAW_OB,PART_DRAW_GR)) + for(bpsys=ob->particlesystem.first; bpsys; bpsys=bpsys->next){ + if(ELEM(bpsys->part->draw_as,PART_DRAW_OB,PART_DRAW_GR)) nr++; } if(nr) @@ -3023,6 +3028,21 @@ void do_effects_panels(unsigned short event) else ob->transflag &= ~OB_DUPLIPARTS; + if(psys->part->type==PART_REACTOR) + if(psys->target_ob) + DAG_object_flush_update(G.scene, psys->target_ob, OB_RECALC_DATA); + + for(base = G.scene->base.first; base; base= base->next) { + bob= base->object; + flush= 0; + for(bpsys=bob->particlesystem.first; bpsys; bpsys=bpsys->next) + if(bpsys->part==psys->part) + flush= 1; + + if(flush) + DAG_object_flush_update(G.scene, bob, OB_RECALC_DATA); + } + DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA); allqueue(REDRAWVIEW3D, 0); allqueue(REDRAWBUTSOBJECT, 0); diff --git a/source/blender/src/buttons_shading.c b/source/blender/src/buttons_shading.c index a4ddd55d2f0..c6847508806 100644 --- a/source/blender/src/buttons_shading.c +++ b/source/blender/src/buttons_shading.c @@ -3288,7 +3288,7 @@ static void material_panel_map_to(Object *ob, Material *ma, int from_nodes) //uiButSetFunc(but, particle_recalc_material, ma, NULL); but=uiDefButBitS(block, TOG3, MAP_PA_KINK, B_MAT_PARTICLE, "Kink", 70,160,60,19, &(mtex->pmapto), 0, 0, 0, 0, "Causes the texture to affect the kink of child particles"); //uiButSetFunc(but, particle_recalc_material, ma, NULL); - but=uiDefButBitS(block, TOG3, MAP_PA_LENGTH, B_MAT_PARTICLE, "Length",130,160,60,19, &(mtex->pmapto), 0, 0, 0, 0, "Causes the texture to affect the length of particles"); + but=uiDefButBitS(block, TOG3, MAP_PA_LENGTH, B_MAT_PARTICLE, "Length",130,160,60,19, &(mtex->pmapto), 0, 0, 0, 0, "Causes the texture to affect the length of child particles"); //uiButSetFunc(but, particle_recalc_material, ma, NULL); but=uiDefButBitS(block, TOG3, MAP_PA_CLUMP, B_MAT_PARTICLE, "Clump", 190,160,60,19, &(mtex->pmapto), 0, 0, 0, 0, "Causes the texture to affect the clump of child particles"); //uiButSetFunc(but, particle_recalc_material, ma, NULL); diff --git a/source/blender/src/header_view3d.c b/source/blender/src/header_view3d.c index 26f5f3af888..dfd62a67cdd 100644 --- a/source/blender/src/header_view3d.c +++ b/source/blender/src/header_view3d.c @@ -5727,11 +5727,11 @@ void view3d_buttons(void) } else if(G.f & G_PARTICLEEDIT) { uiBlockBeginAlign(block); - uiDefIconButBitS(block, TOG, SCE_SELECT_PATH, B_SEL_PATH, ICON_EDGESEL, xco,0,XIC,YIC, &G.scene->selectmode, 1.0, 0.0, 0, 0, "Path edit mode (Ctrl Tab 1)"); + uiDefIconButBitS(block, TOG, SCE_SELECT_PATH, B_SEL_PATH, ICON_EDGESEL, xco,0,XIC,YIC, &G.scene->selectmode, 1.0, 0.0, 0, 0, "Path edit mode"); xco+= XIC; - uiDefIconButBitS(block, TOG, SCE_SELECT_POINT, B_SEL_POINT, ICON_VERTEXSEL, xco,0,XIC,YIC, &G.scene->selectmode, 1.0, 0.0, 0, 0, "Point select mode (Ctrl Tab 2)"); + uiDefIconButBitS(block, TOG, SCE_SELECT_POINT, B_SEL_POINT, ICON_VERTEXSEL, xco,0,XIC,YIC, &G.scene->selectmode, 1.0, 0.0, 0, 0, "Point select mode"); xco+= XIC; - uiDefIconButBitS(block, TOG, SCE_SELECT_END, B_SEL_END, ICON_FACESEL, xco,0,XIC,YIC, &G.scene->selectmode, 1.0, 0.0, 0, 0, "Tip select mode (Ctrl Tab 3)"); + uiDefIconButBitS(block, TOG, SCE_SELECT_END, B_SEL_END, ICON_FACESEL, xco,0,XIC,YIC, &G.scene->selectmode, 1.0, 0.0, 0, 0, "Tip select mode"); xco+= XIC; uiBlockEndAlign(block); if(G.vd->drawtype > OB_WIRE) { From b65d4f95fc6ff35d93dc1f8bbc07f10b7e15ea2c Mon Sep 17 00:00:00 2001 From: Martin Poirier Date: Wed, 14 May 2008 14:53:12 +0000 Subject: [PATCH 19/19] Missing hotkey in menu for Align to Transform Orientation --- source/blender/src/header_view3d.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/src/header_view3d.c b/source/blender/src/header_view3d.c index dfd62a67cdd..82fcdd23c1f 100644 --- a/source/blender/src/header_view3d.c +++ b/source/blender/src/header_view3d.c @@ -1835,7 +1835,7 @@ static uiBlock *view3d_transformmenu(void *arg_unused) if (!G.obedit) { uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Center New", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 11, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Center Cursor", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Align to Transform Orientation", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 21, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Align to Transform Orientation|Ctrl Alt A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 21, ""); } if (BIF_snappingSupported())