2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2.5: Space Image ported back
Organized as follows:
uvedit/
uv editing related code
uvedit_draw.c: drawing code
uvedit_ops.c: operators, just a few done
uvedit_unwrap_ops.c: will be operators for unwrapping
uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
space_image.c: registration and common getter/setters
image_draw.c: drawing code, mostly functional
image_panels.c: panels, all commented out
image_render.c: render callbacks, non functional
image_ops.c: operators, only view navigation done
image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
are not implemented they're displayed grayed out. Ideally the full
header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
still does own view2d management due to some very specific
requirements that the image window has. The drawing code however
is more clear hopefully, it only uses view2d, and there is no
switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
image space settings to scene toolsettings, and the current image
and its buffer is in the context. Especially sync selection and
select mode belonged there anyway as this cannot work correct with
different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
uvedit because there's really no code sharing.. perhaps vertex paint,
image paint and sculpt would be good to have in one module to share
brush code, partial redraw, etc better.
2009-01-15 04:38:18 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2.5: Space Image ported back
Organized as follows:
uvedit/
uv editing related code
uvedit_draw.c: drawing code
uvedit_ops.c: operators, just a few done
uvedit_unwrap_ops.c: will be operators for unwrapping
uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
space_image.c: registration and common getter/setters
image_draw.c: drawing code, mostly functional
image_panels.c: panels, all commented out
image_render.c: render callbacks, non functional
image_ops.c: operators, only view navigation done
image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
are not implemented they're displayed grayed out. Ideally the full
header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
still does own view2d management due to some very specific
requirements that the image window has. The drawing code however
is more clear hopefully, it only uses view2d, and there is no
switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
image space settings to scene toolsettings, and the current image
and its buffer is in the context. Especially sync selection and
select mode belonged there anyway as this cannot work correct with
different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
uvedit because there's really no code sharing.. perhaps vertex paint,
image paint and sculpt would be good to have in one module to share
brush code, partial redraw, etc better.
2009-01-15 04:38:18 +00:00
|
|
|
*
|
|
|
|
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* Contributor(s): Blender Foundation, 2002-2009
|
|
|
|
|
*
|
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
|
*/
|
|
|
|
|
|
2011-02-27 20:29:51 +00:00
|
|
|
/** \file blender/editors/space_image/image_buttons.c
|
|
|
|
|
* \ingroup spimage
|
|
|
|
|
*/
|
|
|
|
|
|
2009-02-21 15:31:01 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
2009-02-21 18:33:09 +00:00
|
|
|
#include "DNA_node_types.h"
|
2009-02-21 15:31:01 +00:00
|
|
|
#include "DNA_scene_types.h"
|
|
|
|
|
|
|
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
|
|
|
|
|
#include "BLI_blenlib.h"
|
2011-01-07 18:36:47 +00:00
|
|
|
#include "BLI_utildefines.h"
|
2009-02-21 15:31:01 +00:00
|
|
|
|
2015-08-16 17:32:01 +10:00
|
|
|
#include "BLT_translation.h"
|
2012-05-25 17:58:15 +00:00
|
|
|
|
2009-02-21 15:31:01 +00:00
|
|
|
#include "BKE_context.h"
|
|
|
|
|
#include "BKE_image.h"
|
2009-02-21 18:33:09 +00:00
|
|
|
#include "BKE_node.h"
|
2009-02-21 15:31:01 +00:00
|
|
|
#include "BKE_screen.h"
|
2015-04-06 10:40:12 -03:00
|
|
|
#include "BKE_scene.h"
|
2009-02-21 15:31:01 +00:00
|
|
|
|
2009-02-21 18:33:09 +00:00
|
|
|
#include "RE_pipeline.h"
|
|
|
|
|
|
2009-02-21 15:31:01 +00:00
|
|
|
#include "IMB_imbuf.h"
|
|
|
|
|
#include "IMB_imbuf_types.h"
|
|
|
|
|
|
2009-08-30 13:32:08 +00:00
|
|
|
#include "ED_gpencil.h"
|
2009-02-21 15:31:01 +00:00
|
|
|
#include "ED_screen.h"
|
2015-11-16 07:13:40 +11:00
|
|
|
#include "ED_image.h"
|
2009-02-21 15:31:01 +00:00
|
|
|
|
|
|
|
|
#include "RNA_access.h"
|
|
|
|
|
|
|
|
|
|
#include "WM_api.h"
|
|
|
|
|
#include "WM_types.h"
|
|
|
|
|
|
|
|
|
|
#include "UI_interface.h"
|
|
|
|
|
#include "UI_resources.h"
|
|
|
|
|
|
|
|
|
|
#include "image_intern.h"
|
|
|
|
|
|
2014-02-12 00:08:54 +11:00
|
|
|
#define B_NOP -1
|
2015-02-09 23:11:30 +01:00
|
|
|
#define MAX_IMAGE_INFO_LEN 128
|
2014-02-12 00:08:54 +11:00
|
|
|
|
2009-02-21 18:33:09 +00:00
|
|
|
/* proto */
|
|
|
|
|
|
2013-03-12 13:18:39 +00:00
|
|
|
static void image_info(Scene *scene, ImageUser *iuser, Image *ima, ImBuf *ibuf, char *str, size_t len)
|
2009-02-21 18:33:09 +00:00
|
|
|
{
|
2013-03-12 13:18:39 +00:00
|
|
|
size_t ofs = 0;
|
2011-05-01 14:02:40 +00:00
|
|
|
|
2012-03-28 11:53:18 +00:00
|
|
|
str[0] = 0;
|
2013-03-12 13:18:39 +00:00
|
|
|
if (ima == NULL)
|
|
|
|
|
return;
|
2011-05-01 14:02:40 +00:00
|
|
|
|
2012-03-28 11:53:18 +00:00
|
|
|
if (ibuf == NULL) {
|
2013-03-14 10:39:18 +00:00
|
|
|
ofs += BLI_strncpy_rlen(str + ofs, IFACE_("Can't Load Image"), len - ofs);
|
2009-02-21 18:33:09 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2012-03-28 11:53:18 +00:00
|
|
|
if (ima->source == IMA_SRC_MOVIE) {
|
2013-03-14 10:39:18 +00:00
|
|
|
ofs += BLI_strncpy_rlen(str + ofs, IFACE_("Movie"), len - ofs);
|
2015-04-06 10:40:12 -03:00
|
|
|
if (BKE_image_has_anim(ima))
|
2013-03-12 13:18:39 +00:00
|
|
|
ofs += BLI_snprintf(str + ofs, len - ofs, IFACE_(" %d frs"),
|
2015-04-06 10:40:12 -03:00
|
|
|
IMB_anim_get_duration(((ImageAnim *)ima->anims.first)->anim, IMB_TC_RECORD_RUN));
|
2011-05-01 14:02:40 +00:00
|
|
|
}
|
2013-03-14 10:39:18 +00:00
|
|
|
else {
|
|
|
|
|
ofs += BLI_strncpy_rlen(str, IFACE_("Image"), len - ofs);
|
|
|
|
|
}
|
2011-05-01 14:02:40 +00:00
|
|
|
|
2013-03-12 13:18:39 +00:00
|
|
|
ofs += BLI_snprintf(str + ofs, len - ofs, IFACE_(": size %d x %d,"), ibuf->x, ibuf->y);
|
2011-05-01 14:02:40 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (ibuf->rect_float) {
|
2012-03-28 11:53:18 +00:00
|
|
|
if (ibuf->channels != 4) {
|
2013-03-12 13:18:39 +00:00
|
|
|
ofs += BLI_snprintf(str + ofs, len - ofs, IFACE_("%d float channel(s)"), ibuf->channels);
|
2011-05-01 14:02:40 +00:00
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (ibuf->planes == R_IMF_PLANES_RGBA)
|
2013-03-14 10:39:18 +00:00
|
|
|
ofs += BLI_strncpy_rlen(str + ofs, IFACE_(" RGBA float"), len - ofs);
|
2011-05-01 14:02:40 +00:00
|
|
|
else
|
2013-03-14 10:39:18 +00:00
|
|
|
ofs += BLI_strncpy_rlen(str + ofs, IFACE_(" RGB float"), len - ofs);
|
2011-05-01 14:02:40 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (ibuf->planes == R_IMF_PLANES_RGBA)
|
2013-03-14 10:39:18 +00:00
|
|
|
ofs += BLI_strncpy_rlen(str + ofs, IFACE_(" RGBA byte"), len - ofs);
|
2011-05-01 14:02:40 +00:00
|
|
|
else
|
2013-03-14 10:39:18 +00:00
|
|
|
ofs += BLI_strncpy_rlen(str + ofs, IFACE_(" RGB byte"), len - ofs);
|
2011-05-01 14:02:40 +00:00
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
if (ibuf->zbuf || ibuf->zbuf_float)
|
2013-03-14 10:39:18 +00:00
|
|
|
ofs += BLI_strncpy_rlen(str + ofs, IFACE_(" + Z"), len - ofs);
|
2011-05-01 14:02:40 +00:00
|
|
|
|
2012-03-28 11:53:18 +00:00
|
|
|
if (ima->source == IMA_SRC_SEQUENCE) {
|
2013-03-04 19:27:51 +00:00
|
|
|
const char *file = BLI_last_slash(ibuf->name);
|
2013-03-12 13:18:39 +00:00
|
|
|
if (file == NULL)
|
|
|
|
|
file = ibuf->name;
|
|
|
|
|
else
|
|
|
|
|
file++;
|
|
|
|
|
ofs += BLI_snprintf(str + ofs, len - ofs, ", %s", file);
|
2011-05-01 14:02:40 +00:00
|
|
|
}
|
2009-02-21 18:33:09 +00:00
|
|
|
}
|
2010-11-05 09:01:00 +00:00
|
|
|
|
2011-05-01 14:02:40 +00:00
|
|
|
/* the frame number, even if we cant */
|
2012-03-28 11:53:18 +00:00
|
|
|
if (ima->source == IMA_SRC_SEQUENCE) {
|
2011-05-01 14:02:40 +00:00
|
|
|
/* don't use iuser->framenr directly because it may not be updated if auto-refresh is off */
|
2018-09-10 14:05:33 +10:00
|
|
|
const int framenr = BKE_image_user_frame_get(iuser, CFRA, NULL);
|
2013-03-12 13:18:39 +00:00
|
|
|
ofs += BLI_snprintf(str + ofs, len - ofs, IFACE_(", Frame: %d"), framenr);
|
2010-11-05 09:01:00 +00:00
|
|
|
}
|
2009-02-21 18:33:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* gets active viewer user */
|
2012-04-21 12:51:47 +00:00
|
|
|
struct ImageUser *ntree_get_active_iuser(bNodeTree *ntree)
|
|
|
|
|
{
|
2009-02-21 18:33:09 +00:00
|
|
|
bNode *node;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (ntree)
|
2012-03-28 11:53:18 +00:00
|
|
|
for (node = ntree->nodes.first; node; node = node->next)
|
|
|
|
|
if (ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER))
|
2012-03-24 06:38:07 +00:00
|
|
|
if (node->flag & NODE_DO_OUTPUT)
|
2009-02-21 18:33:09 +00:00
|
|
|
return node->storage;
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2009-02-21 15:31:01 +00:00
|
|
|
|
2.5: Space Image ported back
Organized as follows:
uvedit/
uv editing related code
uvedit_draw.c: drawing code
uvedit_ops.c: operators, just a few done
uvedit_unwrap_ops.c: will be operators for unwrapping
uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
space_image.c: registration and common getter/setters
image_draw.c: drawing code, mostly functional
image_panels.c: panels, all commented out
image_render.c: render callbacks, non functional
image_ops.c: operators, only view navigation done
image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
are not implemented they're displayed grayed out. Ideally the full
header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
still does own view2d management due to some very specific
requirements that the image window has. The drawing code however
is more clear hopefully, it only uses view2d, and there is no
switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
image space settings to scene toolsettings, and the current image
and its buffer is in the context. Especially sync selection and
select mode belonged there anyway as this cannot work correct with
different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
uvedit because there's really no code sharing.. perhaps vertex paint,
image paint and sculpt would be good to have in one module to share
brush code, partial redraw, etc better.
2009-01-15 04:38:18 +00:00
|
|
|
|
|
|
|
|
/* ************ panel stuff ************* */
|
|
|
|
|
|
2009-02-21 18:33:09 +00:00
|
|
|
#if 0
|
2018-06-04 09:31:30 +02:00
|
|
|
/* 0: disable preview
|
2012-03-03 16:31:46 +00:00
|
|
|
* otherwise refresh preview
|
|
|
|
|
*
|
2015-11-28 17:14:45 +01:00
|
|
|
* XXX if you put this back, also check XXX in image_main_region_draw() */
|
2012-03-28 11:53:18 +00:00
|
|
|
* /
|
2.5: Space Image ported back
Organized as follows:
uvedit/
uv editing related code
uvedit_draw.c: drawing code
uvedit_ops.c: operators, just a few done
uvedit_unwrap_ops.c: will be operators for unwrapping
uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
space_image.c: registration and common getter/setters
image_draw.c: drawing code, mostly functional
image_panels.c: panels, all commented out
image_render.c: render callbacks, non functional
image_ops.c: operators, only view navigation done
image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
are not implemented they're displayed grayed out. Ideally the full
header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
still does own view2d management due to some very specific
requirements that the image window has. The drawing code however
is more clear hopefully, it only uses view2d, and there is no
switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
image space settings to scene toolsettings, and the current image
and its buffer is in the context. Especially sync selection and
select mode belonged there anyway as this cannot work correct with
different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
uvedit because there's really no code sharing.. perhaps vertex paint,
image paint and sculpt would be good to have in one module to share
brush code, partial redraw, etc better.
2009-01-15 04:38:18 +00:00
|
|
|
void image_preview_event(int event)
|
|
|
|
|
{
|
2012-03-28 11:53:18 +00:00
|
|
|
int exec = 0;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-28 11:53:18 +00:00
|
|
|
if (event == 0) {
|
2.5: Space Image ported back
Organized as follows:
uvedit/
uv editing related code
uvedit_draw.c: drawing code
uvedit_ops.c: operators, just a few done
uvedit_unwrap_ops.c: will be operators for unwrapping
uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
space_image.c: registration and common getter/setters
image_draw.c: drawing code, mostly functional
image_panels.c: panels, all commented out
image_render.c: render callbacks, non functional
image_ops.c: operators, only view navigation done
image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
are not implemented they're displayed grayed out. Ideally the full
header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
still does own view2d management due to some very specific
requirements that the image window has. The drawing code however
is more clear hopefully, it only uses view2d, and there is no
switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
image space settings to scene toolsettings, and the current image
and its buffer is in the context. Especially sync selection and
select mode belonged there anyway as this cannot work correct with
different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
uvedit because there's really no code sharing.. perhaps vertex paint,
image paint and sculpt would be good to have in one module to share
brush code, partial redraw, etc better.
2009-01-15 04:38:18 +00:00
|
|
|
G.scene->r.scemode &= ~R_COMP_CROP;
|
2012-03-28 11:53:18 +00:00
|
|
|
exec = 1;
|
2.5: Space Image ported back
Organized as follows:
uvedit/
uv editing related code
uvedit_draw.c: drawing code
uvedit_ops.c: operators, just a few done
uvedit_unwrap_ops.c: will be operators for unwrapping
uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
space_image.c: registration and common getter/setters
image_draw.c: drawing code, mostly functional
image_panels.c: panels, all commented out
image_render.c: render callbacks, non functional
image_ops.c: operators, only view navigation done
image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
are not implemented they're displayed grayed out. Ideally the full
header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
still does own view2d management due to some very specific
requirements that the image window has. The drawing code however
is more clear hopefully, it only uses view2d, and there is no
switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
image space settings to scene toolsettings, and the current image
and its buffer is in the context. Especially sync selection and
select mode belonged there anyway as this cannot work correct with
different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
uvedit because there's really no code sharing.. perhaps vertex paint,
image paint and sculpt would be good to have in one module to share
brush code, partial redraw, etc better.
2009-01-15 04:38:18 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (image_preview_active(curarea, NULL, NULL)) {
|
2.5: Space Image ported back
Organized as follows:
uvedit/
uv editing related code
uvedit_draw.c: drawing code
uvedit_ops.c: operators, just a few done
uvedit_unwrap_ops.c: will be operators for unwrapping
uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
space_image.c: registration and common getter/setters
image_draw.c: drawing code, mostly functional
image_panels.c: panels, all commented out
image_render.c: render callbacks, non functional
image_ops.c: operators, only view navigation done
image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
are not implemented they're displayed grayed out. Ideally the full
header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
still does own view2d management due to some very specific
requirements that the image window has. The drawing code however
is more clear hopefully, it only uses view2d, and there is no
switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
image space settings to scene toolsettings, and the current image
and its buffer is in the context. Especially sync selection and
select mode belonged there anyway as this cannot work correct with
different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
uvedit because there's really no code sharing.. perhaps vertex paint,
image paint and sculpt would be good to have in one module to share
brush code, partial redraw, etc better.
2009-01-15 04:38:18 +00:00
|
|
|
G.scene->r.scemode |= R_COMP_CROP;
|
2012-03-28 11:53:18 +00:00
|
|
|
exec = 1;
|
2.5: Space Image ported back
Organized as follows:
uvedit/
uv editing related code
uvedit_draw.c: drawing code
uvedit_ops.c: operators, just a few done
uvedit_unwrap_ops.c: will be operators for unwrapping
uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
space_image.c: registration and common getter/setters
image_draw.c: drawing code, mostly functional
image_panels.c: panels, all commented out
image_render.c: render callbacks, non functional
image_ops.c: operators, only view navigation done
image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
are not implemented they're displayed grayed out. Ideally the full
header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
still does own view2d management due to some very specific
requirements that the image window has. The drawing code however
is more clear hopefully, it only uses view2d, and there is no
switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
image space settings to scene toolsettings, and the current image
and its buffer is in the context. Especially sync selection and
select mode belonged there anyway as this cannot work correct with
different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
uvedit because there's really no code sharing.. perhaps vertex paint,
image paint and sculpt would be good to have in one module to share
brush code, partial redraw, etc better.
2009-01-15 04:38:18 +00:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
G.scene->r.scemode &= ~R_COMP_CROP;
|
|
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (exec && G.scene->nodetree) {
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
Scene *scene = G.scene;
|
2.5: Space Image ported back
Organized as follows:
uvedit/
uv editing related code
uvedit_draw.c: drawing code
uvedit_ops.c: operators, just a few done
uvedit_unwrap_ops.c: will be operators for unwrapping
uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
space_image.c: registration and common getter/setters
image_draw.c: drawing code, mostly functional
image_panels.c: panels, all commented out
image_render.c: render callbacks, non functional
image_ops.c: operators, only view navigation done
image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
are not implemented they're displayed grayed out. Ideally the full
header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
still does own view2d management due to some very specific
requirements that the image window has. The drawing code however
is more clear hopefully, it only uses view2d, and there is no
switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
image space settings to scene toolsettings, and the current image
and its buffer is in the context. Especially sync selection and
select mode belonged there anyway as this cannot work correct with
different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
uvedit because there's really no code sharing.. perhaps vertex paint,
image paint and sculpt would be good to have in one module to share
brush code, partial redraw, etc better.
2009-01-15 04:38:18 +00:00
|
|
|
/* should work when no node editor in screen..., so we execute right away */
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2.5: Space Image ported back
Organized as follows:
uvedit/
uv editing related code
uvedit_draw.c: drawing code
uvedit_ops.c: operators, just a few done
uvedit_unwrap_ops.c: will be operators for unwrapping
uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
space_image.c: registration and common getter/setters
image_draw.c: drawing code, mostly functional
image_panels.c: panels, all commented out
image_render.c: render callbacks, non functional
image_ops.c: operators, only view navigation done
image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
are not implemented they're displayed grayed out. Ideally the full
header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
still does own view2d management due to some very specific
requirements that the image window has. The drawing code however
is more clear hopefully, it only uses view2d, and there is no
switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
image space settings to scene toolsettings, and the current image
and its buffer is in the context. Especially sync selection and
select mode belonged there anyway as this cannot work correct with
different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
uvedit because there's really no code sharing.. perhaps vertex paint,
image paint and sculpt would be good to have in one module to share
brush code, partial redraw, etc better.
2009-01-15 04:38:18 +00:00
|
|
|
ntreeCompositTagGenerators(G.scene->nodetree);
|
|
|
|
|
|
2014-04-01 11:34:00 +11:00
|
|
|
G.is_break = false;
|
2012-03-28 11:53:18 +00:00
|
|
|
G.scene->nodetree->timecursor = set_timecursor;
|
2016-04-24 22:42:41 +10:00
|
|
|
G.scene->nodetree->test_break = BKE_blender_test_break;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2.5: Space Image ported back
Organized as follows:
uvedit/
uv editing related code
uvedit_draw.c: drawing code
uvedit_ops.c: operators, just a few done
uvedit_unwrap_ops.c: will be operators for unwrapping
uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
space_image.c: registration and common getter/setters
image_draw.c: drawing code, mostly functional
image_panels.c: panels, all commented out
image_render.c: render callbacks, non functional
image_ops.c: operators, only view navigation done
image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
are not implemented they're displayed grayed out. Ideally the full
header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
still does own view2d management due to some very specific
requirements that the image window has. The drawing code however
is more clear hopefully, it only uses view2d, and there is no
switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
image space settings to scene toolsettings, and the current image
and its buffer is in the context. Especially sync selection and
select mode belonged there anyway as this cannot work correct with
different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
uvedit because there's really no code sharing.. perhaps vertex paint,
image paint and sculpt would be good to have in one module to share
brush code, partial redraw, etc better.
2009-01-15 04:38:18 +00:00
|
|
|
BIF_store_spare();
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-01-15 23:24:20 +11:00
|
|
|
/* 1 is do_previews */
|
|
|
|
|
ntreeCompositExecTree(scene->nodetree, &scene->r, 1, &scene->view_settings, &scene->display_settings);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-28 11:53:18 +00:00
|
|
|
G.scene->nodetree->timecursor = NULL;
|
|
|
|
|
G.scene->nodetree->test_break = NULL;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2.5: Space Image ported back
Organized as follows:
uvedit/
uv editing related code
uvedit_draw.c: drawing code
uvedit_ops.c: operators, just a few done
uvedit_unwrap_ops.c: will be operators for unwrapping
uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
space_image.c: registration and common getter/setters
image_draw.c: drawing code, mostly functional
image_panels.c: panels, all commented out
image_render.c: render callbacks, non functional
image_ops.c: operators, only view navigation done
image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
are not implemented they're displayed grayed out. Ideally the full
header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
still does own view2d management due to some very specific
requirements that the image window has. The drawing code however
is more clear hopefully, it only uses view2d, and there is no
switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
image space settings to scene toolsettings, and the current image
and its buffer is in the context. Especially sync selection and
select mode belonged there anyway as this cannot work correct with
different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
uvedit because there's really no code sharing.. perhaps vertex paint,
image paint and sculpt would be good to have in one module to share
brush code, partial redraw, etc better.
2009-01-15 04:38:18 +00:00
|
|
|
scrarea_do_windraw(curarea);
|
|
|
|
|
waitcursor(0);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-02-21 18:33:09 +00:00
|
|
|
WM_event_add_notifier(C, NC_IMAGE, ima_v);
|
2012-10-21 05:46:41 +00:00
|
|
|
}
|
2.5: Space Image ported back
Organized as follows:
uvedit/
uv editing related code
uvedit_draw.c: drawing code
uvedit_ops.c: operators, just a few done
uvedit_unwrap_ops.c: will be operators for unwrapping
uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
space_image.c: registration and common getter/setters
image_draw.c: drawing code, mostly functional
image_panels.c: panels, all commented out
image_render.c: render callbacks, non functional
image_ops.c: operators, only view navigation done
image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
are not implemented they're displayed grayed out. Ideally the full
header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
still does own view2d management due to some very specific
requirements that the image window has. The drawing code however
is more clear hopefully, it only uses view2d, and there is no
switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
image space settings to scene toolsettings, and the current image
and its buffer is in the context. Especially sync selection and
select mode belonged there anyway as this cannot work correct with
different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
uvedit because there's really no code sharing.. perhaps vertex paint,
image paint and sculpt would be good to have in one module to share
brush code, partial redraw, etc better.
2009-01-15 04:38:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* nothing drawn here, we use it to store values */
|
2012-07-26 22:47:05 +00:00
|
|
|
static void preview_cb(ScrArea *sa, struct uiBlock *block)
|
2.5: Space Image ported back
Organized as follows:
uvedit/
uv editing related code
uvedit_draw.c: drawing code
uvedit_ops.c: operators, just a few done
uvedit_unwrap_ops.c: will be operators for unwrapping
uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
space_image.c: registration and common getter/setters
image_draw.c: drawing code, mostly functional
image_panels.c: panels, all commented out
image_render.c: render callbacks, non functional
image_ops.c: operators, only view navigation done
image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
are not implemented they're displayed grayed out. Ideally the full
header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
still does own view2d management due to some very specific
requirements that the image window has. The drawing code however
is more clear hopefully, it only uses view2d, and there is no
switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
image space settings to scene toolsettings, and the current image
and its buffer is in the context. Especially sync selection and
select mode belonged there anyway as this cannot work correct with
different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
uvedit because there's really no code sharing.. perhaps vertex paint,
image paint and sculpt would be good to have in one module to share
brush code, partial redraw, etc better.
2009-01-15 04:38:18 +00:00
|
|
|
{
|
2012-03-28 11:53:18 +00:00
|
|
|
SpaceImage *sima = sa->spacedata.first;
|
2.5: Space Image ported back
Organized as follows:
uvedit/
uv editing related code
uvedit_draw.c: drawing code
uvedit_ops.c: operators, just a few done
uvedit_unwrap_ops.c: will be operators for unwrapping
uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
space_image.c: registration and common getter/setters
image_draw.c: drawing code, mostly functional
image_panels.c: panels, all commented out
image_render.c: render callbacks, non functional
image_ops.c: operators, only view navigation done
image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
are not implemented they're displayed grayed out. Ideally the full
header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
still does own view2d management due to some very specific
requirements that the image window has. The drawing code however
is more clear hopefully, it only uses view2d, and there is no
switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
image space settings to scene toolsettings, and the current image
and its buffer is in the context. Especially sync selection and
select mode belonged there anyway as this cannot work correct with
different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
uvedit because there's really no code sharing.. perhaps vertex paint,
image paint and sculpt would be good to have in one module to share
brush code, partial redraw, etc better.
2009-01-15 04:38:18 +00:00
|
|
|
rctf dispf;
|
2012-03-28 11:53:18 +00:00
|
|
|
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;
|
2011-05-12 16:47:36 +00:00
|
|
|
int mval[2];
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (G.scene->r.mode & R_BORDER) {
|
2012-09-15 11:48:20 +00:00
|
|
|
winx *= BLI_rcti_size_x(&G.scene->r.border);
|
|
|
|
|
winy *= BLI_rctf_size_y(&G.scene->r.border);
|
2.5: Space Image ported back
Organized as follows:
uvedit/
uv editing related code
uvedit_draw.c: drawing code
uvedit_ops.c: operators, just a few done
uvedit_unwrap_ops.c: will be operators for unwrapping
uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
space_image.c: registration and common getter/setters
image_draw.c: drawing code, mostly functional
image_panels.c: panels, all commented out
image_render.c: render callbacks, non functional
image_ops.c: operators, only view navigation done
image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
are not implemented they're displayed grayed out. Ideally the full
header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
still does own view2d management due to some very specific
requirements that the image window has. The drawing code however
is more clear hopefully, it only uses view2d, and there is no
switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
image space settings to scene toolsettings, and the current image
and its buffer is in the context. Especially sync selection and
select mode belonged there anyway as this cannot work correct with
different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
uvedit because there's really no code sharing.. perhaps vertex paint,
image paint and sculpt would be good to have in one module to share
brush code, partial redraw, etc better.
2009-01-15 04:38:18 +00:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2.5: Space Image ported back
Organized as follows:
uvedit/
uv editing related code
uvedit_draw.c: drawing code
uvedit_ops.c: operators, just a few done
uvedit_unwrap_ops.c: will be operators for unwrapping
uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
space_image.c: registration and common getter/setters
image_draw.c: drawing code, mostly functional
image_panels.c: panels, all commented out
image_render.c: render callbacks, non functional
image_ops.c: operators, only view navigation done
image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
are not implemented they're displayed grayed out. Ideally the full
header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
still does own view2d management due to some very specific
requirements that the image window has. The drawing code however
is more clear hopefully, it only uses view2d, and there is no
switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
image space settings to scene toolsettings, and the current image
and its buffer is in the context. Especially sync selection and
select mode belonged there anyway as this cannot work correct with
different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
uvedit because there's really no code sharing.. perhaps vertex paint,
image paint and sculpt would be good to have in one module to share
brush code, partial redraw, etc better.
2009-01-15 04:38:18 +00:00
|
|
|
/* while dragging we need to update the rects, otherwise it doesn't end with correct one */
|
|
|
|
|
|
2012-09-15 11:48:20 +00:00
|
|
|
BLI_rctf_init(&dispf, 15.0f, BLI_rcti_size_x(&block->rect) - 15.0f, 15.0f, (BLI_rctf_size_y(&block->rect)) - 15.0f);
|
2.5: Space Image ported back
Organized as follows:
uvedit/
uv editing related code
uvedit_draw.c: drawing code
uvedit_ops.c: operators, just a few done
uvedit_unwrap_ops.c: will be operators for unwrapping
uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
space_image.c: registration and common getter/setters
image_draw.c: drawing code, mostly functional
image_panels.c: panels, all commented out
image_render.c: render callbacks, non functional
image_ops.c: operators, only view navigation done
image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
are not implemented they're displayed grayed out. Ideally the full
header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
still does own view2d management due to some very specific
requirements that the image window has. The drawing code however
is more clear hopefully, it only uses view2d, and there is no
switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
image space settings to scene toolsettings, and the current image
and its buffer is in the context. Especially sync selection and
select mode belonged there anyway as this cannot work correct with
different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
uvedit because there's really no code sharing.. perhaps vertex paint,
image paint and sculpt would be good to have in one module to share
brush code, partial redraw, etc better.
2009-01-15 04:38:18 +00:00
|
|
|
ui_graphics_to_window_rct(sa->win, &dispf, disprect);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2.5: Space Image ported back
Organized as follows:
uvedit/
uv editing related code
uvedit_draw.c: drawing code
uvedit_ops.c: operators, just a few done
uvedit_unwrap_ops.c: will be operators for unwrapping
uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
space_image.c: registration and common getter/setters
image_draw.c: drawing code, mostly functional
image_panels.c: panels, all commented out
image_render.c: render callbacks, non functional
image_ops.c: operators, only view navigation done
image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
are not implemented they're displayed grayed out. Ideally the full
header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
still does own view2d management due to some very specific
requirements that the image window has. The drawing code however
is more clear hopefully, it only uses view2d, and there is no
switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
image space settings to scene toolsettings, and the current image
and its buffer is in the context. Especially sync selection and
select mode belonged there anyway as this cannot work correct with
different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
uvedit because there's really no code sharing.. perhaps vertex paint,
image paint and sculpt would be good to have in one module to share
brush code, partial redraw, etc better.
2009-01-15 04:38:18 +00:00
|
|
|
/* correction for gla draw */
|
2012-07-15 00:29:56 +00:00
|
|
|
BLI_rcti_translate(disprect, -curarea->winrct.xmin, -curarea->winrct.ymin);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-02-21 18:33:09 +00:00
|
|
|
calc_image_view(sima, 'p');
|
2012-12-29 01:54:58 +00:00
|
|
|
// printf("winrct %d %d %d %d\n", disprect->xmin, disprect->ymin, disprect->xmax, disprect->ymax);
|
2.5: Space Image ported back
Organized as follows:
uvedit/
uv editing related code
uvedit_draw.c: drawing code
uvedit_ops.c: operators, just a few done
uvedit_unwrap_ops.c: will be operators for unwrapping
uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
space_image.c: registration and common getter/setters
image_draw.c: drawing code, mostly functional
image_panels.c: panels, all commented out
image_render.c: render callbacks, non functional
image_ops.c: operators, only view navigation done
image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
are not implemented they're displayed grayed out. Ideally the full
header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
still does own view2d management due to some very specific
requirements that the image window has. The drawing code however
is more clear hopefully, it only uses view2d, and there is no
switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
image space settings to scene toolsettings, and the current image
and its buffer is in the context. Especially sync selection and
select mode belonged there anyway as this cannot work correct with
different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
uvedit because there's really no code sharing.. perhaps vertex paint,
image paint and sculpt would be good to have in one module to share
brush code, partial redraw, etc better.
2009-01-15 04:38:18 +00:00
|
|
|
/* map to image space coordinates */
|
2012-03-28 11:53:18 +00:00
|
|
|
mval[0] = disprect->xmin; mval[1] = disprect->ymin;
|
2009-02-21 18:33:09 +00:00
|
|
|
areamouseco_to_ipoco(v2d, mval, &dispf.xmin, &dispf.ymin);
|
2012-03-28 11:53:18 +00:00
|
|
|
mval[0] = disprect->xmax; mval[1] = disprect->ymax;
|
2009-02-21 18:33:09 +00:00
|
|
|
areamouseco_to_ipoco(v2d, mval, &dispf.xmax, &dispf.ymax);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2.5: Space Image ported back
Organized as follows:
uvedit/
uv editing related code
uvedit_draw.c: drawing code
uvedit_ops.c: operators, just a few done
uvedit_unwrap_ops.c: will be operators for unwrapping
uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
space_image.c: registration and common getter/setters
image_draw.c: drawing code, mostly functional
image_panels.c: panels, all commented out
image_render.c: render callbacks, non functional
image_ops.c: operators, only view navigation done
image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
are not implemented they're displayed grayed out. Ideally the full
header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
still does own view2d management due to some very specific
requirements that the image window has. The drawing code however
is more clear hopefully, it only uses view2d, and there is no
switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
image space settings to scene toolsettings, and the current image
and its buffer is in the context. Especially sync selection and
select mode belonged there anyway as this cannot work correct with
different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
uvedit because there's really no code sharing.. perhaps vertex paint,
image paint and sculpt would be good to have in one module to share
brush code, partial redraw, etc better.
2009-01-15 04:38:18 +00:00
|
|
|
/* map to render coordinates */
|
2012-03-24 02:51:46 +00:00
|
|
|
disprect->xmin = dispf.xmin;
|
|
|
|
|
disprect->xmax = dispf.xmax;
|
|
|
|
|
disprect->ymin = dispf.ymin;
|
|
|
|
|
disprect->ymax = dispf.ymax;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2.5: Space Image ported back
Organized as follows:
uvedit/
uv editing related code
uvedit_draw.c: drawing code
uvedit_ops.c: operators, just a few done
uvedit_unwrap_ops.c: will be operators for unwrapping
uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
space_image.c: registration and common getter/setters
image_draw.c: drawing code, mostly functional
image_panels.c: panels, all commented out
image_render.c: render callbacks, non functional
image_ops.c: operators, only view navigation done
image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
are not implemented they're displayed grayed out. Ideally the full
header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
still does own view2d management due to some very specific
requirements that the image window has. The drawing code however
is more clear hopefully, it only uses view2d, and there is no
switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
image space settings to scene toolsettings, and the current image
and its buffer is in the context. Especially sync selection and
select mode belonged there anyway as this cannot work correct with
different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
uvedit because there's really no code sharing.. perhaps vertex paint,
image paint and sculpt would be good to have in one module to share
brush code, partial redraw, etc better.
2009-01-15 04:38:18 +00:00
|
|
|
CLAMP(disprect->xmin, 0, winx);
|
|
|
|
|
CLAMP(disprect->xmax, 0, winx);
|
|
|
|
|
CLAMP(disprect->ymin, 0, winy);
|
|
|
|
|
CLAMP(disprect->ymax, 0, winy);
|
2012-12-29 01:54:58 +00:00
|
|
|
// printf("drawrct %d %d %d %d\n", disprect->xmin, disprect->ymin, disprect->xmax, disprect->ymax);
|
2.5: Space Image ported back
Organized as follows:
uvedit/
uv editing related code
uvedit_draw.c: drawing code
uvedit_ops.c: operators, just a few done
uvedit_unwrap_ops.c: will be operators for unwrapping
uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
space_image.c: registration and common getter/setters
image_draw.c: drawing code, mostly functional
image_panels.c: panels, all commented out
image_render.c: render callbacks, non functional
image_ops.c: operators, only view navigation done
image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
are not implemented they're displayed grayed out. Ideally the full
header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
still does own view2d management due to some very specific
requirements that the image window has. The drawing code however
is more clear hopefully, it only uses view2d, and there is no
switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
image space settings to scene toolsettings, and the current image
and its buffer is in the context. Especially sync selection and
select mode belonged there anyway as this cannot work correct with
different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
uvedit because there's really no code sharing.. perhaps vertex paint,
image paint and sculpt would be good to have in one module to share
brush code, partial redraw, etc better.
2009-01-15 04:38:18 +00:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2014-01-28 03:52:21 +11:00
|
|
|
static bool is_preview_allowed(ScrArea *cur)
|
2.5: Space Image ported back
Organized as follows:
uvedit/
uv editing related code
uvedit_draw.c: drawing code
uvedit_ops.c: operators, just a few done
uvedit_unwrap_ops.c: will be operators for unwrapping
uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
space_image.c: registration and common getter/setters
image_draw.c: drawing code, mostly functional
image_panels.c: panels, all commented out
image_render.c: render callbacks, non functional
image_ops.c: operators, only view navigation done
image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
are not implemented they're displayed grayed out. Ideally the full
header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
still does own view2d management due to some very specific
requirements that the image window has. The drawing code however
is more clear hopefully, it only uses view2d, and there is no
switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
image space settings to scene toolsettings, and the current image
and its buffer is in the context. Especially sync selection and
select mode belonged there anyway as this cannot work correct with
different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
uvedit because there's really no code sharing.. perhaps vertex paint,
image paint and sculpt would be good to have in one module to share
brush code, partial redraw, etc better.
2009-01-15 04:38:18 +00:00
|
|
|
{
|
2012-03-28 11:53:18 +00:00
|
|
|
SpaceImage *sima = cur->spacedata.first;
|
2.5: Space Image ported back
Organized as follows:
uvedit/
uv editing related code
uvedit_draw.c: drawing code
uvedit_ops.c: operators, just a few done
uvedit_unwrap_ops.c: will be operators for unwrapping
uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
space_image.c: registration and common getter/setters
image_draw.c: drawing code, mostly functional
image_panels.c: panels, all commented out
image_render.c: render callbacks, non functional
image_ops.c: operators, only view navigation done
image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
are not implemented they're displayed grayed out. Ideally the full
header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
still does own view2d management due to some very specific
requirements that the image window has. The drawing code however
is more clear hopefully, it only uses view2d, and there is no
switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
image space settings to scene toolsettings, and the current image
and its buffer is in the context. Especially sync selection and
select mode belonged there anyway as this cannot work correct with
different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
uvedit because there's really no code sharing.. perhaps vertex paint,
image paint and sculpt would be good to have in one module to share
brush code, partial redraw, etc better.
2009-01-15 04:38:18 +00:00
|
|
|
ScrArea *sa;
|
|
|
|
|
|
|
|
|
|
/* check if another areawindow has preview set */
|
2012-03-28 11:53:18 +00:00
|
|
|
for (sa = G.curscreen->areabase.first; sa; sa = sa->next) {
|
|
|
|
|
if (sa != cur && sa->spacetype == SPACE_IMAGE) {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (image_preview_active(sa, NULL, NULL))
|
2011-04-21 15:53:30 +00:00
|
|
|
return 0;
|
2.5: Space Image ported back
Organized as follows:
uvedit/
uv editing related code
uvedit_draw.c: drawing code
uvedit_ops.c: operators, just a few done
uvedit_unwrap_ops.c: will be operators for unwrapping
uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
space_image.c: registration and common getter/setters
image_draw.c: drawing code, mostly functional
image_panels.c: panels, all commented out
image_render.c: render callbacks, non functional
image_ops.c: operators, only view navigation done
image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
are not implemented they're displayed grayed out. Ideally the full
header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
still does own view2d management due to some very specific
requirements that the image window has. The drawing code however
is more clear hopefully, it only uses view2d, and there is no
switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
image space settings to scene toolsettings, and the current image
and its buffer is in the context. Especially sync selection and
select mode belonged there anyway as this cannot work correct with
different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
uvedit because there's really no code sharing.. perhaps vertex paint,
image paint and sculpt would be good to have in one module to share
brush code, partial redraw, etc better.
2009-01-15 04:38:18 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/* check image type */
|
2012-03-28 11:53:18 +00:00
|
|
|
if (sima->image == NULL || sima->image->type != IMA_TYPE_COMPOSITE)
|
2.5: Space Image ported back
Organized as follows:
uvedit/
uv editing related code
uvedit_draw.c: drawing code
uvedit_ops.c: operators, just a few done
uvedit_unwrap_ops.c: will be operators for unwrapping
uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
space_image.c: registration and common getter/setters
image_draw.c: drawing code, mostly functional
image_panels.c: panels, all commented out
image_render.c: render callbacks, non functional
image_ops.c: operators, only view navigation done
image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
are not implemented they're displayed grayed out. Ideally the full
header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
still does own view2d management due to some very specific
requirements that the image window has. The drawing code however
is more clear hopefully, it only uses view2d, and there is no
switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
image space settings to scene toolsettings, and the current image
and its buffer is in the context. Especially sync selection and
select mode belonged there anyway as this cannot work correct with
different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
uvedit because there's really no code sharing.. perhaps vertex paint,
image paint and sculpt would be good to have in one module to share
brush code, partial redraw, etc better.
2009-01-15 04:38:18 +00:00
|
|
|
return 0;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2.5: Space Image ported back
Organized as follows:
uvedit/
uv editing related code
uvedit_draw.c: drawing code
uvedit_ops.c: operators, just a few done
uvedit_unwrap_ops.c: will be operators for unwrapping
uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
space_image.c: registration and common getter/setters
image_draw.c: drawing code, mostly functional
image_panels.c: panels, all commented out
image_render.c: render callbacks, non functional
image_ops.c: operators, only view navigation done
image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
are not implemented they're displayed grayed out. Ideally the full
header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
still does own view2d management due to some very specific
requirements that the image window has. The drawing code however
is more clear hopefully, it only uses view2d, and there is no
switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
image space settings to scene toolsettings, and the current image
and its buffer is in the context. Especially sync selection and
select mode belonged there anyway as this cannot work correct with
different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
uvedit because there's really no code sharing.. perhaps vertex paint,
image paint and sculpt would be good to have in one module to share
brush code, partial redraw, etc better.
2009-01-15 04:38:18 +00:00
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-21 18:33:09 +00:00
|
|
|
|
2012-03-28 11:53:18 +00:00
|
|
|
static void image_panel_preview(ScrArea *sa, short cntrl) // IMAGE_HANDLER_PREVIEW
|
2.5: Space Image ported back
Organized as follows:
uvedit/
uv editing related code
uvedit_draw.c: drawing code
uvedit_ops.c: operators, just a few done
uvedit_unwrap_ops.c: will be operators for unwrapping
uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
space_image.c: registration and common getter/setters
image_draw.c: drawing code, mostly functional
image_panels.c: panels, all commented out
image_render.c: render callbacks, non functional
image_ops.c: operators, only view navigation done
image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
are not implemented they're displayed grayed out. Ideally the full
header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
still does own view2d management due to some very specific
requirements that the image window has. The drawing code however
is more clear hopefully, it only uses view2d, and there is no
switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
image space settings to scene toolsettings, and the current image
and its buffer is in the context. Especially sync selection and
select mode belonged there anyway as this cannot work correct with
different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
uvedit because there's really no code sharing.. perhaps vertex paint,
image paint and sculpt would be good to have in one module to share
brush code, partial redraw, etc better.
2009-01-15 04:38:18 +00:00
|
|
|
{
|
|
|
|
|
uiBlock *block;
|
2012-03-28 11:53:18 +00:00
|
|
|
SpaceImage *sima = sa->spacedata.first;
|
2.5: Space Image ported back
Organized as follows:
uvedit/
uv editing related code
uvedit_draw.c: drawing code
uvedit_ops.c: operators, just a few done
uvedit_unwrap_ops.c: will be operators for unwrapping
uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
space_image.c: registration and common getter/setters
image_draw.c: drawing code, mostly functional
image_panels.c: panels, all commented out
image_render.c: render callbacks, non functional
image_ops.c: operators, only view navigation done
image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
are not implemented they're displayed grayed out. Ideally the full
header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
still does own view2d management due to some very specific
requirements that the image window has. The drawing code however
is more clear hopefully, it only uses view2d, and there is no
switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
image space settings to scene toolsettings, and the current image
and its buffer is in the context. Especially sync selection and
select mode belonged there anyway as this cannot work correct with
different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
uvedit because there's really no code sharing.. perhaps vertex paint,
image paint and sculpt would be good to have in one module to share
brush code, partial redraw, etc better.
2009-01-15 04:38:18 +00:00
|
|
|
int ofsx, ofsy;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-28 11:53:18 +00:00
|
|
|
if (is_preview_allowed(sa) == 0) {
|
2.5: Space Image ported back
Organized as follows:
uvedit/
uv editing related code
uvedit_draw.c: drawing code
uvedit_ops.c: operators, just a few done
uvedit_unwrap_ops.c: will be operators for unwrapping
uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
space_image.c: registration and common getter/setters
image_draw.c: drawing code, mostly functional
image_panels.c: panels, all commented out
image_render.c: render callbacks, non functional
image_ops.c: operators, only view navigation done
image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
are not implemented they're displayed grayed out. Ideally the full
header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
still does own view2d management due to some very specific
requirements that the image window has. The drawing code however
is more clear hopefully, it only uses view2d, and there is no
switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
image space settings to scene toolsettings, and the current image
and its buffer is in the context. Especially sync selection and
select mode belonged there anyway as this cannot work correct with
different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
uvedit because there's really no code sharing.. perhaps vertex paint,
image paint and sculpt would be good to have in one module to share
brush code, partial redraw, etc better.
2009-01-15 04:38:18 +00:00
|
|
|
rem_blockhandler(sa, IMAGE_HANDLER_PREVIEW);
|
2012-03-28 11:53:18 +00:00
|
|
|
G.scene->r.scemode &= ~R_COMP_CROP; /* quite weak */
|
2.5: Space Image ported back
Organized as follows:
uvedit/
uv editing related code
uvedit_draw.c: drawing code
uvedit_ops.c: operators, just a few done
uvedit_unwrap_ops.c: will be operators for unwrapping
uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
space_image.c: registration and common getter/setters
image_draw.c: drawing code, mostly functional
image_panels.c: panels, all commented out
image_render.c: render callbacks, non functional
image_ops.c: operators, only view navigation done
image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
are not implemented they're displayed grayed out. Ideally the full
header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
still does own view2d management due to some very specific
requirements that the image window has. The drawing code however
is more clear hopefully, it only uses view2d, and there is no
switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
image space settings to scene toolsettings, and the current image
and its buffer is in the context. Especially sync selection and
select mode belonged there anyway as this cannot work correct with
different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
uvedit because there's really no code sharing.. perhaps vertex paint,
image paint and sculpt would be good to have in one module to share
brush code, partial redraw, etc better.
2009-01-15 04:38:18 +00:00
|
|
|
return;
|
|
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2014-11-09 21:20:40 +01:00
|
|
|
block = UI_block_begin(C, ar, __func__, UI_EMBOSS);
|
2.5: Space Image ported back
Organized as follows:
uvedit/
uv editing related code
uvedit_draw.c: drawing code
uvedit_ops.c: operators, just a few done
uvedit_unwrap_ops.c: will be operators for unwrapping
uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
space_image.c: registration and common getter/setters
image_draw.c: drawing code, mostly functional
image_panels.c: panels, all commented out
image_render.c: render callbacks, non functional
image_ops.c: operators, only view navigation done
image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
are not implemented they're displayed grayed out. Ideally the full
header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
still does own view2d management due to some very specific
requirements that the image window has. The drawing code however
is more clear hopefully, it only uses view2d, and there is no
switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
image space settings to scene toolsettings, and the current image
and its buffer is in the context. Especially sync selection and
select mode belonged there anyway as this cannot work correct with
different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
uvedit because there's really no code sharing.. perhaps vertex paint,
image paint and sculpt would be good to have in one module to share
brush code, partial redraw, etc better.
2009-01-15 04:38:18 +00:00
|
|
|
uiPanelControl(UI_PNL_SOLID | UI_PNL_CLOSE | UI_PNL_SCALE | cntrl);
|
|
|
|
|
uiSetPanelHandler(IMAGE_HANDLER_PREVIEW); // for close and esc
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-28 11:53:18 +00:00
|
|
|
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;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2014-11-09 21:20:40 +01:00
|
|
|
UI_but_func_drawextra_set(block, preview_cb);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2.5: Space Image ported back
Organized as follows:
uvedit/
uv editing related code
uvedit_draw.c: drawing code
uvedit_ops.c: operators, just a few done
uvedit_unwrap_ops.c: will be operators for unwrapping
uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
space_image.c: registration and common getter/setters
image_draw.c: drawing code, mostly functional
image_panels.c: panels, all commented out
image_render.c: render callbacks, non functional
image_ops.c: operators, only view navigation done
image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
are not implemented they're displayed grayed out. Ideally the full
header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
still does own view2d management due to some very specific
requirements that the image window has. The drawing code however
is more clear hopefully, it only uses view2d, and there is no
switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
image space settings to scene toolsettings, and the current image
and its buffer is in the context. Especially sync selection and
select mode belonged there anyway as this cannot work correct with
different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
uvedit because there's really no code sharing.. perhaps vertex paint,
image paint and sculpt would be good to have in one module to share
brush code, partial redraw, etc better.
2009-01-15 04:38:18 +00:00
|
|
|
}
|
2009-02-21 18:33:09 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* ********************* callbacks for standard image buttons *************** */
|
2.5: Space Image ported back
Organized as follows:
uvedit/
uv editing related code
uvedit_draw.c: drawing code
uvedit_ops.c: operators, just a few done
uvedit_unwrap_ops.c: will be operators for unwrapping
uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
space_image.c: registration and common getter/setters
image_draw.c: drawing code, mostly functional
image_panels.c: panels, all commented out
image_render.c: render callbacks, non functional
image_ops.c: operators, only view navigation done
image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
are not implemented they're displayed grayed out. Ideally the full
header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
still does own view2d management due to some very specific
requirements that the image window has. The drawing code however
is more clear hopefully, it only uses view2d, and there is no
switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
image space settings to scene toolsettings, and the current image
and its buffer is in the context. Especially sync selection and
select mode belonged there anyway as this cannot work correct with
different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
uvedit because there's really no code sharing.. perhaps vertex paint,
image paint and sculpt would be good to have in one module to share
brush code, partial redraw, etc better.
2009-01-15 04:38:18 +00:00
|
|
|
|
2014-10-09 11:15:47 +02:00
|
|
|
static void ui_imageuser_slot_menu(bContext *UNUSED(C), uiLayout *layout, void *image_p)
|
2010-02-09 19:37:37 +00:00
|
|
|
{
|
2014-02-12 00:08:54 +11:00
|
|
|
uiBlock *block = uiLayoutGetBlock(layout);
|
2014-10-09 11:15:47 +02:00
|
|
|
Image *image = image_p;
|
2018-06-14 22:46:30 +02:00
|
|
|
int slot_id;
|
2014-02-12 00:08:54 +11:00
|
|
|
|
2014-11-09 21:20:40 +01:00
|
|
|
uiDefBut(block, UI_BTYPE_LABEL, 0, IFACE_("Slot"),
|
2014-02-12 00:08:54 +11:00
|
|
|
0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
|
|
|
|
|
uiItemS(layout);
|
|
|
|
|
|
2018-06-14 22:46:30 +02:00
|
|
|
slot_id = BLI_listbase_count(&image->renderslots) - 1;
|
|
|
|
|
for (RenderSlot *slot = image->renderslots.last; slot; slot = slot->prev) {
|
2014-10-09 11:15:47 +02:00
|
|
|
char str[64];
|
2018-06-14 22:46:30 +02:00
|
|
|
if (slot->name[0] != '\0') {
|
|
|
|
|
BLI_strncpy(str, slot->name, sizeof(str));
|
2014-10-09 11:15:47 +02:00
|
|
|
}
|
|
|
|
|
else {
|
2018-06-14 22:46:30 +02:00
|
|
|
BLI_snprintf(str, sizeof(str), IFACE_("Slot %d"), slot_id + 1);
|
2014-10-09 11:15:47 +02:00
|
|
|
}
|
2014-11-09 21:20:40 +01:00
|
|
|
uiDefButS(block, UI_BTYPE_BUT_MENU, B_NOP, str, 0, 0,
|
2018-06-14 22:46:30 +02:00
|
|
|
UI_UNIT_X * 5, UI_UNIT_X, &image->render_slot, (float) slot_id, 0.0, 0, -1, "");
|
|
|
|
|
slot_id--;
|
2014-02-12 00:08:54 +11:00
|
|
|
}
|
2010-02-09 19:37:37 +00:00
|
|
|
}
|
|
|
|
|
|
2015-11-16 07:13:40 +11:00
|
|
|
static bool ui_imageuser_slot_menu_step(bContext *C, int direction, void *image_p)
|
|
|
|
|
{
|
|
|
|
|
Image *image = image_p;
|
|
|
|
|
|
|
|
|
|
if (ED_image_slot_cycle(image, direction)) {
|
|
|
|
|
WM_event_add_notifier(C, NC_IMAGE | ND_DRAW, NULL);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-12 00:08:54 +11:00
|
|
|
static const char *ui_imageuser_layer_fake_name(RenderResult *rr)
|
2009-02-21 18:33:09 +00:00
|
|
|
{
|
2015-04-29 11:26:30 -03:00
|
|
|
RenderView *rv = RE_RenderViewGetById(rr, 0);
|
|
|
|
|
if (rv->rectf) {
|
2014-02-12 00:08:54 +11:00
|
|
|
return IFACE_("Composite");
|
2009-02-21 18:33:09 +00:00
|
|
|
}
|
2015-04-29 11:26:30 -03:00
|
|
|
else if (rv->rect32) {
|
2014-02-12 00:08:54 +11:00
|
|
|
return IFACE_("Sequence");
|
2011-11-26 18:33:31 +00:00
|
|
|
}
|
2014-02-12 00:08:54 +11:00
|
|
|
else {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-11-16 06:44:18 +11:00
|
|
|
/* workaround for passing many args */
|
|
|
|
|
struct ImageUI_Data {
|
|
|
|
|
Image *image;
|
|
|
|
|
ImageUser *iuser;
|
|
|
|
|
int rpass_index;
|
|
|
|
|
};
|
|
|
|
|
|
2016-07-19 02:44:14 +10:00
|
|
|
static struct ImageUI_Data *ui_imageuser_data_copy(const struct ImageUI_Data *rnd_pt_src)
|
|
|
|
|
{
|
|
|
|
|
struct ImageUI_Data *rnd_pt_dst = MEM_mallocN(sizeof(*rnd_pt_src), __func__);
|
|
|
|
|
memcpy(rnd_pt_dst, rnd_pt_src, sizeof(*rnd_pt_src));
|
|
|
|
|
return rnd_pt_dst;
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-12 00:08:54 +11:00
|
|
|
static void ui_imageuser_layer_menu(bContext *UNUSED(C), uiLayout *layout, void *rnd_pt)
|
|
|
|
|
{
|
2015-11-16 06:44:18 +11:00
|
|
|
struct ImageUI_Data *rnd_data = rnd_pt;
|
2014-02-12 00:08:54 +11:00
|
|
|
uiBlock *block = uiLayoutGetBlock(layout);
|
2015-11-16 06:44:18 +11:00
|
|
|
Image *image = rnd_data->image;
|
|
|
|
|
ImageUser *iuser = rnd_data->iuser;
|
2014-10-13 18:13:50 +02:00
|
|
|
Scene *scene = iuser->scene;
|
|
|
|
|
RenderResult *rr;
|
2014-02-12 00:08:54 +11:00
|
|
|
RenderLayer *rl;
|
2014-02-17 11:12:39 +11:00
|
|
|
RenderLayer rl_fake = {NULL};
|
2014-02-12 00:08:54 +11:00
|
|
|
const char *fake_name;
|
|
|
|
|
int nr;
|
|
|
|
|
|
2014-10-13 18:13:50 +02:00
|
|
|
/* may have been freed since drawing */
|
|
|
|
|
rr = BKE_image_acquire_renderresult(scene, image);
|
|
|
|
|
if (UNLIKELY(rr == NULL)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2014-11-09 21:20:40 +01:00
|
|
|
UI_block_layout_set_current(block, layout);
|
2014-02-12 00:08:54 +11:00
|
|
|
uiLayoutColumn(layout, false);
|
|
|
|
|
|
2014-11-09 21:20:40 +01:00
|
|
|
uiDefBut(block, UI_BTYPE_LABEL, 0, IFACE_("Layer"),
|
2014-02-12 00:08:54 +11:00
|
|
|
0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
|
|
|
|
|
uiItemS(layout);
|
|
|
|
|
|
2014-11-16 13:57:58 +01:00
|
|
|
nr = BLI_listbase_count(&rr->layers) - 1;
|
2014-02-12 00:08:54 +11:00
|
|
|
fake_name = ui_imageuser_layer_fake_name(rr);
|
|
|
|
|
|
|
|
|
|
if (fake_name) {
|
|
|
|
|
BLI_strncpy(rl_fake.name, fake_name, sizeof(rl_fake.name));
|
|
|
|
|
nr += 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (rl = rr->layers.last; rl; rl = rl->prev, nr--) {
|
|
|
|
|
final:
|
2015-06-09 14:57:29 +02:00
|
|
|
uiDefButS(block, UI_BTYPE_BUT_MENU, B_NOP, rl->name, 0, 0,
|
2014-02-12 00:08:54 +11:00
|
|
|
UI_UNIT_X * 5, UI_UNIT_X, &iuser->layer, (float) nr, 0.0, 0, -1, "");
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-12 02:30:22 +11:00
|
|
|
if (fake_name) {
|
|
|
|
|
fake_name = NULL;
|
2014-02-12 00:08:54 +11:00
|
|
|
rl = &rl_fake;
|
|
|
|
|
goto final;
|
|
|
|
|
}
|
2014-02-12 02:30:22 +11:00
|
|
|
|
|
|
|
|
BLI_assert(nr == -1);
|
2014-10-13 18:13:50 +02:00
|
|
|
|
|
|
|
|
BKE_image_release_renderresult(scene, image);
|
2014-02-12 00:08:54 +11:00
|
|
|
}
|
|
|
|
|
|
2015-04-06 10:40:12 -03:00
|
|
|
static void ui_imageuser_pass_menu(bContext *UNUSED(C), uiLayout *layout, void *rnd_pt)
|
2009-02-21 18:33:09 +00:00
|
|
|
{
|
2015-11-16 06:44:18 +11:00
|
|
|
struct ImageUI_Data *rnd_data = rnd_pt;
|
2014-02-12 00:08:54 +11:00
|
|
|
uiBlock *block = uiLayoutGetBlock(layout);
|
2015-11-16 06:44:18 +11:00
|
|
|
Image *image = rnd_data->image;
|
|
|
|
|
ImageUser *iuser = rnd_data->iuser;
|
2014-10-13 18:13:50 +02:00
|
|
|
/* (rpass_index == -1) means composite result */
|
2015-11-16 06:44:18 +11:00
|
|
|
const int rpass_index = rnd_data->rpass_index;
|
2014-10-13 18:13:50 +02:00
|
|
|
Scene *scene = iuser->scene;
|
|
|
|
|
RenderResult *rr;
|
|
|
|
|
RenderLayer *rl;
|
2009-02-21 18:33:09 +00:00
|
|
|
RenderPass *rpass;
|
2014-02-12 00:08:54 +11:00
|
|
|
int nr;
|
|
|
|
|
|
2014-10-13 18:13:50 +02:00
|
|
|
/* may have been freed since drawing */
|
|
|
|
|
rr = BKE_image_acquire_renderresult(scene, image);
|
|
|
|
|
if (UNLIKELY(rr == NULL)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
rl = BLI_findlink(&rr->layers, rpass_index);
|
|
|
|
|
|
2014-11-09 21:20:40 +01:00
|
|
|
UI_block_layout_set_current(block, layout);
|
2014-02-12 00:08:54 +11:00
|
|
|
uiLayoutColumn(layout, false);
|
|
|
|
|
|
2014-11-09 21:20:40 +01:00
|
|
|
uiDefBut(block, UI_BTYPE_LABEL, 0, IFACE_("Pass"),
|
2014-02-12 00:08:54 +11:00
|
|
|
0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
|
|
|
|
|
|
|
|
|
|
uiItemS(layout);
|
|
|
|
|
|
2017-11-18 17:22:54 +11:00
|
|
|
nr = (rl == NULL) ? 1 : 0;
|
2014-02-12 00:08:54 +11:00
|
|
|
|
Render API/Cycles: Identify Render Passes by their name instead of a type flag
Previously, every RenderPass would have a bitfield that specified its type. That limits the number of passes to 32, which was reached a while ago.
However, most of the code already supported arbitrary RenderPasses since they were also used to store Multilayer EXR images.
Therefore, this commit completely removes the passflag from RenderPass and changes all code to use the unique pass name for identification.
Since Blender Internal relies on hardcoded passes and to preserve compatibility, 32 pass names are reserved for the old hardcoded passes.
To support these arbitrary passes, the Render Result compositor node now adds dynamic sockets. For compatibility, the old hardcoded sockets are always stored and just hidden when the corresponding pass isn't available.
To use these changes, the Render Engine API now includes a function that allows render engines to add arbitrary passes to the render result. To be able to add options for these passes, addons can now add their own properties to SceneRenderLayers.
To keep the compositor input node updated, render engine plugins have to implement a callback that registers all the passes that will be generated.
From a user perspective, nothing should change with this commit.
Differential Revision: https://developer.blender.org/D2443
Differential Revision: https://developer.blender.org/D2444
2017-05-03 00:21:18 +02:00
|
|
|
ListBase added_passes;
|
|
|
|
|
BLI_listbase_clear(&added_passes);
|
|
|
|
|
|
2009-02-21 18:33:09 +00:00
|
|
|
/* rendered results don't have a Combined pass */
|
2015-09-09 19:41:46 +05:00
|
|
|
/* multiview: the ordering must be ascending, so the left-most pass is always the one picked */
|
|
|
|
|
for (rpass = rl ? rl->passes.first : NULL; rpass; rpass = rpass->next, nr++) {
|
2015-04-06 10:40:12 -03:00
|
|
|
/* just show one pass of each kind */
|
Render API/Cycles: Identify Render Passes by their name instead of a type flag
Previously, every RenderPass would have a bitfield that specified its type. That limits the number of passes to 32, which was reached a while ago.
However, most of the code already supported arbitrary RenderPasses since they were also used to store Multilayer EXR images.
Therefore, this commit completely removes the passflag from RenderPass and changes all code to use the unique pass name for identification.
Since Blender Internal relies on hardcoded passes and to preserve compatibility, 32 pass names are reserved for the old hardcoded passes.
To support these arbitrary passes, the Render Result compositor node now adds dynamic sockets. For compatibility, the old hardcoded sockets are always stored and just hidden when the corresponding pass isn't available.
To use these changes, the Render Engine API now includes a function that allows render engines to add arbitrary passes to the render result. To be able to add options for these passes, addons can now add their own properties to SceneRenderLayers.
To keep the compositor input node updated, render engine plugins have to implement a callback that registers all the passes that will be generated.
From a user perspective, nothing should change with this commit.
Differential Revision: https://developer.blender.org/D2443
Differential Revision: https://developer.blender.org/D2444
2017-05-03 00:21:18 +02:00
|
|
|
if (BLI_findstring_ptr(&added_passes, rpass->name, offsetof(LinkData, data))) {
|
2015-04-06 10:40:12 -03:00
|
|
|
continue;
|
Render API/Cycles: Identify Render Passes by their name instead of a type flag
Previously, every RenderPass would have a bitfield that specified its type. That limits the number of passes to 32, which was reached a while ago.
However, most of the code already supported arbitrary RenderPasses since they were also used to store Multilayer EXR images.
Therefore, this commit completely removes the passflag from RenderPass and changes all code to use the unique pass name for identification.
Since Blender Internal relies on hardcoded passes and to preserve compatibility, 32 pass names are reserved for the old hardcoded passes.
To support these arbitrary passes, the Render Result compositor node now adds dynamic sockets. For compatibility, the old hardcoded sockets are always stored and just hidden when the corresponding pass isn't available.
To use these changes, the Render Engine API now includes a function that allows render engines to add arbitrary passes to the render result. To be able to add options for these passes, addons can now add their own properties to SceneRenderLayers.
To keep the compositor input node updated, render engine plugins have to implement a callback that registers all the passes that will be generated.
From a user perspective, nothing should change with this commit.
Differential Revision: https://developer.blender.org/D2443
Differential Revision: https://developer.blender.org/D2444
2017-05-03 00:21:18 +02:00
|
|
|
}
|
|
|
|
|
BLI_addtail(&added_passes, BLI_genericNodeN(rpass->name));
|
2015-04-06 10:40:12 -03:00
|
|
|
|
Render API/Cycles: Identify Render Passes by their name instead of a type flag
Previously, every RenderPass would have a bitfield that specified its type. That limits the number of passes to 32, which was reached a while ago.
However, most of the code already supported arbitrary RenderPasses since they were also used to store Multilayer EXR images.
Therefore, this commit completely removes the passflag from RenderPass and changes all code to use the unique pass name for identification.
Since Blender Internal relies on hardcoded passes and to preserve compatibility, 32 pass names are reserved for the old hardcoded passes.
To support these arbitrary passes, the Render Result compositor node now adds dynamic sockets. For compatibility, the old hardcoded sockets are always stored and just hidden when the corresponding pass isn't available.
To use these changes, the Render Engine API now includes a function that allows render engines to add arbitrary passes to the render result. To be able to add options for these passes, addons can now add their own properties to SceneRenderLayers.
To keep the compositor input node updated, render engine plugins have to implement a callback that registers all the passes that will be generated.
From a user perspective, nothing should change with this commit.
Differential Revision: https://developer.blender.org/D2443
Differential Revision: https://developer.blender.org/D2444
2017-05-03 00:21:18 +02:00
|
|
|
uiDefButS(block, UI_BTYPE_BUT_MENU, B_NOP, IFACE_(rpass->name), 0, 0,
|
2015-09-09 19:41:46 +05:00
|
|
|
UI_UNIT_X * 5, UI_UNIT_X, &iuser->pass, (float) nr, 0.0, 0, -1, "");
|
2014-02-12 00:08:54 +11:00
|
|
|
}
|
|
|
|
|
|
Render API/Cycles: Identify Render Passes by their name instead of a type flag
Previously, every RenderPass would have a bitfield that specified its type. That limits the number of passes to 32, which was reached a while ago.
However, most of the code already supported arbitrary RenderPasses since they were also used to store Multilayer EXR images.
Therefore, this commit completely removes the passflag from RenderPass and changes all code to use the unique pass name for identification.
Since Blender Internal relies on hardcoded passes and to preserve compatibility, 32 pass names are reserved for the old hardcoded passes.
To support these arbitrary passes, the Render Result compositor node now adds dynamic sockets. For compatibility, the old hardcoded sockets are always stored and just hidden when the corresponding pass isn't available.
To use these changes, the Render Engine API now includes a function that allows render engines to add arbitrary passes to the render result. To be able to add options for these passes, addons can now add their own properties to SceneRenderLayers.
To keep the compositor input node updated, render engine plugins have to implement a callback that registers all the passes that will be generated.
From a user perspective, nothing should change with this commit.
Differential Revision: https://developer.blender.org/D2443
Differential Revision: https://developer.blender.org/D2444
2017-05-03 00:21:18 +02:00
|
|
|
BLI_freelistN(&added_passes);
|
|
|
|
|
|
2014-10-13 18:13:50 +02:00
|
|
|
BKE_image_release_renderresult(scene, image);
|
2009-02-21 18:33:09 +00:00
|
|
|
}
|
|
|
|
|
|
2015-04-06 10:40:12 -03:00
|
|
|
/**************************** view menus *****************************/
|
|
|
|
|
static void ui_imageuser_view_menu_rr(bContext *UNUSED(C), uiLayout *layout, void *rnd_pt)
|
|
|
|
|
{
|
2015-11-16 06:44:18 +11:00
|
|
|
struct ImageUI_Data *rnd_data = rnd_pt;
|
2015-04-06 10:40:12 -03:00
|
|
|
uiBlock *block = uiLayoutGetBlock(layout);
|
2015-11-16 06:44:18 +11:00
|
|
|
Image *image = rnd_data->image;
|
|
|
|
|
ImageUser *iuser = rnd_data->iuser;
|
2015-04-06 10:40:12 -03:00
|
|
|
RenderResult *rr;
|
|
|
|
|
RenderView *rview;
|
|
|
|
|
int nr;
|
|
|
|
|
Scene *scene = iuser->scene;
|
|
|
|
|
|
|
|
|
|
/* may have been freed since drawing */
|
|
|
|
|
rr = BKE_image_acquire_renderresult(scene, image);
|
|
|
|
|
if (UNLIKELY(rr == NULL)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UI_block_layout_set_current(block, layout);
|
|
|
|
|
uiLayoutColumn(layout, false);
|
|
|
|
|
|
|
|
|
|
uiDefBut(block, UI_BTYPE_LABEL, 0, IFACE_("View"),
|
|
|
|
|
0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
|
|
|
|
|
|
|
|
|
|
uiItemS(layout);
|
|
|
|
|
|
|
|
|
|
nr = (rr ? BLI_listbase_count(&rr->views) : 0) - 1;
|
|
|
|
|
for (rview = rr ? rr->views.last : NULL; rview; rview = rview->prev, nr--) {
|
|
|
|
|
uiDefButS(block, UI_BTYPE_BUT_MENU, B_NOP, IFACE_(rview->name), 0, 0,
|
|
|
|
|
UI_UNIT_X * 5, UI_UNIT_X, &iuser->view, (float) nr, 0.0, 0, -1, "");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BKE_image_release_renderresult(scene, image);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void ui_imageuser_view_menu_multiview(bContext *UNUSED(C), uiLayout *layout, void *rnd_pt)
|
|
|
|
|
{
|
2015-11-16 06:44:18 +11:00
|
|
|
struct ImageUI_Data *rnd_data = rnd_pt;
|
2015-04-06 10:40:12 -03:00
|
|
|
uiBlock *block = uiLayoutGetBlock(layout);
|
2015-11-16 06:44:18 +11:00
|
|
|
Image *image = rnd_data->image;
|
|
|
|
|
ImageUser *iuser = rnd_data->iuser;
|
2015-04-06 10:40:12 -03:00
|
|
|
int nr;
|
|
|
|
|
ImageView *iv;
|
|
|
|
|
|
|
|
|
|
UI_block_layout_set_current(block, layout);
|
|
|
|
|
uiLayoutColumn(layout, false);
|
|
|
|
|
|
|
|
|
|
uiDefBut(block, UI_BTYPE_LABEL, 0, IFACE_("View"),
|
|
|
|
|
0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
|
|
|
|
|
|
|
|
|
|
uiItemS(layout);
|
|
|
|
|
|
|
|
|
|
nr = BLI_listbase_count(&image->views) - 1;
|
|
|
|
|
for (iv = image->views.last; iv; iv = iv->prev, nr--) {
|
|
|
|
|
uiDefButS(block, UI_BTYPE_BUT_MENU, B_NOP, IFACE_(iv->name), 0, 0,
|
|
|
|
|
UI_UNIT_X * 5, UI_UNIT_X, &iuser->view, (float) nr, 0.0, 0, -1, "");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-21 18:33:09 +00:00
|
|
|
/* 5 layer button callbacks... */
|
2016-07-19 02:44:14 +10:00
|
|
|
static void image_multi_cb(bContext *C, void *rnd_pt, void *rr_v)
|
2009-02-21 18:33:09 +00:00
|
|
|
{
|
2016-07-19 02:44:14 +10:00
|
|
|
struct ImageUI_Data *rnd_data = rnd_pt;
|
|
|
|
|
ImageUser *iuser = rnd_data->iuser;
|
2010-02-09 19:37:37 +00:00
|
|
|
|
2015-04-06 10:40:12 -03:00
|
|
|
BKE_image_multilayer_index(rr_v, iuser);
|
2012-03-28 11:53:18 +00:00
|
|
|
WM_event_add_notifier(C, NC_IMAGE | ND_DRAW, NULL);
|
2009-02-21 18:33:09 +00:00
|
|
|
}
|
2015-04-06 10:40:12 -03:00
|
|
|
|
2015-11-16 07:13:40 +11:00
|
|
|
static bool ui_imageuser_layer_menu_step(bContext *C, int direction, void *rnd_pt)
|
2009-02-21 18:33:09 +00:00
|
|
|
{
|
2015-11-16 07:13:40 +11:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
|
|
|
|
struct ImageUI_Data *rnd_data = rnd_pt;
|
|
|
|
|
Image *image = rnd_data->image;
|
|
|
|
|
ImageUser *iuser = rnd_data->iuser;
|
|
|
|
|
RenderResult *rr;
|
|
|
|
|
bool changed = false;
|
2011-11-26 18:33:31 +00:00
|
|
|
|
2015-11-16 07:13:40 +11:00
|
|
|
rr = BKE_image_acquire_renderresult(scene, image);
|
|
|
|
|
if (UNLIKELY(rr == NULL)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2009-06-23 00:45:41 +00:00
|
|
|
|
2015-11-16 07:13:40 +11:00
|
|
|
if (direction == -1) {
|
|
|
|
|
if (iuser->layer > 0) {
|
|
|
|
|
iuser->layer--;
|
|
|
|
|
changed = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (direction == 1) {
|
|
|
|
|
int tot = BLI_listbase_count(&rr->layers);
|
|
|
|
|
|
2017-10-26 14:23:18 +02:00
|
|
|
if (RE_HasCombinedLayer(rr))
|
2015-11-16 07:13:40 +11:00
|
|
|
tot++; /* fake compo/sequencer layer */
|
|
|
|
|
|
|
|
|
|
if (iuser->layer < tot - 1) {
|
|
|
|
|
iuser->layer++;
|
|
|
|
|
changed = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
BLI_assert(0);
|
2009-06-23 00:45:41 +00:00
|
|
|
}
|
|
|
|
|
|
2016-07-19 02:41:50 +10:00
|
|
|
BKE_image_release_renderresult(scene, image);
|
|
|
|
|
|
2015-11-16 07:13:40 +11:00
|
|
|
if (changed) {
|
|
|
|
|
BKE_image_multilayer_index(rr, iuser);
|
2012-03-28 11:53:18 +00:00
|
|
|
WM_event_add_notifier(C, NC_IMAGE | ND_DRAW, NULL);
|
2009-06-23 00:45:41 +00:00
|
|
|
}
|
2015-11-16 07:13:40 +11:00
|
|
|
|
|
|
|
|
return changed;
|
2009-02-21 18:33:09 +00:00
|
|
|
}
|
2015-11-16 07:13:40 +11:00
|
|
|
|
|
|
|
|
static bool ui_imageuser_pass_menu_step(bContext *C, int direction, void *rnd_pt)
|
2009-02-21 18:33:09 +00:00
|
|
|
{
|
2015-11-16 07:13:40 +11:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
|
|
|
|
struct ImageUI_Data *rnd_data = rnd_pt;
|
|
|
|
|
Image *image = rnd_data->image;
|
|
|
|
|
ImageUser *iuser = rnd_data->iuser;
|
|
|
|
|
RenderResult *rr;
|
|
|
|
|
bool changed = false;
|
2015-04-17 10:38:17 -03:00
|
|
|
int layer = iuser->layer;
|
2015-11-16 07:13:40 +11:00
|
|
|
RenderLayer *rl;
|
|
|
|
|
RenderPass *rpass;
|
|
|
|
|
|
|
|
|
|
rr = BKE_image_acquire_renderresult(scene, image);
|
|
|
|
|
if (UNLIKELY(rr == NULL)) {
|
2016-01-25 01:23:02 +05:00
|
|
|
BKE_image_release_renderresult(scene, image);
|
2015-11-16 07:13:40 +11:00
|
|
|
return false;
|
|
|
|
|
}
|
2009-06-23 00:45:41 +00:00
|
|
|
|
2017-10-26 14:23:18 +02:00
|
|
|
if (RE_HasCombinedLayer(rr)) {
|
2015-04-17 10:41:31 -03:00
|
|
|
layer -= 1;
|
2015-11-16 07:13:40 +11:00
|
|
|
}
|
2015-04-17 10:41:31 -03:00
|
|
|
|
2015-04-17 10:38:17 -03:00
|
|
|
rl = BLI_findlink(&rr->layers, layer);
|
2015-11-16 07:13:40 +11:00
|
|
|
if (rl == NULL) {
|
2016-01-25 01:23:02 +05:00
|
|
|
BKE_image_release_renderresult(scene, image);
|
2015-11-16 07:13:40 +11:00
|
|
|
return false;
|
|
|
|
|
}
|
2011-11-26 18:33:31 +00:00
|
|
|
|
2015-11-16 07:13:40 +11:00
|
|
|
rpass = BLI_findlink(&rl->passes, iuser->pass);
|
|
|
|
|
if (rpass == NULL) {
|
2016-01-25 01:23:02 +05:00
|
|
|
BKE_image_release_renderresult(scene, image);
|
2015-11-16 07:13:40 +11:00
|
|
|
return false;
|
|
|
|
|
}
|
2015-09-09 19:41:46 +05:00
|
|
|
|
2015-11-16 07:13:40 +11:00
|
|
|
/* note, this looks reversed, but matches menu direction */
|
|
|
|
|
if (direction == -1) {
|
|
|
|
|
RenderPass *rp;
|
|
|
|
|
int rp_index = iuser->pass + 1;
|
2015-09-09 19:41:46 +05:00
|
|
|
|
|
|
|
|
for (rp = rpass->next; rp; rp = rp->next, rp_index++) {
|
Render API/Cycles: Identify Render Passes by their name instead of a type flag
Previously, every RenderPass would have a bitfield that specified its type. That limits the number of passes to 32, which was reached a while ago.
However, most of the code already supported arbitrary RenderPasses since they were also used to store Multilayer EXR images.
Therefore, this commit completely removes the passflag from RenderPass and changes all code to use the unique pass name for identification.
Since Blender Internal relies on hardcoded passes and to preserve compatibility, 32 pass names are reserved for the old hardcoded passes.
To support these arbitrary passes, the Render Result compositor node now adds dynamic sockets. For compatibility, the old hardcoded sockets are always stored and just hidden when the corresponding pass isn't available.
To use these changes, the Render Engine API now includes a function that allows render engines to add arbitrary passes to the render result. To be able to add options for these passes, addons can now add their own properties to SceneRenderLayers.
To keep the compositor input node updated, render engine plugins have to implement a callback that registers all the passes that will be generated.
From a user perspective, nothing should change with this commit.
Differential Revision: https://developer.blender.org/D2443
Differential Revision: https://developer.blender.org/D2444
2017-05-03 00:21:18 +02:00
|
|
|
if (!STREQ(rp->name, rpass->name)) {
|
2015-09-09 19:41:46 +05:00
|
|
|
iuser->pass = rp_index;
|
2015-11-16 07:13:40 +11:00
|
|
|
changed = true;
|
2015-04-17 10:38:17 -03:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-02-21 18:33:09 +00:00
|
|
|
}
|
2015-11-16 07:13:40 +11:00
|
|
|
else if (direction == 1) {
|
|
|
|
|
RenderPass *rp;
|
2015-09-09 19:41:46 +05:00
|
|
|
int rp_index = 0;
|
|
|
|
|
|
2016-01-25 01:23:02 +05:00
|
|
|
if (iuser->pass == 0) {
|
|
|
|
|
BKE_image_release_renderresult(scene, image);
|
2015-11-16 07:13:40 +11:00
|
|
|
return false;
|
2016-01-25 01:23:02 +05:00
|
|
|
}
|
2015-09-09 19:41:46 +05:00
|
|
|
|
|
|
|
|
for (rp = rl->passes.first; rp; rp = rp->next, rp_index++) {
|
Render API/Cycles: Identify Render Passes by their name instead of a type flag
Previously, every RenderPass would have a bitfield that specified its type. That limits the number of passes to 32, which was reached a while ago.
However, most of the code already supported arbitrary RenderPasses since they were also used to store Multilayer EXR images.
Therefore, this commit completely removes the passflag from RenderPass and changes all code to use the unique pass name for identification.
Since Blender Internal relies on hardcoded passes and to preserve compatibility, 32 pass names are reserved for the old hardcoded passes.
To support these arbitrary passes, the Render Result compositor node now adds dynamic sockets. For compatibility, the old hardcoded sockets are always stored and just hidden when the corresponding pass isn't available.
To use these changes, the Render Engine API now includes a function that allows render engines to add arbitrary passes to the render result. To be able to add options for these passes, addons can now add their own properties to SceneRenderLayers.
To keep the compositor input node updated, render engine plugins have to implement a callback that registers all the passes that will be generated.
From a user perspective, nothing should change with this commit.
Differential Revision: https://developer.blender.org/D2443
Differential Revision: https://developer.blender.org/D2444
2017-05-03 00:21:18 +02:00
|
|
|
if (STREQ(rp->name, rpass->name)) {
|
2015-09-09 19:41:46 +05:00
|
|
|
iuser->pass = rp_index - 1;
|
2015-11-16 07:13:40 +11:00
|
|
|
changed = true;
|
2015-04-17 10:38:17 -03:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-02-21 18:33:09 +00:00
|
|
|
}
|
2015-11-16 07:13:40 +11:00
|
|
|
else {
|
|
|
|
|
BLI_assert(0);
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-25 01:23:02 +05:00
|
|
|
BKE_image_release_renderresult(scene, image);
|
|
|
|
|
|
2015-11-16 07:13:40 +11:00
|
|
|
if (changed) {
|
|
|
|
|
BKE_image_multilayer_index(rr, iuser);
|
|
|
|
|
WM_event_add_notifier(C, NC_IMAGE | ND_DRAW, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return changed;
|
2009-02-21 18:33:09 +00:00
|
|
|
}
|
|
|
|
|
|
2015-04-06 10:40:12 -03:00
|
|
|
/* 5 view button callbacks... */
|
2016-07-19 02:44:14 +10:00
|
|
|
static void image_multiview_cb(bContext *C, void *rnd_pt, void *UNUSED(arg_v))
|
2015-04-06 10:40:12 -03:00
|
|
|
{
|
2016-07-19 02:44:14 +10:00
|
|
|
struct ImageUI_Data *rnd_data = rnd_pt;
|
|
|
|
|
Image *ima = rnd_data->image;
|
|
|
|
|
ImageUser *iuser = rnd_data->iuser;
|
2015-04-06 10:40:12 -03:00
|
|
|
|
|
|
|
|
BKE_image_multiview_index(ima, iuser);
|
|
|
|
|
WM_event_add_notifier(C, NC_IMAGE | ND_DRAW, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
2009-09-16 19:27:08 +00:00
|
|
|
#if 0
|
2018-06-04 09:31:30 +02:00
|
|
|
static void image_freecache_cb(bContext *C, void *ima_v, void *unused)
|
2009-02-21 18:33:09 +00:00
|
|
|
{
|
2012-03-28 11:53:18 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2009-02-21 18:33:09 +00:00
|
|
|
BKE_image_free_anim_ibufs(ima_v, scene->r.cfra);
|
|
|
|
|
WM_event_add_notifier(C, NC_IMAGE, ima_v);
|
|
|
|
|
}
|
2009-09-16 19:27:08 +00:00
|
|
|
#endif
|
2009-02-21 18:33:09 +00:00
|
|
|
|
2009-09-16 19:27:08 +00:00
|
|
|
#if 0
|
2009-02-21 18:33:09 +00:00
|
|
|
static void image_user_change(bContext *C, void *iuser_v, void *unused)
|
|
|
|
|
{
|
2012-03-28 11:53:18 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2009-02-21 18:33:09 +00:00
|
|
|
BKE_image_user_calc_imanr(iuser_v, scene->r.cfra, 0);
|
|
|
|
|
}
|
2009-09-16 19:27:08 +00:00
|
|
|
#endif
|
2009-02-21 18:33:09 +00:00
|
|
|
|
2015-11-16 05:31:03 +11:00
|
|
|
static void uiblock_layer_pass_buttons(
|
2015-11-16 07:13:40 +11:00
|
|
|
uiLayout *layout, Image *image, RenderResult *rr, ImageUser *iuser, int w,
|
2015-11-16 05:31:03 +11:00
|
|
|
short *render_slot)
|
2009-02-21 18:33:09 +00:00
|
|
|
{
|
2016-07-19 02:44:14 +10:00
|
|
|
struct ImageUI_Data rnd_pt_local, *rnd_pt = NULL;
|
2012-03-28 11:53:18 +00:00
|
|
|
uiBlock *block = uiLayoutGetBlock(layout);
|
2009-02-21 18:33:09 +00:00
|
|
|
uiBut *but;
|
2012-03-28 11:53:18 +00:00
|
|
|
RenderLayer *rl = NULL;
|
2015-04-06 10:40:12 -03:00
|
|
|
int wmenu1, wmenu2, wmenu3, wmenu4;
|
2014-02-12 00:08:54 +11:00
|
|
|
const char *fake_name;
|
2015-04-06 10:40:12 -03:00
|
|
|
const char *display_name = "";
|
2015-09-24 08:34:54 -03:00
|
|
|
const bool show_stereo = (iuser->flag & IMA_SHOW_STEREO) != 0;
|
2009-02-21 18:33:09 +00:00
|
|
|
|
2017-05-15 15:59:47 +02:00
|
|
|
if (iuser->scene == NULL) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-01 11:34:00 +11:00
|
|
|
uiLayoutRow(layout, true);
|
2009-09-16 19:27:08 +00:00
|
|
|
|
2009-02-21 18:33:09 +00:00
|
|
|
/* layer menu is 1/3 larger than pass */
|
2012-03-28 11:53:18 +00:00
|
|
|
wmenu1 = (2 * w) / 5;
|
|
|
|
|
wmenu2 = (3 * w) / 5;
|
|
|
|
|
wmenu3 = (3 * w) / 6;
|
2015-04-06 10:40:12 -03:00
|
|
|
wmenu4 = (3 * w) / 6;
|
2016-07-19 02:44:14 +10:00
|
|
|
|
|
|
|
|
rnd_pt_local.image = image;
|
|
|
|
|
rnd_pt_local.iuser = iuser;
|
|
|
|
|
rnd_pt_local.rpass_index = 0;
|
2014-02-12 00:08:54 +11:00
|
|
|
|
2009-02-21 18:33:09 +00:00
|
|
|
/* menu buts */
|
2012-03-24 06:38:07 +00:00
|
|
|
if (render_slot) {
|
2014-02-12 00:08:54 +11:00
|
|
|
char str[64];
|
2018-06-14 22:46:30 +02:00
|
|
|
RenderSlot *slot = BKE_image_get_renderslot(image, *render_slot);
|
2018-06-25 20:26:14 +02:00
|
|
|
if (slot && slot->name[0] != '\0') {
|
2018-06-14 22:46:30 +02:00
|
|
|
BLI_strncpy(str, slot->name, sizeof(str));
|
2014-10-09 11:15:47 +02:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
BLI_snprintf(str, sizeof(str), IFACE_("Slot %d"), *render_slot + 1);
|
|
|
|
|
}
|
2015-11-16 07:13:40 +11:00
|
|
|
|
2016-07-19 02:44:14 +10:00
|
|
|
rnd_pt = ui_imageuser_data_copy(&rnd_pt_local);
|
2014-10-09 11:15:47 +02:00
|
|
|
but = uiDefMenuBut(block, ui_imageuser_slot_menu, image, str, 0, 0, wmenu1, UI_UNIT_Y, TIP_("Select Slot"));
|
2015-11-16 07:13:40 +11:00
|
|
|
UI_but_func_menu_step_set(but, ui_imageuser_slot_menu_step);
|
2016-07-19 02:44:14 +10:00
|
|
|
UI_but_funcN_set(but, image_multi_cb, rnd_pt, rr);
|
2014-11-09 21:20:40 +01:00
|
|
|
UI_but_type_set_menu_from_pulldown(but);
|
2016-07-19 02:44:14 +10:00
|
|
|
rnd_pt = NULL;
|
2010-02-09 19:37:37 +00:00
|
|
|
}
|
|
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (rr) {
|
2014-02-12 00:08:54 +11:00
|
|
|
RenderPass *rpass;
|
2015-04-06 10:40:12 -03:00
|
|
|
RenderView *rview;
|
2014-10-13 18:13:50 +02:00
|
|
|
int rpass_index;
|
2014-02-12 00:08:54 +11:00
|
|
|
|
|
|
|
|
/* layer */
|
|
|
|
|
fake_name = ui_imageuser_layer_fake_name(rr);
|
2014-10-13 18:13:50 +02:00
|
|
|
rpass_index = iuser->layer - (fake_name ? 1 : 0);
|
|
|
|
|
rl = BLI_findlink(&rr->layers, rpass_index);
|
2016-07-19 02:44:14 +10:00
|
|
|
rnd_pt_local.rpass_index = rpass_index;
|
2014-02-12 00:08:54 +11:00
|
|
|
|
2015-04-06 10:40:12 -03:00
|
|
|
if (RE_layers_have_name(rr)) {
|
|
|
|
|
display_name = rl ? rl->name : (fake_name ? fake_name : "");
|
2016-07-19 02:44:14 +10:00
|
|
|
rnd_pt = ui_imageuser_data_copy(&rnd_pt_local);
|
|
|
|
|
but = uiDefMenuBut(
|
|
|
|
|
block, ui_imageuser_layer_menu, rnd_pt, display_name,
|
|
|
|
|
0, 0, wmenu2, UI_UNIT_Y, TIP_("Select Layer"));
|
2015-11-16 07:13:40 +11:00
|
|
|
UI_but_func_menu_step_set(but, ui_imageuser_layer_menu_step);
|
2016-07-19 02:44:14 +10:00
|
|
|
UI_but_funcN_set(but, image_multi_cb, rnd_pt, rr);
|
2015-04-06 10:40:12 -03:00
|
|
|
UI_but_type_set_menu_from_pulldown(but);
|
2016-07-19 02:44:14 +10:00
|
|
|
rnd_pt = NULL;
|
2015-04-06 10:40:12 -03:00
|
|
|
}
|
2014-02-12 00:08:54 +11:00
|
|
|
|
|
|
|
|
/* pass */
|
2017-10-26 14:17:58 +02:00
|
|
|
rpass = (rl ? BLI_findlink(&rl->passes, iuser->pass) : NULL);
|
2014-02-12 00:08:54 +11:00
|
|
|
|
2017-10-26 14:17:58 +02:00
|
|
|
if (rpass && RE_passes_have_name(rl)) {
|
|
|
|
|
display_name = rpass->name;
|
|
|
|
|
rnd_pt = ui_imageuser_data_copy(&rnd_pt_local);
|
|
|
|
|
but = uiDefMenuBut(
|
|
|
|
|
block, ui_imageuser_pass_menu, rnd_pt, IFACE_(display_name),
|
|
|
|
|
0, 0, wmenu3, UI_UNIT_Y, TIP_("Select Pass"));
|
|
|
|
|
UI_but_func_menu_step_set(but, ui_imageuser_pass_menu_step);
|
|
|
|
|
UI_but_funcN_set(but, image_multi_cb, rnd_pt, rr);
|
|
|
|
|
UI_but_type_set_menu_from_pulldown(but);
|
|
|
|
|
rnd_pt = NULL;
|
|
|
|
|
}
|
2015-04-06 10:40:12 -03:00
|
|
|
|
|
|
|
|
/* view */
|
2018-04-03 17:05:21 +02:00
|
|
|
if (BLI_listbase_count_at_most(&rr->views, 2) > 1 &&
|
2015-09-24 08:34:54 -03:00
|
|
|
((!show_stereo) || (!RE_RenderResult_is_stereo(rr))))
|
|
|
|
|
{
|
2015-04-06 10:40:12 -03:00
|
|
|
rview = BLI_findlink(&rr->views, iuser->view);
|
|
|
|
|
display_name = rview ? rview->name : "";
|
|
|
|
|
|
2016-07-19 02:44:14 +10:00
|
|
|
rnd_pt = ui_imageuser_data_copy(&rnd_pt_local);
|
|
|
|
|
but = uiDefMenuBut(
|
|
|
|
|
block, ui_imageuser_view_menu_rr, rnd_pt, display_name,
|
|
|
|
|
0, 0, wmenu4, UI_UNIT_Y, TIP_("Select View"));
|
|
|
|
|
UI_but_funcN_set(but, image_multi_cb, rnd_pt, rr);
|
2015-04-06 10:40:12 -03:00
|
|
|
UI_but_type_set_menu_from_pulldown(but);
|
2016-07-19 02:44:14 +10:00
|
|
|
rnd_pt = NULL;
|
2015-04-06 10:40:12 -03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* stereo image */
|
2015-10-11 01:14:02 +02:00
|
|
|
else if ((BKE_image_is_stereo(image) && (!show_stereo)) ||
|
|
|
|
|
(BKE_image_is_multiview(image) && !BKE_image_is_stereo(image)))
|
2015-04-06 10:40:12 -03:00
|
|
|
{
|
|
|
|
|
ImageView *iv;
|
|
|
|
|
int nr = 0;
|
|
|
|
|
|
|
|
|
|
for (iv = image->views.first; iv; iv = iv->next) {
|
|
|
|
|
if (nr++ == iuser->view) {
|
|
|
|
|
display_name = iv->name;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-07-19 02:44:14 +10:00
|
|
|
rnd_pt = ui_imageuser_data_copy(&rnd_pt_local);
|
|
|
|
|
but = uiDefMenuBut(
|
|
|
|
|
block, ui_imageuser_view_menu_multiview, rnd_pt, display_name,
|
|
|
|
|
0, 0, wmenu1, UI_UNIT_Y, TIP_("Select View"));
|
|
|
|
|
UI_but_funcN_set(but, image_multiview_cb, rnd_pt, NULL);
|
2015-04-06 10:40:12 -03:00
|
|
|
UI_but_type_set_menu_from_pulldown(but);
|
2016-07-19 02:44:14 +10:00
|
|
|
rnd_pt = NULL;
|
2010-02-09 19:37:37 +00:00
|
|
|
}
|
2009-02-21 18:33:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// XXX HACK!
|
2009-09-16 19:27:08 +00:00
|
|
|
// static int packdummy=0;
|
|
|
|
|
|
|
|
|
|
typedef struct RNAUpdateCb {
|
|
|
|
|
PointerRNA ptr;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
ImageUser *iuser;
|
|
|
|
|
} RNAUpdateCb;
|
|
|
|
|
|
2010-10-14 12:24:08 +00:00
|
|
|
static void rna_update_cb(bContext *C, void *arg_cb, void *UNUSED(arg))
|
2009-09-16 19:27:08 +00:00
|
|
|
{
|
2012-03-28 11:53:18 +00:00
|
|
|
RNAUpdateCb *cb = (RNAUpdateCb *)arg_cb;
|
2009-09-16 19:27:08 +00:00
|
|
|
|
|
|
|
|
/* ideally this would be done by RNA itself, but there we have
|
2012-04-22 11:54:53 +00:00
|
|
|
* no image user available, so we just update this flag here */
|
2012-03-28 11:53:18 +00:00
|
|
|
cb->iuser->ok = 1;
|
2009-02-21 18:33:09 +00:00
|
|
|
|
2009-09-16 19:27:08 +00:00
|
|
|
/* we call update here on the pointer property, this way the
|
2012-03-03 16:31:46 +00:00
|
|
|
* owner of the image pointer can still define it's own update
|
|
|
|
|
* and notifier */
|
2009-09-16 19:27:08 +00:00
|
|
|
RNA_property_update(C, &cb->ptr, cb->prop);
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-01 15:47:09 +02:00
|
|
|
void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, PointerRNA *userptr, bool compact, bool multiview)
|
2009-02-21 18:33:09 +00:00
|
|
|
{
|
2009-09-16 19:27:08 +00:00
|
|
|
PropertyRNA *prop;
|
|
|
|
|
PointerRNA imaptr;
|
|
|
|
|
RNAUpdateCb *cb;
|
|
|
|
|
Image *ima;
|
|
|
|
|
ImageUser *iuser;
|
2012-03-28 11:53:18 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2009-09-16 19:27:08 +00:00
|
|
|
uiLayout *row, *split, *col;
|
|
|
|
|
uiBlock *block;
|
2015-02-09 23:11:30 +01:00
|
|
|
char str[MAX_IMAGE_INFO_LEN];
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
|
2009-09-30 18:18:32 +00:00
|
|
|
void *lock;
|
2009-09-16 19:27:08 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (!ptr->data)
|
2009-09-16 19:27:08 +00:00
|
|
|
return;
|
2011-01-26 16:21:54 +00:00
|
|
|
|
2012-03-28 11:53:18 +00:00
|
|
|
prop = RNA_struct_find_property(ptr, propname);
|
2012-03-24 06:38:07 +00:00
|
|
|
if (!prop) {
|
2011-11-21 14:03:10 +00:00
|
|
|
printf("%s: property not found: %s.%s\n",
|
|
|
|
|
__func__, RNA_struct_identifier(ptr->type), propname);
|
2009-02-21 18:33:09 +00:00
|
|
|
return;
|
|
|
|
|
}
|
2009-09-16 19:27:08 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (RNA_property_type(prop) != PROP_POINTER) {
|
2011-11-21 14:03:10 +00:00
|
|
|
printf("%s: expected pointer property for %s.%s\n",
|
|
|
|
|
__func__, RNA_struct_identifier(ptr->type), propname);
|
2011-01-26 16:21:54 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2012-03-28 11:53:18 +00:00
|
|
|
block = uiLayoutGetBlock(layout);
|
2009-09-16 19:27:08 +00:00
|
|
|
|
2012-03-28 11:53:18 +00:00
|
|
|
imaptr = RNA_property_pointer_get(ptr, prop);
|
|
|
|
|
ima = imaptr.data;
|
|
|
|
|
iuser = userptr->data;
|
2009-09-16 19:27:08 +00:00
|
|
|
|
2018-09-10 14:05:33 +10:00
|
|
|
BKE_image_user_check_frame_calc(iuser, (int)scene->r.cfra);
|
2012-06-04 10:41:18 +00:00
|
|
|
|
2012-03-28 11:53:18 +00:00
|
|
|
cb = MEM_callocN(sizeof(RNAUpdateCb), "RNAUpdateCb");
|
|
|
|
|
cb->ptr = *ptr;
|
|
|
|
|
cb->prop = prop;
|
|
|
|
|
cb->iuser = iuser;
|
2009-09-16 19:27:08 +00:00
|
|
|
|
2009-10-09 22:00:33 +00:00
|
|
|
uiLayoutSetContextPointer(layout, "edit_image", &imaptr);
|
2012-06-01 17:28:09 +00:00
|
|
|
uiLayoutSetContextPointer(layout, "edit_image_user", userptr);
|
2009-10-09 22:00:33 +00:00
|
|
|
|
2018-01-03 21:54:02 +11:00
|
|
|
if (!compact) {
|
|
|
|
|
uiTemplateID(
|
|
|
|
|
layout, C, ptr, propname,
|
2018-07-31 10:22:19 +02:00
|
|
|
ima ? NULL : "IMAGE_OT_new", "IMAGE_OT_open", NULL, UI_TEMPLATE_ID_FILTER_ALL, false);
|
2018-01-03 21:54:02 +11:00
|
|
|
}
|
2009-09-16 19:27:08 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (ima) {
|
2014-11-09 21:20:40 +01:00
|
|
|
UI_block_funcN_set(block, rna_update_cb, MEM_dupallocN(cb), NULL);
|
2009-09-16 19:27:08 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (ima->source == IMA_SRC_VIEWER) {
|
2013-03-15 22:55:10 +00:00
|
|
|
ImBuf *ibuf = BKE_image_acquire_ibuf(ima, iuser, &lock);
|
2015-02-09 23:11:30 +01:00
|
|
|
image_info(scene, iuser, ima, ibuf, str, MAX_IMAGE_INFO_LEN);
|
2012-11-15 15:59:58 +00:00
|
|
|
BKE_image_release_ibuf(ima, ibuf, lock);
|
2009-09-16 19:27:08 +00:00
|
|
|
|
2012-03-28 11:53:18 +00:00
|
|
|
uiItemL(layout, ima->id.name + 2, ICON_NONE);
|
2011-02-27 18:03:19 +00:00
|
|
|
uiItemL(layout, str, ICON_NONE);
|
2009-09-16 19:27:08 +00:00
|
|
|
|
2012-03-28 11:53:18 +00:00
|
|
|
if (ima->type == IMA_TYPE_COMPOSITE) {
|
2009-09-16 19:27:08 +00:00
|
|
|
// XXX not working yet
|
|
|
|
|
#if 0
|
2012-03-28 11:53:18 +00:00
|
|
|
iuser = ntree_get_active_iuser(scene->nodetree);
|
2012-03-24 06:38:07 +00:00
|
|
|
if (iuser) {
|
2014-11-09 21:20:40 +01:00
|
|
|
UI_block_align_begin(block);
|
|
|
|
|
uiDefIconTextBut(block, UI_BTYPE_BUT, B_SIMA_RECORD, ICON_REC, "Record", 10, 120, 100, 20, 0, 0, 0, 0, 0, "");
|
|
|
|
|
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);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (iuser->frames)
|
2012-01-11 12:33:51 +00:00
|
|
|
BLI_snprintf(str, sizeof(str), "(%d) Frames:", iuser->framenr);
|
2009-09-16 19:27:08 +00:00
|
|
|
else strcpy(str, "Frames:");
|
2014-11-09 21:20:40 +01:00
|
|
|
UI_block_align_begin(block);
|
|
|
|
|
uiDefButI(block, UI_BTYPE_NUM, imagechanged, str, 10, 90, 150, 20, &iuser->frames, 0.0, MAXFRAMEF, 0, 0, "Number of images of a movie to use");
|
|
|
|
|
uiDefButI(block, UI_BTYPE_NUM, imagechanged, "StartFr:", 160, 90, 150, 20, &iuser->sfra, 1.0, MAXFRAMEF, 0, 0, "Global starting frame of the movie");
|
2009-09-16 19:27:08 +00:00
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
}
|
2012-03-28 11:53:18 +00:00
|
|
|
else if (ima->type == IMA_TYPE_R_RESULT) {
|
2009-09-16 19:27:08 +00:00
|
|
|
/* browse layer/passes */
|
2015-11-16 07:13:40 +11:00
|
|
|
RenderResult *rr;
|
2015-04-22 20:42:26 +02:00
|
|
|
const float dpi_fac = UI_DPI_FAC;
|
2015-04-23 13:33:29 +02:00
|
|
|
const int menus_width = 230 * dpi_fac;
|
2012-08-21 11:10:16 +00:00
|
|
|
|
2015-11-16 07:13:40 +11:00
|
|
|
/* use BKE_image_acquire_renderresult so we get the correct slot in the menu */
|
|
|
|
|
rr = BKE_image_acquire_renderresult(scene, ima);
|
|
|
|
|
uiblock_layer_pass_buttons(layout, ima, rr, iuser, menus_width, &ima->render_slot);
|
2012-08-21 11:10:16 +00:00
|
|
|
BKE_image_release_renderresult(scene, ima);
|
2009-09-16 19:27:08 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
2011-06-12 11:03:21 +00:00
|
|
|
uiItemR(layout, &imaptr, "source", 0, NULL, ICON_NONE);
|
2009-09-16 19:27:08 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (ima->source != IMA_SRC_GENERATED) {
|
2014-04-01 11:34:00 +11:00
|
|
|
row = uiLayoutRow(layout, true);
|
2015-04-06 10:40:12 -03:00
|
|
|
if (BKE_image_has_packedfile(ima))
|
2011-06-12 11:03:21 +00:00
|
|
|
uiItemO(row, "", ICON_PACKAGE, "image.unpack");
|
2010-06-17 07:20:12 +00:00
|
|
|
else
|
2011-06-12 11:03:21 +00:00
|
|
|
uiItemO(row, "", ICON_UGLYPACKAGE, "image.pack");
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2014-04-01 11:34:00 +11:00
|
|
|
row = uiLayoutRow(row, true);
|
2015-04-06 10:40:12 -03:00
|
|
|
uiLayoutSetEnabled(row, BKE_image_has_packedfile(ima) == false);
|
2011-02-27 18:03:19 +00:00
|
|
|
uiItemR(row, &imaptr, "filepath", 0, "", ICON_NONE);
|
2009-10-09 22:00:33 +00:00
|
|
|
uiItemO(row, "", ICON_FILE_REFRESH, "image.reload");
|
2009-09-16 19:27:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// XXX what was this for?
|
|
|
|
|
#if 0
|
2012-03-28 11:53:18 +00:00
|
|
|
/* check for re-render, only buttons */
|
|
|
|
|
if (imagechanged == B_IMAGECHANGED) {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (iuser->flag & IMA_ANIM_REFRESHED) {
|
2009-09-16 19:27:08 +00:00
|
|
|
iuser->flag &= ~IMA_ANIM_REFRESHED;
|
|
|
|
|
WM_event_add_notifier(C, NC_IMAGE, ima);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* multilayer? */
|
2012-03-28 11:53:18 +00:00
|
|
|
if (ima->type == IMA_TYPE_MULTILAYER && ima->rr) {
|
2015-04-22 20:42:26 +02:00
|
|
|
const float dpi_fac = UI_DPI_FAC;
|
2015-11-16 07:13:40 +11:00
|
|
|
uiblock_layer_pass_buttons(layout, ima, ima->rr, iuser, 230 * dpi_fac, NULL);
|
2009-09-16 19:27:08 +00:00
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (ima->source != IMA_SRC_GENERATED) {
|
|
|
|
|
if (compact == 0) {
|
2015-02-09 23:11:30 +01:00
|
|
|
uiTemplateImageInfo(layout, C, ima, iuser);
|
2010-01-19 22:44:43 +00:00
|
|
|
}
|
2009-09-16 19:27:08 +00:00
|
|
|
}
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
|
2014-04-01 11:34:00 +11:00
|
|
|
col = uiLayoutColumn(layout, false);
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
uiTemplateColorspaceSettings(col, &imaptr, "colorspace_settings");
|
2013-04-23 07:06:29 +00:00
|
|
|
uiItemR(col, &imaptr, "use_view_as_render", 0, NULL, ICON_NONE);
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (ima->source != IMA_SRC_GENERATED) {
|
2018-09-27 15:35:22 +02:00
|
|
|
if (compact == 0) { /* background image view doesn't need these */
|
2012-12-31 13:52:13 +00:00
|
|
|
ImBuf *ibuf = BKE_image_acquire_ibuf(ima, iuser, NULL);
|
2014-01-28 03:52:21 +11:00
|
|
|
bool has_alpha = true;
|
2012-12-31 13:52:13 +00:00
|
|
|
|
|
|
|
|
if (ibuf) {
|
2015-07-13 13:58:17 +02:00
|
|
|
int imtype = BKE_image_ftype_to_imtype(ibuf->ftype, &ibuf->foptions);
|
2014-03-31 14:20:55 +09:00
|
|
|
char valid_channels = BKE_imtype_valid_channels(imtype, false);
|
2012-12-31 13:52:13 +00:00
|
|
|
|
2014-01-28 03:52:21 +11:00
|
|
|
has_alpha = (valid_channels & IMA_CHAN_FLAG_ALPHA) != 0;
|
2012-12-31 13:52:13 +00:00
|
|
|
|
|
|
|
|
BKE_image_release_ibuf(ima, ibuf, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-13 14:04:39 -03:00
|
|
|
if (multiview) {
|
|
|
|
|
if ((scene->r.scemode & R_MULTIVIEW) != 0) {
|
|
|
|
|
uiItemR(layout, &imaptr, "use_multiview", 0, NULL, ICON_NONE);
|
2015-04-08 00:28:03 +02:00
|
|
|
|
2015-06-13 14:04:39 -03:00
|
|
|
if (RNA_boolean_get(&imaptr, "use_multiview")) {
|
|
|
|
|
uiTemplateImageViews(layout, &imaptr);
|
|
|
|
|
}
|
2015-04-08 00:28:03 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-31 13:52:13 +00:00
|
|
|
if (has_alpha) {
|
2014-04-01 11:34:00 +11:00
|
|
|
col = uiLayoutColumn(layout, false);
|
2012-12-31 13:52:13 +00:00
|
|
|
uiItemR(col, &imaptr, "use_alpha", 0, NULL, ICON_NONE);
|
2015-02-09 23:11:30 +01:00
|
|
|
row = uiLayoutRow(col, false);
|
|
|
|
|
uiLayoutSetActive(row, RNA_boolean_get(&imaptr, "use_alpha"));
|
|
|
|
|
uiItemR(row, &imaptr, "alpha_mode", 0, IFACE_("Alpha"), ICON_NONE);
|
2012-12-31 13:52:13 +00:00
|
|
|
}
|
|
|
|
|
|
2015-02-03 18:17:12 +05:00
|
|
|
if (ima->source == IMA_SRC_MOVIE) {
|
|
|
|
|
col = uiLayoutColumn(layout, false);
|
|
|
|
|
uiItemR(col, &imaptr, "use_deinterlace", 0, IFACE_("Deinterlace"), ICON_NONE);
|
|
|
|
|
}
|
2010-01-19 22:44:43 +00:00
|
|
|
}
|
2009-09-16 19:58:01 +00:00
|
|
|
}
|
|
|
|
|
|
2014-01-14 04:59:58 +11:00
|
|
|
if (BKE_image_is_animated(ima)) {
|
2009-09-16 19:58:01 +00:00
|
|
|
uiItemS(layout);
|
2012-06-01 17:28:09 +00:00
|
|
|
|
2014-04-01 11:34:00 +11:00
|
|
|
split = uiLayoutSplit(layout, 0.0f, false);
|
2009-09-16 19:27:08 +00:00
|
|
|
|
2014-04-01 11:34:00 +11:00
|
|
|
col = uiLayoutColumn(split, false);
|
2012-06-01 17:28:09 +00:00
|
|
|
|
2012-05-25 17:58:15 +00:00
|
|
|
BLI_snprintf(str, sizeof(str), IFACE_("(%d) Frames"), iuser->framenr);
|
2011-02-27 18:03:19 +00:00
|
|
|
uiItemR(col, userptr, "frame_duration", 0, str, ICON_NONE);
|
2012-05-25 17:58:15 +00:00
|
|
|
uiItemR(col, userptr, "frame_start", 0, IFACE_("Start"), ICON_NONE);
|
2011-02-27 18:03:19 +00:00
|
|
|
uiItemR(col, userptr, "frame_offset", 0, NULL, ICON_NONE);
|
2009-09-16 19:27:08 +00:00
|
|
|
|
2014-04-01 11:34:00 +11:00
|
|
|
col = uiLayoutColumn(split, false);
|
2012-06-01 17:28:09 +00:00
|
|
|
uiItemO(col, NULL, ICON_NONE, "IMAGE_OT_match_movie_length");
|
2011-02-27 18:03:19 +00:00
|
|
|
uiItemR(col, userptr, "use_auto_refresh", 0, NULL, ICON_NONE);
|
|
|
|
|
uiItemR(col, userptr, "use_cyclic", 0, NULL, ICON_NONE);
|
2009-09-16 19:27:08 +00:00
|
|
|
}
|
2012-03-28 11:53:18 +00:00
|
|
|
else if (ima->source == IMA_SRC_GENERATED) {
|
2014-04-01 11:34:00 +11:00
|
|
|
split = uiLayoutSplit(layout, 0.0f, false);
|
2009-09-16 19:27:08 +00:00
|
|
|
|
2014-04-01 11:34:00 +11:00
|
|
|
col = uiLayoutColumn(split, true);
|
2011-02-27 18:03:19 +00:00
|
|
|
uiItemR(col, &imaptr, "generated_width", 0, "X", ICON_NONE);
|
|
|
|
|
uiItemR(col, &imaptr, "generated_height", 0, "Y", ICON_NONE);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-07-21 00:41:00 +00:00
|
|
|
uiItemR(col, &imaptr, "use_generated_float", 0, NULL, ICON_NONE);
|
2009-09-16 19:27:08 +00:00
|
|
|
|
2011-06-12 11:03:21 +00:00
|
|
|
uiItemR(split, &imaptr, "generated_type", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
|
2014-10-02 19:04:38 +06:00
|
|
|
|
|
|
|
|
if (ima->gen_type == IMA_GENTYPE_BLANK) {
|
|
|
|
|
uiItemR(layout, &imaptr, "generated_color", 0, NULL, ICON_NONE);
|
|
|
|
|
}
|
2009-09-16 19:27:08 +00:00
|
|
|
}
|
|
|
|
|
|
2012-03-28 11:53:18 +00:00
|
|
|
}
|
2009-09-16 19:27:08 +00:00
|
|
|
|
2014-11-09 21:20:40 +01:00
|
|
|
UI_block_funcN_set(block, NULL, NULL, NULL);
|
2009-09-16 19:27:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MEM_freeN(cb);
|
|
|
|
|
}
|
2009-02-21 18:33:09 +00:00
|
|
|
|
2018-07-01 15:47:09 +02:00
|
|
|
void uiTemplateImageSettings(uiLayout *layout, PointerRNA *imfptr, bool color_management)
|
2011-11-21 20:19:58 +00:00
|
|
|
{
|
2012-03-28 11:53:18 +00:00
|
|
|
ImageFormatData *imf = imfptr->data;
|
|
|
|
|
ID *id = imfptr->id.data;
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
PointerRNA display_settings_ptr;
|
|
|
|
|
PropertyRNA *prop;
|
2012-03-28 11:53:18 +00:00
|
|
|
const int depth_ok = BKE_imtype_valid_depths(imf->imtype);
|
2018-09-27 15:49:59 +02:00
|
|
|
/* some settings depend on this being a scene that's rendered */
|
2014-01-28 03:52:21 +11:00
|
|
|
const bool is_render_out = (id && GS(id->name) == ID_SCE);
|
2011-11-21 20:19:58 +00:00
|
|
|
|
2018-09-03 17:23:48 +02:00
|
|
|
uiLayout *col;
|
2014-04-11 11:25:41 +10:00
|
|
|
bool show_preview = false;
|
2011-11-21 20:19:58 +00:00
|
|
|
|
2014-04-01 11:34:00 +11:00
|
|
|
col = uiLayoutColumn(layout, false);
|
2011-11-21 20:19:58 +00:00
|
|
|
|
2018-09-03 17:23:48 +02:00
|
|
|
uiLayoutSetPropSep(col, true);
|
|
|
|
|
uiLayoutSetPropDecorate(col, false);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2018-09-03 17:23:48 +02:00
|
|
|
uiItemR(col, imfptr, "file_format", 0, NULL, ICON_NONE);
|
2018-09-04 14:09:45 +10:00
|
|
|
uiItemR(uiLayoutRow(col, true), imfptr, "color_mode", UI_ITEM_R_EXPAND, IFACE_("Color"), ICON_NONE);
|
2011-11-21 20:19:58 +00:00
|
|
|
|
|
|
|
|
/* only display depth setting if multiple depths can be used */
|
2014-07-20 01:30:29 +10:00
|
|
|
if ((ELEM(depth_ok,
|
|
|
|
|
R_IMF_CHAN_DEPTH_1,
|
|
|
|
|
R_IMF_CHAN_DEPTH_8,
|
|
|
|
|
R_IMF_CHAN_DEPTH_10,
|
|
|
|
|
R_IMF_CHAN_DEPTH_12,
|
|
|
|
|
R_IMF_CHAN_DEPTH_16,
|
|
|
|
|
R_IMF_CHAN_DEPTH_24,
|
|
|
|
|
R_IMF_CHAN_DEPTH_32)) == 0)
|
2011-11-21 20:19:58 +00:00
|
|
|
{
|
2018-09-04 14:09:45 +10:00
|
|
|
uiItemR(uiLayoutRow(col, true), imfptr, "color_depth", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
|
2011-11-21 20:19:58 +00:00
|
|
|
}
|
|
|
|
|
|
2011-11-22 00:06:54 +00:00
|
|
|
if (BKE_imtype_supports_quality(imf->imtype)) {
|
2011-11-21 20:19:58 +00:00
|
|
|
uiItemR(col, imfptr, "quality", 0, NULL, ICON_NONE);
|
|
|
|
|
}
|
|
|
|
|
|
2011-11-22 00:06:54 +00:00
|
|
|
if (BKE_imtype_supports_compress(imf->imtype)) {
|
2011-11-21 20:19:58 +00:00
|
|
|
uiItemR(col, imfptr, "compression", 0, NULL, ICON_NONE);
|
|
|
|
|
}
|
|
|
|
|
|
2011-11-22 10:04:28 +00:00
|
|
|
if (ELEM(imf->imtype, R_IMF_IMTYPE_OPENEXR, R_IMF_IMTYPE_MULTILAYER)) {
|
|
|
|
|
uiItemR(col, imfptr, "exr_codec", 0, NULL, ICON_NONE);
|
|
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-11-22 00:06:54 +00:00
|
|
|
if (BKE_imtype_supports_zbuf(imf->imtype)) {
|
2018-09-03 17:23:48 +02:00
|
|
|
uiItemR(col, imfptr, "use_zbuffer", 0, NULL, ICON_NONE);
|
2011-11-21 20:19:58 +00:00
|
|
|
}
|
|
|
|
|
|
2017-10-20 15:18:26 +02:00
|
|
|
if (is_render_out && ELEM(imf->imtype, R_IMF_IMTYPE_OPENEXR, R_IMF_IMTYPE_MULTILAYER)) {
|
2014-04-01 11:34:00 +11:00
|
|
|
show_preview = true;
|
2018-09-03 17:23:48 +02:00
|
|
|
uiItemR(col, imfptr, "use_preview", 0, NULL, ICON_NONE);
|
2011-11-21 20:19:58 +00:00
|
|
|
}
|
|
|
|
|
|
2011-11-22 00:35:26 +00:00
|
|
|
if (imf->imtype == R_IMF_IMTYPE_JP2) {
|
2012-12-23 13:57:09 +00:00
|
|
|
uiItemR(col, imfptr, "jpeg2k_codec", 0, NULL, ICON_NONE);
|
|
|
|
|
|
2018-09-03 17:23:48 +02:00
|
|
|
uiItemR(col, imfptr, "use_jpeg2k_cinema_preset", 0, NULL, ICON_NONE);
|
|
|
|
|
uiItemR(col, imfptr, "use_jpeg2k_cinema_48", 0, NULL, ICON_NONE);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2011-11-21 20:19:58 +00:00
|
|
|
uiItemR(col, imfptr, "use_jpeg2k_ycc", 0, NULL, ICON_NONE);
|
|
|
|
|
}
|
|
|
|
|
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 12:49:00 +00:00
|
|
|
if (imf->imtype == R_IMF_IMTYPE_DPX) {
|
|
|
|
|
uiItemR(col, imfptr, "use_cineon_log", 0, NULL, ICON_NONE);
|
|
|
|
|
}
|
|
|
|
|
|
2011-11-22 00:35:26 +00:00
|
|
|
if (imf->imtype == R_IMF_IMTYPE_CINEON) {
|
2011-11-21 20:19:58 +00:00
|
|
|
#if 1
|
Patch #27397: Improved DPX/Cineon code
Patch by Julien Enche, thanks!
From the patch comment:
It allows Blender to load:
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or
filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.
It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used
type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace).
For Log colorspace, the common default values are used for gamma,
reference black and reference white (respectively 1.7, 95 and 685 for
10 bits files).
- Saved DPX/Cineon files now match the viewer.
Some files won't load (mostly because I haven't seen any of them):
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too,
I haven't seen any file that was not top-bottom/left-right oriented.
2012-10-22 12:49:00 +00:00
|
|
|
uiItemL(col, IFACE_("Hard coded Non-Linear, Gamma:1.7"), ICON_NONE);
|
2011-11-21 20:19:58 +00:00
|
|
|
#else
|
|
|
|
|
uiItemR(col, imfptr, "use_cineon_log", 0, NULL, ICON_NONE);
|
|
|
|
|
uiItemR(col, imfptr, "cineon_black", 0, NULL, ICON_NONE);
|
|
|
|
|
uiItemR(col, imfptr, "cineon_white", 0, NULL, ICON_NONE);
|
|
|
|
|
uiItemR(col, imfptr, "cineon_gamma", 0, NULL, ICON_NONE);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
|
2016-01-14 15:02:13 +05:00
|
|
|
if (imf->imtype == R_IMF_IMTYPE_TIFF) {
|
|
|
|
|
uiItemR(col, imfptr, "tiff_codec", 0, NULL, ICON_NONE);
|
|
|
|
|
}
|
|
|
|
|
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
/* color management */
|
|
|
|
|
if (color_management &&
|
2012-09-24 11:56:07 +00:00
|
|
|
(!BKE_imtype_requires_linear_float(imf->imtype) ||
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
(show_preview && imf->flag & R_IMF_FLAG_PREVIEW_JPG)))
|
|
|
|
|
{
|
|
|
|
|
prop = RNA_struct_find_property(imfptr, "display_settings");
|
|
|
|
|
display_settings_ptr = RNA_property_pointer_get(imfptr, prop);
|
|
|
|
|
|
2014-04-01 11:34:00 +11:00
|
|
|
col = uiLayoutColumn(layout, false);
|
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
|
|
|
uiItemL(col, IFACE_("Color Management"), ICON_NONE);
|
|
|
|
|
|
|
|
|
|
uiItemR(col, &display_settings_ptr, "display_device", 0, NULL, ICON_NONE);
|
|
|
|
|
|
|
|
|
|
uiTemplateColormanagedViewSettings(col, NULL, imfptr, "view_settings");
|
|
|
|
|
}
|
2011-11-21 20:19:58 +00:00
|
|
|
}
|
|
|
|
|
|
2015-04-06 10:40:12 -03:00
|
|
|
void uiTemplateImageStereo3d(uiLayout *layout, PointerRNA *stereo3d_format_ptr)
|
|
|
|
|
{
|
|
|
|
|
Stereo3dFormat *stereo3d_format = stereo3d_format_ptr->data;
|
|
|
|
|
uiLayout *col;
|
|
|
|
|
|
|
|
|
|
col = uiLayoutColumn(layout, false);
|
|
|
|
|
uiItemR(col, stereo3d_format_ptr, "display_mode", 0, NULL, ICON_NONE);
|
|
|
|
|
|
|
|
|
|
switch (stereo3d_format->display_mode) {
|
|
|
|
|
case S3D_DISPLAY_ANAGLYPH:
|
|
|
|
|
{
|
|
|
|
|
uiItemR(col, stereo3d_format_ptr, "anaglyph_type", 0, NULL, ICON_NONE);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case S3D_DISPLAY_INTERLACE:
|
|
|
|
|
{
|
|
|
|
|
uiItemR(col, stereo3d_format_ptr, "interlace_type", 0, NULL, ICON_NONE);
|
|
|
|
|
uiItemR(col, stereo3d_format_ptr, "use_interlace_swap", 0, NULL, ICON_NONE);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case S3D_DISPLAY_SIDEBYSIDE:
|
|
|
|
|
{
|
|
|
|
|
uiItemR(col, stereo3d_format_ptr, "use_sidebyside_crosseyed", 0, NULL, ICON_NONE);
|
2017-05-20 14:01:03 +10:00
|
|
|
ATTR_FALLTHROUGH;
|
2015-04-06 10:40:12 -03:00
|
|
|
}
|
|
|
|
|
case S3D_DISPLAY_TOPBOTTOM:
|
|
|
|
|
{
|
|
|
|
|
uiItemR(col, stereo3d_format_ptr, "use_squeezed_frame", 0, NULL, ICON_NONE);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void uiTemplateViewsFormat(uiLayout *layout, PointerRNA *ptr, PointerRNA *stereo3d_format_ptr)
|
|
|
|
|
{
|
2018-09-03 17:23:48 +02:00
|
|
|
uiLayout *col;
|
2015-04-06 10:40:12 -03:00
|
|
|
|
|
|
|
|
col = uiLayoutColumn(layout, false);
|
|
|
|
|
|
2018-09-03 17:23:48 +02:00
|
|
|
uiLayoutSetPropSep(col, true);
|
|
|
|
|
uiLayoutSetPropDecorate(col, false);
|
2015-04-06 10:40:12 -03:00
|
|
|
|
2018-09-03 17:23:48 +02:00
|
|
|
uiItemR(col, ptr, "views_format", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
|
|
|
|
|
|
|
|
|
|
if (stereo3d_format_ptr &&
|
|
|
|
|
RNA_enum_get(ptr, "views_format") == R_IMF_VIEWS_STEREO_3D)
|
|
|
|
|
{
|
|
|
|
|
uiTemplateImageStereo3d(col, stereo3d_format_ptr);
|
2015-04-06 10:40:12 -03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void uiTemplateImageViews(uiLayout *layout, PointerRNA *imaptr)
|
|
|
|
|
{
|
|
|
|
|
Image *ima = imaptr->data;
|
|
|
|
|
|
|
|
|
|
if (ima->type != IMA_TYPE_MULTILAYER) {
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
PointerRNA stereo3d_format_ptr;
|
|
|
|
|
|
|
|
|
|
prop = RNA_struct_find_property(imaptr, "stereo_3d_format");
|
|
|
|
|
stereo3d_format_ptr = RNA_property_pointer_get(imaptr, prop);
|
|
|
|
|
|
|
|
|
|
uiTemplateViewsFormat(layout, imaptr, &stereo3d_format_ptr);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
uiTemplateViewsFormat(layout, imaptr, NULL);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void uiTemplateImageFormatViews(uiLayout *layout, PointerRNA *imfptr, PointerRNA *ptr)
|
|
|
|
|
{
|
|
|
|
|
ImageFormatData *imf = imfptr->data;
|
|
|
|
|
|
2015-04-08 00:28:03 +02:00
|
|
|
if (ptr == NULL)
|
|
|
|
|
return;
|
2015-04-06 10:40:12 -03:00
|
|
|
|
2015-04-08 00:28:03 +02:00
|
|
|
uiItemR(layout, ptr, "use_multiview", 0, NULL, ICON_NONE);
|
2015-04-06 10:40:12 -03:00
|
|
|
|
2015-04-08 00:28:03 +02:00
|
|
|
if (RNA_boolean_get(ptr, "use_multiview")) {
|
|
|
|
|
if (imf->imtype != R_IMF_IMTYPE_MULTILAYER) {
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
PointerRNA stereo3d_format_ptr;
|
2015-04-06 10:40:12 -03:00
|
|
|
|
2015-04-08 00:28:03 +02:00
|
|
|
prop = RNA_struct_find_property(imfptr, "stereo_3d_format");
|
|
|
|
|
stereo3d_format_ptr = RNA_property_pointer_get(imfptr, prop);
|
|
|
|
|
|
|
|
|
|
uiTemplateViewsFormat(layout, imfptr, &stereo3d_format_ptr);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
uiTemplateViewsFormat(layout, imfptr, NULL);
|
|
|
|
|
}
|
2015-04-06 10:40:12 -03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2009-06-23 00:45:41 +00:00
|
|
|
void uiTemplateImageLayers(uiLayout *layout, bContext *C, Image *ima, ImageUser *iuser)
|
|
|
|
|
{
|
2012-03-28 11:53:18 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2009-06-23 00:45:41 +00:00
|
|
|
|
|
|
|
|
/* render layers and passes */
|
2012-03-24 06:38:07 +00:00
|
|
|
if (ima && iuser) {
|
2015-11-16 07:13:40 +11:00
|
|
|
RenderResult *rr;
|
2015-04-22 20:42:26 +02:00
|
|
|
const float dpi_fac = UI_DPI_FAC;
|
|
|
|
|
const int menus_width = 160 * dpi_fac;
|
2015-04-23 13:21:36 +02:00
|
|
|
const bool is_render_result = (ima->type == IMA_TYPE_R_RESULT);
|
2012-08-21 11:10:16 +00:00
|
|
|
|
|
|
|
|
/* use BKE_image_acquire_renderresult so we get the correct slot in the menu */
|
2015-11-16 07:13:40 +11:00
|
|
|
rr = BKE_image_acquire_renderresult(scene, ima);
|
|
|
|
|
uiblock_layer_pass_buttons(layout, ima, rr, iuser, menus_width,
|
2015-11-16 05:31:03 +11:00
|
|
|
is_render_result ? &ima->render_slot : NULL);
|
2012-08-21 11:10:16 +00:00
|
|
|
BKE_image_release_renderresult(scene, ima);
|
2009-06-23 00:45:41 +00:00
|
|
|
}
|
|
|
|
|
}
|
2.5: Space Image ported back
Organized as follows:
uvedit/
uv editing related code
uvedit_draw.c: drawing code
uvedit_ops.c: operators, just a few done
uvedit_unwrap_ops.c: will be operators for unwrapping
uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
space_image.c: registration and common getter/setters
image_draw.c: drawing code, mostly functional
image_panels.c: panels, all commented out
image_render.c: render callbacks, non functional
image_ops.c: operators, only view navigation done
image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
are not implemented they're displayed grayed out. Ideally the full
header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
still does own view2d management due to some very specific
requirements that the image window has. The drawing code however
is more clear hopefully, it only uses view2d, and there is no
switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
image space settings to scene toolsettings, and the current image
and its buffer is in the context. Especially sync selection and
select mode belonged there anyway as this cannot work correct with
different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
uvedit because there's really no code sharing.. perhaps vertex paint,
image paint and sculpt would be good to have in one module to share
brush code, partial redraw, etc better.
2009-01-15 04:38:18 +00:00
|
|
|
|
2015-02-09 23:11:30 +01:00
|
|
|
void uiTemplateImageInfo(uiLayout *layout, bContext *C, Image *ima, ImageUser *iuser)
|
|
|
|
|
{
|
|
|
|
|
ImBuf *ibuf;
|
|
|
|
|
char str[MAX_IMAGE_INFO_LEN];
|
|
|
|
|
void *lock;
|
|
|
|
|
|
|
|
|
|
if (!ima || !iuser)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
ibuf = BKE_image_acquire_ibuf(ima, iuser, &lock);
|
|
|
|
|
|
|
|
|
|
image_info(CTX_data_scene(C), iuser, ima, ibuf, str, MAX_IMAGE_INFO_LEN);
|
|
|
|
|
BKE_image_release_ibuf(ima, ibuf, lock);
|
|
|
|
|
uiItemL(layout, str, ICON_NONE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#undef MAX_IMAGE_INFO_LEN
|
|
|
|
|
|
2014-11-30 19:28:59 +01:00
|
|
|
void image_buttons_register(ARegionType *UNUSED(art))
|
2009-02-21 15:31:01 +00:00
|
|
|
{
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-02-21 15:31:01 +00:00
|
|
|
}
|
|
|
|
|
|
2013-07-28 17:06:31 +00:00
|
|
|
static int image_properties_toggle_exec(bContext *C, wmOperator *UNUSED(op))
|
2009-02-21 15:31:01 +00:00
|
|
|
{
|
2012-03-28 11:53:18 +00:00
|
|
|
ScrArea *sa = CTX_wm_area(C);
|
|
|
|
|
ARegion *ar = image_has_buttons_region(sa);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (ar)
|
2009-09-14 19:12:29 +00:00
|
|
|
ED_region_toggle_hidden(C, ar);
|
|
|
|
|
|
2009-02-21 15:31:01 +00:00
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void IMAGE_OT_properties(wmOperatorType *ot)
|
|
|
|
|
{
|
2018-06-12 22:55:53 +02:00
|
|
|
ot->name = "Toggle Sidebar";
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->idname = "IMAGE_OT_properties";
|
2016-08-04 00:26:49 +02:00
|
|
|
ot->description = "Toggle the properties region visibility";
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2013-07-28 17:06:31 +00:00
|
|
|
ot->exec = image_properties_toggle_exec;
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->poll = ED_operator_image_active;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-02-21 15:31:01 +00:00
|
|
|
/* flags */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->flag = 0;
|
2009-02-21 15:31:01 +00:00
|
|
|
}
|
|
|
|
|
|
2013-07-28 17:06:31 +00:00
|
|
|
static int image_scopes_toggle_exec(bContext *C, wmOperator *UNUSED(op))
|
2010-01-19 01:32:06 +00:00
|
|
|
{
|
2012-03-28 11:53:18 +00:00
|
|
|
ScrArea *sa = CTX_wm_area(C);
|
2014-02-13 19:49:26 +02:00
|
|
|
ARegion *ar = image_has_tools_region(sa);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (ar)
|
2010-01-19 01:32:06 +00:00
|
|
|
ED_region_toggle_hidden(C, ar);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2010-01-19 01:32:06 +00:00
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
|
}
|
2009-02-21 15:31:01 +00:00
|
|
|
|
2014-02-13 19:49:26 +02:00
|
|
|
void IMAGE_OT_toolshelf(wmOperatorType *ot)
|
2010-01-19 01:32:06 +00:00
|
|
|
{
|
2018-06-12 22:55:53 +02:00
|
|
|
ot->name = "Toggle Toolbar";
|
2014-02-13 19:49:26 +02:00
|
|
|
ot->idname = "IMAGE_OT_toolshelf";
|
|
|
|
|
ot->description = "Toggles tool shelf display";
|
|
|
|
|
|
2013-07-28 17:06:31 +00:00
|
|
|
ot->exec = image_scopes_toggle_exec;
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->poll = ED_operator_image_active;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2010-01-19 01:32:06 +00:00
|
|
|
/* flags */
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->flag = 0;
|
2010-01-19 01:32:06 +00:00
|
|
|
}
|