Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorLukas Stockner <lukas.stockner@freenet.de>2020-02-06 05:36:46 +0300
committerLukas Stockner <lukas.stockner@freenet.de>2020-02-06 05:37:43 +0300
commit8c353931afe1ac8969bcf7cdadc056f322cb2af8 (patch)
treec9f7c5f804c41c3db3430871dde2e57cc69b5639 /source
parentd1112ae0d0e602fcba58c39147cbcd66fe624564 (diff)
parent3caefc89ee1afc20c5ee46c0ddf538213d802819 (diff)
Merge branch 'blender-v2.82-release'
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/space_image/image_ops.c45
1 files changed, 41 insertions, 4 deletions
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 17c6f76a1d9..e6bd563b02f 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -781,6 +781,29 @@ static int image_view_all_exec(bContext *C, wmOperator *op)
w = width * aspx;
h = height * aspy;
+ float xof = 0.0f, yof = 0.0f;
+ if ((sima->image == NULL) || (sima->image->source == IMA_SRC_TILED)) {
+ /* Extend the shown area to cover all UDIM tiles. */
+ int x_tiles, y_tiles;
+ if (sima->image == NULL) {
+ x_tiles = sima->tile_grid_shape[0];
+ y_tiles = sima->tile_grid_shape[1];
+ }
+ else {
+ x_tiles = y_tiles = 1;
+ LISTBASE_FOREACH (ImageTile *, tile, &sima->image->tiles) {
+ int tile_x = (tile->tile_number - 1001) % 10;
+ int tile_y = (tile->tile_number - 1001) / 10;
+ x_tiles = max_ii(x_tiles, tile_x + 1);
+ y_tiles = max_ii(y_tiles, tile_y + 1);
+ }
+ }
+ xof = 0.5f * (x_tiles - 1.0f) * w;
+ yof = 0.5f * (y_tiles - 1.0f) * h;
+ w *= x_tiles;
+ h *= y_tiles;
+ }
+
/* check if the image will fit in the image with (zoom == 1) */
width = BLI_rcti_size_x(&ar->winrct) + 1;
height = BLI_rcti_size_y(&ar->winrct) + 1;
@@ -806,7 +829,8 @@ static int image_view_all_exec(bContext *C, wmOperator *op)
}
}
- sima->xof = sima->yof = 0.0f;
+ sima->xof = xof;
+ sima->yof = yof;
ED_region_tag_redraw(ar);
@@ -4346,7 +4370,13 @@ static int tile_add_exec(bContext *C, wmOperator *op)
Image *ima = CTX_data_edit_image(C);
int start_tile = RNA_int_get(op->ptr, "number");
- int end_tile = min_ii(start_tile + RNA_int_get(op->ptr, "count"), IMA_UDIM_MAX);
+ int end_tile = start_tile + RNA_int_get(op->ptr, "count");
+
+ if (start_tile < 1001 || end_tile > IMA_UDIM_MAX) {
+ BKE_report(op->reports, RPT_ERROR, "Invalid UDIM index range was specified");
+ return OPERATOR_CANCELLED;
+ }
+
bool fill_tile = RNA_boolean_get(op->ptr, "fill");
char *label = RNA_string_get_alloc(op->ptr, "label", NULL, 0);
@@ -4442,8 +4472,15 @@ void IMAGE_OT_tile_add(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
- RNA_def_int(
- ot->srna, "number", 1002, 1001, INT_MAX, "Number", "UDIM number of the tile", 1001, 1099);
+ RNA_def_int(ot->srna,
+ "number",
+ 1002,
+ 1001,
+ IMA_UDIM_MAX,
+ "Number",
+ "UDIM number of the tile",
+ 1001,
+ 1099);
RNA_def_int(ot->srna, "count", 1, 1, INT_MAX, "Count", "How many tiles to add", 1, 1000);
RNA_def_string(ot->srna, "label", NULL, 0, "Label", "Optional tile label");
RNA_def_boolean(ot->srna, "fill", true, "Fill", "Fill new tile with a generated image");