Cleanup: Remove image preview code

Was commented out for literally 10 years.
This commit is contained in:
Sergey Sharybin 2019-04-19 12:05:51 +02:00
parent fd05d7bbcb
commit 0ebf43b4d0
4 changed files with 0 additions and 186 deletions

View File

@ -1144,7 +1144,6 @@ void ntreeCompositExecTree(struct Scene *scene,
const struct ColorManagedDisplaySettings *display_settings,
const char *view_name);
void ntreeCompositTagRender(struct Scene *sce);
void ntreeCompositTagGenerators(struct bNodeTree *ntree);
void ntreeCompositUpdateRLayers(struct bNodeTree *ntree);
void ntreeCompositRegisterPass(struct bNodeTree *ntree,
struct Scene *scene,

View File

@ -154,150 +154,6 @@ struct ImageUser *ntree_get_active_iuser(bNodeTree *ntree)
return NULL;
}
/* ************ panel stuff ************* */
#if 0
/* 0: disable preview
* otherwise refresh preview
*
* XXX if you put this back, also check XXX in image_main_region_draw() */
void image_preview_event(int event)
{
int exec = 0;
if (event == 0) {
G.scene->r.scemode &= ~R_COMP_CROP;
exec = 1;
}
else {
if (image_preview_active(curarea, NULL, NULL)) {
G.scene->r.scemode |= R_COMP_CROP;
exec = 1;
}
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();
/* 1 is do_previews */
ntreeCompositExecTree(
scene->nodetree, &scene->r, 1, &scene->view_settings, &scene->display_settings);
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);
}
}
/* nothing drawn here, we use it to store values */
static void preview_cb(ScrArea *sa, struct uiBlock *block)
{
SpaceImage *sima = sa->spacedata.first;
rctf dispf;
rcti *disprect = &G.scene->r.disprect;
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 */
mval[0] = disprect->xmin;
mval[1] = disprect->ymin;
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);
CLAMP(disprect->ymax, 0, winy);
// printf("drawrct %d %d %d %d\n", disprect->xmin, disprect->ymin, disprect->xmax, disprect->ymax);
}
static bool is_preview_allowed(ScrArea *cur)
{
SpaceImage *sima = cur->spacedata.first;
ScrArea *sa;
/* check if another areawindow has preview set */
for (sa = G.curscreen->areabase.first; sa; sa = sa->next) {
if (sa != cur && sa->spacetype == SPACE_IMAGE) {
if (image_preview_active(sa, NULL, NULL))
return 0;
}
}
/* check image type */
if (sima->image == NULL || sima->image->type != IMA_TYPE_COMPOSITE)
return 0;
return 1;
}
static void image_panel_preview(ScrArea *sa, short cntrl) // IMAGE_HANDLER_PREVIEW
{
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
/* ********************* callbacks for standard image buttons *************** */
static void ui_imageuser_slot_menu(bContext *UNUSED(C), uiLayout *layout, void *image_p)

View File

@ -356,15 +356,6 @@ static int image_view_pan_exec(bContext *C, wmOperator *op)
ED_region_tag_redraw(CTX_wm_region(C));
/* XXX notifier? */
#if 0
if (image_preview_active(curarea, NULL, NULL)) {
/* recalculates new preview rect */
scrarea_do_windraw(curarea);
image_preview_event(2);
}
#endif
return OPERATOR_FINISHED;
}
@ -521,15 +512,6 @@ static int image_view_zoom_exec(bContext *C, wmOperator *op)
ED_region_tag_redraw(ar);
/* XXX notifier? */
#if 0
if (image_preview_active(curarea, NULL, NULL)) {
/* recalculates new preview rect */
scrarea_do_windraw(curarea);
image_preview_event(2);
}
#endif
return OPERATOR_FINISHED;
}
@ -1006,15 +988,6 @@ static int image_view_zoom_ratio_exec(bContext *C, wmOperator *op)
sima->xof = (int)sima->xof;
sima->yof = (int)sima->yof;
/* XXX notifier? */
#if 0
if (image_preview_active(curarea, NULL, NULL)) {
/* recalculates new preview rect */
scrarea_do_windraw(curarea);
image_preview_event(2);
}
#endif
ED_region_tag_redraw(ar);
return OPERATOR_FINISHED;

View File

@ -299,20 +299,6 @@ void ntreeCompositTagRender(Scene *curscene)
}
}
/* called from image window preview */
void ntreeCompositTagGenerators(bNodeTree *ntree)
{
bNode *node;
if (ntree == NULL)
return;
for (node = ntree->nodes.first; node; node = node->next) {
if (ELEM(node->type, CMP_NODE_R_LAYERS, CMP_NODE_IMAGE))
nodeUpdate(ntree, node);
}
}
/* XXX after render animation system gets a refresh, this call allows composite to end clean */
void ntreeCompositClearTags(bNodeTree *ntree)
{