From 44505b38df557a5711703613685a1dec9fc2c3d9 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 4 Jun 2018 09:31:30 +0200 Subject: Cleanup: strip trailing space in editors --- source/blender/editors/space_image/image_buttons.c | 72 ++++---- source/blender/editors/space_image/image_draw.c | 48 ++--- source/blender/editors/space_image/image_edit.c | 4 +- source/blender/editors/space_image/image_ops.c | 194 ++++++++++----------- source/blender/editors/space_image/space_image.c | 96 +++++----- 5 files changed, 207 insertions(+), 207 deletions(-) (limited to 'source/blender/editors/space_image') diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index c105f40f1d6..8b8aabb2ce0 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -134,7 +134,7 @@ static void image_info(Scene *scene, ImageUser *iuser, Image *ima, ImBuf *ibuf, struct ImageUser *ntree_get_active_iuser(bNodeTree *ntree) { bNode *node; - + if (ntree) for (node = ntree->nodes.first; node; node = node->next) if (ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) @@ -147,7 +147,7 @@ struct ImageUser *ntree_get_active_iuser(bNodeTree *ntree) /* ************ panel stuff ************* */ #if 0 -/* 0: disable preview +/* 0: disable preview * otherwise refresh preview * * XXX if you put this back, also check XXX in image_main_region_draw() */ @@ -155,7 +155,7 @@ struct ImageUser *ntree_get_active_iuser(bNodeTree *ntree) void image_preview_event(int event) { int exec = 0; - + if (event == 0) { G.scene->r.scemode &= ~R_COMP_CROP; exec = 1; @@ -168,27 +168,27 @@ void image_preview_event(int event) else G.scene->r.scemode &= ~R_COMP_CROP; } - + if (exec && G.scene->nodetree) { Scene *scene = G.scene; /* should work when no node editor in screen..., so we execute right away */ - + ntreeCompositTagGenerators(G.scene->nodetree); G.is_break = false; G.scene->nodetree->timecursor = set_timecursor; G.scene->nodetree->test_break = BKE_blender_test_break; - + BIF_store_spare(); - + ntreeCompositExecTree(scene->nodetree, &scene->r, 1, &scene->view_settings, &scene->display_settings); /* 1 is do_previews */ - + G.scene->nodetree->timecursor = NULL; G.scene->nodetree->test_break = NULL; - + scrarea_do_windraw(curarea); waitcursor(0); - + WM_event_add_notifier(C, NC_IMAGE, ima_v); } } @@ -203,20 +203,20 @@ static void preview_cb(ScrArea *sa, struct uiBlock *block) int winx = (G.scene->r.size * G.scene->r.xsch) / 100; int winy = (G.scene->r.size * G.scene->r.ysch) / 100; int mval[2]; - + if (G.scene->r.mode & R_BORDER) { winx *= BLI_rcti_size_x(&G.scene->r.border); winy *= BLI_rctf_size_y(&G.scene->r.border); } - + /* while dragging we need to update the rects, otherwise it doesn't end with correct one */ BLI_rctf_init(&dispf, 15.0f, BLI_rcti_size_x(&block->rect) - 15.0f, 15.0f, (BLI_rctf_size_y(&block->rect)) - 15.0f); ui_graphics_to_window_rct(sa->win, &dispf, disprect); - + /* correction for gla draw */ BLI_rcti_translate(disprect, -curarea->winrct.xmin, -curarea->winrct.ymin); - + calc_image_view(sima, 'p'); // printf("winrct %d %d %d %d\n", disprect->xmin, disprect->ymin, disprect->xmax, disprect->ymax); /* map to image space coordinates */ @@ -224,13 +224,13 @@ static void preview_cb(ScrArea *sa, struct uiBlock *block) areamouseco_to_ipoco(v2d, mval, &dispf.xmin, &dispf.ymin); mval[0] = disprect->xmax; mval[1] = disprect->ymax; areamouseco_to_ipoco(v2d, mval, &dispf.xmax, &dispf.ymax); - + /* map to render coordinates */ disprect->xmin = dispf.xmin; disprect->xmax = dispf.xmax; disprect->ymin = dispf.ymin; disprect->ymax = dispf.ymax; - + CLAMP(disprect->xmin, 0, winx); CLAMP(disprect->xmax, 0, winx); CLAMP(disprect->ymin, 0, winy); @@ -254,7 +254,7 @@ static bool is_preview_allowed(ScrArea *cur) /* check image type */ if (sima->image == NULL || sima->image->type != IMA_TYPE_COMPOSITE) return 0; - + return 1; } @@ -264,23 +264,23 @@ static void image_panel_preview(ScrArea *sa, short cntrl) // IMAGE_HANDLER_PRE uiBlock *block; SpaceImage *sima = sa->spacedata.first; int ofsx, ofsy; - + if (is_preview_allowed(sa) == 0) { rem_blockhandler(sa, IMAGE_HANDLER_PREVIEW); G.scene->r.scemode &= ~R_COMP_CROP; /* quite weak */ return; } - + block = UI_block_begin(C, ar, __func__, UI_EMBOSS); uiPanelControl(UI_PNL_SOLID | UI_PNL_CLOSE | UI_PNL_SCALE | cntrl); uiSetPanelHandler(IMAGE_HANDLER_PREVIEW); // for close and esc - + ofsx = -150 + (sa->winx / 2) / sima->blockscale; ofsy = -100 + (sa->winy / 2) / sima->blockscale; if (uiNewPanel(C, ar, block, "Preview", "Image", ofsx, ofsy, 300, 200) == 0) return; - + UI_but_func_drawextra_set(block, preview_cb); - + } #endif @@ -660,7 +660,7 @@ static void image_multiview_cb(bContext *C, void *rnd_pt, void *UNUSED(arg_v)) } #if 0 -static void image_freecache_cb(bContext *C, void *ima_v, void *unused) +static void image_freecache_cb(bContext *C, void *ima_v, void *unused) { Scene *scene = CTX_data_scene(C); BKE_image_free_anim_ibufs(ima_v, scene->r.cfra); @@ -898,7 +898,7 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char uiDefIconTextBut(block, UI_BTYPE_BUT, B_SIMA_PLAY, ICON_PLAY, "Play", 110, 120, 100, 20, 0, 0, 0, 0, 0, ""); but = uiDefBut(block, UI_BTYPE_BUT, B_NOP, "Free Cache", 210, 120, 100, 20, 0, 0, 0, 0, 0, ""); UI_but_func_set(but, image_freecache_cb, ima, NULL); - + if (iuser->frames) BLI_snprintf(str, sizeof(str), "(%d) Frames:", iuser->framenr); else strcpy(str, "Frames:"); @@ -929,7 +929,7 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char uiItemO(row, "", ICON_PACKAGE, "image.unpack"); else uiItemO(row, "", ICON_UGLYPACKAGE, "image.pack"); - + row = uiLayoutRow(row, true); uiLayoutSetEnabled(row, BKE_image_has_packedfile(ima) == false); uiItemR(row, &imaptr, "filepath", 0, "", ICON_NONE); @@ -1043,7 +1043,7 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char col = uiLayoutColumn(split, true); uiItemR(col, &imaptr, "generated_width", 0, "X", ICON_NONE); uiItemR(col, &imaptr, "generated_height", 0, "Y", ICON_NONE); - + uiItemR(col, &imaptr, "use_generated_float", 0, NULL, ICON_NONE); uiItemR(split, &imaptr, "generated_type", UI_ITEM_R_EXPAND, NULL, ICON_NONE); @@ -1077,7 +1077,7 @@ void uiTemplateImageSettings(uiLayout *layout, PointerRNA *imfptr, int color_man col = uiLayoutColumn(layout, false); split = uiLayoutSplit(col, 0.5f, false); - + uiItemR(split, imfptr, "file_format", 0, "", ICON_NONE); sub = uiLayoutRow(split, false); uiItemR(sub, imfptr, "color_mode", UI_ITEM_R_EXPAND, IFACE_("Color"), ICON_NONE); @@ -1109,7 +1109,7 @@ void uiTemplateImageSettings(uiLayout *layout, PointerRNA *imfptr, int color_man if (ELEM(imf->imtype, R_IMF_IMTYPE_OPENEXR, R_IMF_IMTYPE_MULTILAYER)) { uiItemR(col, imfptr, "exr_codec", 0, NULL, ICON_NONE); } - + row = uiLayoutRow(col, false); if (BKE_imtype_supports_zbuf(imf->imtype)) { uiItemR(row, imfptr, "use_zbuffer", 0, NULL, ICON_NONE); @@ -1126,7 +1126,7 @@ void uiTemplateImageSettings(uiLayout *layout, PointerRNA *imfptr, int color_man row = uiLayoutRow(col, false); uiItemR(row, imfptr, "use_jpeg2k_cinema_preset", 0, NULL, ICON_NONE); uiItemR(row, imfptr, "use_jpeg2k_cinema_48", 0, NULL, ICON_NONE); - + uiItemR(col, imfptr, "use_jpeg2k_ycc", 0, NULL, ICON_NONE); } @@ -1297,14 +1297,14 @@ void uiTemplateImageInfo(uiLayout *layout, bContext *C, Image *ima, ImageUser *i void image_buttons_register(ARegionType *UNUSED(art)) { - + } static int image_properties_toggle_exec(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa = CTX_wm_area(C); ARegion *ar = image_has_buttons_region(sa); - + if (ar) ED_region_toggle_hidden(C, ar); @@ -1316,10 +1316,10 @@ void IMAGE_OT_properties(wmOperatorType *ot) ot->name = "Properties"; ot->idname = "IMAGE_OT_properties"; ot->description = "Toggle the properties region visibility"; - + ot->exec = image_properties_toggle_exec; ot->poll = ED_operator_image_active; - + /* flags */ ot->flag = 0; } @@ -1328,10 +1328,10 @@ static int image_scopes_toggle_exec(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa = CTX_wm_area(C); ARegion *ar = image_has_tools_region(sa); - + if (ar) ED_region_toggle_hidden(C, ar); - + return OPERATOR_FINISHED; } @@ -1343,7 +1343,7 @@ void IMAGE_OT_toolshelf(wmOperatorType *ot) ot->exec = image_scopes_toggle_exec; ot->poll = ED_operator_image_active; - + /* flags */ ot->flag = 0; } diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index 594938b82aa..c358b38520a 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -221,7 +221,7 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, bool color_manage, bool use_d BLF_position(blf_mono_font, dx, dy, 0); BLF_draw_ascii(blf_mono_font, str, sizeof(str)); dx += BLF_width(blf_mono_font, str, sizeof(str)); - + glColor3ubv(green); if (fp) BLI_snprintf(str, sizeof(str), " G:%-.5f", fp[1]); @@ -232,7 +232,7 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, bool color_manage, bool use_d BLF_position(blf_mono_font, dx, dy, 0); BLF_draw_ascii(blf_mono_font, str, sizeof(str)); dx += BLF_width(blf_mono_font, str, sizeof(str)); - + glColor3ubv(blue); if (fp) BLI_snprintf(str, sizeof(str), " B:%-.5f", fp[2]); @@ -243,7 +243,7 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, bool color_manage, bool use_d BLF_position(blf_mono_font, dx, dy, 0); BLF_draw_ascii(blf_mono_font, str, sizeof(str)); dx += BLF_width(blf_mono_font, str, sizeof(str)); - + if (channels == 4) { glColor3ub(255, 255, 255); if (fp) @@ -277,7 +277,7 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, bool color_manage, bool use_d dx += BLF_width(blf_mono_font, str, sizeof(str)); } } - + /* color rectangle */ if (channels == 1) { if (fp) { @@ -366,7 +366,7 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, bool color_manage, bool use_d rgb_to_hsv((float)cp[0] / 255.0f, (float)cp[0] / 255.0f, (float)cp[0] / 255.0f, &hue, &sat, &val); rgb_to_yuv((float)cp[0] / 255.0f, (float)cp[0] / 255.0f, (float)cp[0] / 255.0f, &lum, &u, &v, BLI_YUV_ITU_BT709); } - + BLI_snprintf(str, sizeof(str), "V:%-.4f", val); BLF_position(blf_mono_font, dx, dy, 0); BLF_draw_ascii(blf_mono_font, str, sizeof(str)); @@ -409,7 +409,7 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, bool color_manage, bool use_d static void sima_draw_alpha_pixels(float x1, float y1, int rectx, int recty, unsigned int *recti) { - + /* swap bytes, so alpha is most significant one, then just draw it as luminance int */ if (ENDIAN_ORDER == B_ENDIAN) glPixelStorei(GL_UNPACK_SWAP_BYTES, 1); @@ -422,10 +422,10 @@ static void sima_draw_alpha_pixelsf(float x1, float y1, int rectx, int recty, fl { float *trectf = MEM_mallocN(rectx * recty * 4, "temp"); int a, b; - + for (a = rectx * recty - 1, b = 4 * a + 3; a >= 0; a--, b -= 4) trectf[a] = rectf[b]; - + glaDrawPixelsSafe(x1, y1, rectx, recty, rectx, GL_LUMINANCE, GL_FLOAT, trectf); MEM_freeN(trectf); /* ogl trick below is slower... (on ATI 9600) */ @@ -447,9 +447,9 @@ static void sima_draw_zbuf_pixels(float x1, float y1, int rectx, int recty, int glPixelTransferf(GL_RED_BIAS, 0.5f); glPixelTransferf(GL_GREEN_BIAS, 0.5f); glPixelTransferf(GL_BLUE_BIAS, 0.5f); - + glaDrawPixelsSafe(x1, y1, rectx, recty, rectx, GL_LUMINANCE, GL_INT, recti); - + glPixelTransferf(GL_RED_SCALE, 1.0f); glPixelTransferf(GL_GREEN_SCALE, 1.0f); glPixelTransferf(GL_BLUE_SCALE, 1.0f); @@ -462,7 +462,7 @@ static void sima_draw_zbuffloat_pixels(Scene *scene, float x1, float y1, int rec { float bias, scale, *rectf, clipend; int a; - + if (scene->camera && scene->camera->type == OB_CAMERA) { bias = ((Camera *)scene->camera->data)->clipsta; clipend = ((Camera *)scene->camera->data)->clipend; @@ -473,7 +473,7 @@ static void sima_draw_zbuffloat_pixels(Scene *scene, float x1, float y1, int rec scale = 0.01f; clipend = 100.0f; } - + rectf = MEM_mallocN(rectx * recty * 4, "temp"); for (a = rectx * recty - 1; a >= 0; a--) { if (rect_float[a] > clipend) @@ -486,7 +486,7 @@ static void sima_draw_zbuffloat_pixels(Scene *scene, float x1, float y1, int rec } } glaDrawPixelsSafe(x1, y1, rectx, recty, rectx, GL_LUMINANCE, GL_FLOAT, rectf); - + MEM_freeN(rectf); } @@ -511,7 +511,7 @@ static void draw_image_buffer(const bContext *C, SpaceImage *sima, ARegion *ar, glPixelZoom(zoomx, zoomy); glaDefine2DArea(&ar->winrct); - + /* find window pixel coordinates of origin */ UI_view2d_view_to_region(&ar->v2d, fx, fy, &x, &y); @@ -586,7 +586,7 @@ static unsigned int *get_part_from_buffer(unsigned int *buffer, int width, short heigth = (endy - starty); rp = rectmain = MEM_mallocN(heigth * len * sizeof(int), "rect"); - + for (y = 0; y < heigth; y++) { memcpy(rp, rt, len * 4); rt += width; @@ -619,14 +619,14 @@ static void draw_image_buffer_tiled(SpaceImage *sima, ARegion *ar, Scene *scene, if (sima->curtile >= ima->xrep * ima->yrep) sima->curtile = ima->xrep * ima->yrep - 1; - + /* retrieve part of image buffer */ dx = max_ii(ibuf->x / ima->xrep, 1); dy = max_ii(ibuf->y / ima->yrep, 1); sx = (sima->curtile % ima->xrep) * dx; sy = (sima->curtile / ima->xrep) * dy; rect = get_part_from_buffer((unsigned int *)display_buffer, ibuf->x, sx, sy, sx + dx, sy + dy); - + /* draw repeated */ if ((sima->flag & (SI_SHOW_R | SI_SHOW_G | SI_SHOW_B)) != 0) { channel_offset = draw_image_channel_offset(sima); @@ -690,7 +690,7 @@ void draw_image_grease_pencil(bContext *C, bool onlyv2d) else { /* assume that UI_view2d_restore(C) has been called... */ //SpaceImage *sima = (SpaceImage *)CTX_wm_space_data(C); - + /* draw grease-pencil ('screen' strokes) */ ED_gpencil_draw_view2d(C, 0); } @@ -735,7 +735,7 @@ static void draw_image_view_tool(Scene *scene) } else if (settings->imapaint.flag & IMAGEPAINT_DRAW_TOOL) draw = 1; - + if (draw) { getmouseco_areawin(mval); @@ -762,7 +762,7 @@ static unsigned char *get_alpha_clone_image(const bContext *C, Scene *scene, int if (!brush || !brush->clone.image) return NULL; - + ibuf = BKE_image_acquire_ibuf(brush->clone.image, NULL, NULL); if (!ibuf) @@ -848,10 +848,10 @@ void draw_image_main(const bContext *C, ARegion *ar) /* XXX can we do this in refresh? */ #if 0 what_image(sima); - + if (sima->image) { ED_image_get_aspect(sima->image, &xuser_asp, &yuser_asp); - + /* UGLY hack? until now iusers worked fine... but for flipbook viewer we need this */ if (sima->image->type == IMA_TYPE_COMPOSITE) { ImageUser *iuser = ntree_get_active_iuser(scene->nodetree); @@ -906,7 +906,7 @@ void draw_image_main(const bContext *C, ARegion *ar) draw_image_buffer_tiled(sima, ar, scene, ima, ibuf, 0.0f, 0.0, zoomx, zoomy); else draw_image_buffer(C, sima, ar, scene, ibuf, 0.0f, 0.0f, zoomx, zoomy); - + if (sima->flag & SI_DRAW_METADATA) { int x, y; rctf frame; @@ -928,7 +928,7 @@ void draw_image_main(const bContext *C, ARegion *ar) #if 0 if (ibuf) { float xoffs = 0.0f, yoffs = 0.0f; - + if (image_preview_active(sa, &xim, &yim)) { xoffs = scene->r.disprect.xmin; yoffs = scene->r.disprect.ymin; diff --git a/source/blender/editors/space_image/image_edit.c b/source/blender/editors/space_image/image_edit.c index 383303c9ad0..39a029fb9f0 100644 --- a/source/blender/editors/space_image/image_edit.c +++ b/source/blender/editors/space_image/image_edit.c @@ -324,7 +324,7 @@ void ED_space_image_scopes_update(const struct bContext *C, struct SpaceImage *s { Scene *scene = CTX_data_scene(C); Object *ob = CTX_data_active_object(C); - + /* scope update can be expensive, don't update during paint modes */ if (sima->mode == SI_MODE_PAINT) return; @@ -340,7 +340,7 @@ void ED_space_image_scopes_update(const struct bContext *C, struct SpaceImage *s return; } } - + scopes_update(&sima->scopes, ibuf, use_view_settings ? &scene->view_settings : NULL, &scene->display_settings); } diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 0e553b11919..dea1f761073 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -364,7 +364,7 @@ static int image_view_pan_exec(bContext *C, wmOperator *op) image_preview_event(2); } #endif - + return OPERATOR_FINISHED; } @@ -373,7 +373,7 @@ static int image_view_pan_invoke(bContext *C, wmOperator *op, const wmEvent *eve if (event->type == MOUSEPAN) { SpaceImage *sima = CTX_wm_space_image(C); float offset[2]; - + offset[0] = (event->prevx - event->x) / sima->zoom; offset[1] = (event->prevy - event->y) / sima->zoom; RNA_float_set_array(op->ptr, "offset", offset); @@ -424,7 +424,7 @@ void IMAGE_OT_view_pan(wmOperatorType *ot) ot->name = "View Pan"; ot->idname = "IMAGE_OT_view_pan"; ot->description = "Pan the view"; - + /* api callbacks */ ot->exec = image_view_pan_exec; ot->invoke = image_view_pan_invoke; @@ -434,7 +434,7 @@ void IMAGE_OT_view_pan(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_BLOCKING | OPTYPE_GRAB_CURSOR | OPTYPE_LOCK_BYPASS; - + /* properties */ RNA_def_float_vector(ot->srna, "offset", 2, NULL, -FLT_MAX, FLT_MAX, "Offset", "Offset in floating point units, 1.0 is the width and height of the image", -FLT_MAX, FLT_MAX); @@ -519,7 +519,7 @@ static int image_view_zoom_exec(bContext *C, wmOperator *op) image_preview_event(2); } #endif - + return OPERATOR_FINISHED; } @@ -547,7 +547,7 @@ static int image_view_zoom_invoke(bContext *C, wmOperator *op, const wmEvent *ev RNA_float_set(op->ptr, "factor", factor); sima_zoom_set(sima, ar, sima->zoom * factor, location); ED_region_tag_redraw(ar); - + return OPERATOR_FINISHED; } else { @@ -640,7 +640,7 @@ void IMAGE_OT_view_zoom(wmOperatorType *ot) ot->name = "View Zoom"; ot->idname = "IMAGE_OT_view_zoom"; ot->description = "Zoom in/out the image"; - + /* api callbacks */ ot->exec = image_view_zoom_exec; ot->invoke = image_view_zoom_invoke; @@ -650,7 +650,7 @@ void IMAGE_OT_view_zoom(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_BLOCKING | OPTYPE_GRAB_CURSOR | OPTYPE_LOCK_BYPASS; - + /* properties */ prop = RNA_def_float(ot->srna, "factor", 0.0f, -FLT_MAX, FLT_MAX, "Factor", "Zoom factor, values higher than 1.0 zoom in, lower values zoom out", -FLT_MAX, FLT_MAX); @@ -699,7 +699,7 @@ void IMAGE_OT_view_ndof(wmOperatorType *ot) ot->name = "NDOF Pan/Zoom"; ot->idname = "IMAGE_OT_view_ndof"; ot->description = "Use a 3D mouse device to pan/zoom the view"; - + /* api callbacks */ ot->invoke = image_view_ndof_invoke; ot->poll = space_image_main_region_poll; @@ -732,7 +732,7 @@ static int image_view_all_exec(bContext *C, wmOperator *op) w = width * aspx; h = height * aspy; - + /* check if the image will fit in the image with (zoom == 1) */ width = BLI_rcti_size_x(&ar->winrct) + 1; height = BLI_rcti_size_y(&ar->winrct) + 1; @@ -760,7 +760,7 @@ static int image_view_all_exec(bContext *C, wmOperator *op) sima->xof = sima->yof = 0.0f; ED_region_tag_redraw(ar); - + return OPERATOR_FINISHED; } @@ -772,7 +772,7 @@ void IMAGE_OT_view_all(wmOperatorType *ot) ot->name = "View All"; ot->idname = "IMAGE_OT_view_all"; ot->description = "View the entire image"; - + /* api callbacks */ ot->exec = image_view_all_exec; ot->poll = space_image_main_region_poll; @@ -826,7 +826,7 @@ static int image_view_selected_exec(bContext *C, wmOperator *UNUSED(op)) sima_zoom_set_from_bounds(sima, ar, &bounds); ED_region_tag_redraw(ar); - + return OPERATOR_FINISHED; } @@ -841,7 +841,7 @@ void IMAGE_OT_view_selected(wmOperatorType *ot) ot->name = "View Center"; ot->idname = "IMAGE_OT_view_selected"; ot->description = "View all selected UVs"; - + /* api callbacks */ ot->exec = image_view_selected_exec; ot->poll = image_view_selected_poll; @@ -854,13 +854,13 @@ static int image_view_zoom_in_exec(bContext *C, wmOperator *op) SpaceImage *sima = CTX_wm_space_image(C); ARegion *ar = CTX_wm_region(C); float location[2]; - + RNA_float_get_array(op->ptr, "location", location); sima_zoom_set_factor(sima, ar, powf(2.0f, 1.0f / 3.0f), location); ED_region_tag_redraw(ar); - + return OPERATOR_FINISHED; } @@ -883,7 +883,7 @@ void IMAGE_OT_view_zoom_in(wmOperatorType *ot) ot->name = "View Zoom In"; ot->idname = "IMAGE_OT_view_zoom_in"; ot->description = "Zoom in the image (centered around 2D cursor)"; - + /* api callbacks */ ot->invoke = image_view_zoom_in_invoke; ot->exec = image_view_zoom_in_exec; @@ -903,13 +903,13 @@ static int image_view_zoom_out_exec(bContext *C, wmOperator *op) SpaceImage *sima = CTX_wm_space_image(C); ARegion *ar = CTX_wm_region(C); float location[2]; - + RNA_float_get_array(op->ptr, "location", location); sima_zoom_set_factor(sima, ar, powf(0.5f, 1.0f / 3.0f), location); - + ED_region_tag_redraw(ar); - + return OPERATOR_FINISHED; } @@ -932,7 +932,7 @@ void IMAGE_OT_view_zoom_out(wmOperatorType *ot) ot->name = "View Zoom Out"; ot->idname = "IMAGE_OT_view_zoom_out"; ot->description = "Zoom out the image (centered around 2D cursor)"; - + /* api callbacks */ ot->invoke = image_view_zoom_out_invoke; ot->exec = image_view_zoom_out_exec; @@ -955,7 +955,7 @@ static int image_view_zoom_ratio_exec(bContext *C, wmOperator *op) ARegion *ar = CTX_wm_region(C); sima_zoom_set(sima, ar, RNA_float_get(op->ptr, "ratio"), NULL); - + /* ensure pixel exact locations for draw */ sima->xof = (int)sima->xof; sima->yof = (int)sima->yof; @@ -970,7 +970,7 @@ static int image_view_zoom_ratio_exec(bContext *C, wmOperator *op) #endif ED_region_tag_redraw(ar); - + return OPERATOR_FINISHED; } @@ -980,7 +980,7 @@ void IMAGE_OT_view_zoom_ratio(wmOperatorType *ot) ot->name = "View Zoom Ratio"; ot->idname = "IMAGE_OT_view_zoom_ratio"; ot->description = "Set zoom ratio of the view"; - + /* api callbacks */ ot->exec = image_view_zoom_ratio_exec; ot->poll = space_image_main_region_poll; @@ -1053,7 +1053,7 @@ void IMAGE_OT_view_zoom_border(wmOperatorType *ot) static void image_filesel(bContext *C, wmOperator *op, const char *path) { RNA_string_set(op->ptr, "filepath", path); - WM_event_add_fileselect(C, op); + WM_event_add_fileselect(C, op); } /******************** open image operator ********************/ @@ -1342,10 +1342,10 @@ static int image_open_exec(bContext *C, wmOperator *op) /* XXX unpackImage frees image buffers */ ED_preview_kill_jobs(CTX_wm_manager(C), bmain); - + BKE_image_signal(ima, iuser, IMA_SIGNAL_RELOAD); WM_event_add_notifier(C, NC_IMAGE | NA_EDITED, ima); - + MEM_freeN(op->customdata); return OPERATOR_FINISHED; @@ -1393,7 +1393,7 @@ static int image_open_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED( if (RNA_struct_property_is_set(op->ptr, "filepath")) return image_open_exec(C, op); - + image_open_init(C, op); /* show multiview save options only if scene has multiviews */ @@ -1442,7 +1442,7 @@ void IMAGE_OT_open(wmOperatorType *ot) ot->name = "Open Image"; ot->description = "Open image"; ot->idname = "IMAGE_OT_open"; - + /* api callbacks */ ot->exec = image_open_exec; ot->invoke = image_open_invoke; @@ -1481,7 +1481,7 @@ static int image_match_len_exec(bContext *C, wmOperator *UNUSED(op)) ima = sima->image; iuser = &sima->iuser; } - + } if (!ima || !iuser || !BKE_image_has_anim(ima)) @@ -1503,7 +1503,7 @@ void IMAGE_OT_match_movie_length(wmOperatorType *ot) ot->name = "Match Movie Length"; ot->description = "Set image's user's length to the one of this video"; ot->idname = "IMAGE_OT_match_movie_length"; - + /* api callbacks */ ot->exec = image_match_len_exec; @@ -1520,7 +1520,7 @@ static int image_replace_exec(bContext *C, wmOperator *op) if (!sima->image) return OPERATOR_CANCELLED; - + RNA_string_get(op->ptr, "filepath", str); /* we cant do much if the str is longer then FILE_MAX :/ */ @@ -1530,7 +1530,7 @@ static int image_replace_exec(bContext *C, wmOperator *op) sima->image->source = IMA_SRC_FILE; BKE_image_signal(sima->image, &sima->iuser, IMA_SIGNAL_SRC_CHANGE); } - + if (BLI_testextensie_array(str, imb_ext_movie)) sima->image->source = IMA_SRC_MOVIE; else @@ -1538,7 +1538,7 @@ static int image_replace_exec(bContext *C, wmOperator *op) /* XXX unpackImage frees image buffers */ ED_preview_kill_jobs(CTX_wm_manager(C), CTX_data_main(C)); - + BKE_icon_changed(BKE_icon_id_ensure(&sima->image->id)); BKE_image_signal(sima->image, &sima->iuser, IMA_SIGNAL_RELOAD); WM_event_add_notifier(C, NC_IMAGE | NA_EDITED, sima->image); @@ -1570,7 +1570,7 @@ void IMAGE_OT_replace(wmOperatorType *ot) ot->name = "Replace Image"; ot->idname = "IMAGE_OT_replace"; ot->description = "Replace current image by another one from disk"; - + /* api callbacks */ ot->exec = image_replace_exec; ot->invoke = image_replace_invoke; @@ -2174,7 +2174,7 @@ void IMAGE_OT_save_as(wmOperatorType *ot) ot->name = "Save As Image"; ot->idname = "IMAGE_OT_save_as"; ot->description = "Save the image with another name and/or settings"; - + /* api callbacks */ ot->exec = image_save_as_exec; ot->check = image_save_as_check; @@ -2229,7 +2229,7 @@ void IMAGE_OT_save(wmOperatorType *ot) ot->name = "Save Image"; ot->idname = "IMAGE_OT_save"; ot->description = "Save the image with current name and settings"; - + /* api callbacks */ ot->exec = image_save_exec; ot->poll = space_image_file_exists_poll; @@ -2248,7 +2248,7 @@ static int image_save_sequence_exec(bContext *C, wmOperator *op) int tot = 0; char di[FILE_MAX]; struct MovieCacheIter *iter; - + if (sima->image == NULL) return OPERATOR_CANCELLED; @@ -2261,7 +2261,7 @@ static int image_save_sequence_exec(bContext *C, wmOperator *op) BKE_report(op->reports, RPT_ERROR, "Cannot save multilayer sequences"); return OPERATOR_CANCELLED; } - + /* get total dirty buffers and first dirty buffer which is used for menu */ ibuf = NULL; if (sima->image->cache != NULL) { @@ -2278,7 +2278,7 @@ static int image_save_sequence_exec(bContext *C, wmOperator *op) } IMB_moviecacheIter_free(iter); } - + if (tot == 0) { BKE_report(op->reports, RPT_WARNING, "No images have been changed"); return OPERATOR_CANCELLED; @@ -2320,7 +2320,7 @@ void IMAGE_OT_save_sequence(wmOperatorType *ot) ot->name = "Save Sequence"; ot->idname = "IMAGE_OT_save_sequence"; ot->description = "Save a sequence of images"; - + /* api callbacks */ ot->exec = image_save_sequence_exec; ot->poll = space_image_buffer_exists_poll; @@ -2341,13 +2341,13 @@ static int image_reload_exec(bContext *C, wmOperator *UNUSED(op)) /* XXX unpackImage frees image buffers */ ED_preview_kill_jobs(CTX_wm_manager(C), CTX_data_main(C)); - + // XXX other users? BKE_image_signal(ima, (sima) ? &sima->iuser : NULL, IMA_SIGNAL_RELOAD); DAG_id_tag_update(&ima->id, 0); WM_event_add_notifier(C, NC_IMAGE | NA_EDITED, ima); - + return OPERATOR_FINISHED; } @@ -2357,7 +2357,7 @@ void IMAGE_OT_reload(wmOperatorType *ot) ot->name = "Reload Image"; ot->idname = "IMAGE_OT_reload"; ot->description = "Reload current image from disk"; - + /* api callbacks */ ot->exec = image_reload_exec; @@ -2440,12 +2440,12 @@ static int image_new_exec(bContext *C, wmOperator *op) else if (gen_context == GEN_CONTEXT_PAINT_CANVAS) { bScreen *sc; Object *ob = CTX_data_active_object(C); - - GPU_drawobject_free(ob->derivedFinal); + + GPU_drawobject_free(ob->derivedFinal); if (scene->toolsettings->imapaint.canvas) id_us_min(&scene->toolsettings->imapaint.canvas->id); scene->toolsettings->imapaint.canvas = ima; - + for (sc = bmain->screen.first; sc; sc = sc->id.next) { ScrArea *sa; for (sa = sc->areabase.first; sa; sa = sa->next) { @@ -2453,7 +2453,7 @@ static int image_new_exec(bContext *C, wmOperator *op) for (sl = sa->spacedata.first; sl; sl = sl->next) { if (sl->spacetype == SPACE_IMAGE) { SpaceImage *sima_other = (SpaceImage *)sl; - + if (!sima_other->pin) { ED_space_image_set(bmain, sima_other, scene, scene->obedit, ima); } @@ -2469,8 +2469,8 @@ static int image_new_exec(bContext *C, wmOperator *op) if (scene->toolsettings->imapaint.stencil) id_us_min(&scene->toolsettings->imapaint.stencil->id); scene->toolsettings->imapaint.stencil = ima; - BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL); - WM_event_add_notifier(C, NC_SCENE | ND_TOOLSETTINGS, NULL); + BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL); + WM_event_add_notifier(C, NC_SCENE | ND_TOOLSETTINGS, NULL); } else { Tex *tex = CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data; @@ -2483,9 +2483,9 @@ static int image_new_exec(bContext *C, wmOperator *op) } BKE_image_signal(ima, (sima) ? &sima->iuser : NULL, IMA_SIGNAL_USER_NEW_IMAGE); - + WM_event_add_notifier(C, NC_IMAGE | NA_ADDED, ima); - + return OPERATOR_FINISHED; } @@ -2556,17 +2556,17 @@ void IMAGE_OT_new(wmOperatorType *ot) {GEN_CONTEXT_PAINT_STENCIL, "PAINT_STENCIL", 0, "Paint Stencil", ""}, {0, NULL, 0, NULL, NULL} }; - + /* identifiers */ ot->name = "New Image"; ot->description = "Create a new image"; ot->idname = "IMAGE_OT_new"; - + /* api callbacks */ ot->exec = image_new_exec; ot->invoke = image_new_invoke; ot->ui = image_new_draw; - + /* flags */ ot->flag = OPTYPE_UNDO; @@ -2628,7 +2628,7 @@ static int image_invert_exec(bContext *C, wmOperator *op) } /* TODO: make this into an IMB_invert_channels(ibuf,r,g,b,a) method!? */ if (ibuf->rect_float) { - + float *fp = (float *) ibuf->rect_float; for (i = ((size_t)ibuf->x) * ibuf->y; i > 0; i--, fp += 4) { if (r) fp[0] = 1.0f - fp[0]; @@ -2642,7 +2642,7 @@ static int image_invert_exec(bContext *C, wmOperator *op) } } else if (ibuf->rect) { - + char *cp = (char *) ibuf->rect; for (i = ((size_t)ibuf->x) * ibuf->y; i > 0; i--, cp += 4) { if (r) cp[0] = 255 - cp[0]; @@ -2683,11 +2683,11 @@ void IMAGE_OT_invert(wmOperatorType *ot) ot->name = "Invert Channels"; ot->idname = "IMAGE_OT_invert"; ot->description = "Invert image's channels"; - + /* api callbacks */ ot->exec = image_invert_exec; ot->poll = image_invert_poll; - + /* properties */ prop = RNA_def_boolean(ot->srna, "invert_r", 0, "Red", "Invert Red Channel"); RNA_def_property_flag(prop, PROP_SKIP_SAVE); @@ -2697,7 +2697,7 @@ void IMAGE_OT_invert(wmOperatorType *ot) RNA_def_property_flag(prop, PROP_SKIP_SAVE); prop = RNA_def_boolean(ot->srna, "invert_a", 0, "Alpha", "Invert Alpha Channel"); RNA_def_property_flag(prop, PROP_SKIP_SAVE); - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } @@ -2731,7 +2731,7 @@ static int image_pack_exec(bContext *C, wmOperator *op) if (!image_pack_test(C, op)) return OPERATOR_CANCELLED; - + if (!as_png && (ibuf && (ibuf->userflags & IB_BITMAPDIRTY))) { BKE_report(op->reports, RPT_ERROR, "Cannot pack edited image from disk, only as internal PNG"); return OPERATOR_CANCELLED; @@ -2783,9 +2783,9 @@ void IMAGE_OT_pack(wmOperatorType *ot) { /* identifiers */ ot->name = "Pack Image"; - ot->description = "Pack an image as embedded data into the .blend file"; + ot->description = "Pack an image as embedded data into the .blend file"; ot->idname = "IMAGE_OT_pack"; - + /* api callbacks */ ot->exec = image_pack_exec; ot->invoke = image_pack_invoke; @@ -2811,7 +2811,7 @@ static int image_unpack_exec(bContext *C, wmOperator *op) ima = BLI_findstring(&CTX_data_main(C)->image, imaname, offsetof(ID, name) + 2); if (!ima) ima = CTX_data_edit_image(C); } - + if (!ima || !BKE_image_has_packedfile(ima)) return OPERATOR_CANCELLED; @@ -2822,12 +2822,12 @@ static int image_unpack_exec(bContext *C, wmOperator *op) if (G.fileflags & G_AUTOPACK) BKE_report(op->reports, RPT_WARNING, "AutoPack is enabled, so image will be packed again on file save"); - + /* XXX unpackImage frees image buffers */ ED_preview_kill_jobs(CTX_wm_manager(C), CTX_data_main(C)); - + unpackImage(CTX_data_main(C), op->reports, ima, method); - + WM_event_add_notifier(C, NC_IMAGE | NA_EDITED, ima); return OPERATOR_FINISHED; @@ -2839,7 +2839,7 @@ static int image_unpack_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSE if (RNA_struct_property_is_set(op->ptr, "id")) return image_unpack_exec(C, op); - + if (!ima || !BKE_image_has_packedfile(ima)) return OPERATOR_CANCELLED; @@ -2860,16 +2860,16 @@ void IMAGE_OT_unpack(wmOperatorType *ot) { /* identifiers */ ot->name = "Unpack Image"; - ot->description = "Save an image packed in the .blend file to disk"; + ot->description = "Save an image packed in the .blend file to disk"; ot->idname = "IMAGE_OT_unpack"; - + /* api callbacks */ ot->exec = image_unpack_exec; ot->invoke = image_unpack_invoke; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - + /* properties */ RNA_def_enum(ot->srna, "method", rna_enum_unpack_method_items, PF_USE_LOCAL, "Method", "How to unpack"); RNA_def_string(ot->srna, "id", NULL, MAX_ID_NAME - 2, "Image Name", "Image data-block name to unpack"); /* XXX, weark!, will fail with library, name collisions */ @@ -3072,7 +3072,7 @@ static void image_sample_apply(bContext *C, wmOperator *op, const wmEvent *event #if 0 { ScrArea *sa, *cur = curarea; - + node_curvemap_sample(fp); /* sends global to node editor */ for (sa = G.curscreen->areabase.first; sa; sa = sa->next) { if (sa->spacetype == SPACE_NODE) { @@ -3116,7 +3116,7 @@ static int image_sample_invoke(bContext *C, wmOperator *op, const wmEvent *event if (!ED_space_image_has_buffer(sima)) return OPERATOR_CANCELLED; - + info = MEM_callocN(sizeof(ImageSampleInfo), "ImageSampleInfo"); info->art = ar->type; info->draw_handle = ED_region_draw_cb_activate(ar->type, image_sample_draw, info, REGION_DRAW_POST_PIXEL); @@ -3158,7 +3158,7 @@ void IMAGE_OT_sample(wmOperatorType *ot) ot->name = "Sample Color"; ot->idname = "IMAGE_OT_sample"; ot->description = "Use mouse to sample a color in current image"; - + /* api callbacks */ ot->invoke = image_sample_invoke; ot->modal = image_sample_modal; @@ -3180,13 +3180,13 @@ static int image_sample_line_exec(bContext *C, wmOperator *op) int y_start = RNA_int_get(op->ptr, "ystart"); int x_end = RNA_int_get(op->ptr, "xend"); int y_end = RNA_int_get(op->ptr, "yend"); - + void *lock; ImBuf *ibuf = ED_space_image_acquire_buffer(sima, &lock); Histogram *hist = &sima->sample_line_hist; - + float x1f, y1f, x2f, y2f; - + if (ibuf == NULL) { ED_space_image_release_buffer(sima, ibuf, lock); return OPERATOR_CANCELLED; @@ -3196,7 +3196,7 @@ static int image_sample_line_exec(bContext *C, wmOperator *op) ED_space_image_release_buffer(sima, ibuf, lock); return OPERATOR_CANCELLED; } - + UI_view2d_region_to_view(&ar->v2d, x_start, y_start, &x1f, &y1f); UI_view2d_region_to_view(&ar->v2d, x_end, y_end, &x2f, &y2f); @@ -3209,14 +3209,14 @@ static int image_sample_line_exec(bContext *C, wmOperator *op) hist->flag |= HISTO_FLAG_SAMPLELINE; BKE_histogram_update_sample_line(hist, ibuf, &scene->view_settings, &scene->display_settings); - + /* reset y zoom */ hist->ymax = 1.0f; ED_space_image_release_buffer(sima, ibuf, lock); - + ED_area_tag_redraw(CTX_wm_area(C)); - + return OPERATOR_FINISHED; } @@ -3229,7 +3229,7 @@ static int image_sample_line_invoke(bContext *C, wmOperator *op, const wmEvent * if (!ED_space_image_has_buffer(sima)) return OPERATOR_CANCELLED; - + return WM_gesture_straightline_invoke(C, op, event); } @@ -3239,17 +3239,17 @@ void IMAGE_OT_sample_line(wmOperatorType *ot) ot->name = "Sample Line"; ot->idname = "IMAGE_OT_sample_line"; ot->description = "Sample a line and show it in Scope panels"; - + /* api callbacks */ ot->invoke = image_sample_line_invoke; ot->modal = WM_gesture_straightline_modal; ot->exec = image_sample_line_exec; ot->poll = space_image_main_region_poll; ot->cancel = WM_gesture_straightline_cancel; - + /* flags */ ot->flag = 0; /* no undo/register since this operates on the space */ - + WM_operator_properties_gesture_straightline(ot, CURSOR_EDIT); } @@ -3270,7 +3270,7 @@ void IMAGE_OT_curves_point_set(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - + /* api callbacks */ ot->invoke = image_sample_invoke; ot->modal = image_sample_modal; @@ -3296,19 +3296,19 @@ static int image_record_composite_apply(bContext *C, wmOperator *op) RecordCompositeData *rcd = op->customdata; Scene *scene = CTX_data_scene(C); ImBuf *ibuf; - + WM_cursor_time(CTX_wm_window(C), scene->r.cfra); // XXX scene->nodetree->test_break = BKE_blender_test_break; // XXX scene->nodetree->test_break = NULL; - + BKE_image_all_free_anim_ibufs(scene->r.cfra); ntreeCompositTagAnimated(scene->nodetree); ntreeCompositExecTree(scene->nodetree, &scene->r, 0, scene->r.cfra != rcd->old_cfra, &scene->view_settings, &scene->display_settings); /* 1 is no previews */ ED_area_tag_redraw(CTX_wm_area(C)); - + ibuf = BKE_image_acquire_ibuf(sima->image, &sima->iuser, NULL); /* save memory in flipbooks */ if (ibuf) @@ -3331,7 +3331,7 @@ static int image_record_composite_init(bContext *C, wmOperator *op) return 0; if (scene->nodetree == NULL) return 0; - + op->customdata = rcd = MEM_callocN(sizeof(RecordCompositeData), "ImageRecordCompositeData"); rcd->old_cfra = scene->r.cfra; @@ -3367,18 +3367,18 @@ static int image_record_composite_exec(bContext *C, wmOperator *op) { if (!image_record_composite_init(C, op)) return OPERATOR_CANCELLED; - + while (image_record_composite_apply(C, op)) {} - + image_record_composite_exit(C, op); - + return OPERATOR_FINISHED; } static int image_record_composite_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) { RecordCompositeData *rcd; - + if (!image_record_composite_init(C, op)) return OPERATOR_CANCELLED; @@ -3424,7 +3424,7 @@ void IMAGE_OT_record_composite(wmOperatorType *ot) /* identifiers */ ot->name = "Record Composite"; ot->idname = "IMAGE_OT_record_composite"; - + /* api callbacks */ ot->exec = image_record_composite_exec; ot->invoke = image_record_composite_invoke; @@ -3458,7 +3458,7 @@ static int image_cycle_render_slot_exec(bContext *C, wmOperator *op) /* no undo push for browsing existing */ if (ima->renders[ima->render_slot] || ima->render_slot == ima->last_render_slot) return OPERATOR_CANCELLED; - + return OPERATOR_FINISHED; } @@ -3468,7 +3468,7 @@ void IMAGE_OT_cycle_render_slot(wmOperatorType *ot) ot->name = "Cycle Render Slot"; ot->idname = "IMAGE_OT_cycle_render_slot"; ot->description = "Cycle through all non-void render slots"; - + /* api callbacks */ ot->exec = image_cycle_render_slot_exec; ot->poll = image_cycle_render_slot_poll; diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index d179020b978..dbe7ae578c7 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -110,21 +110,21 @@ ARegion *image_has_buttons_region(ScrArea *sa) ar = BKE_area_find_region_type(sa, RGN_TYPE_UI); if (ar) return ar; - + /* add subdiv level; after header */ ar = BKE_area_find_region_type(sa, RGN_TYPE_HEADER); /* is error! */ if (ar == NULL) return NULL; - + arnew = MEM_callocN(sizeof(ARegion), "buttons for image"); - + BLI_insertlinkafter(&sa->regionbase, ar, arnew); arnew->regiontype = RGN_TYPE_UI; arnew->alignment = RGN_ALIGN_RIGHT; - + arnew->flag = RGN_FLAG_HIDDEN; - + return arnew; } @@ -140,17 +140,17 @@ ARegion *image_has_tools_region(ScrArea *sa) /* is error! */ if (ar == NULL) return NULL; - + arnew = MEM_callocN(sizeof(ARegion), "scopes for image"); - + BLI_insertlinkafter(&sa->regionbase, ar, arnew); arnew->regiontype = RGN_TYPE_TOOLS; arnew->alignment = RGN_ALIGN_LEFT; - + arnew->flag = RGN_FLAG_HIDDEN; image_scopes_tag_refresh(sa); - + return arnew; } @@ -160,7 +160,7 @@ static SpaceLink *image_new(const bContext *UNUSED(C)) { ARegion *ar; SpaceImage *simage; - + simage = MEM_callocN(sizeof(SpaceImage), "initimage"); simage->spacetype = SPACE_IMAGE; simage->zoom = 1.0f; @@ -177,22 +177,22 @@ static SpaceLink *image_new(const bContext *UNUSED(C)) /* header */ ar = MEM_callocN(sizeof(ARegion), "header for image"); - + BLI_addtail(&simage->regionbase, ar); ar->regiontype = RGN_TYPE_HEADER; ar->alignment = RGN_ALIGN_BOTTOM; - + /* buttons/list view */ ar = MEM_callocN(sizeof(ARegion), "buttons for image"); - + BLI_addtail(&simage->regionbase, ar); ar->regiontype = RGN_TYPE_UI; ar->alignment = RGN_ALIGN_RIGHT; ar->flag = RGN_FLAG_HIDDEN; - + /* scopes/uv sculpt/paint */ ar = MEM_callocN(sizeof(ARegion), "buttons for image"); - + BLI_addtail(&simage->regionbase, ar); ar->regiontype = RGN_TYPE_TOOLS; ar->alignment = RGN_ALIGN_LEFT; @@ -200,16 +200,16 @@ static SpaceLink *image_new(const bContext *UNUSED(C)) /* main area */ ar = MEM_callocN(sizeof(ARegion), "main area for image"); - + BLI_addtail(&simage->regionbase, ar); ar->regiontype = RGN_TYPE_WINDOW; - + return (SpaceLink *)simage; } /* not spacelink itself */ static void image_free(SpaceLink *sl) -{ +{ SpaceImage *simage = (SpaceImage *) sl; scopes_free(&simage->scopes); @@ -223,13 +223,13 @@ static void image_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa) /* add drop boxes */ WM_event_add_dropbox_handler(&sa->handlers, lb); - + } static SpaceLink *image_duplicate(SpaceLink *sl) { SpaceImage *simagen = MEM_dupallocN(sl); - + /* clear or remove stuff from old */ scopes_new(&simagen->scopes); @@ -261,7 +261,7 @@ static void image_operatortypes(void) WM_operatortype_append(IMAGE_OT_save_sequence); WM_operatortype_append(IMAGE_OT_pack); WM_operatortype_append(IMAGE_OT_unpack); - + WM_operatortype_append(IMAGE_OT_invert); WM_operatortype_append(IMAGE_OT_cycle_render_slot); @@ -285,7 +285,7 @@ static void image_keymap(struct wmKeyConfig *keyconf) wmKeyMap *keymap = WM_keymap_find(keyconf, "Image Generic", SPACE_IMAGE, 0); wmKeyMapItem *kmi; int i; - + WM_keymap_add_item(keymap, "IMAGE_OT_new", NKEY, KM_PRESS, KM_ALT, 0); WM_keymap_add_item(keymap, "IMAGE_OT_open", OKEY, KM_PRESS, KM_ALT, 0); WM_keymap_add_item(keymap, "IMAGE_OT_reload", RKEY, KM_PRESS, KM_ALT, 0); @@ -297,9 +297,9 @@ static void image_keymap(struct wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "IMAGE_OT_cycle_render_slot", JKEY, KM_PRESS, 0, 0); RNA_boolean_set(WM_keymap_add_item(keymap, "IMAGE_OT_cycle_render_slot", JKEY, KM_PRESS, KM_ALT, 0)->ptr, "reverse", true); - + keymap = WM_keymap_find(keyconf, "Image", SPACE_IMAGE, 0); - + WM_keymap_add_item(keymap, "IMAGE_OT_view_all", HOMEKEY, KM_PRESS, 0, 0); kmi = WM_keymap_add_item(keymap, "IMAGE_OT_view_all", HOMEKEY, KM_PRESS, KM_SHIFT, 0); @@ -392,7 +392,7 @@ static void image_drop_copy(wmDrag *drag, wmDropBox *drop) static void image_dropboxes(void) { ListBase *lb = WM_dropboxmap_find("Image", SPACE_IMAGE, 0); - + WM_dropbox_add(lb, "IMAGE_OT_open", image_drop_poll, image_drop_copy); } @@ -410,7 +410,7 @@ static void image_refresh(const bContext *C, ScrArea *sa) ima = ED_space_image(sima); BKE_image_user_check_frame_calc(&sima->iuser, scene->r.cfra, 0); - + /* check if we have to set the image from the editmesh */ if (ima && (ima->source == IMA_SRC_VIEWER && sima->mode == SI_MODE_MASK)) { if (scene->nodetree) { @@ -439,7 +439,7 @@ static void image_refresh(const bContext *C, ScrArea *sa) if (EDBM_uv_active_face_get(em, sloppy, selected, &tf)) { /* don't need to check for pin here, see above */ sima->image = tf->tpage; - + if ((sima->flag & SI_EDITTILE) == 0) { sima->curtile = tf->tile; } @@ -453,7 +453,7 @@ static void image_listener(bScreen *sc, ScrArea *sa, wmNotifier *wmn) { Scene *scene = sc->scene; SpaceImage *sima = (SpaceImage *)sa->spacedata.first; - + /* context changes */ switch (wmn->category) { case NC_WINDOW: @@ -604,7 +604,7 @@ static void image_main_region_set_view2d(SpaceImage *sima, ARegion *ar) Image *ima = ED_space_image(sima); float x1, y1, w, h; int width, height, winx, winy; - + #if 0 if (image_preview_active(curarea, &width, &height)) {} else @@ -613,18 +613,18 @@ static void image_main_region_set_view2d(SpaceImage *sima, ARegion *ar) w = width; h = height; - + if (ima) h *= ima->aspy / ima->aspx; winx = BLI_rcti_size_x(&ar->winrct) + 1; winy = BLI_rcti_size_y(&ar->winrct) + 1; - + ar->v2d.tot.xmin = 0; ar->v2d.tot.ymin = 0; ar->v2d.tot.xmax = w; ar->v2d.tot.ymax = h; - + ar->v2d.mask.xmin = ar->v2d.mask.ymin = 0; ar->v2d.mask.xmax = winx; ar->v2d.mask.ymax = winy; @@ -635,15 +635,15 @@ static void image_main_region_set_view2d(SpaceImage *sima, ARegion *ar) x1 -= sima->zoom * sima->xof; y1 -= sima->zoom * sima->yof; - + /* relative display right */ ar->v2d.cur.xmin = ((ar->winrct.xmin - (float)x1) / sima->zoom); ar->v2d.cur.xmax = ar->v2d.cur.xmin + ((float)winx / sima->zoom); - + /* relative display left */ ar->v2d.cur.ymin = ((ar->winrct.ymin - (float)y1) / sima->zoom); ar->v2d.cur.ymax = ar->v2d.cur.ymin + ((float)winy / sima->zoom); - + /* normalize 0.0..1.0 */ ar->v2d.cur.xmin /= w; ar->v2d.cur.xmax /= w; @@ -655,7 +655,7 @@ static void image_main_region_set_view2d(SpaceImage *sima, ARegion *ar) static void image_main_region_init(wmWindowManager *wm, ARegion *ar) { wmKeyMap *keymap; - + // image space manages own v2d // UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_STANDARD, ar->winx, ar->winy); @@ -675,7 +675,7 @@ static void image_main_region_init(wmWindowManager *wm, ARegion *ar) keymap = WM_keymap_find(wm->defaultconf, "UV Editor", 0, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); - + keymap = WM_keymap_find(wm->defaultconf, "UV Sculpt", 0, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); @@ -702,7 +702,7 @@ static void image_main_region_draw(const bContext *C, ARegion *ar) /* XXX not supported yet, disabling for now */ scene->r.scemode &= ~R_COMP_CROP; - + /* clear and setup matrix */ UI_GetThemeColor3fv(TH_BACK, col); glClearColor(col[0], col[1], col[2], 0.0); @@ -834,7 +834,7 @@ static void image_buttons_region_init(wmWindowManager *wm, ARegion *ar) ar->v2d.scroll = V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HIDE; ED_region_panels_init(wm, ar); - + keymap = WM_keymap_find(wm->defaultconf, "Image Generic", SPACE_IMAGE, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); } @@ -883,10 +883,10 @@ static void image_buttons_region_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(s static void image_tools_region_init(wmWindowManager *wm, ARegion *ar) { wmKeyMap *keymap; - + ar->v2d.scroll = V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HIDE; ED_region_panels_init(wm, ar); - + keymap = WM_keymap_find(wm->defaultconf, "Image Generic", SPACE_IMAGE, 0); WM_event_add_keymap_handler(&ar->handlers, keymap); } @@ -913,7 +913,7 @@ static void image_tools_region_draw(const bContext *C, ARegion *ar) } } ED_space_image_release_buffer(sima, ibuf, lock); - + ED_region_panels(C, ar, NULL, -1, true); } @@ -946,7 +946,7 @@ static void image_tools_region_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa) case NC_NODE: ED_region_tag_redraw(ar); break; - + } } @@ -1023,10 +1023,10 @@ void ED_spacetype_image(void) { SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype image"); ARegionType *art; - + st->spaceid = SPACE_IMAGE; strncpy(st->name, "Image", BKE_ST_MAXNAME); - + st->new = image_new; st->free = image_free; st->init = image_init; @@ -1048,7 +1048,7 @@ void ED_spacetype_image(void) art->listener = image_main_region_listener; BLI_addhead(&st->regiontypes, art); - + /* regions: listview/buttons */ art = MEM_callocN(sizeof(ARegionType), "spacetype image region"); art->regionid = RGN_TYPE_UI; @@ -1080,9 +1080,9 @@ void ED_spacetype_image(void) art->listener = image_header_region_listener; art->init = image_header_region_init; art->draw = image_header_region_draw; - + BLI_addhead(&st->regiontypes, art); - + BKE_spacetype_register(st); } -- cgit v1.2.3