diff options
Diffstat (limited to 'source/blender/editors/space_image')
-rw-r--r-- | source/blender/editors/space_image/CMakeLists.txt | 8 | ||||
-rw-r--r-- | source/blender/editors/space_image/Makefile | 17 | ||||
-rw-r--r-- | source/blender/editors/space_image/image_buttons.c | 26 | ||||
-rw-r--r-- | source/blender/editors/space_image/image_draw.c | 30 | ||||
-rw-r--r-- | source/blender/editors/space_image/image_header.c | 8 | ||||
-rw-r--r-- | source/blender/editors/space_image/image_ops.c | 99 | ||||
-rw-r--r-- | source/blender/editors/space_image/image_render.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_image/space_image.c | 5 |
8 files changed, 110 insertions, 85 deletions
diff --git a/source/blender/editors/space_image/CMakeLists.txt b/source/blender/editors/space_image/CMakeLists.txt index fce56b9c239..59749a47afd 100644 --- a/source/blender/editors/space_image/CMakeLists.txt +++ b/source/blender/editors/space_image/CMakeLists.txt @@ -34,13 +34,13 @@ SET(INC ../../windowmanager ) -IF(WITH_OPENEXR) +IF(WITH_IMAGE_OPENEXR) ADD_DEFINITIONS(-DWITH_OPENEXR) -ENDIF(WITH_OPENEXR) +ENDIF(WITH_IMAGE_OPENEXR) -IF(WITH_TIFF) +IF(WITH_IMAGE_TIFF) ADD_DEFINITIONS(-DWITH_TIFF) -ENDIF(WITH_TIFF) +ENDIF(WITH_IMAGE_TIFF) IF(WITH_LCMS) SET(INC ${INC} ${LCMS_INCLUDE_DIR}) diff --git a/source/blender/editors/space_image/Makefile b/source/blender/editors/space_image/Makefile index ab30ff607ec..51a29115813 100644 --- a/source/blender/editors/space_image/Makefile +++ b/source/blender/editors/space_image/Makefile @@ -15,7 +15,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # The Original Code is Copyright (C) 2007 Blender Foundation # All rights reserved. @@ -58,7 +58,20 @@ ifeq ($(WITH_OPENEXR), true) CPPFLAGS += -DWITH_OPENEXR endif -ifeq ($(WHITH_TIFF), true) +ifeq ($(WITH_TIFF), true) CPPFLAGS += -DWITH_TIFF endif +ifeq ($(WITH_LCMS), true) + CPPFLAGS += -DWITH_LCMS + CPPFLAGS += -I$(BF_LCMS_INC) +endif + +ifeq ($(WITH_CINEON), true) + CPPFLAGS += -DWITH_CINEON +endif + +ifeq ($(WITH_HDR), true) + CPPFLAGS += -DWITH_HDR +endif + diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index e9b094ee8fb..44f3f5f5764 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -45,15 +45,9 @@ #include "BKE_context.h" #include "BKE_customdata.h" #include "BKE_image.h" -#include "BKE_global.h" -#include "BKE_library.h" -#include "BKE_main.h" #include "BKE_mesh.h" #include "BKE_node.h" -#include "BKE_packedFile.h" -#include "BKE_paint.h" #include "BKE_screen.h" -#include "BKE_utildefines.h" #include "BKE_tessmesh.h" #include "RE_pipeline.h" @@ -66,8 +60,6 @@ #include "ED_screen.h" #include "ED_uvedit.h" -#include "BIF_gl.h" -#include "BIF_glutil.h" #include "RNA_access.h" @@ -759,7 +751,7 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propn prop= RNA_struct_find_property(ptr, propname); if(!prop) { - printf("uiTemplateImage: property not found: %s\n", propname); + printf("uiTemplateImage: property not found: %s.%s\n", RNA_struct_identifier(ptr->type), propname); return; } @@ -777,7 +769,7 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propn uiLayoutSetContextPointer(layout, "edit_image", &imaptr); if(!compact) - uiTemplateID(layout, C, ptr, propname, "IMAGE_OT_new", "IMAGE_OT_open", NULL, NULL); + uiTemplateID(layout, C, ptr, propname, "IMAGE_OT_new", "IMAGE_OT_open", NULL); // XXX missing: reload, pack @@ -871,13 +863,13 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propn split= uiLayoutSplit(layout, 0, 0); col= uiLayoutColumn(split, 0); - uiItemR(col, &imaptr, "fields", 0, NULL, 0); + uiItemR(col, &imaptr, "use_fields", 0, NULL, 0); row= uiLayoutRow(col, 0); uiItemR(row, &imaptr, "field_order", UI_ITEM_R_EXPAND, NULL, 0); - uiLayoutSetActive(row, RNA_boolean_get(&imaptr, "fields")); + uiLayoutSetActive(row, RNA_boolean_get(&imaptr, "use_fields")); col= uiLayoutColumn(split, 0); - uiItemR(col, &imaptr, "premultiply", 0, NULL, 0); + uiItemR(col, &imaptr, "use_premultiply", 0, NULL, 0); } } @@ -890,7 +882,7 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propn sprintf(str, "(%d) Frames", iuser->framenr); row= uiLayoutRow(col, 1); - uiItemR(col, userptr, "frames", 0, str, 0); + uiItemR(col, userptr, "frame_duration", 0, str, 0); if(ima->anim) { block= uiLayoutGetBlock(row); but= uiDefBut(block, BUT, 0, "Match Movie Length", 0, 0, UI_UNIT_X*2, UI_UNIT_Y, 0, 0, 0, 0, 0, "Set the number of frames to match the movie or sequence."); @@ -898,12 +890,12 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propn } uiItemR(col, userptr, "frame_start", 0, "Start", 0); - uiItemR(col, userptr, "offset", 0, NULL, 0); + uiItemR(col, userptr, "frame_offset", 0, NULL, 0); col= uiLayoutColumn(split, 0); uiItemR(col, userptr, "fields_per_frame", 0, "Fields", 0); - uiItemR(col, userptr, "auto_refresh", 0, NULL, 0); - uiItemR(col, userptr, "cyclic", 0, NULL, 0); + uiItemR(col, userptr, "use_auto_refresh", 0, NULL, 0); + uiItemR(col, userptr, "use_cyclic", 0, NULL, 0); } else if(ima->source==IMA_SRC_GENERATED) { split= uiLayoutSplit(layout, 0, 0); diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index 309c0061130..6a77d4da067 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -36,6 +36,7 @@ #include "DNA_space_types.h" #include "DNA_scene_types.h" #include "DNA_screen_types.h" +#include "DNA_brush_types.h" #include "PIL_time.h" #include "BLI_threads.h" @@ -44,11 +45,9 @@ #include "IMB_imbuf_types.h" #include "BKE_context.h" -#include "BKE_colortools.h" #include "BKE_global.h" #include "BKE_image.h" #include "BKE_paint.h" -#include "BKE_utildefines.h" #include "BIF_gl.h" #include "BIF_glutil.h" @@ -215,7 +214,7 @@ static void draw_image_grid(ARegion *ar, float zoomx, float zoomy) glEnd(); } -static void sima_draw_alpha_backdrop(float x1, float y1, float xsize, float ysize, float zoomx, float zoomy) +static void sima_draw_alpha_backdrop(float x1, float y1, float xsize, float ysize, float zoomx, float zoomy, unsigned char col1[3], unsigned char col2[3]) { GLubyte checker_stipple[32*32/8] = { @@ -229,9 +228,9 @@ static void sima_draw_alpha_backdrop(float x1, float y1, float xsize, float ysiz 0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255, \ }; - glColor3ub(100, 100, 100); + glColor3ubv(col1); glRectf(x1, y1, x1 + zoomx*xsize, y1 + zoomy*ysize); - glColor3ub(160, 160, 160); + glColor3ubv(col2); glEnable(GL_POLYGON_STIPPLE); glPolygonStipple(checker_stipple); @@ -271,11 +270,16 @@ static void sima_draw_alpha_pixelsf(float x1, float y1, int rectx, int recty, fl } #ifdef WITH_LCMS -static void sima_draw_colorcorrected_pixels(float x1, float y1, ImBuf *ibuf) +static int sima_draw_colorcorrected_pixels(float x1, float y1, ImBuf *ibuf) { colorcorrection_do_ibuf(ibuf, "MONOSCNR.ICM"); /* path is hardcoded here, find some place better */ - - glaDrawPixelsSafe(x1, y1, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->crect); + + if(ibuf->crect) { + glaDrawPixelsSafe(x1, y1, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->crect); + return 1; + } + + return 0; } #endif @@ -361,13 +365,17 @@ static void draw_image_buffer(SpaceImage *sima, ARegion *ar, Scene *scene, Image else if(sima->flag & SI_COLOR_CORRECTION) { image_verify_buffer_float(sima, ima, ibuf, color_manage); - sima_draw_colorcorrected_pixels(x, y, ibuf); + if(sima_draw_colorcorrected_pixels(x, y, ibuf)==0) { + unsigned char col1[3]= {100, 0, 100}, col2[3]= {160, 0, 160}; /* pink says 'warning' in blender land */ + sima_draw_alpha_backdrop(x, y, ibuf->x, ibuf->y, zoomx, zoomy, col1, col2); + } } #endif else { if(sima->flag & SI_USE_ALPHA) { - sima_draw_alpha_backdrop(x, y, ibuf->x, ibuf->y, zoomx, zoomy); + unsigned char col1[3]= {100, 100, 100}, col2[3]= {160, 160, 160}; + sima_draw_alpha_backdrop(x, y, ibuf->x, ibuf->y, zoomx, zoomy, col1, col2); glEnable(GL_BLEND); glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); @@ -521,7 +529,7 @@ static void draw_image_view_tool(Scene *scene) if(draw) { getmouseco_areawin(mval); - radius= brush->size*G.sima->zoom/2; + radius= brush_size(brush)*G.sima->zoom; fdrawXORcirc(mval[0], mval[1], radius); if (brush->innerradius != 1.0) { diff --git a/source/blender/editors/space_image/image_header.c b/source/blender/editors/space_image/image_header.c index efe832040c7..0ec917846fd 100644 --- a/source/blender/editors/space_image/image_header.c +++ b/source/blender/editors/space_image/image_header.c @@ -33,17 +33,11 @@ #include "DNA_space_types.h" #include "DNA_windowmanager_types.h" -#include "MEM_guardedalloc.h" #include "BLI_blenlib.h" #include "BLI_editVert.h" #include "BKE_context.h" -#include "BKE_customdata.h" -#include "BKE_image.h" -#include "BKE_mesh.h" -#include "BKE_screen.h" -#include "BKE_utildefines.h" #include "BKE_mesh.h" @@ -51,8 +45,6 @@ #include "WM_types.h" -#include "BIF_gl.h" -#include "BIF_glutil.h" #include "UI_interface.h" diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index a8e231bfae9..818a6181626 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -33,6 +33,7 @@ #include "MEM_guardedalloc.h" #include "DNA_object_types.h" +#include "DNA_node_types.h" #include "DNA_packedFile_types.h" #include "DNA_scene_types.h" #include "DNA_meshdata_types.h" @@ -41,7 +42,6 @@ #include "BKE_context.h" #include "BKE_image.h" #include "BKE_global.h" -#include "BKE_image.h" #include "BKE_library.h" #include "BKE_main.h" #include "BKE_node.h" @@ -131,10 +131,15 @@ static int space_image_file_exists_poll(bContext *C) SpaceImage *sima= CTX_wm_space_image(C); ImBuf *ibuf; void *lock; - int poll; - + int poll= 0; + char name[FILE_MAX]; + ibuf= ED_space_image_acquire_buffer(sima, &lock); - poll= (ibuf && BLI_exists(ibuf->name) && BLI_is_writable(ibuf->name)); + if(ibuf) { + BLI_strncpy(name, ibuf->name, FILE_MAX); + BLI_path_abs(name, G.sce); + poll= (BLI_exists(name) && BLI_is_writable(name)); + } ED_space_image_release_buffer(sima, lock); return poll; @@ -646,9 +651,13 @@ static const EnumPropertyItem image_file_type_items[] = { #ifdef WITH_TIFF {R_TIFF, "TIFF", 0, "Tiff", ""}, #endif +#ifdef WITH_DDS {R_RADHDR, "RADIANCE_HDR", 0, "Radiance HDR", ""}, +#endif +#ifdef WITH_CINEON {R_CINEON, "CINEON", 0, "Cineon", ""}, {R_DPX, "DPX", 0, "DPX", ""}, +#endif #ifdef WITH_OPENEXR {R_OPENEXR, "OPENEXR", 0, "OpenEXR", ""}, /* saving sequences of multilayer won't work, they copy buffers */ @@ -734,7 +743,22 @@ static int open_exec(bContext *C, wmOperator *op) static int open_invoke(bContext *C, wmOperator *op, wmEvent *event) { SpaceImage *sima= CTX_wm_space_image(C); - char *path= (sima && sima->image)? sima->image->name: U.textudir; + char *path=U.textudir; + Image *ima= NULL; + + if(sima) { + ima= sima->image; + } + + if (ima==NULL) { + Tex *tex= CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data; + if(tex && tex->type==TEX_IMAGE) + ima= tex->ima; + } + + if(ima) + path= ima->name; + if(!RNA_property_is_set(op->ptr, "relative_path")) RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS); @@ -1034,6 +1058,8 @@ static int save_exec(bContext *C, wmOperator *op) BLI_strncpy(name, ibuf->name, FILE_MAX); if(name[0]==0) BLI_strncpy(name, G.ima, FILE_MAX); + else + BLI_path_abs(name, G.sce); if(BLI_exists(name) && BLI_is_writable(name)) { rr= BKE_image_acquire_renderresult(scene, ima); @@ -1241,7 +1267,7 @@ static int new_exec(bContext *C, wmOperator *op) void IMAGE_OT_new(wmOperatorType *ot) { PropertyRNA *prop; - float default_color[4]= {0.0f, 0.0f, 0.0f, 1.0f}; + static float default_color[4]= {0.0f, 0.0f, 0.0f, 1.0f}; /* identifiers */ ot->name= "New"; @@ -2056,8 +2082,10 @@ void IMAGE_OT_cycle_render_slot(wmOperatorType *ot) void ED_image_update_frame(const bContext *C) { - Main *mainp = CTX_data_main(C); + Main *mainp= CTX_data_main(C); Scene *scene= CTX_data_scene(C); + wmWindowManager *wm= CTX_wm_manager(C); + wmWindow *win; Tex *tex; /* texture users */ @@ -2070,41 +2098,40 @@ void ED_image_update_frame(const bContext *C) } } -#if 0 /* image window, compo node users */ - if(G.curscreen) { - ScrArea *sa; - for(sa= G.curscreen->areabase.first; sa; sa= sa->next) { - if(sa->spacetype==SPACE_VIEW3D) { - View3D *v3d= sa->spacedata.first; - if(v3d->bgpic) - if(v3d->bgpic->iuser.flag & IMA_ANIM_ALWAYS) - BKE_image_user_calc_frame(&v3d->bgpic->iuser, scene->r.cfra, 0); - } - else if(sa->spacetype==SPACE_IMAGE) { - SpaceImage *sima= sa->spacedata.first; - if(sima->iuser.flag & IMA_ANIM_ALWAYS) - BKE_image_user_calc_frame(&sima->iuser, scene->r.cfra, 0); - } - else if(sa->spacetype==SPACE_NODE) { - SpaceNode *snode= sa->spacedata.first; - if((snode->treetype==NTREE_COMPOSIT) && (snode->nodetree)) { - bNode *node; - for(node= snode->nodetree->nodes.first; node; node= node->next) { - if(node->id && node->type==CMP_NODE_IMAGE) { - Image *ima= (Image *)node->id; - ImageUser *iuser= node->storage; - if(ELEM(ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) - if(iuser->flag & IMA_ANIM_ALWAYS) - BKE_image_user_calc_frame(iuser, scene->r.cfra, 0); + if(wm) { + for(win= wm->windows.first; win; win= win->next) { + ScrArea *sa; + for(sa= win->screen->areabase.first; sa; sa= sa->next) { + if(sa->spacetype==SPACE_VIEW3D) { + View3D *v3d= sa->spacedata.first; + BGpic *bgpic; + for(bgpic= v3d->bgpicbase.first; bgpic; bgpic= bgpic->next) + if(bgpic->iuser.flag & IMA_ANIM_ALWAYS) + BKE_image_user_calc_frame(&bgpic->iuser, scene->r.cfra, 0); + } + else if(sa->spacetype==SPACE_IMAGE) { + SpaceImage *sima= sa->spacedata.first; + if(sima->iuser.flag & IMA_ANIM_ALWAYS) + BKE_image_user_calc_frame(&sima->iuser, scene->r.cfra, 0); + } + else if(sa->spacetype==SPACE_NODE) { + SpaceNode *snode= sa->spacedata.first; + if((snode->treetype==NTREE_COMPOSIT) && (snode->nodetree)) { + bNode *node; + for(node= snode->nodetree->nodes.first; node; node= node->next) { + if(node->id && node->type==CMP_NODE_IMAGE) { + Image *ima= (Image *)node->id; + ImageUser *iuser= node->storage; + if(ELEM(ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) + if(iuser->flag & IMA_ANIM_ALWAYS) + BKE_image_user_calc_frame(iuser, scene->r.cfra, 0); + } } } } } } } -#endif } - - diff --git a/source/blender/editors/space_image/image_render.c b/source/blender/editors/space_image/image_render.c index 18e42ce8797..be9d60a5adb 100644 --- a/source/blender/editors/space_image/image_render.c +++ b/source/blender/editors/space_image/image_render.c @@ -32,9 +32,7 @@ #include "DNA_space_types.h" #include "BKE_context.h" -#include "BKE_global.h" #include "BKE_image.h" -#include "BKE_screen.h" #include "BIF_gl.h" #include "BIF_glutil.h" diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index 28669847814..32e8be83bc5 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -45,10 +45,8 @@ #include "BKE_image.h" #include "BKE_mesh.h" #include "BKE_screen.h" -#include "BKE_utildefines.h" #include "BKE_tessmesh.h" -#include "IMB_imbuf.h" #include "IMB_imbuf_types.h" #include "ED_mesh.h" @@ -57,7 +55,6 @@ #include "ED_uvedit.h" #include "BIF_gl.h" -#include "BIF_glutil.h" #include "RNA_access.h" @@ -773,8 +770,6 @@ static void image_main_area_draw(const bContext *C, ARegion *ar) /* draw Grease Pencil - screen space only */ draw_image_grease_pencil((bContext *)C, 0); - - ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_PIXEL); /* scrollers? */ /*scrollers= UI_view2d_scrollers_calc(C, v2d, V2D_UNIT_VALUES, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY); |