From 064903f8ed7e7d52e4a6fc6dad42538b52f15efb Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 25 Jan 2016 12:04:50 +0100 Subject: Keep image dimension used by space image and some other tools sync When using an empty render result (after re-opening the file, i.e.) some tools (like masking) could have used wrong image resolution because of not being aware of special cases supported by the image space to display the render result. This should fix selecting mask points when mask is opened op top if an empty render result. --- source/blender/blenkernel/intern/image.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'source/blender') diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index ad1f30555a8..7c40674dd6c 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -4410,6 +4410,15 @@ void BKE_image_get_size(Image *image, ImageUser *iuser, int *width, int *height) *width = ibuf->x; *height = ibuf->y; } + else if (image->type == IMA_TYPE_R_RESULT && iuser != NULL && iuser->scene != NULL) { + Scene *scene = iuser->scene; + *width = (scene->r.xsch * scene->r.size) / 100; + *height = (scene->r.ysch * scene->r.size) / 100; + if ((scene->r.mode & R_BORDER) && (scene->r.mode & R_CROP)) { + *width *= BLI_rctf_size_x(&scene->r.border); + *height *= BLI_rctf_size_y(&scene->r.border); + } + } else { *width = IMG_SIZE_FALLBACK; *height = IMG_SIZE_FALLBACK; -- cgit v1.2.3