From bf06f76be6316be92a4655a41391e163d2fb1221 Mon Sep 17 00:00:00 2001 From: Siddhartha Jejurkar Date: Wed, 29 Sep 2021 17:47:32 +1000 Subject: UV Editor: Grid and snapping improvements Implements T89789, T89792, custom grid (described as dynamic grid in T78389) and UV grid snapping (T78391) Replaces the default UV editor grid with 2 new types of grid : * Custom grid: Allows the user to create an NxN grid, where the value of N is specified by the user. * Subdividing grid: Subdivides the UV editor grid when the user zooms in the viewport and vice versa when zooming out. UV snapping improvements : * Increment snapping: Increment values for snapping are calculated based on which grid type is being used in the UV editor (subdividing or custom). In general the increment value is equal to the distance between 2 visible grid lines. * Absolute grid snap: New toggle added to increment snapping option in the UV editor, allows UV grid snapping during translation. Reviewed By: campbellbarton Ref D12684 --- source/blender/editors/space_image/space_image.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source/blender/editors/space_image/space_image.c') diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index de8e4684d45..5adcdacd49d 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -126,6 +126,8 @@ static SpaceLink *image_create(const ScrArea *UNUSED(area), const Scene *UNUSED( simage->tile_grid_shape[0] = 1; simage->tile_grid_shape[1] = 1; + simage->custom_grid_subdiv = 10; + /* tool header */ region = MEM_callocN(sizeof(ARegion), "tool header for image"); -- cgit v1.2.3 From 4cf4bb2664ebe145dac9715bbbfcc2b96f5ff175 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 28 Sep 2021 14:44:36 +1000 Subject: UI: swap tool and regular header Swap the tool-header and header order so the tool-header so the header is always next to the window edge. Note that files saved in 3.0 will have overlapping headers when opened in any version of Blender before this commit. Reviewed By: Severin, fsiddi Maniphest Tasks: T91536 Ref D12631 --- source/blender/editors/space_image/space_image.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'source/blender/editors/space_image/space_image.c') diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index 5adcdacd49d..f14a8266cdd 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -128,20 +128,20 @@ static SpaceLink *image_create(const ScrArea *UNUSED(area), const Scene *UNUSED( simage->custom_grid_subdiv = 10; - /* tool header */ - region = MEM_callocN(sizeof(ARegion), "tool header for image"); + /* header */ + region = MEM_callocN(sizeof(ARegion), "header for image"); BLI_addtail(&simage->regionbase, region); - region->regiontype = RGN_TYPE_TOOL_HEADER; + region->regiontype = RGN_TYPE_HEADER; region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP; - region->flag = RGN_FLAG_HIDDEN | RGN_FLAG_HIDDEN_BY_USER; - /* header */ - region = MEM_callocN(sizeof(ARegion), "header for image"); + /* tool header */ + region = MEM_callocN(sizeof(ARegion), "tool header for image"); BLI_addtail(&simage->regionbase, region); - region->regiontype = RGN_TYPE_HEADER; + region->regiontype = RGN_TYPE_TOOL_HEADER; region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP; + region->flag = RGN_FLAG_HIDDEN | RGN_FLAG_HIDDEN_BY_USER; /* buttons/list view */ region = MEM_callocN(sizeof(ARegion), "buttons for image"); -- cgit v1.2.3