Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-06-04 10:39:04 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-06-04 10:39:04 +0300
commit95011f6d484b369db92ae13c674a6522d664ea8f (patch)
tree91ba2719c9f3096fad0f1f768aa7b1c4d79aa32a /source/blender/editors/space_image
parent0911acb5cf49c5ba05b1df045b41697704aa288a (diff)
parent44505b38df557a5711703613685a1dec9fc2c3d9 (diff)
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/editors/space_image')
-rw-r--r--source/blender/editors/space_image/image_buttons.c72
-rw-r--r--source/blender/editors/space_image/image_draw.c16
-rw-r--r--source/blender/editors/space_image/image_edit.c4
-rw-r--r--source/blender/editors/space_image/image_ops.c192
-rw-r--r--source/blender/editors/space_image/space_image.c94
5 files changed, 189 insertions, 189 deletions
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 fc4d8c39e26..1e2d668018f 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -231,7 +231,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));
-
+
BLF_color3ubv(blf_mono_font, green);
if (fp)
BLI_snprintf(str, sizeof(str), " G:%-.5f", fp[1]);
@@ -242,7 +242,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));
-
+
BLF_color3ubv(blf_mono_font, blue);
if (fp)
BLI_snprintf(str, sizeof(str), " B:%-.5f", fp[2]);
@@ -253,7 +253,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) {
BLF_color3ub(blf_mono_font, 255, 255, 255);
if (fp)
@@ -287,7 +287,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) {
@@ -384,7 +384,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));
@@ -561,7 +561,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);
}
@@ -647,10 +647,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);
diff --git a/source/blender/editors/space_image/image_edit.c b/source/blender/editors/space_image/image_edit.c
index 19829517e00..0911bea3be4 100644
--- a/source/blender/editors/space_image/image_edit.c
+++ b/source/blender/editors/space_image/image_edit.c
@@ -323,7 +323,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;
@@ -339,7 +339,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 c8cec4c7306..95cbc4fe4a2 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -366,7 +366,7 @@ static int image_view_pan_exec(bContext *C, wmOperator *op)
image_preview_event(2);
}
#endif
-
+
return OPERATOR_FINISHED;
}
@@ -375,7 +375,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);
@@ -426,7 +426,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;
@@ -436,7 +436,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);
@@ -521,7 +521,7 @@ static int image_view_zoom_exec(bContext *C, wmOperator *op)
image_preview_event(2);
}
#endif
-
+
return OPERATOR_FINISHED;
}
@@ -549,7 +549,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 {
@@ -642,7 +642,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;
@@ -652,7 +652,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);
@@ -701,7 +701,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;
@@ -734,7 +734,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;
@@ -762,7 +762,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;
}
@@ -774,7 +774,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;
@@ -830,7 +830,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;
}
@@ -845,7 +845,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;
@@ -858,13 +858,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;
}
@@ -887,7 +887,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;
@@ -907,13 +907,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;
}
@@ -936,7 +936,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;
@@ -959,7 +959,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;
@@ -974,7 +974,7 @@ static int image_view_zoom_ratio_exec(bContext *C, wmOperator *op)
#endif
ED_region_tag_redraw(ar);
-
+
return OPERATOR_FINISHED;
}
@@ -984,7 +984,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;
@@ -1057,7 +1057,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 ********************/
@@ -1348,10 +1348,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;
@@ -1399,7 +1399,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 */
@@ -1448,7 +1448,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;
@@ -1487,7 +1487,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))
@@ -1509,7 +1509,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;
@@ -1526,7 +1526,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 :/ */
@@ -1536,7 +1536,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
@@ -1544,7 +1544,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);
@@ -1576,7 +1576,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;
@@ -2180,7 +2180,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;
@@ -2235,7 +2235,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;
@@ -2254,7 +2254,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;
@@ -2267,7 +2267,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) {
@@ -2284,7 +2284,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;
@@ -2326,7 +2326,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;
@@ -2347,13 +2347,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);
DEG_id_tag_update(&ima->id, 0);
WM_event_add_notifier(C, NC_IMAGE | NA_EDITED, ima);
-
+
return OPERATOR_FINISHED;
}
@@ -2363,7 +2363,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;
@@ -2446,11 +2446,11 @@ 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);
-
+
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) {
@@ -2458,7 +2458,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(sima_other, scene, obedit, ima);
}
@@ -2474,8 +2474,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;
@@ -2488,9 +2488,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;
}
@@ -2561,17 +2561,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;
@@ -2633,7 +2633,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];
@@ -2647,7 +2647,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];
@@ -2688,11 +2688,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);
@@ -2702,7 +2702,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;
}
@@ -2736,7 +2736,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;
@@ -2788,9 +2788,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;
@@ -2816,7 +2816,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;
@@ -2827,12 +2827,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;
@@ -2844,7 +2844,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;
@@ -2865,16 +2865,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 */
@@ -3077,7 +3077,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) {
@@ -3121,7 +3121,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);
@@ -3163,7 +3163,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;
@@ -3185,13 +3185,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;
@@ -3201,7 +3201,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);
@@ -3214,14 +3214,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;
}
@@ -3234,7 +3234,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);
}
@@ -3244,17 +3244,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);
}
@@ -3275,7 +3275,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;
@@ -3301,19 +3301,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)
@@ -3336,7 +3336,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;
@@ -3372,18 +3372,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;
@@ -3429,7 +3429,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;
@@ -3463,7 +3463,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;
}
@@ -3473,7 +3473,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 e04354529e4..28ce88b38f5 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -117,21 +117,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;
}
@@ -147,17 +147,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;
}
@@ -167,7 +167,7 @@ static SpaceLink *image_new(const ScrArea *UNUSED(area), const Scene *UNUSED(sce
{
ARegion *ar;
SpaceImage *simage;
-
+
simage = MEM_callocN(sizeof(SpaceImage), "initimage");
simage->spacetype = SPACE_IMAGE;
simage->zoom = 1.0f;
@@ -184,22 +184,22 @@ static SpaceLink *image_new(const ScrArea *UNUSED(area), const Scene *UNUSED(sce
/* header */
ar = MEM_callocN(sizeof(ARegion), "header for image");
-
+
BLI_addtail(&simage->regionbase, ar);
ar->regiontype = RGN_TYPE_HEADER;
ar->alignment = RGN_ALIGN_TOP;
-
+
/* 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;
@@ -207,16 +207,16 @@ static SpaceLink *image_new(const ScrArea *UNUSED(area), const Scene *UNUSED(sce
/* 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);
@@ -230,13 +230,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);
@@ -268,7 +268,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);
@@ -292,7 +292,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);
@@ -304,9 +304,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);
@@ -399,7 +399,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);
}
@@ -416,7 +416,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) {
@@ -432,7 +432,7 @@ static void image_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn, Sc
WorkSpace *workspace)
{
SpaceImage *sima = (SpaceImage *)sa->spacedata.first;
-
+
/* context changes */
switch (wmn->category) {
case NC_WINDOW:
@@ -605,7 +605,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
@@ -614,18 +614,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;
@@ -636,15 +636,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;
@@ -656,7 +656,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);
@@ -686,7 +686,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);
@@ -714,7 +714,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);
@@ -860,7 +860,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);
}
@@ -911,10 +911,10 @@ static void image_buttons_region_listener(
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);
}
@@ -941,7 +941,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);
}
@@ -976,7 +976,7 @@ static void image_tools_region_listener(
case NC_NODE:
ED_region_tag_redraw(ar);
break;
-
+
}
}
@@ -1070,10 +1070,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;
@@ -1096,7 +1096,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;
@@ -1129,9 +1129,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);
}