2023-08-16 00:20:26 +10:00
|
|
|
/* SPDX-FileCopyrightText: 2008 Blender Authors
|
2023-05-31 16:19:06 +02:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
2009-01-28 21:43:43 +00:00
|
|
|
|
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
|
|
|
#pragma once
|
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"
|
|
|
|
|
|
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 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;
|
2022-01-24 21:16:06 +11:00
|
|
|
struct View2D;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct bContext;
|
2022-06-08 12:37:29 -07:00
|
|
|
struct Paint;
|
2020-02-07 00:01:50 +01:00
|
|
|
struct wmOperator;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct wmWindowManager;
|
2021-09-29 17:47:32 +10:00
|
|
|
|
2023-07-31 11:50:54 +10:00
|
|
|
/* `image_draw.cc` */
|
2022-04-04 13:17:03 +10:00
|
|
|
|
2023-08-04 22:15:25 -04:00
|
|
|
float ED_space_image_zoom_level(const View2D *v2d, int grid_dimension);
|
|
|
|
|
void ED_space_image_grid_steps(SpaceImage *sima,
|
2022-09-18 17:03:40 +12:00
|
|
|
float grid_steps_x[SI_GRID_STEPS_LEN],
|
|
|
|
|
float grid_steps_y[SI_GRID_STEPS_LEN],
|
2022-01-07 11:38:08 +11:00
|
|
|
int grid_dimension);
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Calculate the increment snapping value for UV/image editor based on the zoom factor
|
|
|
|
|
* The code in here (except the offset part) is used in `grid_frag.glsl` (see `grid_res`) for
|
|
|
|
|
* drawing the grid overlay for the UV/Image editor.
|
|
|
|
|
*/
|
2022-09-20 09:20:55 +12:00
|
|
|
float ED_space_image_increment_snap_value(int grid_dimensions,
|
2021-09-29 17:47:32 +10:00
|
|
|
const float grid_steps[SI_GRID_STEPS_LEN],
|
2022-01-07 11:38:08 +11:00
|
|
|
float zoom_factor);
|
2009-01-28 21:43:43 +00:00
|
|
|
|
2023-07-31 11:50:54 +10:00
|
|
|
/* `image_edit.cc`, exported for transform. */
|
2021-12-09 00:55:11 +11:00
|
|
|
|
2023-08-04 22:15:25 -04:00
|
|
|
Image *ED_space_image(const SpaceImage *sima);
|
|
|
|
|
void ED_space_image_set(Main *bmain, SpaceImage *sima, Image *ima, bool automatic);
|
|
|
|
|
void ED_space_image_sync(Main *bmain, Image *image, bool ignore_render_viewer);
|
|
|
|
|
void ED_space_image_auto_set(const bContext *C, SpaceImage *sima);
|
|
|
|
|
Mask *ED_space_image_get_mask(const SpaceImage *sima);
|
|
|
|
|
void ED_space_image_set_mask(bContext *C, SpaceImage *sima, Mask *mask);
|
2009-02-09 20:58:31 +00:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Returns mouse position in image space.
|
|
|
|
|
*/
|
2023-10-17 12:57:00 +11:00
|
|
|
bool ED_space_image_get_position(SpaceImage *sima,
|
|
|
|
|
ARegion *region,
|
|
|
|
|
const int mval[2],
|
|
|
|
|
float r_fpos[2]);
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Returns color in linear space, matching #ED_space_node_color_sample().
|
|
|
|
|
*/
|
2023-08-04 22:15:25 -04:00
|
|
|
bool ED_space_image_color_sample(
|
|
|
|
|
SpaceImage *sima, ARegion *region, const int mval[2], float r_col[3], bool *r_is_data);
|
|
|
|
|
ImBuf *ED_space_image_acquire_buffer(SpaceImage *sima, void **r_lock, int tile);
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Get the #SpaceImage flag that is valid for the given ibuf.
|
|
|
|
|
*/
|
2023-08-04 22:15:25 -04:00
|
|
|
int ED_space_image_get_display_channel_mask(ImBuf *ibuf);
|
|
|
|
|
void ED_space_image_release_buffer(SpaceImage *sima, ImBuf *ibuf, void *lock);
|
|
|
|
|
bool ED_space_image_has_buffer(SpaceImage *sima);
|
|
|
|
|
|
|
|
|
|
void ED_space_image_get_size(SpaceImage *sima, int *r_width, int *r_height);
|
|
|
|
|
void ED_space_image_get_size_fl(SpaceImage *sima, float r_size[2]);
|
|
|
|
|
void ED_space_image_get_aspect(SpaceImage *sima, float *r_aspx, float *r_aspy);
|
|
|
|
|
void ED_space_image_get_zoom(SpaceImage *sima,
|
|
|
|
|
const ARegion *region,
|
2020-03-25 17:58:58 +11:00
|
|
|
float *r_zoomx,
|
|
|
|
|
float *r_zoomy);
|
2023-08-04 22:15:25 -04:00
|
|
|
void ED_space_image_get_uv_aspect(SpaceImage *sima, float *r_aspx, float *r_aspy);
|
2009-01-28 21:43:43 +00:00
|
|
|
|
2023-08-04 22:15:25 -04:00
|
|
|
void ED_space_image_scopes_update(const bContext *C,
|
|
|
|
|
SpaceImage *sima,
|
|
|
|
|
ImBuf *ibuf,
|
2015-01-12 14:21:23 +01:00
|
|
|
bool use_view_settings);
|
|
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Enable the paint cursor if it isn't already.
|
|
|
|
|
*
|
|
|
|
|
* purpose is to make sure the paint cursor is shown if paint mode is enabled in the image editor.
|
|
|
|
|
* The paint poll will ensure that the cursor is hidden when not in paint mode.
|
|
|
|
|
*/
|
2023-08-04 22:15:25 -04:00
|
|
|
void ED_space_image_paint_update(Main *bmain, wmWindowManager *wm, Scene *scene);
|
|
|
|
|
|
|
|
|
|
void ED_image_get_uv_aspect(Image *ima, ImageUser *iuser, float *r_aspx, float *r_aspy);
|
2021-12-09 00:55:11 +11:00
|
|
|
/** Takes `event->mval`. */
|
2023-08-04 22:15:25 -04:00
|
|
|
void ED_image_mouse_pos(SpaceImage *sima, const ARegion *region, const int mval[2], float co[2]);
|
|
|
|
|
void ED_image_view_center_to_point(SpaceImage *sima, float x, float y);
|
|
|
|
|
void ED_image_point_pos(
|
|
|
|
|
SpaceImage *sima, const ARegion *region, float x, float y, float *r_x, float *r_y);
|
|
|
|
|
void ED_image_point_pos__reverse(SpaceImage *sima,
|
|
|
|
|
const ARegion *region,
|
2012-07-26 09:54:52 +00:00
|
|
|
const float co[2],
|
|
|
|
|
float r_co[2]);
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* This is more a user-level functionality, for going to `next/prev` used slot,
|
|
|
|
|
* Stepping onto the last unused slot too.
|
|
|
|
|
*/
|
2023-08-04 22:15:25 -04:00
|
|
|
bool ED_image_slot_cycle(Image *image, int direction);
|
2009-02-09 20:58:31 +00:00
|
|
|
|
2023-08-04 22:15:25 -04:00
|
|
|
bool ED_space_image_show_render(const SpaceImage *sima);
|
|
|
|
|
bool ED_space_image_show_paint(const SpaceImage *sima);
|
|
|
|
|
bool ED_space_image_show_uvedit(const SpaceImage *sima, Object *obedit);
|
2009-02-09 20:58:31 +00:00
|
|
|
|
2023-08-04 22:15:25 -04:00
|
|
|
bool ED_space_image_paint_curve(const bContext *C);
|
2014-07-21 12:02:05 +02:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Matches clip function.
|
|
|
|
|
*/
|
2023-08-04 22:15:25 -04:00
|
|
|
bool ED_space_image_check_show_maskedit(SpaceImage *sima, Object *obedit);
|
2022-06-20 11:25:38 +02:00
|
|
|
|
|
|
|
|
/* Returns true when the following conditions are met:
|
|
|
|
|
* - Current space is Image Editor.
|
2022-06-20 10:14:00 -05:00
|
|
|
* - The image editor is not a UV Editor.
|
2022-06-20 11:25:38 +02:00
|
|
|
* - It is set to Mask mode.
|
|
|
|
|
*
|
|
|
|
|
* It is not required to have mask opened for editing. */
|
2023-08-04 22:15:25 -04:00
|
|
|
bool ED_space_image_maskedit_poll(bContext *C);
|
2022-06-20 11:25:38 +02:00
|
|
|
|
|
|
|
|
/* Returns true when the following conditions are met:
|
|
|
|
|
* - Current space is Image Editor.
|
2022-06-20 10:14:00 -05:00
|
|
|
* - The image editor is not a UV Editor.
|
2022-06-20 11:25:38 +02:00
|
|
|
* - It is set to Mask mode.
|
2022-06-16 10:13:03 +02:00
|
|
|
* - Mask has visible and editable splines.
|
|
|
|
|
*
|
|
|
|
|
* It is not required to have mask opened for editing. */
|
2023-08-04 22:15:25 -04:00
|
|
|
bool ED_space_image_maskedit_visible_splines_poll(bContext *C);
|
2022-06-16 10:13:03 +02:00
|
|
|
|
|
|
|
|
/* Returns true when the following conditions are met:
|
|
|
|
|
* - Current space is Image Editor.
|
|
|
|
|
* - The image editor is not an UV Editor.
|
|
|
|
|
* - It is set to Mask mode.
|
2022-06-20 11:25:38 +02:00
|
|
|
* - The space has mask opened. */
|
2023-08-04 22:15:25 -04:00
|
|
|
bool ED_space_image_maskedit_mask_poll(bContext *C);
|
2022-06-20 11:25:38 +02:00
|
|
|
|
2022-06-16 10:13:03 +02:00
|
|
|
/* Returns true when the following conditions are met:
|
|
|
|
|
* - Current space is Image Editor.
|
|
|
|
|
* - The image editor is not an UV Editor.
|
|
|
|
|
* - It is set to Mask mode.
|
|
|
|
|
* - The space has mask opened.
|
|
|
|
|
* - Mask has visible and editable splines. */
|
2023-08-04 22:15:25 -04:00
|
|
|
bool ED_space_image_maskedit_mask_visible_splines_poll(bContext *C);
|
2022-06-16 10:13:03 +02:00
|
|
|
|
2023-08-04 22:15:25 -04:00
|
|
|
bool ED_space_image_cursor_poll(bContext *C);
|
2012-07-25 10:39:54 +00:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Used by node view too.
|
|
|
|
|
*/
|
2023-08-04 22:15:25 -04:00
|
|
|
void ED_image_draw_info(Scene *scene,
|
|
|
|
|
ARegion *region,
|
2014-03-31 23:39:08 +11:00
|
|
|
bool color_manage,
|
|
|
|
|
bool use_default_view,
|
|
|
|
|
int channels,
|
|
|
|
|
int x,
|
|
|
|
|
int y,
|
2013-03-18 11:34:05 +00:00
|
|
|
const unsigned char cp[4],
|
|
|
|
|
const float fp[4],
|
2023-07-04 17:03:02 +02:00
|
|
|
const float linearcol[4]);
|
2012-01-12 05:46:45 +00:00
|
|
|
|
2023-08-04 22:15:25 -04:00
|
|
|
bool ED_space_image_show_cache(const SpaceImage *sima);
|
|
|
|
|
bool ED_space_image_show_cache_and_mval_over(const SpaceImage *sima,
|
|
|
|
|
ARegion *region,
|
2021-10-19 12:22:06 +11:00
|
|
|
const int mval[2]);
|
2014-12-09 20:33:19 +05:00
|
|
|
|
2023-08-04 22:15:25 -04:00
|
|
|
bool ED_image_should_save_modified(const Main *bmain);
|
|
|
|
|
int ED_image_save_all_modified_info(const Main *bmain, ReportList *reports);
|
|
|
|
|
bool ED_image_save_all_modified(const bContext *C, ReportList *reports);
|
2019-05-16 16:01:11 +02:00
|
|
|
|
2023-07-31 11:50:54 +10:00
|
|
|
/* `image_sequence.cc` */
|
2022-04-04 13:17:03 +10:00
|
|
|
|
2023-08-04 22:15:25 -04:00
|
|
|
struct ImageFrameRange {
|
|
|
|
|
ImageFrameRange *next, *prev;
|
2020-02-07 00:01:50 +01:00
|
|
|
|
|
|
|
|
/** Absolute file path of the first file in the range. */
|
|
|
|
|
char filepath[FILE_MAX];
|
|
|
|
|
/* Sequence parameters. */
|
|
|
|
|
int length;
|
|
|
|
|
int offset;
|
|
|
|
|
/* UDIM tiles. */
|
2022-05-27 22:11:52 -07:00
|
|
|
bool udims_detected;
|
2020-02-07 00:01:50 +01:00
|
|
|
ListBase udim_tiles;
|
|
|
|
|
|
|
|
|
|
/* Temporary data. */
|
|
|
|
|
ListBase frames;
|
2023-08-04 22:15:25 -04:00
|
|
|
};
|
2020-02-07 00:01:50 +01:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Used for both images and volume file loading.
|
|
|
|
|
*/
|
2023-08-04 22:15:25 -04:00
|
|
|
ListBase ED_image_filesel_detect_sequences(Main *bmain, wmOperator *op, bool detect_udim);
|
2020-02-07 00:01:50 +01:00
|
|
|
|
2023-08-04 22:15:25 -04:00
|
|
|
bool ED_image_tools_paint_poll(bContext *C);
|
|
|
|
|
void ED_paint_cursor_start(Paint *p, bool (*poll)(bContext *C));
|