2011-02-21 07:25:24 +00:00
|
|
|
/*
|
2009-01-28 21:43:43 +00:00
|
|
|
* 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
|
2018-06-01 18:19:39 +02:00
|
|
|
* of the License, or (at your option) any later version.
|
2009-01-28 21:43:43 +00:00
|
|
|
*
|
|
|
|
|
* 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.
|
2009-01-28 21:43:43 +00:00
|
|
|
*
|
|
|
|
|
* The Original Code is Copyright (C) 2008 Blender Foundation.
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*/
|
|
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup editors
|
2011-02-21 07:25:24 +00:00
|
|
|
*/
|
|
|
|
|
|
2012-02-17 18:59:41 +00:00
|
|
|
#ifndef __ED_IMAGE_H__
|
|
|
|
|
#define __ED_IMAGE_H__
|
2009-01-28 21:43:43 +00:00
|
|
|
|
2020-02-07 00:01:50 +01:00
|
|
|
#include "DNA_listBase.h"
|
|
|
|
|
#include "DNA_space_types.h"
|
|
|
|
|
|
2020-03-02 15:09:10 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2019-01-28 21:08:24 +11:00
|
|
|
struct ARegion;
|
|
|
|
|
struct ImBuf;
|
2009-02-21 19:17:31 +00:00
|
|
|
struct Image;
|
|
|
|
|
struct ImageUser;
|
2020-02-07 00:01:50 +01:00
|
|
|
struct LinkNodePair;
|
|
|
|
|
struct Main;
|
2019-05-16 16:01:11 +02:00
|
|
|
struct ReportList;
|
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
|
|
|
struct Scene;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct SpaceImage;
|
2017-11-22 10:52:39 -02:00
|
|
|
struct ViewLayer;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct bContext;
|
2020-02-07 00:01:50 +01:00
|
|
|
struct wmOperator;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct wmWindowManager;
|
2009-01-28 21:43:43 +00:00
|
|
|
|
2012-07-25 10:15:24 +00:00
|
|
|
/* image_edit.c, exported for transform */
|
2009-01-28 21:43:43 +00:00
|
|
|
struct Image *ED_space_image(struct SpaceImage *sima);
|
2019-04-17 06:17:24 +02:00
|
|
|
void ED_space_image_set(struct Main *bmain,
|
|
|
|
|
struct SpaceImage *sima,
|
|
|
|
|
struct Object *obedit,
|
|
|
|
|
struct Image *ima,
|
|
|
|
|
bool automatic);
|
|
|
|
|
void ED_space_image_auto_set(const struct bContext *C, struct SpaceImage *sima);
|
|
|
|
|
struct Mask *ED_space_image_get_mask(struct SpaceImage *sima);
|
|
|
|
|
void ED_space_image_set_mask(struct bContext *C, struct SpaceImage *sima, struct Mask *mask);
|
2009-02-09 20:58:31 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
bool ED_space_image_color_sample(struct SpaceImage *sima,
|
2020-03-06 16:56:42 +01:00
|
|
|
struct ARegion *region,
|
2019-04-17 06:17:24 +02:00
|
|
|
int mval[2],
|
|
|
|
|
float r_col[3]);
|
Add support for tiled images and the UDIM naming scheme
This patch contains the work that I did during my week at the Code Quest - adding support for tiled images to Blender.
With this patch, images now contain a list of tiles. By default, this just contains one tile, but if the source type is set to Tiled, the user can add additional tiles. When acquiring an ImBuf, the tile to be loaded is specified in the ImageUser.
Therefore, code that is not yet aware of tiles will just access the default tile as usual.
The filenames of the additional tiles are derived from the original filename according to the UDIM naming scheme - the filename contains an index that is calculated as (1001 + 10*<y coordinate of the tile> + <x coordinate of the tile>), where the x coordinate never goes above 9.
Internally, the various tiles are stored in a cache just like sequences. When acquired for the first time, the code will try to load the corresponding file from disk. Alternatively, a new operator can be used to initialize the tile similar to the New Image operator.
The following features are supported so far:
- Automatic detection and loading of all tiles when opening the first tile (1001)
- Saving all tiles
- Adding and removing tiles
- Filling tiles with generated images
- Drawing all tiles in the Image Editor
- Viewing a tiled grid even if no image is selected
- Rendering tiled images in Eevee
- Rendering tiled images in Cycles (in SVM mode)
- Automatically skipping loading of unused tiles in Cycles
- 2D texture painting (also across tiles)
- 3D texture painting (also across tiles, only limitation: individual faces can not cross tile borders)
- Assigning custom labels to individual tiles (drawn in the Image Editor instead of the ID)
- Different resolutions between tiles
There still are some missing features that will be added later (see T72390):
- Workbench engine support
- Packing/Unpacking support
- Baking support
- Cycles OSL support
- many other Blender features that rely on images
Thanks to Brecht for the review and to all who tested the intermediate versions!
Differential Revision: https://developer.blender.org/D3509
2019-12-12 16:06:08 +01:00
|
|
|
struct ImBuf *ED_space_image_acquire_buffer(struct SpaceImage *sima, void **r_lock, int tile);
|
2020-03-23 13:51:55 +01:00
|
|
|
int ED_space_image_get_display_channel_mask(struct ImBuf *ibuf);
|
2012-11-15 15:59:58 +00:00
|
|
|
void ED_space_image_release_buffer(struct SpaceImage *sima, struct ImBuf *ibuf, void *lock);
|
2014-01-28 03:52:21 +11:00
|
|
|
bool ED_space_image_has_buffer(struct SpaceImage *sima);
|
2009-09-30 18:18:32 +00:00
|
|
|
|
2020-03-25 17:58:58 +11:00
|
|
|
void ED_space_image_get_size(struct SpaceImage *sima, int *r_width, int *r_height);
|
|
|
|
|
void ED_space_image_get_size_fl(struct SpaceImage *sima, float r_size[2]);
|
|
|
|
|
void ED_space_image_get_aspect(struct SpaceImage *sima, float *r_aspx, float *r_aspy);
|
2019-04-17 06:17:24 +02:00
|
|
|
void ED_space_image_get_zoom(struct SpaceImage *sima,
|
2020-05-04 19:32:59 +10:00
|
|
|
const struct ARegion *region,
|
2020-03-25 17:58:58 +11:00
|
|
|
float *r_zoomx,
|
|
|
|
|
float *r_zoomy);
|
|
|
|
|
void ED_space_image_get_uv_aspect(struct SpaceImage *sima, float *r_aspx, float *r_aspy);
|
2009-01-28 21:43:43 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
void ED_space_image_scopes_update(const struct bContext *C,
|
|
|
|
|
struct SpaceImage *sima,
|
|
|
|
|
struct ImBuf *ibuf,
|
|
|
|
|
bool use_view_settings);
|
2015-01-12 14:21:23 +01:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
void ED_space_image_paint_update(struct Main *bmain,
|
|
|
|
|
struct wmWindowManager *wm,
|
|
|
|
|
struct Scene *scene);
|
2010-10-20 00:42:19 +00:00
|
|
|
|
2020-03-25 17:58:58 +11:00
|
|
|
void ED_image_get_uv_aspect(struct Image *ima,
|
|
|
|
|
struct ImageUser *iuser,
|
|
|
|
|
float *r_aspx,
|
|
|
|
|
float *r_aspy);
|
2019-04-17 06:17:24 +02:00
|
|
|
void ED_image_mouse_pos(struct SpaceImage *sima,
|
2020-05-04 19:32:59 +10:00
|
|
|
const struct ARegion *region,
|
2019-04-17 06:17:24 +02:00
|
|
|
const int mval[2],
|
|
|
|
|
float co[2]);
|
2019-10-01 20:19:44 +10:00
|
|
|
void ED_image_view_center_to_point(struct SpaceImage *sima, float x, float y);
|
2020-05-04 19:32:59 +10:00
|
|
|
void ED_image_point_pos(struct SpaceImage *sima,
|
|
|
|
|
const struct ARegion *region,
|
|
|
|
|
float x,
|
|
|
|
|
float y,
|
|
|
|
|
float *r_x,
|
|
|
|
|
float *r_y);
|
2019-04-17 06:17:24 +02:00
|
|
|
void ED_image_point_pos__reverse(struct SpaceImage *sima,
|
2020-05-04 19:32:59 +10:00
|
|
|
const struct ARegion *region,
|
2019-04-17 06:17:24 +02:00
|
|
|
const float co[2],
|
|
|
|
|
float r_co[2]);
|
2015-11-16 07:13:40 +11:00
|
|
|
bool ED_image_slot_cycle(struct Image *image, int direction);
|
2009-02-09 20:58:31 +00:00
|
|
|
|
2014-01-28 03:52:21 +11:00
|
|
|
bool ED_space_image_show_render(struct SpaceImage *sima);
|
|
|
|
|
bool ED_space_image_show_paint(struct SpaceImage *sima);
|
|
|
|
|
bool ED_space_image_show_uvedit(struct SpaceImage *sima, struct Object *obedit);
|
2009-02-09 20:58:31 +00:00
|
|
|
|
2014-07-21 12:02:05 +02:00
|
|
|
bool ED_space_image_paint_curve(const struct bContext *C);
|
|
|
|
|
|
2018-04-05 18:20:27 +02:00
|
|
|
bool ED_space_image_check_show_maskedit(struct SpaceImage *sima, struct ViewLayer *view_layer);
|
2018-07-02 11:47:00 +02:00
|
|
|
bool ED_space_image_maskedit_poll(struct bContext *C);
|
|
|
|
|
bool ED_space_image_maskedit_mask_poll(struct bContext *C);
|
2019-10-01 20:19:44 +10:00
|
|
|
bool ED_space_image_cursor_poll(struct bContext *C);
|
2012-07-25 10:39:54 +00:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
void ED_image_draw_info(struct Scene *scene,
|
2020-03-06 16:56:42 +01:00
|
|
|
struct ARegion *region,
|
2019-04-17 06:17:24 +02:00
|
|
|
bool color_manage,
|
|
|
|
|
bool use_default_view,
|
|
|
|
|
int channels,
|
|
|
|
|
int x,
|
|
|
|
|
int y,
|
|
|
|
|
const unsigned char cp[4],
|
|
|
|
|
const float fp[4],
|
|
|
|
|
const float linearcol[4],
|
|
|
|
|
int *zp,
|
|
|
|
|
float *zpf);
|
2012-01-12 05:46:45 +00:00
|
|
|
|
2014-12-09 20:33:19 +05:00
|
|
|
bool ED_space_image_show_cache(struct SpaceImage *sima);
|
|
|
|
|
|
2020-03-06 16:22:28 +01:00
|
|
|
bool ED_image_should_save_modified(const struct Main *bmain);
|
|
|
|
|
int ED_image_save_all_modified_info(const struct Main *bmain, struct ReportList *reports);
|
2019-05-16 16:01:11 +02:00
|
|
|
bool ED_image_save_all_modified(const struct bContext *C, struct ReportList *reports);
|
|
|
|
|
|
2020-02-07 00:01:50 +01:00
|
|
|
/* image_sequence.c */
|
|
|
|
|
typedef struct ImageFrameRange {
|
|
|
|
|
struct ImageFrameRange *next, *prev;
|
|
|
|
|
|
|
|
|
|
/** Absolute file path of the first file in the range. */
|
|
|
|
|
char filepath[FILE_MAX];
|
|
|
|
|
/* Sequence parameters. */
|
|
|
|
|
int length;
|
|
|
|
|
int offset;
|
|
|
|
|
/* UDIM tiles. */
|
|
|
|
|
ListBase udim_tiles;
|
|
|
|
|
|
|
|
|
|
/* Temporary data. */
|
|
|
|
|
ListBase frames;
|
|
|
|
|
} ImageFrameRange;
|
|
|
|
|
|
|
|
|
|
ListBase ED_image_filesel_detect_sequences(struct Main *bmain,
|
|
|
|
|
struct wmOperator *op,
|
|
|
|
|
const bool detect_udim);
|
|
|
|
|
|
2020-03-02 15:09:10 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2012-02-17 18:59:41 +00:00
|
|
|
#endif /* __ED_IMAGE_H__ */
|