diff options
author | Campbell Barton <ideasman42@gmail.com> | 2007-09-20 03:50:46 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2007-09-20 03:50:46 +0400 |
commit | 037f6f20d83b248368bc2ac5083df200cdfd1048 (patch) | |
tree | 8702c950be959b812ffb2fe6157893b824dbbe6f /source | |
parent | 28ae78a745bab375ee227be8846479a4afc02ffd (diff) |
added a view properties panel for image/uv. moved the cursor x/y there to match the 3d view.
added an optional view setting - Repeat/Tile image display so mapping with tiled textures you dont have to guess the locations or look in the 3d view to see what your mapping to.
copy and face menu was missing depgraph update calls.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/include/BIF_space.h | 1 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_space_types.h | 3 | ||||
-rw-r--r-- | source/blender/src/drawimage.c | 146 | ||||
-rw-r--r-- | source/blender/src/editmesh_mods.c | 2 | ||||
-rw-r--r-- | source/blender/src/editmesh_tools.c | 6 | ||||
-rw-r--r-- | source/blender/src/header_image.c | 4 |
6 files changed, 113 insertions, 49 deletions
diff --git a/source/blender/include/BIF_space.h b/source/blender/include/BIF_space.h index 9c51ad290d0..22b9adcdce0 100644 --- a/source/blender/include/BIF_space.h +++ b/source/blender/include/BIF_space.h @@ -66,6 +66,7 @@ struct SpaceOops; #define IMAGE_HANDLER_PREVIEW 33 #define IMAGE_HANDLER_GAME_PROPERTIES 34 #define IMAGE_HANDLER_TRANSFORM_PROPERTIES 35 +#define IMAGE_HANDLER_VIEW_PROPERTIES 36 /* action handler codes */ #define ACTION_HANDLER_PROPERTIES 40 diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index af6bb24e284..b6dbb3b9b98 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -482,6 +482,9 @@ typedef struct SpaceImaSel { #define SI_FULLWINDOW 1<<16 #define SI_SYNC_UVSEL 1<<17 #define SI_LOCAL_UV 1<<18 + /* this means that the image is drawn until it reaches the view edge, + * in the image view, its unrelated to the 'tile' mode for texface */ +#define SI_DRAW_TILE 1<<19 /* SpaceText flags (moved from DNA_text_types.h) */ diff --git a/source/blender/src/drawimage.c b/source/blender/src/drawimage.c index 05cd04946ba..5387d0fca6e 100644 --- a/source/blender/src/drawimage.c +++ b/source/blender/src/drawimage.c @@ -1048,9 +1048,26 @@ static void image_panel_transform_properties(short cntrl) // IMAGE_HANDLER_TRANS if(uiNewPanel(curarea, block, "Transform Properties", "Image", 10, 10, 318, 204)==0) return; - uiDefButBitI(block, TOG, SI_COORDFLOATS, B_REDR, "Normalized Coords", 10,80,140,19, &G.sima->flag, 0, 0, 0, 0, "Display coords from 0.0 to 1.0 rather then in pixels"); + //uiDefButBitI(block, TOG, SI_COORDFLOATS, B_REDR, "Normalized Coords", 10,80,140,19, &G.sima->flag, 0, 0, 0, 0, "Display coords from 0.0 to 1.0 rather then in pixels"); image_editvertex_buts(block); + //image_editcursor_buts(block); +} + +static void image_panel_view_properties(short cntrl) // IMAGE_HANDLER_VIEW_PROPERTIES +{ + uiBlock *block; + + block= uiNewBlock(&curarea->uiblocks, "image_view_properties", UI_EMBOSS, UI_HELV, curarea->win); + uiPanelControl(UI_PNL_SOLID | UI_PNL_CLOSE | cntrl); + uiSetPanelHandler(IMAGE_HANDLER_VIEW_PROPERTIES); // for close and esc + if(uiNewPanel(curarea, block, "View Properties", "Image", 10, 10, 318, 204)==0) + return; + + uiDefButBitI(block, TOG, SI_COORDFLOATS, B_REDR, "Normalized Coords", 10,100,140,19, &G.sima->flag, 0, 0, 0, 0, "Display coords from 0.0 to 1.0 rather then in pixels"); + uiDefButBitI(block, TOG, SI_DRAW_TILE, B_REDR, "Repeat Image", 10,80,140,19, &G.sima->flag, 0, 0, 0, 0, "Repeat/Tile the image display"); + + //image_editvertex_buts(block); image_editcursor_buts(block); } @@ -1371,6 +1388,9 @@ static void image_blockhandlers(ScrArea *sa) if (EM_texFaceCheck()) image_panel_transform_properties(sima->blockhandler[a+1]); break; + case IMAGE_HANDLER_VIEW_PROPERTIES: + image_panel_view_properties(sima->blockhandler[a+1]); + break; case IMAGE_HANDLER_PAINT: image_panel_paint(sima->blockhandler[a+1]); break; @@ -1800,52 +1820,81 @@ void drawimagespace(ScrArea *sa, void *spacedata) MEM_freeN(rect); } else { - /* this part is generic image display */ - if(sima->flag & SI_SHOW_ALPHA) { - if(ibuf->rect) - sima_draw_alpha_pixels(x1, y1, ibuf->x, ibuf->y, ibuf->rect); - else if(ibuf->rect_float && ibuf->channels==4) - sima_draw_alpha_pixelsf(x1, y1, ibuf->x, ibuf->y, ibuf->rect_float); - } - else if(sima->flag & SI_SHOW_ZBUF && ((ibuf->zbuf || ibuf->zbuf_float || (ibuf->channels==1)) == 0)) { - if(ibuf->zbuf) - sima_draw_zbuf_pixels(x1, y1, ibuf->x, ibuf->y, ibuf->zbuf); - else if(ibuf->zbuf_float) - sima_draw_zbuffloat_pixels(x1, y1, ibuf->x, ibuf->y, ibuf->zbuf_float); - else if(ibuf->channels==1) - sima_draw_zbuffloat_pixels(x1, y1, ibuf->x, ibuf->y, ibuf->rect_float); - } - else { - if(sima->flag & SI_USE_ALPHA) { - sima_draw_alpha_backdrop(sima, x1, y1, (float)ibuf->x, (float)ibuf->y); - glEnable(GL_BLEND); - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - } - - /* detect if we need to redo the curve map. - ibuf->rect is zero for compositor and render results after change - convert to 32 bits always... drawing float rects isnt supported well (atis) - - NOTE: if float buffer changes, we have to manually remove the rect - */ - - if(ibuf->rect_float) { - if(ibuf->rect==NULL) { - if(image_curves_active(sa)) - curvemapping_do_ibuf(G.sima->cumap, ibuf); - else - IMB_rect_from_float(ibuf); + float x1_rep, y1_rep; + int x_rep, y_rep; + + /* Loop for drawing repeating images */ + for (x_rep= ((int)G.v2d->cur.xmin)-1; x_rep < G.v2d->cur.xmax; x_rep++) { + x1_rep=x1+ (x_rep* ibuf->x * sima->zoom); + for (y_rep= ((int)G.v2d->cur.ymin)-1; y_rep < G.v2d->cur.ymax; y_rep++) { + y1_rep=y1+ (y_rep * ibuf->y *sima->zoom); + /* end repeating image loop */ + + if((sima->flag & SI_DRAW_TILE)==0) { + y1_rep = y1; + x1_rep = x1; + } + + /*printf("Drawing %d %d zoom:%.6f (%.6f %.6f), (%.6f %.6f)\n", x_rep, y_rep, sima->zoom, G.v2d->cur.xmin, G.v2d->cur.ymin, G.v2d->cur.xmax, G.v2d->cur.ymax);*/ + + /* this part is generic image display */ + if(sima->flag & SI_SHOW_ALPHA) { + if(ibuf->rect) + sima_draw_alpha_pixels(x1_rep, y1_rep, ibuf->x, ibuf->y, ibuf->rect); + else if(ibuf->rect_float && ibuf->channels==4) + sima_draw_alpha_pixelsf(x1_rep, y1_rep, ibuf->x, ibuf->y, ibuf->rect_float); + } + else if(sima->flag & SI_SHOW_ZBUF && ((ibuf->zbuf || ibuf->zbuf_float || (ibuf->channels==1)) == 0)) { + if(ibuf->zbuf) + sima_draw_zbuf_pixels(x1_rep, y1_rep, ibuf->x, ibuf->y, ibuf->zbuf); + else if(ibuf->zbuf_float) + sima_draw_zbuffloat_pixels(x1_rep, y1_rep, ibuf->x, ibuf->y, ibuf->zbuf_float); + else if(ibuf->channels==1) + sima_draw_zbuffloat_pixels(x1_rep, y1_rep, ibuf->x, ibuf->y, ibuf->rect_float); + } + else { + if(sima->flag & SI_USE_ALPHA) { + sima_draw_alpha_backdrop(sima, x1_rep, y1_rep, (float)ibuf->x, (float)ibuf->y); + glEnable(GL_BLEND); + glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + } + + /* detect if we need to redo the curve map. + ibuf->rect is zero for compositor and render results after change + convert to 32 bits always... drawing float rects isnt supported well (atis) + + NOTE: if float buffer changes, we have to manually remove the rect + */ + + if(ibuf->rect_float) { + if(ibuf->rect==NULL) { + if(image_curves_active(sa)) + curvemapping_do_ibuf(G.sima->cumap, ibuf); + else + IMB_rect_from_float(ibuf); + } + } + + if(ibuf->rect) + glaDrawPixelsSafe(x1_rep, y1_rep, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect); + // else + // glaDrawPixelsSafe(x1_rep, y1_rep, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_FLOAT, ibuf->rect_float); + + if(sima->flag & SI_USE_ALPHA) + glDisable(GL_BLEND); + } + + /* only draw once */ + if((sima->flag & SI_DRAW_TILE)==0) { + x_rep = G.v2d->cur.xmax+1; + y_rep = G.v2d->cur.ymax+1; } + + /* tile draw loop */ } - - if(ibuf->rect) - glaDrawPixelsSafe(x1, y1, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect); -// else -// glaDrawPixelsSafe(x1, y1, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_FLOAT, ibuf->rect_float); - - if(sima->flag & SI_USE_ALPHA) - glDisable(GL_BLEND); } + /* tile draw loop */ + } brush= G.scene->toolsettings->imapaint.brush; @@ -1928,7 +1977,7 @@ static void image_zoom_set_factor(float zoomfac) /* check zoom limits */ - calc_image_view(G.sima, 'p'); + calc_image_view(G.sima, 'f'); /* was 'p' are there any cases where this should be 'p'?*/ width= 256; height= 256; if (sima->image) { @@ -2078,8 +2127,9 @@ void image_home(void) G.sima->xof= G.sima->yof= 0.0f; - calc_image_view(G.sima, 'p'); - + calc_image_view(G.sima, 'f'); /* was 'p' are there any cases where this should be 'p'?*/ + /*calc_arearcts(curarea);*/ + scrarea_queue_winredraw(curarea); scrarea_queue_winredraw(curarea); } @@ -2108,7 +2158,7 @@ void image_viewcenter(void) G.sima->zoom= 0.7/size; - calc_image_view(G.sima, 'p'); + calc_image_view(G.sima, 'f'); /* was 'p' are there any cases where 'p' is still needed? */ scrarea_queue_winredraw(curarea); } diff --git a/source/blender/src/editmesh_mods.c b/source/blender/src/editmesh_mods.c index 037c0118325..60b7939a3ff 100644 --- a/source/blender/src/editmesh_mods.c +++ b/source/blender/src/editmesh_mods.c @@ -1719,6 +1719,7 @@ void mesh_copy_menu(void) } if (change) { + DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA); allqueue(REDRAWVIEW3D, 0); allqueue(REDRAWBUTSEDIT, 0); @@ -3416,6 +3417,7 @@ void Face_Menu() { { case 1: flip_editnormals(); + DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA); BIF_undo_push("Flip Normals"); break; case 2: diff --git a/source/blender/src/editmesh_tools.c b/source/blender/src/editmesh_tools.c index 88d1cb172c3..f4c6c475f1a 100644 --- a/source/blender/src/editmesh_tools.c +++ b/source/blender/src/editmesh_tools.c @@ -5148,7 +5148,7 @@ void mesh_set_face_flags(short mode) if (change) { BIF_undo_push((mode ? "Set Flags" : "Clear Flags")); - + allqueue(REDRAWIMAGE, 0); allqueue(REDRAWVIEW3D, 0); } @@ -6595,6 +6595,7 @@ void mesh_rotate_uvs(void) } if (change) { + DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA); allqueue(REDRAWVIEW3D, 0); BIF_undo_push("Rotate UV face"); } @@ -6645,6 +6646,7 @@ void mesh_mirror_uvs(void) } if (change) { + DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA); allqueue(REDRAWVIEW3D, 0); BIF_undo_push("Mirror UV face"); } @@ -6680,6 +6682,7 @@ void mesh_rotate_colors(void) } if (change) { + DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA); allqueue(REDRAWVIEW3D, 0); BIF_undo_push("Rotate Color face"); } @@ -6716,6 +6719,7 @@ void mesh_mirror_colors(void) } if (change) { + DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA); allqueue(REDRAWVIEW3D, 0); BIF_undo_push("Mirror Color face"); } diff --git a/source/blender/src/header_image.c b/source/blender/src/header_image.c index a01fa72abc8..7c00dfe6dda 100644 --- a/source/blender/src/header_image.c +++ b/source/blender/src/header_image.c @@ -425,6 +425,9 @@ static void do_image_viewmenu(void *arg, int event) case 2: /* Maximize Window */ /* using event B_FULL */ break; + case 4: /* Realtime Panel... */ + add_blockhandler(curarea, IMAGE_HANDLER_VIEW_PROPERTIES, UI_PNL_UNSTOW); + break; case 5: /* Draw Shadow Mesh */ G.sima->flag ^= SI_DRAWSHADOW; allqueue(REDRAWIMAGE, 0); @@ -472,6 +475,7 @@ static uiBlock *image_viewmenu(void *arg_unused) block= uiNewBlock(&curarea->uiblocks, "image_viewmenu", UI_EMBOSSP, UI_HELV, curarea->headwin); uiBlockSetButmFunc(block, do_image_viewmenu, NULL); + 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...", 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, ""); |