UVEdit: Add back uv angle stretch aspect correction
[blender.git] / source / blender / editors / uvedit / uvedit_draw.c
index 30bc6301487b14e9b986076cc894c9352562f838..46c62c4a086ebd93454a37cd211df0a710c86ce2 100644 (file)
@@ -305,7 +305,9 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit, Depsgraph *
 
        if (faces) {
                GPU_batch_program_set_builtin(faces, (draw_stretch)
-                                                    ? GPU_SHADER_2D_UV_FACES_STRETCH
+                                                    ? (sima->dt_uvstretch == SI_UVDT_STRETCH_AREA)
+                                                      ? GPU_SHADER_2D_UV_FACES_STRETCH_AREA
+                                                      : GPU_SHADER_2D_UV_FACES_STRETCH_ANGLE
                                                     : GPU_SHADER_2D_UV_FACES);
 
                if (!draw_stretch) {
@@ -319,6 +321,11 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit, Depsgraph *
                        GPU_batch_uniform_4fv(faces, "selectColor", col2);
                        GPU_batch_uniform_4fv(faces, "activeColor", col3);
                }
+               else if (sima->dt_uvstretch == SI_UVDT_STRETCH_ANGLE) {
+                       float asp[2];
+                       ED_space_image_get_uv_aspect(sima, &asp[0], &asp[1]);
+                       GPU_batch_uniform_2fv(faces, "aspect", asp);
+               }
 
                GPU_batch_draw(faces);