Blender  V2.93
overlay_edit_uv.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * Copyright 2019, Blender Foundation.
17  */
18 
22 #include "DRW_render.h"
23 
24 #include "draw_cache_impl.h"
25 #include "draw_manager_text.h"
26 
27 #include "BKE_editmesh.h"
28 #include "BKE_image.h"
29 #include "BKE_layer.h"
30 #include "BKE_mask.h"
31 #include "BKE_object.h"
32 #include "BKE_paint.h"
33 
34 #include "DNA_brush_types.h"
35 #include "DNA_mesh_types.h"
36 
37 #include "DEG_depsgraph_query.h"
38 
39 #include "ED_image.h"
40 
41 #include "IMB_imbuf_types.h"
42 
43 #include "GPU_batch.h"
44 
45 #include "UI_interface.h"
46 #include "UI_resources.h"
47 
48 #include "overlay_private.h"
49 
50 /* Forward declarations. */
51 static void overlay_edit_uv_cache_populate(OVERLAY_Data *vedata, Object *ob);
52 
54  void *next, *prev;
55  float *total_area;
56  float *total_area_uv;
58 
60 {
61  const bool is_uv_editor = sima->mode == SI_MODE_UV;
62  if (is_uv_editor) {
63  switch (sima->dt_uv) {
64  case SI_UVDT_OUTLINE:
66  case SI_UVDT_BLACK:
68  case SI_UVDT_WHITE:
70  case SI_UVDT_DASH:
72  default:
74  }
75  }
76  else {
78  }
79 }
80 
81 /* TODO(jbakker): the GPU texture should be cached with the mask. */
83  Mask *mask, const int width, const int height_, const float aspx, const float aspy)
84 {
85  const int height = (float)height_ * (aspy / aspx);
86  MaskRasterHandle *handle;
87  float *buffer = MEM_mallocN(sizeof(float) * height * width, __func__);
88 
89  /* Initialize rasterization handle. */
91  BKE_maskrasterize_handle_init(handle, mask, width, height, true, true, true);
92 
94 
95  /* Free memory. */
99  return texture;
100 }
101 
102 /* -------------------------------------------------------------------- */
107 {
108  OVERLAY_StorageList *stl = vedata->stl;
109  OVERLAY_PrivateData *pd = stl->pd;
110  const DRWContextState *draw_ctx = DRW_context_state_get();
111  SpaceImage *sima = (SpaceImage *)draw_ctx->space_data;
112  const Scene *scene = draw_ctx->scene;
114  const Brush *brush = BKE_paint_brush(&ts->imapaint.paint);
115  const bool show_overlays = !pd->hide_overlays;
116 
117  Image *image = sima->image;
118  /* By design no image is an image type. This so editor shows UV's by default. */
119  const bool is_image_type =
121  const bool is_uv_editor = sima->mode == SI_MODE_UV;
122  const bool has_edit_object = (draw_ctx->object_edit) != NULL;
123  const bool is_paint_mode = sima->mode == SI_MODE_PAINT;
124  const bool is_view_mode = sima->mode == SI_MODE_VIEW;
125  const bool is_mask_mode = sima->mode == SI_MODE_MASK;
126  const bool is_edit_mode = draw_ctx->object_mode == OB_MODE_EDIT;
127  const bool do_uv_overlay = is_image_type && is_uv_editor && has_edit_object;
128  const bool show_modified_uvs = sima->flag & SI_DRAWSHADOW;
129  const bool is_tiled_image = image && (image->source == IMA_SRC_TILED);
130  const bool do_faces = ((sima->flag & SI_NO_DRAWFACES) == 0);
131  const bool do_face_dots = (ts->uv_flag & UV_SYNC_SELECTION) ?
132  (ts->selectmode & SCE_SELECT_FACE) != 0 :
133  (ts->uv_selectmode == UV_SELECT_FACE);
134  const bool do_uvstretching_overlay = is_image_type && is_uv_editor && is_edit_mode &&
135  ((sima->flag & SI_DRAW_STRETCH) != 0);
136  const bool do_tex_paint_shadows = (sima->flag & SI_NO_DRAW_TEXPAINT) == 0;
137  const bool do_stencil_overlay = is_paint_mode && is_image_type && brush &&
138  (brush->imagepaint_tool == PAINT_TOOL_CLONE) &&
139  brush->clone.image;
140 
141  pd->edit_uv.do_faces = show_overlays && do_faces && !do_uvstretching_overlay;
142  pd->edit_uv.do_face_dots = show_overlays && do_faces && do_face_dots;
143  pd->edit_uv.do_uv_overlay = show_overlays && do_uv_overlay;
144  pd->edit_uv.do_uv_shadow_overlay = show_overlays && is_image_type &&
145  ((is_paint_mode && do_tex_paint_shadows &&
146  ((draw_ctx->object_mode &
147  (OB_MODE_TEXTURE_PAINT | OB_MODE_EDIT)) != 0)) ||
148  (is_uv_editor && do_tex_paint_shadows &&
149  ((draw_ctx->object_mode & (OB_MODE_TEXTURE_PAINT)) != 0)) ||
150  (is_view_mode && do_tex_paint_shadows &&
151  ((draw_ctx->object_mode & (OB_MODE_TEXTURE_PAINT)) != 0)) ||
152  (do_uv_overlay && (show_modified_uvs)));
153 
154  pd->edit_uv.do_mask_overlay = show_overlays && is_mask_mode && (sima->mask_info.mask != NULL) &&
155  ((sima->mask_info.draw_flag & MASK_DRAWFLAG_OVERLAY) != 0);
158  draw_ctx->depsgraph, &sima->mask_info.mask->id) :
159  NULL;
160 
161  pd->edit_uv.do_uv_stretching_overlay = show_overlays && do_uvstretching_overlay;
162  pd->edit_uv.uv_opacity = sima->uv_opacity;
163  pd->edit_uv.do_tiled_image_overlay = show_overlays && is_image_type && is_tiled_image;
164  pd->edit_uv.do_tiled_image_border_overlay = is_image_type && is_tiled_image;
165  pd->edit_uv.dash_length = 4.0f * UI_DPI_FAC;
167  pd->edit_uv.do_smooth_wire = ((U.gpu_flag & USER_GPU_FLAG_OVERLAY_SMOOTH_WIRE) != 0);
168  pd->edit_uv.do_stencil_overlay = show_overlays && do_stencil_overlay;
169 
170  pd->edit_uv.draw_type = sima->dt_uvstretch;
172  pd->edit_uv.total_area_ratio = 0.0f;
173  pd->edit_uv.total_area_ratio_inv = 0.0f;
174 
175  /* During engine initialization phase the `sima` isn't locked and
176  * we are able to retrieve the needed data.
177  * During cache_init the image engine locks the `sima` and makes it impossible
178  * to retrieve the data. */
182 }
183 
185 {
186  OVERLAY_StorageList *stl = vedata->stl;
187  OVERLAY_PassList *psl = vedata->psl;
188  OVERLAY_PrivateData *pd = stl->pd;
189 
190  const DRWContextState *draw_ctx = DRW_context_state_get();
191  SpaceImage *sima = (SpaceImage *)draw_ctx->space_data;
192  Image *image = sima->image;
193  const Scene *scene = draw_ctx->scene;
195 
197  /* uv edges */
198  {
203  if (pd->edit_uv.do_uv_shadow_overlay) {
209  pd->edit_uv_shadow_edges_grp, "alpha", pd->edit_uv.uv_opacity);
211  pd->edit_uv_shadow_edges_grp, "dashLength", &pd->edit_uv.dash_length, 1);
213  pd->edit_uv_shadow_edges_grp, "doSmoothWire", &pd->edit_uv.do_smooth_wire, 1);
214  }
215 
216  if (pd->edit_uv.do_uv_overlay) {
222  pd->edit_uv_edges_grp, "dashLength", &pd->edit_uv.dash_length, 1);
224  pd->edit_uv_edges_grp, "doSmoothWire", &pd->edit_uv.do_smooth_wire, 1);
225  }
226  }
227  }
228 
229  if (pd->edit_uv.do_uv_overlay) {
230  /* uv verts */
231  {
237 
238  const float point_size = UI_GetThemeValuef(TH_VERTEX_SIZE) * U.dpi_fac;
239 
242  pd->edit_uv_verts_grp, "pointSize", (point_size + 1.5f) * M_SQRT2);
243  DRW_shgroup_uniform_float_copy(pd->edit_uv_verts_grp, "outlineWidth", 0.75f);
244  }
245 
246  /* uv faces */
247  if (pd->edit_uv.do_faces) {
254  }
255 
256  /* uv face dots */
257  if (pd->edit_uv.do_face_dots) {
258  const float point_size = UI_GetThemeValuef(TH_FACEDOT_SIZE) * U.dpi_fac;
262  DRW_shgroup_uniform_float_copy(pd->edit_uv_face_dots_grp, "pointSize", point_size);
263  }
264  }
265 
266  /* uv stretching */
275  }
276  else /* SI_UVDT_STRETCH_AREA */ {
281  pd->edit_uv_stretching_grp, "totalAreaRatio", &pd->edit_uv.total_area_ratio, 1);
283  pd->edit_uv_stretching_grp, "totalAreaRatioInv", &pd->edit_uv.total_area_ratio_inv, 1);
284  }
285  }
286 
289  float obmat[4][4];
290  unit_m4(obmat);
291 
295 
296  float theme_color[4], selected_color[4];
297  UI_GetThemeColorShade4fv(TH_BACK, 60, theme_color);
298  UI_GetThemeColor4fv(TH_FACE_SELECT, selected_color);
299  srgb_to_linearrgb_v4(theme_color, theme_color);
300  srgb_to_linearrgb_v4(selected_color, selected_color);
301 
303  DRW_shgroup_uniform_vec4_copy(grp, "color", theme_color);
304  DRW_shgroup_uniform_vec3_copy(grp, "offset", (float[3]){0.0f, 0.0f, 0.0f});
305 
306  LISTBASE_FOREACH (ImageTile *, tile, &image->tiles) {
307  const int tile_x = ((tile->tile_number - 1001) % 10);
308  const int tile_y = ((tile->tile_number - 1001) / 10);
309  obmat[3][1] = (float)tile_y;
310  obmat[3][0] = (float)tile_x;
311  DRW_shgroup_call_obmat(grp, geom, obmat);
312  }
313  /* Only mark active border when overlays are enabled. */
315  /* Active tile border */
316  ImageTile *active_tile = BLI_findlink(&image->tiles, image->active_tile_index);
317  if (active_tile) {
318  obmat[3][0] = (float)((active_tile->tile_number - 1001) % 10);
319  obmat[3][1] = (float)((active_tile->tile_number - 1001) / 10);
321  DRW_shgroup_uniform_vec4_copy(grp, "color", selected_color);
322  DRW_shgroup_call_obmat(grp, geom, obmat);
323  }
324  }
325  }
326 
328  struct DRWTextStore *dt = DRW_text_cache_ensure();
329  uchar color[4];
330  /* Color Management: Exception here as texts are drawn in sRGB space directly. */
332  char text[16];
333  LISTBASE_FOREACH (ImageTile *, tile, &image->tiles) {
334  BLI_snprintf(text, 5, "%d", tile->tile_number);
335  float tile_location[3] = {
336  ((tile->tile_number - 1001) % 10), ((tile->tile_number - 1001) / 10), 0.0f};
338  tile_location,
339  text,
340  strlen(text),
341  10,
342  10,
344  color);
345  }
346  }
347 
348  if (pd->edit_uv.do_stencil_overlay) {
349  const Brush *brush = BKE_paint_brush(&ts->imapaint.paint);
350 
354  GPUBatch *geom = DRW_cache_quad_get();
356  Image *stencil_image = brush->clone.image;
357  ImBuf *stencil_ibuf = BKE_image_acquire_ibuf(stencil_image, NULL, &pd->edit_uv.stencil_lock);
358  pd->edit_uv.stencil_ibuf = stencil_ibuf;
359  pd->edit_uv.stencil_image = stencil_image;
360  GPUTexture *stencil_texture = BKE_image_get_gpu_texture(stencil_image, NULL, stencil_ibuf);
361  DRW_shgroup_uniform_texture(grp, "imgTexture", stencil_texture);
362  DRW_shgroup_uniform_bool_copy(grp, "imgPremultiplied", true);
363  DRW_shgroup_uniform_bool_copy(grp, "imgAlphaBlend", true);
364  DRW_shgroup_uniform_vec4_copy(grp, "color", (float[4]){1.0f, 1.0f, 1.0f, brush->clone.alpha});
365 
366  float size_image[2];
367  BKE_image_get_size_fl(image, NULL, size_image);
368  float size_stencil_image[2] = {stencil_ibuf->x, stencil_ibuf->y};
369 
370  float obmat[4][4];
371  unit_m4(obmat);
372  obmat[3][1] = brush->clone.offset[1];
373  obmat[3][0] = brush->clone.offset[0];
374  obmat[0][0] = size_stencil_image[0] / size_image[0];
375  obmat[1][1] = size_stencil_image[1] / size_image[1];
376 
377  DRW_shgroup_call_obmat(grp, geom, obmat);
378  }
379  else {
380  pd->edit_uv.stencil_ibuf = NULL;
381  pd->edit_uv.stencil_image = NULL;
382  }
383 
384  if (pd->edit_uv.do_mask_overlay) {
385  const bool is_combined_overlay = pd->edit_uv.mask_overlay_mode == MASK_OVERLAY_COMBINED;
387  state |= is_combined_overlay ? DRW_STATE_BLEND_MUL : DRW_STATE_BLEND_ALPHA;
389 
391  GPUBatch *geom = DRW_cache_quad_get();
393  GPUTexture *mask_texture = edit_uv_mask_texture(pd->edit_uv.mask,
394  pd->edit_uv.image_size[0],
395  pd->edit_uv.image_size[1],
396  pd->edit_uv.image_aspect[1],
397  pd->edit_uv.image_aspect[1]);
398  pd->edit_uv.mask_texture = mask_texture;
399  DRW_shgroup_uniform_texture(grp, "imgTexture", mask_texture);
400  DRW_shgroup_uniform_vec4_copy(grp, "color", (float[4]){1.0f, 1.0f, 1.0f, 1.0f});
401  DRW_shgroup_call_obmat(grp, geom, NULL);
402  }
403 
404  /* HACK: When editing objects that share the same mesh we should only draw the
405  * first one in the order that is used during uv editing. We can only trust that the first object
406  * has the correct batches with the correct selection state. See T83187. */
408  draw_ctx->obact->type == OB_MESH) {
409  uint objects_len = 0;
411  draw_ctx->view_layer, NULL, &objects_len, draw_ctx->object_mode);
412  for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
413  Object *object_eval = DEG_get_evaluated_object(draw_ctx->depsgraph, objects[ob_index]);
414  DRW_mesh_batch_cache_validate((Mesh *)object_eval->data);
415  overlay_edit_uv_cache_populate(vedata, object_eval);
416  }
417  MEM_freeN(objects);
418  }
419 }
420 
422 {
424  return;
425  }
426 
427  OVERLAY_StorageList *stl = vedata->stl;
428  OVERLAY_PrivateData *pd = stl->pd;
429  GPUBatch *geom;
430 
431  const DRWContextState *draw_ctx = DRW_context_state_get();
432  const bool is_edit_object = DRW_object_is_in_edit_mode(ob);
433  Mesh *me = (Mesh *)ob->data;
434  const bool has_active_object_uvmap = CustomData_get_active_layer(&me->ldata, CD_MLOOPUV) != -1;
435  const bool has_active_edit_uvmap = is_edit_object &&
437  CD_MLOOPUV) != -1);
438  const bool draw_shadows = (draw_ctx->object_mode != OB_MODE_OBJECT) &&
439  (ob->mode == draw_ctx->object_mode);
440 
441  if (has_active_edit_uvmap) {
442  if (pd->edit_uv.do_uv_overlay) {
444  if (geom) {
446  }
448  if (geom) {
450  }
451  if (pd->edit_uv.do_faces) {
453  if (geom) {
455  }
456  }
457  if (pd->edit_uv.do_face_dots) {
459  if (geom) {
461  }
462  }
463  }
464 
468  }
469  else /* SI_UVDT_STRETCH_AREA */ {
471  __func__);
472  BLI_addtail(&pd->edit_uv.totals, totals);
474  me, &totals->total_area, &totals->total_area_uv);
475  }
476  if (geom) {
478  }
479  }
480  }
481 
482  if (draw_shadows && (has_active_object_uvmap || has_active_edit_uvmap)) {
483  if (pd->edit_uv.do_uv_shadow_overlay) {
485  if (geom) {
487  }
488  }
489  }
490 }
491 
493 {
494  OVERLAY_StorageList *stl = vedata->stl;
495  OVERLAY_PrivateData *pd = stl->pd;
496 
498  float total_area = 0.0f;
499  float total_area_uv = 0.0f;
500 
502  total_area += *totals->total_area;
503  total_area_uv += *totals->total_area_uv;
504  }
505 
506  if (total_area > FLT_EPSILON && total_area_uv > FLT_EPSILON) {
507  pd->edit_uv.total_area_ratio = total_area / total_area_uv;
508  pd->edit_uv.total_area_ratio_inv = total_area_uv / total_area;
509  }
510  }
512 }
513 
515 {
516  OVERLAY_StorageList *stl = vedata->stl;
517  OVERLAY_PrivateData *pd = stl->pd;
518 
521  }
522 }
523 
525 {
526  OVERLAY_StorageList *stl = vedata->stl;
527  OVERLAY_PrivateData *pd = stl->pd;
528 
529  if (pd->edit_uv.stencil_ibuf) {
532  pd->edit_uv.stencil_image = NULL;
533  pd->edit_uv.stencil_ibuf = NULL;
534  }
535 
537 }
538 
540 {
541  OVERLAY_PassList *psl = vedata->psl;
542  OVERLAY_StorageList *stl = vedata->stl;
543  OVERLAY_PrivateData *pd = stl->pd;
544 
547  }
548  if (pd->edit_uv.do_mask_overlay) {
549  /* Combined overlay renders in the default framebuffer and modifies the image in SRS.
550  * The alpha overlay renders in the overlay framebuffer. */
551  const bool is_combined_overlay = pd->edit_uv.mask_overlay_mode == MASK_OVERLAY_COMBINED;
552  GPUFrameBuffer *previous_framebuffer = NULL;
553  if (is_combined_overlay) {
555  previous_framebuffer = GPU_framebuffer_active_get();
557  }
559  if (previous_framebuffer) {
560  GPU_framebuffer_bind(previous_framebuffer);
561  }
562  }
563 
566  }
567 
568  if (pd->edit_uv.do_uv_overlay) {
569  if (pd->edit_uv.do_faces) {
571  }
573 
575  }
576  else if (pd->edit_uv.do_uv_shadow_overlay) {
578  }
579  if (pd->edit_uv.do_stencil_overlay) {
581  }
583 }
584 
typedef float(TangentPoint)[2]
int CustomData_get_active_layer(const struct CustomData *data, int type)
void BKE_image_release_ibuf(struct Image *ima, struct ImBuf *ibuf, void *lock)
Definition: image.c:5113
struct ImBuf * BKE_image_acquire_ibuf(struct Image *ima, struct ImageUser *iuser, void **r_lock)
Definition: image.c:5100
void BKE_image_get_size_fl(struct Image *image, struct ImageUser *iuser, float r_size[2])
Definition: image.c:5535
struct GPUTexture * BKE_image_get_gpu_texture(struct Image *image, struct ImageUser *iuser, struct ImBuf *ibuf)
Definition: image_gpu.c:439
#define BKE_view_layer_array_from_objects_in_mode_unique_data(view_layer, v3d, r_len, mode)
Definition: BKE_layer.h:444
void BKE_maskrasterize_handle_free(MaskRasterHandle *mr_handle)
void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mask, const int width, const int height, const bool do_aspect_correct, const bool do_mask_aa, const bool do_feather)
void BKE_maskrasterize_buffer(MaskRasterHandle *mr_handle, const unsigned int width, const unsigned int height, float *buffer)
Rasterize a buffer from a single mask (threaded execution).
MaskRasterHandle * BKE_maskrasterize_handle_new(void)
General operations, lookup, etc. for blender objects.
@ OB_VISIBLE_SELF
Definition: BKE_object.h:125
struct Brush * BKE_paint_brush(struct Paint *paint)
Definition: paint.c:604
#define LISTBASE_FOREACH(type, var, list)
Definition: BLI_listbase.h:172
BLI_INLINE void BLI_listbase_clear(struct ListBase *lb)
Definition: BLI_listbase.h:128
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
Definition: listbase.c:547
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:110
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define M_SQRT2
Definition: BLI_math_base.h:47
MINLINE void srgb_to_linearrgb_v4(float linear[4], const float srgb[4])
void unit_m4(float m[4][4])
Definition: rct.c:1140
size_t BLI_snprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
unsigned char uchar
Definition: BLI_sys_types.h:86
unsigned int uint
Definition: BLI_sys_types.h:83
#define ELEM(...)
struct ID * DEG_get_evaluated_id(const struct Depsgraph *depsgraph, struct ID *id)
struct Object * DEG_get_evaluated_object(const struct Depsgraph *depsgraph, struct Object *object)
@ PAINT_TOOL_CLONE
@ CD_MLOOPUV
@ IMA_TYPE_MULTILAYER
@ IMA_TYPE_UV_TEST
@ IMA_TYPE_IMAGE
@ IMA_SRC_TILED
@ MASK_OVERLAY_COMBINED
#define MASK_DRAWFLAG_OVERLAY
@ OB_MODE_EDIT
@ OB_MODE_TEXTURE_PAINT
@ OB_MODE_OBJECT
@ OB_MESH
#define UV_SELECT_FACE
#define SCE_SELECT_FACE
#define UV_SYNC_SELECTION
@ SI_NO_DRAW_TEXPAINT
@ SI_DRAW_STRETCH
@ SI_NO_DRAWFACES
@ SI_DRAWSHADOW
@ SI_UVDT_BLACK
@ SI_UVDT_DASH
@ SI_UVDT_WHITE
@ SI_UVDT_OUTLINE
@ SI_UVDT_STRETCH_AREA
@ SI_UVDT_STRETCH_ANGLE
@ SI_MODE_PAINT
@ SI_MODE_VIEW
@ SI_MODE_MASK
@ SI_MODE_UV
@ USER_GPU_FLAG_OVERLAY_SMOOTH_WIRE
DRWState
Definition: DRW_render.h:312
@ DRW_STATE_BLEND_ALPHA
Definition: DRW_render.h:340
@ DRW_STATE_WRITE_DEPTH
Definition: DRW_render.h:314
@ DRW_STATE_WRITE_COLOR
Definition: DRW_render.h:315
@ DRW_STATE_DEPTH_LESS_EQUAL
Definition: DRW_render.h:323
@ DRW_STATE_DEPTH_ALWAYS
Definition: DRW_render.h:321
@ DRW_STATE_BLEND_ALPHA_PREMUL
Definition: DRW_render.h:342
@ DRW_STATE_BLEND_MUL
Definition: DRW_render.h:345
#define DRW_PASS_CREATE(pass, state)
Definition: DRW_render.h:593
#define DRW_shgroup_call_obmat(shgroup, geom, obmat)
Definition: DRW_render.h:424
#define DRW_TEXTURE_FREE_SAFE(tex)
Definition: DRW_render.h:180
void ED_space_image_get_uv_aspect(struct SpaceImage *sima, float *r_aspx, float *r_aspy)
Definition: image_edit.c:282
void ED_space_image_get_size(struct SpaceImage *sima, int *r_width, int *r_height)
Definition: image_edit.c:215
void ED_space_image_get_aspect(struct SpaceImage *sima, float *r_aspx, float *r_aspy)
Definition: image_edit.c:256
GPUBatch
Definition: GPU_batch.h:93
struct GPUFrameBuffer GPUFrameBuffer
GPUFrameBuffer * GPU_framebuffer_active_get(void)
void GPU_framebuffer_bind(GPUFrameBuffer *fb)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
struct GPUShader GPUShader
Definition: GPU_shader.h:33
struct GPUTexture GPUTexture
Definition: GPU_texture.h:33
GPUTexture * GPU_texture_create_2d(const char *name, int w, int h, int mip_len, eGPUTextureFormat format, const float *data)
Definition: gpu_texture.cc:250
@ GPU_R16F
Definition: GPU_texture.h:114
Contains defines and structs used throughout the imbuf module.
#define UI_DPI_FAC
Definition: UI_interface.h:309
@ TH_BACK
Definition: UI_resources.h:55
@ TH_FACEDOT_SIZE
Definition: UI_resources.h:112
@ TH_VERTEX_SIZE
Definition: UI_resources.h:97
@ TH_FACE_SELECT
Definition: UI_resources.h:105
void UI_GetThemeColor4fv(int colorid, float col[4])
Definition: resources.c:1199
void UI_GetThemeColorShade4fv(int colorid, int offset, float col[4])
Definition: resources.c:1359
void UI_GetThemeColorShade4ubv(int colorid, int offset, unsigned char col[4])
Definition: resources.c:1268
float UI_GetThemeValuef(int colorid)
Definition: resources.c:1164
unsigned int U
Definition: btGjkEpa3.h:78
short type
short source
Scene scene
GPUBatch * DRW_cache_quad_get(void)
Definition: draw_cache.c:392
GPUBatch * DRW_cache_quad_wires_get(void)
Definition: draw_cache.c:413
struct GPUBatch * DRW_mesh_batch_cache_get_edituv_faces(struct Mesh *me)
struct GPUBatch * DRW_mesh_batch_cache_get_edituv_facedots(struct Mesh *me)
struct GPUBatch * DRW_mesh_batch_cache_get_edituv_verts(struct Mesh *me)
struct GPUBatch * DRW_mesh_batch_cache_get_edituv_edges(struct Mesh *me)
void DRW_mesh_batch_cache_validate(struct Mesh *me)
struct GPUBatch * DRW_mesh_batch_cache_get_uv_edges(struct Mesh *me)
struct GPUBatch * DRW_mesh_batch_cache_get_edituv_faces_stretch_angle(struct Mesh *me)
struct GPUBatch * DRW_mesh_batch_cache_get_edituv_faces_stretch_area(struct Mesh *me, float **tot_area, float **tot_uv_area)
struct DRW_Global G_draw
Definition: draw_common.c:45
bool DRW_object_is_in_edit_mode(const Object *ob)
Definition: draw_manager.c:204
DefaultFramebufferList * DRW_viewport_framebuffer_list_get(void)
Definition: draw_manager.c:697
int DRW_object_visibility_in_active_context(const Object *ob)
Definition: draw_manager.c:235
const DRWContextState * DRW_context_state_get(void)
struct DRWTextStore * DRW_text_cache_ensure(void)
void DRW_shgroup_uniform_float_copy(DRWShadingGroup *shgroup, const char *name, const float value)
void DRW_shgroup_uniform_block(DRWShadingGroup *shgroup, const char *name, const GPUUniformBuf *ubo)
void DRW_shgroup_uniform_texture(DRWShadingGroup *shgroup, const char *name, const GPUTexture *tex)
void DRW_shgroup_uniform_vec3_copy(DRWShadingGroup *shgroup, const char *name, const float *value)
void DRW_shgroup_uniform_int_copy(DRWShadingGroup *shgroup, const char *name, const int value)
void DRW_shgroup_uniform_bool(DRWShadingGroup *shgroup, const char *name, const int *value, int arraysize)
DRWShadingGroup * DRW_shgroup_create(struct GPUShader *shader, DRWPass *pass)
void DRW_shgroup_uniform_vec4_copy(DRWShadingGroup *shgroup, const char *name, const float *value)
void DRW_shgroup_uniform_bool_copy(DRWShadingGroup *shgroup, const char *name, const bool value)
void DRW_shgroup_uniform_float(DRWShadingGroup *shgroup, const char *name, const float *value, int arraysize)
void DRW_shgroup_uniform_vec2_copy(DRWShadingGroup *shgroup, const char *name, const float *value)
void DRW_draw_pass(DRWPass *pass)
void DRW_text_cache_add(DRWTextStore *dt, const float co[3], const char *str, const int str_len, short xoffs, short yoffs, short flag, const uchar col[4])
@ DRW_TEXT_CACHE_GLOBALSPACE
@ DRW_TEXT_CACHE_ASCII
__kernel void ccl_constant KernelData ccl_global void ccl_global char ccl_global int ccl_global char ccl_global unsigned int ccl_global float * buffer
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:41
void *(* MEM_mallocN)(size_t len, const char *str)
Definition: mallocn.c:47
static ulong state[N]
void OVERLAY_edit_uv_cache_init(OVERLAY_Data *vedata)
static void OVERLAY_edit_uv_draw_finish(OVERLAY_Data *vedata)
static OVERLAY_UVLineStyle edit_uv_line_style_from_space_image(const SpaceImage *sima)
static GPUTexture * edit_uv_mask_texture(Mask *mask, const int width, const int height_, const float aspx, const float aspy)
static void edit_uv_stretching_update_ratios(OVERLAY_Data *vedata)
struct OVERLAY_StretchingAreaTotals OVERLAY_StretchingAreaTotals
void OVERLAY_edit_uv_draw(OVERLAY_Data *vedata)
void OVERLAY_edit_uv_cache_finish(OVERLAY_Data *vedata)
void OVERLAY_edit_uv_init(OVERLAY_Data *vedata)
static void overlay_edit_uv_cache_populate(OVERLAY_Data *vedata, Object *ob)
GPUShader * OVERLAY_shader_edit_uv_stretching_angle_get(void)
GPUShader * OVERLAY_shader_edit_uv_face_get(void)
GPUShader * OVERLAY_shader_edit_uv_stencil_image(void)
GPUShader * OVERLAY_shader_edit_uv_face_dots_get(void)
OVERLAY_UVLineStyle
@ OVERLAY_UV_LINE_STYLE_DASH
@ OVERLAY_UV_LINE_STYLE_SHADOW
@ OVERLAY_UV_LINE_STYLE_WHITE
@ OVERLAY_UV_LINE_STYLE_OUTLINE
@ OVERLAY_UV_LINE_STYLE_BLACK
GPUShader * OVERLAY_shader_edit_uv_stretching_area_get(void)
GPUShader * OVERLAY_shader_edit_uv_verts_get(void)
GPUShader * OVERLAY_shader_edit_uv_mask_image(void)
GPUShader * OVERLAY_shader_edit_uv_edges_get(void)
GPUShader * OVERLAY_shader_edit_uv_tiled_image_borders_get(void)
struct BMesh * bm
Definition: BKE_editmesh.h:52
CustomData ldata
Definition: bmesh_class.h:337
struct Image * image
float offset[2]
struct BrushClone clone
struct Object * obact
Definition: DRW_render.h:749
struct Scene * scene
Definition: DRW_render.h:745
struct SpaceLink * space_data
Definition: DRW_render.h:743
struct Depsgraph * depsgraph
Definition: DRW_render.h:753
struct ViewLayer * view_layer
Definition: DRW_render.h:746
eObjectMode object_mode
Definition: DRW_render.h:757
struct Object * object_edit
Definition: DRW_render.h:769
struct GPUUniformBuf * block_ubo
Definition: draw_common.h:210
struct GPUFrameBuffer * default_fb
struct Mask * mask
struct BMEditMesh * edit_mesh
struct CustomData pdata ldata
OVERLAY_PassList * psl
OVERLAY_StorageList * stl
DRWPass * edit_uv_edges_ps
DRWPass * edit_uv_stencil_ps
DRWPass * edit_uv_mask_ps
DRWPass * edit_uv_tiled_image_borders_ps
DRWPass * edit_uv_faces_ps
DRWPass * edit_uv_verts_ps
DRWPass * edit_uv_stretching_ps
OVERLAY_UVLineStyle line_style
struct ImBuf * stencil_ibuf
DRWShadingGroup * edit_uv_verts_grp
struct Image * stencil_image
DRWShadingGroup * edit_uv_edges_grp
struct OVERLAY_PrivateData::@244 edit_uv
DRWShadingGroup * edit_uv_shadow_edges_grp
eMaskOverlayMode mask_overlay_mode
DRWShadingGroup * edit_uv_faces_grp
DRWShadingGroup * edit_uv_stretching_grp
eSpaceImage_UVDT_Stretch draw_type
DRWShadingGroup * edit_uv_face_dots_grp
GPUTexture * mask_texture
struct OVERLAY_PrivateData * pd
void * data
struct ToolSettings * toolsettings
MaskSpaceInfo mask_info
struct Image * image
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)