2011-02-18 14:05:18 +01:00
|
|
|
/*
|
2002-10-12 13:37:38 +02: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
|
2008-04-17 00:40:48 +02:00
|
|
|
* of the License, or (at your option) any later version.
|
2002-10-12 13:37:38 +02: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 14:34:04 +01:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2002-10-12 13:37:38 +02:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
|
|
|
* All rights reserved.
|
|
|
|
*/
|
2020-08-07 09:50:34 +02:00
|
|
|
#pragma once
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2019-02-17 22:08:12 +01:00
|
|
|
/** \file
|
|
|
|
* \ingroup bke
|
2011-02-18 14:05:18 +01:00
|
|
|
*/
|
|
|
|
|
2020-05-08 18:16:39 +02:00
|
|
|
#include "BLI_utildefines.h"
|
|
|
|
|
2002-10-12 13:37:38 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2019-02-18 16:19:15 +01:00
|
|
|
struct Depsgraph;
|
|
|
|
struct ID;
|
2002-10-12 13:37:38 +02:00
|
|
|
struct ImBuf;
|
2019-01-28 11:08:24 +01:00
|
|
|
struct Image;
|
2011-11-21 21:19:58 +01:00
|
|
|
struct ImageFormatData;
|
2013-01-21 09:49:42 +01:00
|
|
|
struct ImagePool;
|
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 ImageTile;
|
2019-01-28 11:08:24 +01:00
|
|
|
struct ImbFormatOptions;
|
2012-06-04 12:41:18 +02:00
|
|
|
struct Main;
|
2019-01-28 11:08:24 +01:00
|
|
|
struct Object;
|
2015-04-21 18:33:33 +02:00
|
|
|
struct RenderResult;
|
2019-01-28 11:08:24 +01:00
|
|
|
struct ReportList;
|
|
|
|
struct Scene;
|
2015-05-26 12:02:14 +02:00
|
|
|
struct StampData;
|
2019-01-28 11:08:24 +01:00
|
|
|
struct anim;
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
#define IMA_MAX_SPACE 64
|
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
|
|
|
#define IMA_UDIM_MAX 1999
|
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 12:05:07 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
void BKE_images_init(void);
|
|
|
|
void BKE_images_exit(void);
|
2012-11-15 16:59:58 +01:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
void BKE_image_free_packedfiles(struct Image *image);
|
|
|
|
void BKE_image_free_views(struct Image *image);
|
|
|
|
void BKE_image_free_buffers(struct Image *image);
|
|
|
|
void BKE_image_free_buffers_ex(struct Image *image, bool do_lock);
|
2020-07-29 18:13:19 +02:00
|
|
|
void BKE_image_free_gputextures(struct Image *ima);
|
2006-12-20 18:57:56 +01:00
|
|
|
/* call from library */
|
2019-04-17 06:17:24 +02:00
|
|
|
void BKE_image_free(struct Image *image);
|
2006-12-20 18:57:56 +01:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
typedef void(StampCallback)(void *data, const char *propname, char *propvalue, int len);
|
2015-05-26 12:02:14 +02:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
void BKE_render_result_stamp_info(struct Scene *scene,
|
|
|
|
struct Object *camera,
|
|
|
|
struct RenderResult *rr,
|
|
|
|
bool allocate_only);
|
2018-04-05 16:31:59 +02:00
|
|
|
/**
|
|
|
|
* Fills in the static stamp data (i.e. everything except things that can change per frame).
|
|
|
|
* The caller is responsible for freeing the allocated memory.
|
|
|
|
*/
|
2020-03-13 07:27:11 +01:00
|
|
|
struct StampData *BKE_stamp_info_from_scene_static(const struct Scene *scene);
|
2019-04-17 06:17:24 +02:00
|
|
|
bool BKE_stamp_is_known_field(const char *field_name);
|
|
|
|
void BKE_imbuf_stamp_info(struct RenderResult *rr, struct ImBuf *ibuf);
|
|
|
|
void BKE_stamp_info_from_imbuf(struct RenderResult *rr, struct ImBuf *ibuf);
|
|
|
|
void BKE_stamp_info_callback(void *data,
|
|
|
|
struct StampData *stamp_data,
|
|
|
|
StampCallback callback,
|
|
|
|
bool noskip);
|
|
|
|
void BKE_render_result_stamp_data(struct RenderResult *rr, const char *key, const char *value);
|
2019-02-25 19:51:36 +01:00
|
|
|
struct StampData *BKE_stamp_data_copy(const struct StampData *stamp_data);
|
2019-04-17 06:17:24 +02:00
|
|
|
void BKE_stamp_data_free(struct StampData *stamp_data);
|
|
|
|
void BKE_image_stamp_buf(struct Scene *scene,
|
|
|
|
struct Object *camera,
|
|
|
|
const struct StampData *stamp_data_template,
|
|
|
|
unsigned char *rect,
|
|
|
|
float *rectf,
|
|
|
|
int width,
|
|
|
|
int height,
|
|
|
|
int channels);
|
|
|
|
bool BKE_imbuf_alpha_test(struct ImBuf *ibuf);
|
|
|
|
int BKE_imbuf_write_stamp(struct Scene *scene,
|
|
|
|
struct RenderResult *rr,
|
|
|
|
struct ImBuf *ibuf,
|
|
|
|
const char *name,
|
|
|
|
const struct ImageFormatData *imf);
|
|
|
|
void BKE_imbuf_write_prepare(struct ImBuf *ibuf, const struct ImageFormatData *imf);
|
|
|
|
int BKE_imbuf_write(struct ImBuf *ibuf, const char *name, const struct ImageFormatData *imf);
|
|
|
|
int BKE_imbuf_write_as(struct ImBuf *ibuf,
|
|
|
|
const char *name,
|
|
|
|
struct ImageFormatData *imf,
|
2020-09-04 20:59:13 +02:00
|
|
|
const bool save_copy);
|
2019-04-17 06:17:24 +02:00
|
|
|
void BKE_image_path_from_imformat(char *string,
|
|
|
|
const char *base,
|
|
|
|
const char *relbase,
|
|
|
|
int frame,
|
|
|
|
const struct ImageFormatData *im_format,
|
|
|
|
const bool use_ext,
|
|
|
|
const bool use_frames,
|
|
|
|
const char *suffix);
|
|
|
|
void BKE_image_path_from_imtype(char *string,
|
|
|
|
const char *base,
|
|
|
|
const char *relbase,
|
|
|
|
int frame,
|
|
|
|
const char imtype,
|
|
|
|
const bool use_ext,
|
|
|
|
const bool use_frames,
|
|
|
|
const char *suffix);
|
|
|
|
int BKE_image_path_ensure_ext_from_imformat(char *string, const struct ImageFormatData *im_format);
|
|
|
|
int BKE_image_path_ensure_ext_from_imtype(char *string, const char imtype);
|
|
|
|
char BKE_image_ftype_to_imtype(const int ftype, const struct ImbFormatOptions *options);
|
|
|
|
int BKE_image_imtype_to_ftype(const char imtype, struct ImbFormatOptions *r_options);
|
|
|
|
|
|
|
|
bool BKE_imtype_is_movie(const char imtype);
|
2020-09-02 19:10:18 +02:00
|
|
|
bool BKE_imtype_supports_zbuf(const char imtype);
|
|
|
|
bool BKE_imtype_supports_compress(const char imtype);
|
|
|
|
bool BKE_imtype_supports_quality(const char imtype);
|
|
|
|
bool BKE_imtype_requires_linear_float(const char imtype);
|
2019-04-17 06:17:24 +02:00
|
|
|
char BKE_imtype_valid_channels(const char imtype, bool write_file);
|
|
|
|
char BKE_imtype_valid_depths(const char imtype);
|
|
|
|
|
|
|
|
char BKE_imtype_from_arg(const char *arg);
|
|
|
|
|
|
|
|
void BKE_imformat_defaults(struct ImageFormatData *im_format);
|
|
|
|
void BKE_imbuf_to_image_format(struct ImageFormatData *im_format, const struct ImBuf *imbuf);
|
|
|
|
|
|
|
|
struct anim *openanim(const char *name,
|
|
|
|
int flags,
|
|
|
|
int streamindex,
|
|
|
|
char colorspace[IMA_MAX_SPACE]);
|
|
|
|
struct anim *openanim_noload(const char *name,
|
|
|
|
int flags,
|
|
|
|
int streamindex,
|
|
|
|
char colorspace[IMA_MAX_SPACE]);
|
|
|
|
|
|
|
|
void BKE_image_tag_time(struct Image *ima);
|
2006-12-20 18:57:56 +01:00
|
|
|
|
|
|
|
/* ********************************** NEW IMAGE API *********************** */
|
|
|
|
|
|
|
|
/* ImageUser is in Texture, in Nodes, Background Image, Image Window, .... */
|
|
|
|
/* should be used in conjunction with an ID * to Image. */
|
|
|
|
struct ImageUser;
|
2015-04-06 15:40:12 +02:00
|
|
|
struct RenderData;
|
2006-12-20 18:57:56 +01:00
|
|
|
struct RenderPass;
|
|
|
|
struct RenderResult;
|
|
|
|
|
|
|
|
/* ima->ok */
|
2019-04-17 06:17:24 +02:00
|
|
|
#define IMA_OK 1
|
|
|
|
#define IMA_OK_LOADED 2
|
2006-12-20 18:57:56 +01:00
|
|
|
|
|
|
|
/* signals */
|
2012-05-12 22:39:39 +02:00
|
|
|
/* reload only frees, doesn't read until image_get_ibuf() called */
|
2019-04-17 06:17:24 +02:00
|
|
|
#define IMA_SIGNAL_RELOAD 0
|
|
|
|
#define IMA_SIGNAL_FREE 1
|
2012-05-12 22:39:39 +02:00
|
|
|
/* source changes, from image to sequence or movie, etc */
|
2019-04-17 06:17:24 +02:00
|
|
|
#define IMA_SIGNAL_SRC_CHANGE 5
|
2012-05-12 22:39:39 +02:00
|
|
|
/* image-user gets a new image, check settings */
|
2019-04-17 06:17:24 +02:00
|
|
|
#define IMA_SIGNAL_USER_NEW_IMAGE 6
|
|
|
|
#define IMA_SIGNAL_COLORMANAGE 7
|
2006-12-20 18:57:56 +01:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
#define IMA_CHAN_FLAG_BW 1
|
|
|
|
#define IMA_CHAN_FLAG_RGB 2
|
2011-11-25 04:47:34 +01:00
|
|
|
#define IMA_CHAN_FLAG_ALPHA 4
|
|
|
|
|
2012-11-15 16:59:58 +01:00
|
|
|
/* checks whether there's an image buffer for given image and user */
|
2014-02-03 08:55:59 +01:00
|
|
|
bool BKE_image_has_ibuf(struct Image *ima, struct ImageUser *iuser);
|
2006-12-20 18:57:56 +01:00
|
|
|
|
2009-09-30 20:18:32 +02:00
|
|
|
/* same as above, but can be used to retrieve images being rendered in
|
|
|
|
* a thread safe way, always call both acquire and release */
|
2015-05-07 23:25:39 +02:00
|
|
|
struct ImBuf *BKE_image_acquire_ibuf(struct Image *ima, struct ImageUser *iuser, void **r_lock);
|
2012-11-15 16:59:58 +01:00
|
|
|
void BKE_image_release_ibuf(struct Image *ima, struct ImBuf *ibuf, void *lock);
|
2009-09-30 20:18:32 +02:00
|
|
|
|
2013-01-21 09:49:42 +01:00
|
|
|
struct ImagePool *BKE_image_pool_new(void);
|
|
|
|
void BKE_image_pool_free(struct ImagePool *pool);
|
2019-04-17 06:17:24 +02:00
|
|
|
struct ImBuf *BKE_image_pool_acquire_ibuf(struct Image *ima,
|
|
|
|
struct ImageUser *iuser,
|
|
|
|
struct ImagePool *pool);
|
2013-01-21 09:49:42 +01:00
|
|
|
void BKE_image_pool_release_ibuf(struct Image *ima, struct ImBuf *ibuf, struct ImagePool *pool);
|
|
|
|
|
2013-02-19 09:37:08 +01:00
|
|
|
/* set an alpha mode based on file extension */
|
2019-04-17 06:17:24 +02:00
|
|
|
char BKE_image_alpha_mode_from_extension_ex(const char *filepath);
|
2013-02-19 09:37:08 +01:00
|
|
|
void BKE_image_alpha_mode_from_extension(struct Image *image);
|
|
|
|
|
2012-05-05 16:52:04 +02:00
|
|
|
/* returns a new image or NULL if it can't load */
|
2013-02-05 13:46:15 +01:00
|
|
|
struct Image *BKE_image_load(struct Main *bmain, const char *filepath);
|
2009-01-04 15:14:06 +01:00
|
|
|
/* returns existing Image when filename/type is same (frame optional) */
|
2018-06-11 15:40:37 +02:00
|
|
|
struct Image *BKE_image_load_exists_ex(struct Main *bmain, const char *filepath, bool *r_exists);
|
|
|
|
struct Image *BKE_image_load_exists(struct Main *bmain, const char *filepath);
|
2006-12-20 18:57:56 +01:00
|
|
|
|
|
|
|
/* adds image, adds ibuf, generates color or pattern */
|
2019-04-17 06:17:24 +02:00
|
|
|
struct Image *BKE_image_add_generated(struct Main *bmain,
|
|
|
|
unsigned int width,
|
|
|
|
unsigned int height,
|
|
|
|
const char *name,
|
|
|
|
int depth,
|
|
|
|
int floatbuf,
|
|
|
|
short gen_type,
|
|
|
|
const float color[4],
|
2019-06-26 15:04:44 +02:00
|
|
|
const bool stereo3d,
|
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
|
|
|
const bool is_data,
|
|
|
|
const bool tiled);
|
2010-03-08 21:08:04 +01:00
|
|
|
/* adds image from imbuf, owns imbuf */
|
2018-06-11 15:40:37 +02:00
|
|
|
struct Image *BKE_image_add_from_imbuf(struct Main *bmain, struct ImBuf *ibuf, const char *name);
|
2006-12-20 18:57:56 +01:00
|
|
|
|
|
|
|
/* for reload, refresh, pack */
|
2016-02-20 22:36:02 +01:00
|
|
|
void BKE_imageuser_default(struct ImageUser *iuser);
|
2015-04-06 15:40:12 +02:00
|
|
|
void BKE_image_init_imageuser(struct Image *ima, struct ImageUser *iuser);
|
2018-06-11 15:40:37 +02:00
|
|
|
void BKE_image_signal(struct Main *bmain, struct Image *ima, struct ImageUser *iuser, int signal);
|
2006-12-20 18:57:56 +01:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
void BKE_image_walk_all_users(const struct Main *mainp,
|
|
|
|
void *customdata,
|
|
|
|
void callback(struct Image *ima,
|
2019-06-26 19:34:35 +02:00
|
|
|
struct ID *iuser_id,
|
2019-04-17 06:17:24 +02:00
|
|
|
struct ImageUser *iuser,
|
|
|
|
void *customdata));
|
2012-06-04 12:41:18 +02:00
|
|
|
|
2006-12-20 18:57:56 +01:00
|
|
|
/* ensures an Image exists for viewing nodes or render */
|
2020-03-06 03:02:59 +01:00
|
|
|
struct Image *BKE_image_ensure_viewer(struct Main *bmain, int type, const char *name);
|
2015-04-06 15:40:12 +02:00
|
|
|
/* ensures the view node cache is compatible with the scene views */
|
2020-03-06 03:02:59 +01:00
|
|
|
void BKE_image_ensure_viewer_views(const struct RenderData *rd,
|
2019-04-17 06:17:24 +02:00
|
|
|
struct Image *ima,
|
|
|
|
struct ImageUser *iuser);
|
2006-12-20 18:57:56 +01:00
|
|
|
|
|
|
|
/* called on frame change or before render */
|
2019-06-17 11:39:52 +02:00
|
|
|
void BKE_image_user_frame_calc(struct Image *ima, struct ImageUser *iuser, int cfra);
|
2019-04-17 06:17:24 +02:00
|
|
|
int BKE_image_user_frame_get(const struct ImageUser *iuser, int cfra, bool *r_is_in_range);
|
2018-06-17 17:05:51 +02:00
|
|
|
void BKE_image_user_file_path(struct ImageUser *iuser, struct Image *ima, char *path);
|
2019-02-18 13:23:49 +01:00
|
|
|
void BKE_image_editors_update_frame(const struct Main *bmain, int cfra);
|
|
|
|
|
|
|
|
/* dependency graph update for image user users */
|
|
|
|
bool BKE_image_user_id_has_animation(struct ID *id);
|
2020-09-04 20:59:13 +02:00
|
|
|
void BKE_image_user_id_eval_animation(struct Depsgraph *depsgraph, struct ID *id);
|
2006-12-20 18:57:56 +01:00
|
|
|
|
|
|
|
/* sets index offset for multilayer files */
|
|
|
|
struct RenderPass *BKE_image_multilayer_index(struct RenderResult *rr, struct ImageUser *iuser);
|
|
|
|
|
2015-04-06 15:40:12 +02:00
|
|
|
/* sets index offset for multiview files */
|
|
|
|
void BKE_image_multiview_index(struct Image *ima, struct ImageUser *iuser);
|
|
|
|
|
2006-12-20 18:57:56 +01:00
|
|
|
/* for multilayer images as well as for render-viewer */
|
2015-04-06 15:40:12 +02:00
|
|
|
bool BKE_image_is_multilayer(struct Image *ima);
|
2015-10-11 01:14:02 +02:00
|
|
|
bool BKE_image_is_multiview(struct Image *ima);
|
|
|
|
bool BKE_image_is_stereo(struct Image *ima);
|
2009-09-30 20:18:32 +02:00
|
|
|
struct RenderResult *BKE_image_acquire_renderresult(struct Scene *scene, struct Image *ima);
|
|
|
|
void BKE_image_release_renderresult(struct Scene *scene, struct Image *ima);
|
2010-03-27 16:35:34 +01:00
|
|
|
|
2015-04-06 15:40:12 +02:00
|
|
|
/* for multilayer images as well as for singlelayer */
|
|
|
|
bool BKE_image_is_openexr(struct Image *ima);
|
|
|
|
|
2010-03-27 16:35:34 +01:00
|
|
|
/* for multiple slot render, call this before render */
|
2015-11-30 00:51:30 +01:00
|
|
|
void BKE_image_backup_render(struct Scene *scene, struct Image *ima, bool free_current_slot);
|
2015-04-06 15:40:12 +02:00
|
|
|
|
|
|
|
/* for singlelayer openexr saving */
|
2019-04-17 06:17:24 +02:00
|
|
|
bool BKE_image_save_openexr_multiview(struct Image *ima,
|
|
|
|
struct ImBuf *ibuf,
|
|
|
|
const char *filepath,
|
|
|
|
const int flags);
|
2015-04-06 15:40:12 +02:00
|
|
|
|
2006-12-20 18:57:56 +01:00
|
|
|
/* goes over all textures that use images */
|
2019-04-17 06:17:24 +02:00
|
|
|
void BKE_image_free_all_textures(struct Main *bmain);
|
2006-12-20 18:57:56 +01:00
|
|
|
|
|
|
|
/* does one image! */
|
2019-04-17 06:17:24 +02:00
|
|
|
void BKE_image_free_anim_ibufs(struct Image *ima, int except_frame);
|
2006-12-20 18:57:56 +01:00
|
|
|
|
|
|
|
/* does all images with type MOVIE or SEQUENCE */
|
2020-09-04 20:59:13 +02:00
|
|
|
void BKE_image_all_free_anim_ibufs(struct Main *bmain, int cfra);
|
3D view orbit option: Around Active
This fixes the active object in place when orbiting the view.
Choppy 15fps demo can be seen there: http://www.elysiun.com/~theeth/bf/around_active.html
Image Memory Grabage Collection
This adds memory handling to the image code. An image is tagged each time it is used.
During a collection cycle (frequency of cycles is user defined), if an image is older
than a user defined limit, its buffer gets deallocated. This also applies to gl memory buffers.
Images that are loading in GL memory needs to go through two time outs before being fully deallocated: the first time out deallocated the gl memorry, the second the buffer in ram.
Notes:
Image buffer loaded from python gets tagged as permanent upon load. That tag is removed when python stops using the image.
I might have missed some tagging spots, especially in the rendering pipeline. Someone with more knowledge about this code should check to be careful.
Tagging is done on every access, for rendering, this will probably be a performance hit. A scheme should be developped to only tag when the rendering is completed.
Collecting is called in draw_object, most likely not the best place to do it.
Safe from undo, since using undo deallocates memory anyway (like when loading a blend file with one currently opened)
Userpref DNA changes:
I've changed a couple of flagging variables from short to int. Some because they needed more space, others to keep SDNA happy.
Info window changes:
I've grouped a couple of buttons in aligned blocks and changed the color of mutually exclusive options to make them clearer.
Matt didn't do any changes on that in tuhopuu, so hopefully I'm not stepping on anyone's feet with this.
Also changed double constants into floats with f in a couple of places (mostly space.c) to make compiler happier.
2005-07-06 02:33:41 +02:00
|
|
|
|
2020-07-29 18:13:19 +02:00
|
|
|
void BKE_image_free_all_gputextures(struct Main *bmain);
|
|
|
|
void BKE_image_free_anim_gputextures(struct Main *bmain);
|
|
|
|
void BKE_image_free_old_gputextures(struct Main *bmain);
|
|
|
|
|
2018-03-03 16:55:08 +01:00
|
|
|
bool BKE_image_memorypack(struct Image *ima);
|
2015-04-06 15:40:12 +02:00
|
|
|
void BKE_image_packfiles(struct ReportList *reports, struct Image *ima, const char *basepath);
|
2019-04-17 06:17:24 +02:00
|
|
|
void BKE_image_packfiles_from_mem(struct ReportList *reports,
|
|
|
|
struct Image *ima,
|
|
|
|
char *data,
|
|
|
|
const size_t data_len);
|
3D view orbit option: Around Active
This fixes the active object in place when orbiting the view.
Choppy 15fps demo can be seen there: http://www.elysiun.com/~theeth/bf/around_active.html
Image Memory Grabage Collection
This adds memory handling to the image code. An image is tagged each time it is used.
During a collection cycle (frequency of cycles is user defined), if an image is older
than a user defined limit, its buffer gets deallocated. This also applies to gl memory buffers.
Images that are loading in GL memory needs to go through two time outs before being fully deallocated: the first time out deallocated the gl memorry, the second the buffer in ram.
Notes:
Image buffer loaded from python gets tagged as permanent upon load. That tag is removed when python stops using the image.
I might have missed some tagging spots, especially in the rendering pipeline. Someone with more knowledge about this code should check to be careful.
Tagging is done on every access, for rendering, this will probably be a performance hit. A scheme should be developped to only tag when the rendering is completed.
Collecting is called in draw_object, most likely not the best place to do it.
Safe from undo, since using undo deallocates memory anyway (like when loading a blend file with one currently opened)
Userpref DNA changes:
I've changed a couple of flagging variables from short to int. Some because they needed more space, others to keep SDNA happy.
Info window changes:
I've grouped a couple of buttons in aligned blocks and changed the color of mutually exclusive options to make them clearer.
Matt didn't do any changes on that in tuhopuu, so hopefully I'm not stepping on anyone's feet with this.
Also changed double constants into floats with f in a couple of places (mostly space.c) to make compiler happier.
2005-07-06 02:33:41 +02:00
|
|
|
|
2008-02-01 13:14:15 +01:00
|
|
|
/* prints memory statistics for images */
|
2018-06-11 15:40:37 +02:00
|
|
|
void BKE_image_print_memlist(struct Main *bmain);
|
2008-02-01 13:14:15 +01:00
|
|
|
|
2009-01-27 20:32:44 +01:00
|
|
|
/* empty image block, of similar type and filename */
|
2017-06-14 22:36:30 +02:00
|
|
|
struct Image *BKE_image_copy(struct Main *bmain, const struct Image *ima);
|
2009-01-27 20:32:44 +01:00
|
|
|
|
|
|
|
/* merge source into dest, and free source */
|
2018-06-11 15:40:37 +02:00
|
|
|
void BKE_image_merge(struct Main *bmain, struct Image *dest, struct Image *source);
|
2009-01-27 20:32:44 +01:00
|
|
|
|
2012-05-17 17:26:11 +02:00
|
|
|
/* scale the image */
|
2014-02-03 08:55:59 +01:00
|
|
|
bool BKE_image_scale(struct Image *image, int width, int height);
|
2012-05-17 17:26:11 +02:00
|
|
|
|
TexFace to Material Settings big patch
Summary:
========
The idea here is to move the texface options into the material panel.
For images with the change please visit:
http://code.blender.org/index.php/2011/09/bge-material-texface-changes
1 - Some of the legacy problems 2.49 and 2.5x has with the texface system:
==========================================================================
1.1) Shadow, Bilboard and Halo are mutual exclusive (in the code), yet you can
select a face to be more than one mode.
1.2) Sort only works for blend Alpha yet it's an option regardless of the
Transparency Blend you pick.
1.3) Shared doesn't affect anything in BGE.
1.4) ObColor only works for Text objects (old bitmap texts) when using Texture
Face Materials. (not address yet, I so far ignored obcolor)
2 - Notes:
============
2.1) Now "Use Face Textures" in material Option panel will work in Multitexture
even if there is no texture channel.
2.2) In FaceTexture mode it will use TexFace all the time, even if you don't
check the "Use Texture Face" option in the UI. It's a matter of decision, since
the code for either way is there. I decided by the solution that makes the
creation of a material fast - in this mode the user doesn't need to mess with
textures or this "Use Texture Face" option at all. I'm not strong in my opinion
here. But I think if we don't have this then what is the point of the Texture
Face mode?
2.3) I kept references for tface only when we need the image, UV or the tiling
setting. It should help later when/if we split the Image and UV layers from the
tface struct (Campbell and Brecht proposal).
3 - Changes in a Nutshell:
==========================
3.1) "Texture Face" panel (in the Mesh/Object Data panel) no longer exists. Those settings are all part of the material properties, visible when Game Render is set.
3.2) "Texture Face" Shading mode (in the Render panel) is now called “Single Texture”, it needs a material for special settings (e.g. Billboard, Alpha Sort, …).
3.3) New options in the Material Panel
* Shadeless option in the Material panel is now supported for all three Shading modes.
* Physics is now toggleable, this is the old Collision option.
* Two Side (on) is now called Back Culling (off).
* Alpha Sort is one of the Alpha options, together (and mutually exclusive) to Alpha Blend, Alpha Clip, Add and Opaque (i.e. solid).
* Shadow, Billboard and Halo are grouped in the “Face Orientation” property.
* "Face Textures" and "Face Textures Alpha" (under Options) can be used for all but GLSL shading mode (to be supported in GLSL eventually).
* The backend in the game engine is still the same as before. The only changes are in the interface and in the way you need to think your materials. The bottomline is: It’s no longer possible to share materials between faces that do not share the same game properties.
4 - Acknowledgment:
==================
Mike Pan for the design discussions, and testing along the whole development process.
Vitor Balbio for the first hands-on code with the interface changes. That helped me a lot to push me into work on that.
Benoit Bolsee and Brecht van Lommel for patch review (* no one reviewed the whole patch, or the latest iteractions, so I still hold liability for any problems).
Blender artists that gave feedback and helped testing the patch.
Patch review and original documentation can be found here:
http://wiki.blender.org/index.php/User:Dfelinto/TexFace
http://codereview.appspot.com/4289041/
2011-09-19 21:55:59 +02:00
|
|
|
/* check if texture has alpha (depth=32) */
|
2014-02-03 08:55:59 +01:00
|
|
|
bool BKE_image_has_alpha(struct Image *image);
|
TexFace to Material Settings big patch
Summary:
========
The idea here is to move the texface options into the material panel.
For images with the change please visit:
http://code.blender.org/index.php/2011/09/bge-material-texface-changes
1 - Some of the legacy problems 2.49 and 2.5x has with the texface system:
==========================================================================
1.1) Shadow, Bilboard and Halo are mutual exclusive (in the code), yet you can
select a face to be more than one mode.
1.2) Sort only works for blend Alpha yet it's an option regardless of the
Transparency Blend you pick.
1.3) Shared doesn't affect anything in BGE.
1.4) ObColor only works for Text objects (old bitmap texts) when using Texture
Face Materials. (not address yet, I so far ignored obcolor)
2 - Notes:
============
2.1) Now "Use Face Textures" in material Option panel will work in Multitexture
even if there is no texture channel.
2.2) In FaceTexture mode it will use TexFace all the time, even if you don't
check the "Use Texture Face" option in the UI. It's a matter of decision, since
the code for either way is there. I decided by the solution that makes the
creation of a material fast - in this mode the user doesn't need to mess with
textures or this "Use Texture Face" option at all. I'm not strong in my opinion
here. But I think if we don't have this then what is the point of the Texture
Face mode?
2.3) I kept references for tface only when we need the image, UV or the tiling
setting. It should help later when/if we split the Image and UV layers from the
tface struct (Campbell and Brecht proposal).
3 - Changes in a Nutshell:
==========================
3.1) "Texture Face" panel (in the Mesh/Object Data panel) no longer exists. Those settings are all part of the material properties, visible when Game Render is set.
3.2) "Texture Face" Shading mode (in the Render panel) is now called “Single Texture”, it needs a material for special settings (e.g. Billboard, Alpha Sort, …).
3.3) New options in the Material Panel
* Shadeless option in the Material panel is now supported for all three Shading modes.
* Physics is now toggleable, this is the old Collision option.
* Two Side (on) is now called Back Culling (off).
* Alpha Sort is one of the Alpha options, together (and mutually exclusive) to Alpha Blend, Alpha Clip, Add and Opaque (i.e. solid).
* Shadow, Billboard and Halo are grouped in the “Face Orientation” property.
* "Face Textures" and "Face Textures Alpha" (under Options) can be used for all but GLSL shading mode (to be supported in GLSL eventually).
* The backend in the game engine is still the same as before. The only changes are in the interface and in the way you need to think your materials. The bottomline is: It’s no longer possible to share materials between faces that do not share the same game properties.
4 - Acknowledgment:
==================
Mike Pan for the design discussions, and testing along the whole development process.
Vitor Balbio for the first hands-on code with the interface changes. That helped me a lot to push me into work on that.
Benoit Bolsee and Brecht van Lommel for patch review (* no one reviewed the whole patch, or the latest iteractions, so I still hold liability for any problems).
Blender artists that gave feedback and helped testing the patch.
Patch review and original documentation can be found here:
http://wiki.blender.org/index.php/User:Dfelinto/TexFace
http://codereview.appspot.com/4289041/
2011-09-19 21:55:59 +02:00
|
|
|
|
World textures displaying for viewport in BI.
This patch supports "Image or Movie" and "Environment map" types of world texture for the viewport.
It supports:
- "View", "AngMap" and "Equirectangular" types of mapping.
- Different types of texture blending (according to BI world render).
- Same color blending as when it lacked textures (but render via glsl).
{F207734}
{F207735}
Example: {F275180}
Original author: @valentin_b4w
Regards,
Alexander (Blend4Web Team).
Reviewers: sergey, valentin_b4w, brecht, merwin
Reviewed By: merwin
Subscribers: campbellbarton, merwin, blueprintrandom, youle, a.romanov, yurikovelenov, AlexKowel, Evgeny_Rodygin
Projects: #rendering, #opengl_gfx, #bf_blender:_next
Differential Revision: https://developer.blender.org/D1414
2016-01-27 10:06:57 +01:00
|
|
|
/* check if texture has gpu texture code */
|
2018-06-11 22:30:59 +02:00
|
|
|
bool BKE_image_has_opengl_texture(struct Image *ima);
|
World textures displaying for viewport in BI.
This patch supports "Image or Movie" and "Environment map" types of world texture for the viewport.
It supports:
- "View", "AngMap" and "Equirectangular" types of mapping.
- Different types of texture blending (according to BI world render).
- Same color blending as when it lacked textures (but render via glsl).
{F207734}
{F207735}
Example: {F275180}
Original author: @valentin_b4w
Regards,
Alexander (Blend4Web Team).
Reviewers: sergey, valentin_b4w, brecht, merwin
Reviewed By: merwin
Subscribers: campbellbarton, merwin, blueprintrandom, youle, a.romanov, yurikovelenov, AlexKowel, Evgeny_Rodygin
Projects: #rendering, #opengl_gfx, #bf_blender:_next
Differential Revision: https://developer.blender.org/D1414
2016-01-27 10:06:57 +01:00
|
|
|
|
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
|
|
|
/* get tile index for tiled images */
|
|
|
|
void BKE_image_get_tile_label(struct Image *ima,
|
|
|
|
struct ImageTile *tile,
|
|
|
|
char *label,
|
|
|
|
int len_label);
|
|
|
|
|
|
|
|
struct ImageTile *BKE_image_add_tile(struct Image *ima, int tile_number, const char *label);
|
|
|
|
bool BKE_image_remove_tile(struct Image *ima, struct ImageTile *tile);
|
|
|
|
|
|
|
|
bool BKE_image_fill_tile(struct Image *ima,
|
|
|
|
struct ImageTile *tile,
|
|
|
|
int width,
|
|
|
|
int height,
|
|
|
|
const float color[4],
|
|
|
|
int gen_type,
|
|
|
|
int planes,
|
|
|
|
bool is_float);
|
|
|
|
|
|
|
|
struct ImageTile *BKE_image_get_tile(struct Image *ima, int tile_number);
|
2020-05-01 06:37:13 +02:00
|
|
|
struct ImageTile *BKE_image_get_tile_from_iuser(struct Image *ima, const struct ImageUser *iuser);
|
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
|
|
|
|
|
|
|
int BKE_image_get_tile_from_pos(struct Image *ima,
|
|
|
|
const float uv[2],
|
2020-03-25 07:58:58 +01:00
|
|
|
float r_uv[2],
|
|
|
|
float r_ofs[2]);
|
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
|
|
|
|
2020-03-25 07:58:58 +01:00
|
|
|
void BKE_image_get_size(struct Image *image, struct ImageUser *iuser, int *r_width, int *r_height);
|
|
|
|
void BKE_image_get_size_fl(struct Image *image, struct ImageUser *iuser, float r_size[2]);
|
|
|
|
void BKE_image_get_aspect(struct Image *image, float *r_aspx, float *r_aspy);
|
2012-09-13 07:29:38 +02:00
|
|
|
|
2010-03-21 01:25:52 +01:00
|
|
|
/* image_gen.c */
|
2019-04-17 06:17:24 +02:00
|
|
|
void BKE_image_buf_fill_color(
|
|
|
|
unsigned char *rect, float *rect_float, int width, int height, const float color[4]);
|
2019-10-02 23:31:24 +02:00
|
|
|
void BKE_image_buf_fill_checker(unsigned char *rect, float *rect_float, int width, int height);
|
2019-04-17 06:17:24 +02:00
|
|
|
void BKE_image_buf_fill_checker_color(unsigned char *rect,
|
|
|
|
float *rect_float,
|
2019-10-02 23:31:24 +02:00
|
|
|
int width,
|
|
|
|
int height);
|
2010-03-21 01:25:52 +01:00
|
|
|
|
Movies support for Cycles
This adds support of movie textures for Cycles rendering.
Uses the same builtin images routines as packed/generated images,
but with some extra non-rna hookups from blender_session side.
Basically, it's not so clear how to give access to video frames
via C++ RNA -- it'll require exposing ImBuf to API, doing some
threading locks and so. Ended up adding two more functions which
are actually bad level call, but don't consider it's so much bad
-- we have few bad calls already, which are actually related.
Changed a bit how builtin images names are passing to image
manager. Now it's not just an ID datablock name, but also a frame
number concatenated via '@' character, which makes itpossible to
easily know frame number to be used for movie images, without
adding extra descriptors to image manager.
Decoding of builtin name is a bit slower now, but it should be
still nothing in comparison with rendering complexity.
Also exposed image user's frame_current to python API, which
is needed to get absolute frame number of movie from node's
image user.
P.S. Generated/packed images are also using bad level call but
only does it to make things more clear here. Either all images
are using C++ RNA here or no images does. That's the most clear
for now.
2013-01-16 18:07:25 +01:00
|
|
|
/* Cycles hookup */
|
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
|
|
|
unsigned char *BKE_image_get_pixels_for_frame(struct Image *image, int frame, int tile);
|
|
|
|
float *BKE_image_get_float_pixels_for_frame(struct Image *image, int frame, int tile);
|
Movies support for Cycles
This adds support of movie textures for Cycles rendering.
Uses the same builtin images routines as packed/generated images,
but with some extra non-rna hookups from blender_session side.
Basically, it's not so clear how to give access to video frames
via C++ RNA -- it'll require exposing ImBuf to API, doing some
threading locks and so. Ended up adding two more functions which
are actually bad level call, but don't consider it's so much bad
-- we have few bad calls already, which are actually related.
Changed a bit how builtin images names are passing to image
manager. Now it's not just an ID datablock name, but also a frame
number concatenated via '@' character, which makes itpossible to
easily know frame number to be used for movie images, without
adding extra descriptors to image manager.
Decoding of builtin name is a bit slower now, but it should be
still nothing in comparison with rendering complexity.
Also exposed image user's frame_current to python API, which
is needed to get absolute frame number of movie from node's
image user.
P.S. Generated/packed images are also using bad level call but
only does it to make things more clear here. Either all images
are using C++ RNA here or no images does. That's the most clear
for now.
2013-01-16 18:07:25 +01:00
|
|
|
|
2019-05-14 17:28:13 +02:00
|
|
|
/* Image modifications */
|
|
|
|
bool BKE_image_is_dirty(struct Image *image);
|
|
|
|
void BKE_image_mark_dirty(struct Image *image, struct ImBuf *ibuf);
|
2019-06-19 14:28:54 +02:00
|
|
|
bool BKE_image_buffer_format_writable(struct ImBuf *ibuf);
|
|
|
|
bool BKE_image_is_dirty_writable(struct Image *image, bool *is_format_writable);
|
2019-05-14 17:28:13 +02:00
|
|
|
|
2013-03-27 12:26:10 +01:00
|
|
|
/* Guess offset for the first frame in the sequence */
|
|
|
|
int BKE_image_sequence_guess_offset(struct Image *image);
|
2015-04-06 15:40:12 +02:00
|
|
|
bool BKE_image_has_anim(struct Image *image);
|
|
|
|
bool BKE_image_has_packedfile(struct Image *image);
|
2018-03-04 22:45:22 +01:00
|
|
|
bool BKE_image_has_filepath(struct Image *ima);
|
2014-01-13 18:59:58 +01:00
|
|
|
bool BKE_image_is_animated(struct Image *image);
|
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
|
|
|
bool BKE_image_has_multiple_ibufs(struct Image *image);
|
2019-04-17 06:17:24 +02:00
|
|
|
void BKE_image_file_format_set(struct Image *image,
|
|
|
|
int ftype,
|
|
|
|
const struct ImbFormatOptions *options);
|
2013-12-13 11:22:08 +01:00
|
|
|
bool BKE_image_has_loaded_ibuf(struct Image *image);
|
|
|
|
struct ImBuf *BKE_image_get_ibuf_with_name(struct Image *image, const char *name);
|
|
|
|
struct ImBuf *BKE_image_get_first_ibuf(struct Image *image);
|
2018-06-14 22:46:30 +02:00
|
|
|
|
2020-07-29 18:13:19 +02:00
|
|
|
/* Not to be use directly. */
|
|
|
|
struct GPUTexture *BKE_image_create_gpu_texture_from_ibuf(struct Image *image, struct ImBuf *ibuf);
|
|
|
|
|
|
|
|
/* Get the GPUTexture for a given `Image`.
|
|
|
|
*
|
|
|
|
* `iuser` and `ibuf` are mutual exclusive parameters. The caller can pass the `ibuf` when already
|
|
|
|
* available. It is also required when requesting the GPUTexture for a render result. */
|
|
|
|
struct GPUTexture *BKE_image_get_gpu_texture(struct Image *image,
|
|
|
|
struct ImageUser *iuser,
|
|
|
|
struct ImBuf *ibuf);
|
|
|
|
struct GPUTexture *BKE_image_get_gpu_tiles(struct Image *image,
|
|
|
|
struct ImageUser *iuser,
|
|
|
|
struct ImBuf *ibuf);
|
|
|
|
struct GPUTexture *BKE_image_get_gpu_tilemap(struct Image *image,
|
|
|
|
struct ImageUser *iuser,
|
|
|
|
struct ImBuf *ibuf);
|
2020-09-22 13:52:38 +02:00
|
|
|
bool BKE_image_has_gpu_texture_premultiplied_alpha(struct Image *image, struct ImBuf *ibuf);
|
2020-07-29 18:13:19 +02:00
|
|
|
void BKE_image_update_gputexture(
|
|
|
|
struct Image *ima, struct ImageUser *iuser, int x, int y, int w, int h);
|
|
|
|
void BKE_image_paint_set_mipmap(struct Main *bmain, bool mipmap);
|
|
|
|
|
|
|
|
/* Delayed free of OpenGL buffers by main thread */
|
|
|
|
void BKE_image_free_unused_gpu_textures(void);
|
|
|
|
|
2018-06-14 22:46:30 +02:00
|
|
|
struct RenderSlot *BKE_image_add_renderslot(struct Image *ima, const char *name);
|
|
|
|
bool BKE_image_remove_renderslot(struct Image *ima, struct ImageUser *iuser, int slot);
|
2020-09-04 20:59:13 +02:00
|
|
|
struct RenderSlot *BKE_image_get_renderslot(struct Image *ima, int index);
|
2018-06-14 22:46:30 +02:00
|
|
|
bool BKE_image_clear_renderslot(struct Image *ima, struct ImageUser *iuser, int slot);
|
|
|
|
|
2002-10-12 13:37:38 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|