[Bf-blender-cvs] [b3da4f8fd50] temp-udim-images: Added highlighted border around currently selected tile
Lukas Stockner
noreply at git.blender.org
Fri Jun 15 20:46:05 CEST 2018
Commit: b3da4f8fd50363a9be3d963aa0745da24acea492
Author: Lukas Stockner
Date: Fri Jun 15 20:39:59 2018 +0200
Branches: temp-udim-images
https://developer.blender.org/rBb3da4f8fd50363a9be3d963aa0745da24acea492
Added highlighted border around currently selected tile
===================================================================
M release/scripts/startup/bl_ui/space_image.py
M source/blender/editors/space_image/image_draw.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py
index 67331967919..4ddf75eb99c 100644
--- a/release/scripts/startup/bl_ui/space_image.py
+++ b/release/scripts/startup/bl_ui/space_image.py
@@ -781,7 +781,6 @@ class IMAGE_PT_tile_properties(Panel):
row.operator("image.add_tile")
row.operator("image.remove_tile")
- layout.prop(sima, "current_tile")
tile = ima.tiles.get(sima.current_tile)
if tile:
layout.prop(tile, "label")
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c
index ae14cba3de5..22fc843d7db 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -655,6 +655,23 @@ static void draw_image_paint_helpers(const bContext *C, ARegion *ar, Scene *scen
}
}
+static void draw_udim_tile_grid(unsigned int pos_attr, unsigned int color_attr,
+ ARegion *ar, int tile_number,
+ float stepx, float stepy, const float color[3])
+{
+ int x = tile_number % 10;
+ int y = tile_number / 10;
+ float x1, y1;
+ UI_view2d_view_to_region_fl(&ar->v2d, x, y, &x1, &y1);
+ int gridpos[5][2] = {{0, 0}, {0, 1}, {1, 1}, {1, 0}, {0, 0}};
+ for(int i = 0; i < 4; i++) {
+ immAttrib3fv(color_attr, color);
+ immVertex2f(pos_attr, x1 + gridpos[i][0]*stepx, y1 + gridpos[i][1]*stepy);
+ immAttrib3fv(color_attr, color);
+ immVertex2f(pos_attr, x1 + gridpos[i+1][0]*stepx, y1 + gridpos[i+1][1]*stepy);
+ }
+}
+
static bool draw_image_udim_grid(ARegion *ar, SpaceImage *sima, float zoomx, float zoomy, bool draw_tilegrids)
{
Image *ima = ED_space_image(sima);
@@ -676,23 +693,16 @@ static bool draw_image_udim_grid(ARegion *ar, SpaceImage *sima, float zoomx, flo
immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR);
int num_tiles = BLI_listbase_count(&ima->tiles);
- immBegin(GWN_PRIM_LINES, 8*num_tiles);
- float theme_color[3];
+ immBegin(GWN_PRIM_LINES, 8*(num_tiles + 1));
+
+ float theme_color[3], selected_color[3];
UI_GetThemeColorShade3fv(TH_BACK, 20.0f, theme_color);
+ UI_GetThemeColor3fv(TH_FACE_SELECT, selected_color);
LISTBASE_FOREACH(ImageTile*, tile, &ima->tiles) {
- int x = tile->tile_number % 10;
- int y = tile->tile_number / 10;
- float x1, y1;
- UI_view2d_view_to_region_fl(&ar->v2d, x, y, &x1, &y1);
- int gridpos[5][2] = {{0, 0}, {0, 1}, {1, 1}, {1, 0}, {0, 0}};
- for(int i = 0; i < 4; i++) {
- immAttrib3fv(color, theme_color);
- immVertex2f(pos, x1 + gridpos[i][0]*stepx, y1 + gridpos[i][1]*stepy);
- immAttrib3fv(color, theme_color);
- immVertex2f(pos, x1 + gridpos[i+1][0]*stepx, y1 + gridpos[i+1][1]*stepy);
- }
+ draw_udim_tile_grid(pos, color, ar, tile->tile_number, stepx, stepy, theme_color);
}
+ draw_udim_tile_grid(pos, color, ar, sima->curtile, stepx, stepy, selected_color);
immEnd();
immUnbindProgram();
More information about the Bf-blender-cvs
mailing list