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
diff options
context:
space:
mode:
authorSiddhartha Jejurkar <sidd017>2021-09-29 10:47:32 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-09-29 10:48:35 +0300
commitbf06f76be6316be92a4655a41391e163d2fb1221 (patch)
tree5dac6a12fb65f0897806739d5ef8e00407112041 /source/blender/makesdna
parent008ae26712f85475a8a9dc4d031447e12fb05522 (diff)
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
Diffstat (limited to 'source/blender/makesdna')
-rw-r--r--source/blender/makesdna/DNA_scene_types.h7
-rw-r--r--source/blender/makesdna/DNA_space_types.h12
2 files changed, 15 insertions, 4 deletions
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index b28c3ac2b85..9a5c51825e1 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -1463,14 +1463,15 @@ typedef struct ToolSettings {
char edge_mode_live_unwrap;
- char _pad1[1];
-
/* Transform */
char transform_pivot_point;
char transform_flag;
- char snap_mode, snap_node_mode;
+ char snap_mode;
+ char snap_node_mode;
char snap_uv_mode;
char snap_flag;
+ /** UV equivalent of `snap_flag`, limited to: #SCE_SNAP_ABS_GRID. */
+ char snap_uv_flag;
char snap_target;
char snap_transform_mode_flag;
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index 075575775ed..a8f21e597c5 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -1200,6 +1200,12 @@ typedef struct SpaceImage {
float uv_opacity;
int tile_grid_shape[2];
+ /**
+ * UV editor custom-grid. Value of `N` will produce `NxN` grid.
+ * Use when #SI_CUSTOM_GRID is set.
+ */
+ int custom_grid_subdiv;
+ char _pad3[4];
MaskSpaceInfo mask_info;
SpaceImageOverlay overlay;
@@ -1255,6 +1261,7 @@ typedef enum eSpaceImage_Flag {
SI_FLAG_UNUSED_7 = (1 << 7), /* cleared */
SI_FLAG_UNUSED_8 = (1 << 8), /* cleared */
SI_COORDFLOATS = (1 << 9),
+
SI_FLAG_UNUSED_10 = (1 << 10),
SI_LIVE_UNWRAP = (1 << 11),
SI_USE_ALPHA = (1 << 12),
@@ -1266,7 +1273,7 @@ typedef enum eSpaceImage_Flag {
SI_FULLWINDOW = (1 << 16),
SI_FLAG_UNUSED_17 = (1 << 17),
- SI_FLAG_UNUSED_18 = (1 << 18), /* cleared */
+ SI_CUSTOM_GRID = (1 << 18),
/**
* This means that the image is drawn until it reaches the view edge,
@@ -1292,6 +1299,9 @@ typedef enum eSpaceImageOverlay_Flag {
SI_OVERLAY_SHOW_OVERLAYS = (1 << 0),
} eSpaceImageOverlay_Flag;
+/** Keep in sync with `STEPS_LEN` in `grid_frag.glsl`. */
+#define SI_GRID_STEPS_LEN 8
+
/** \} */
/* -------------------------------------------------------------------- */