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 */
|
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
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup spimage
|
2011-02-27 20:29:51 +00:00
|
|
|
*/
|
|
|
|
|
|
2012-02-17 18:59:41 +00:00
|
|
|
#pragma once
|
2008-12-13 17:44:30 +00:00
|
|
|
|
|
|
|
|
/* internal exports only */
|
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
|
|
|
struct ARegion;
|
2009-05-19 17:13:33 +00:00
|
|
|
struct ARegionType;
|
2025-01-07 12:39:13 +01:00
|
|
|
struct ImageUser;
|
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
|
|
|
struct SpaceImage;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct bContext;
|
2009-02-21 18:33:09 +00:00
|
|
|
struct bNodeTree;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct wmOperatorType;
|
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
|
|
|
|
2023-07-31 11:50:54 +10:00
|
|
|
/* `space_image.cc` */
|
2009-02-21 15:31:01 +00:00
|
|
|
|
2023-12-20 15:27:28 +02:00
|
|
|
extern "C" {
|
|
|
|
|
extern const char *image_context_dir[]; /* doc access */
|
|
|
|
|
}
|
2011-02-15 14:38:43 +00:00
|
|
|
|
2023-07-31 11:50:54 +10:00
|
|
|
/* `image_draw.cc` */
|
2021-12-09 00:55:11 +11:00
|
|
|
|
2024-01-04 15:07:48 -05:00
|
|
|
void draw_image_main_helpers(const bContext *C, ARegion *region);
|
|
|
|
|
void draw_image_cache(const bContext *C, ARegion *region);
|
|
|
|
|
void draw_image_sample_line(SpaceImage *sima);
|
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
|
|
|
|
2023-07-31 11:50:54 +10:00
|
|
|
/* `image_ops.cc` */
|
2021-12-09 00:55:11 +11:00
|
|
|
|
2024-01-04 15:07:48 -05:00
|
|
|
bool space_image_main_region_poll(bContext *C);
|
|
|
|
|
bool space_image_view_center_cursor_poll(bContext *C);
|
|
|
|
|
|
|
|
|
|
void IMAGE_OT_view_all(wmOperatorType *ot);
|
|
|
|
|
void IMAGE_OT_view_pan(wmOperatorType *ot);
|
|
|
|
|
void IMAGE_OT_view_selected(wmOperatorType *ot);
|
|
|
|
|
void IMAGE_OT_view_center_cursor(wmOperatorType *ot);
|
|
|
|
|
void IMAGE_OT_view_cursor_center(wmOperatorType *ot);
|
|
|
|
|
void IMAGE_OT_view_zoom(wmOperatorType *ot);
|
|
|
|
|
void IMAGE_OT_view_zoom_in(wmOperatorType *ot);
|
|
|
|
|
void IMAGE_OT_view_zoom_out(wmOperatorType *ot);
|
|
|
|
|
void IMAGE_OT_view_zoom_ratio(wmOperatorType *ot);
|
|
|
|
|
void IMAGE_OT_view_zoom_border(wmOperatorType *ot);
|
2016-08-18 00:21:55 -04:00
|
|
|
#ifdef WITH_INPUT_NDOF
|
2024-01-04 15:07:48 -05:00
|
|
|
void IMAGE_OT_view_ndof(wmOperatorType *ot);
|
2016-08-18 00:21:55 -04:00
|
|
|
#endif
|
2008-12-13 17:44:30 +00:00
|
|
|
|
2024-01-04 15:07:48 -05:00
|
|
|
void IMAGE_OT_new(wmOperatorType *ot);
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Called by other space types too.
|
|
|
|
|
*/
|
2024-01-04 15:07:48 -05:00
|
|
|
void IMAGE_OT_open(wmOperatorType *ot);
|
|
|
|
|
void IMAGE_OT_file_browse(wmOperatorType *ot);
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Called by other space types too.
|
|
|
|
|
*/
|
2024-01-04 15:07:48 -05:00
|
|
|
void IMAGE_OT_match_movie_length(wmOperatorType *ot);
|
|
|
|
|
void IMAGE_OT_replace(wmOperatorType *ot);
|
|
|
|
|
void IMAGE_OT_reload(wmOperatorType *ot);
|
|
|
|
|
void IMAGE_OT_save(wmOperatorType *ot);
|
|
|
|
|
void IMAGE_OT_save_as(wmOperatorType *ot);
|
|
|
|
|
void IMAGE_OT_save_sequence(wmOperatorType *ot);
|
|
|
|
|
void IMAGE_OT_save_all_modified(wmOperatorType *ot);
|
|
|
|
|
void IMAGE_OT_pack(wmOperatorType *ot);
|
|
|
|
|
void IMAGE_OT_unpack(wmOperatorType *ot);
|
|
|
|
|
void IMAGE_OT_clipboard_copy(wmOperatorType *ot);
|
|
|
|
|
void IMAGE_OT_clipboard_paste(wmOperatorType *ot);
|
|
|
|
|
|
|
|
|
|
void IMAGE_OT_flip(wmOperatorType *ot);
|
2024-01-31 23:36:28 +01:00
|
|
|
void IMAGE_OT_rotate_orthogonal(wmOperatorType *ot);
|
2024-01-04 15:07:48 -05:00
|
|
|
void IMAGE_OT_invert(wmOperatorType *ot);
|
|
|
|
|
void IMAGE_OT_resize(wmOperatorType *ot);
|
|
|
|
|
|
|
|
|
|
void IMAGE_OT_cycle_render_slot(wmOperatorType *ot);
|
|
|
|
|
void IMAGE_OT_clear_render_slot(wmOperatorType *ot);
|
|
|
|
|
void IMAGE_OT_add_render_slot(wmOperatorType *ot);
|
|
|
|
|
void IMAGE_OT_remove_render_slot(wmOperatorType *ot);
|
|
|
|
|
|
|
|
|
|
void IMAGE_OT_sample(wmOperatorType *ot);
|
|
|
|
|
void IMAGE_OT_sample_line(wmOperatorType *ot);
|
|
|
|
|
void IMAGE_OT_curves_point_set(wmOperatorType *ot);
|
|
|
|
|
|
|
|
|
|
void IMAGE_OT_change_frame(wmOperatorType *ot);
|
|
|
|
|
|
|
|
|
|
void IMAGE_OT_read_viewlayers(wmOperatorType *ot);
|
|
|
|
|
void IMAGE_OT_render_border(wmOperatorType *ot);
|
|
|
|
|
void IMAGE_OT_clear_render_border(wmOperatorType *ot);
|
|
|
|
|
|
|
|
|
|
void IMAGE_OT_tile_add(wmOperatorType *ot);
|
|
|
|
|
void IMAGE_OT_tile_remove(wmOperatorType *ot);
|
|
|
|
|
void IMAGE_OT_tile_fill(wmOperatorType *ot);
|
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
|
|
|
|
2009-02-21 15:31:01 +00:00
|
|
|
/* image_panels.c */
|
2021-12-09 00:55:11 +11:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets active viewer user.
|
|
|
|
|
*/
|
2024-01-04 15:07:48 -05:00
|
|
|
ImageUser *ntree_get_active_iuser(bNodeTree *ntree);
|
|
|
|
|
void image_buttons_register(ARegionType *art);
|