Blender  V3.3
overlay_edit_uv.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2019 Blender Foundation. */
3 
7 #include "DRW_render.h"
8 
9 #include "draw_cache_impl.h"
10 #include "draw_manager_text.h"
11 
12 #include "BKE_customdata.h"
13 #include "BKE_editmesh.h"
14 #include "BKE_image.h"
15 #include "BKE_layer.h"
16 #include "BKE_mask.h"
17 #include "BKE_object.h"
18 #include "BKE_paint.h"
19 
20 #include "DNA_brush_types.h"
21 #include "DNA_mesh_types.h"
22 
23 #include "DEG_depsgraph_query.h"
24 
25 #include "ED_image.h"
26 
27 #include "IMB_imbuf_types.h"
28 
29 #include "GPU_batch.h"
30 
31 #include "UI_interface.h"
32 #include "UI_resources.h"
33 
34 #include "overlay_private.h"
35 
36 /* Forward declarations. */
37 static void overlay_edit_uv_cache_populate(OVERLAY_Data *vedata, Object *ob);
38 
40  void *next, *prev;
41  float *total_area;
42  float *total_area_uv;
44 
46 {
47  const bool is_uv_editor = sima->mode == SI_MODE_UV;
48  if (is_uv_editor) {
49  switch (sima->dt_uv) {
50  case SI_UVDT_OUTLINE:
52  case SI_UVDT_BLACK:
54  case SI_UVDT_WHITE:
56  case SI_UVDT_DASH:
58  default:
60  }
61  }
62  else {
64  }
65 }
66 
67 /* TODO(jbakker): the GPU texture should be cached with the mask. */
69  Mask *mask, const int width, const int height_, const float aspx, const float aspy)
70 {
71  const int height = (float)height_ * (aspy / aspx);
72  MaskRasterHandle *handle;
73  float *buffer = MEM_mallocN(sizeof(float) * height * width, __func__);
74 
75  /* Initialize rasterization handle. */
77  BKE_maskrasterize_handle_init(handle, mask, width, height, true, true, true);
78 
80 
81  /* Free memory. */
83  GPUTexture *texture = GPU_texture_create_2d(mask->id.name, width, height, 1, GPU_R16F, buffer);
85  return texture;
86 }
87 
88 /* -------------------------------------------------------------------- */
93 {
94  OVERLAY_StorageList *stl = vedata->stl;
95  OVERLAY_PrivateData *pd = stl->pd;
96  const DRWContextState *draw_ctx = DRW_context_state_get();
97  SpaceImage *sima = (SpaceImage *)draw_ctx->space_data;
98  const Scene *scene = draw_ctx->scene;
100  const Brush *brush = BKE_paint_brush(&ts->imapaint.paint);
101  const bool show_overlays = !pd->hide_overlays;
102 
103  Image *image = sima->image;
104  /* By design no image is an image type. This so editor shows UV's by default. */
105  const bool is_image_type =
107  const bool is_uv_editor = sima->mode == SI_MODE_UV;
108  const bool has_edit_object = (draw_ctx->object_edit) != NULL;
109  const bool is_paint_mode = sima->mode == SI_MODE_PAINT;
110  const bool is_view_mode = sima->mode == SI_MODE_VIEW;
111  const bool is_mask_mode = sima->mode == SI_MODE_MASK;
112  const bool is_edit_mode = draw_ctx->object_mode == OB_MODE_EDIT;
113  const bool do_uv_overlay = is_image_type && is_uv_editor && has_edit_object;
114  const bool show_modified_uvs = sima->flag & SI_DRAWSHADOW;
115  const bool is_tiled_image = image && (image->source == IMA_SRC_TILED);
116  const bool do_edges_only = (ts->uv_flag & UV_SYNC_SELECTION) ?
117  /* NOTE: Ignore #SCE_SELECT_EDGE because a single selected edge
118  * on the mesh may cause single UV vertices to be selected. */
119  false :
120  (ts->uv_selectmode == UV_SELECT_EDGE);
121  const bool do_faces = ((sima->flag & SI_NO_DRAWFACES) == 0);
122  const bool do_face_dots = (ts->uv_flag & UV_SYNC_SELECTION) ?
123  (ts->selectmode & SCE_SELECT_FACE) != 0 :
124  (ts->uv_selectmode == UV_SELECT_FACE);
125  const bool do_uvstretching_overlay = is_image_type && is_uv_editor && is_edit_mode &&
126  ((sima->flag & SI_DRAW_STRETCH) != 0);
127  const bool do_tex_paint_shadows = (sima->flag & SI_NO_DRAW_TEXPAINT) == 0;
128  const bool do_stencil_overlay = is_paint_mode && is_image_type && brush &&
129  (brush->imagepaint_tool == PAINT_TOOL_CLONE) &&
130  brush->clone.image;
131 
132  pd->edit_uv.do_verts = show_overlays && (!do_edges_only);
133  pd->edit_uv.do_faces = show_overlays && do_faces && !do_uvstretching_overlay;
134  pd->edit_uv.do_face_dots = show_overlays && do_faces && do_face_dots;
135  pd->edit_uv.do_uv_overlay = show_overlays && do_uv_overlay;
136  pd->edit_uv.do_uv_shadow_overlay = show_overlays && is_image_type &&
137  ((is_paint_mode && do_tex_paint_shadows &&
138  ((draw_ctx->object_mode &
139  (OB_MODE_TEXTURE_PAINT | OB_MODE_EDIT)) != 0)) ||
140  (is_uv_editor && do_tex_paint_shadows &&
141  ((draw_ctx->object_mode & (OB_MODE_TEXTURE_PAINT)) != 0)) ||
142  (is_view_mode && do_tex_paint_shadows &&
143  ((draw_ctx->object_mode & (OB_MODE_TEXTURE_PAINT)) != 0)) ||
144  (do_uv_overlay && (show_modified_uvs)));
145 
146  pd->edit_uv.do_mask_overlay = show_overlays && is_mask_mode && (sima->mask_info.mask != NULL) &&
147  ((sima->mask_info.draw_flag & MASK_DRAWFLAG_OVERLAY) != 0);
150  draw_ctx->depsgraph, &sima->mask_info.mask->id) :
151  NULL;
152 
153  pd->edit_uv.do_uv_stretching_overlay = show_overlays && do_uvstretching_overlay;
154  pd->edit_uv.uv_opacity = sima->uv_opacity;
155  pd->edit_uv.do_tiled_image_overlay = show_overlays && is_image_type && is_tiled_image;
156  pd->edit_uv.do_tiled_image_border_overlay = is_image_type && is_tiled_image;
157  pd->edit_uv.dash_length = 4.0f * UI_DPI_FAC;
159  pd->edit_uv.do_smooth_wire = ((U.gpu_flag & USER_GPU_FLAG_OVERLAY_SMOOTH_WIRE) != 0);
160  pd->edit_uv.do_stencil_overlay = show_overlays && do_stencil_overlay;
161 
162  pd->edit_uv.draw_type = sima->dt_uvstretch;
164  pd->edit_uv.total_area_ratio = 0.0f;
165 
166  /* During engine initialization phase the `sima` isn't locked and
167  * we are able to retrieve the needed data.
168  * During cache_init the image engine locks the `sima` and makes it impossible
169  * to retrieve the data. */
173 }
174 
176 {
177  OVERLAY_StorageList *stl = vedata->stl;
178  OVERLAY_PassList *psl = vedata->psl;
179  OVERLAY_PrivateData *pd = stl->pd;
180 
181  const DRWContextState *draw_ctx = DRW_context_state_get();
182  SpaceImage *sima = (SpaceImage *)draw_ctx->space_data;
183  Image *image = sima->image;
184  const Scene *scene = draw_ctx->scene;
186 
188  /* uv edges */
189  {
193  const bool do_edges_only = (ts->uv_flag & UV_SYNC_SELECTION) ?
194  false :
195  (ts->uv_selectmode & UV_SELECT_EDGE);
198  if (pd->edit_uv.do_uv_shadow_overlay) {
204  pd->edit_uv_shadow_edges_grp, "alpha", pd->edit_uv.uv_opacity);
206  pd->edit_uv_shadow_edges_grp, "dashLength", &pd->edit_uv.dash_length, 1);
208  pd->edit_uv_shadow_edges_grp, "doSmoothWire", &pd->edit_uv.do_smooth_wire, 1);
209  }
210 
211  if (pd->edit_uv.do_uv_overlay) {
217  pd->edit_uv_edges_grp, "dashLength", &pd->edit_uv.dash_length, 1);
219  pd->edit_uv_edges_grp, "doSmoothWire", &pd->edit_uv.do_smooth_wire, 1);
220  }
221  }
222  }
223 
224  if (pd->edit_uv.do_uv_overlay) {
225  if (pd->edit_uv.do_verts || pd->edit_uv.do_face_dots) {
229  }
230 
231  /* uv verts */
232  if (pd->edit_uv.do_verts) {
235 
236  const float point_size = UI_GetThemeValuef(TH_VERTEX_SIZE) * U.dpi_fac;
237 
240  pd->edit_uv_verts_grp, "pointSize", (point_size + 1.5f) * M_SQRT2);
241  DRW_shgroup_uniform_float_copy(pd->edit_uv_verts_grp, "outlineWidth", 0.75f);
242  float theme_color[4];
243  UI_GetThemeColor4fv(TH_VERTEX, theme_color);
244  srgb_to_linearrgb_v4(theme_color, theme_color);
245  DRW_shgroup_uniform_vec4_copy(pd->edit_uv_verts_grp, "color", theme_color);
246  }
247 
248  /* uv faces */
249  if (pd->edit_uv.do_faces) {
256  }
257 
258  /* uv face dots */
259  if (pd->edit_uv.do_face_dots) {
260  const float point_size = UI_GetThemeValuef(TH_FACEDOT_SIZE) * U.dpi_fac;
264  DRW_shgroup_uniform_float_copy(pd->edit_uv_face_dots_grp, "pointSize", point_size);
265  }
266  }
267 
268  /* uv stretching */
277  }
278  else /* SI_UVDT_STRETCH_AREA */ {
283  pd->edit_uv_stretching_grp, "totalAreaRatio", &pd->edit_uv.total_area_ratio, 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  dt, tile_location, text, strlen(text), 10, 10, DRW_TEXT_CACHE_GLOBALSPACE, color);
339  }
340  }
341 
342  if (pd->edit_uv.do_stencil_overlay) {
343  const Brush *brush = BKE_paint_brush(&ts->imapaint.paint);
344  Image *stencil_image = brush->clone.image;
345  ImBuf *stencil_ibuf = BKE_image_acquire_ibuf(stencil_image, NULL, &pd->edit_uv.stencil_lock);
346 
347  if (stencil_ibuf == NULL) {
348  pd->edit_uv.stencil_ibuf = NULL;
349  pd->edit_uv.stencil_image = NULL;
350  }
351  else {
356  GPUBatch *geom = DRW_cache_quad_get();
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);
365  grp, "color", (float[4]){1.0f, 1.0f, 1.0f, brush->clone.alpha});
366 
367  float size_image[2];
368  BKE_image_get_size_fl(image, NULL, size_image);
369  float size_stencil_image[2] = {stencil_ibuf->x, stencil_ibuf->y};
370 
371  float obmat[4][4];
372  unit_m4(obmat);
373  obmat[3][1] = brush->clone.offset[1];
374  obmat[3][0] = brush->clone.offset[0];
375  obmat[0][0] = size_stencil_image[0] / size_image[0];
376  obmat[1][1] = size_stencil_image[1] / size_image[1];
377 
378  DRW_shgroup_call_obmat(grp, geom, obmat);
379  }
380  }
381  else {
382  pd->edit_uv.stencil_ibuf = NULL;
383  pd->edit_uv.stencil_image = NULL;
384  }
385 
386  if (pd->edit_uv.do_mask_overlay) {
387  const bool is_combined_overlay = pd->edit_uv.mask_overlay_mode == MASK_OVERLAY_COMBINED;
389  state |= is_combined_overlay ? DRW_STATE_BLEND_MUL : DRW_STATE_BLEND_ALPHA;
391 
393  GPUBatch *geom = DRW_cache_quad_get();
395  GPUTexture *mask_texture = edit_uv_mask_texture(pd->edit_uv.mask,
396  pd->edit_uv.image_size[0],
397  pd->edit_uv.image_size[1],
398  pd->edit_uv.image_aspect[1],
399  pd->edit_uv.image_aspect[1]);
400  pd->edit_uv.mask_texture = mask_texture;
401  DRW_shgroup_uniform_texture(grp, "imgTexture", mask_texture);
402  DRW_shgroup_uniform_vec4_copy(grp, "color", (float[4]){1.0f, 1.0f, 1.0f, 1.0f});
403  DRW_shgroup_call_obmat(grp, geom, NULL);
404  }
405 
406  /* HACK: When editing objects that share the same mesh we should only draw the
407  * first one in the order that is used during uv editing. We can only trust that the first object
408  * has the correct batches with the correct selection state. See T83187. */
410  draw_ctx->obact->type == OB_MESH) {
411  uint objects_len = 0;
413  draw_ctx->view_layer, NULL, &objects_len, draw_ctx->object_mode);
414  for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
415  Object *object_eval = DEG_get_evaluated_object(draw_ctx->depsgraph, objects[ob_index]);
416  DRW_mesh_batch_cache_validate(object_eval, (Mesh *)object_eval->data);
417  overlay_edit_uv_cache_populate(vedata, object_eval);
418  }
419  MEM_freeN(objects);
420  }
421 }
422 
424 {
426  return;
427  }
428 
429  OVERLAY_StorageList *stl = vedata->stl;
430  OVERLAY_PrivateData *pd = stl->pd;
431  GPUBatch *geom;
432 
433  const DRWContextState *draw_ctx = DRW_context_state_get();
434  const bool is_edit_object = DRW_object_is_in_edit_mode(ob);
435  Mesh *me = (Mesh *)ob->data;
436  const bool has_active_object_uvmap = CustomData_get_active_layer(&me->ldata, CD_MLOOPUV) != -1;
437  const bool has_active_edit_uvmap = is_edit_object &&
439  CD_MLOOPUV) != -1);
440  const bool draw_shadows = (draw_ctx->object_mode != OB_MODE_OBJECT) &&
441  (ob->mode == draw_ctx->object_mode);
442 
443  if (has_active_edit_uvmap) {
444  if (pd->edit_uv.do_uv_overlay) {
446  if (geom) {
448  }
449  if (pd->edit_uv.do_verts) {
451  if (geom) {
453  }
454  }
455  if (pd->edit_uv.do_faces) {
457  if (geom) {
459  }
460  }
461  if (pd->edit_uv.do_face_dots) {
463  if (geom) {
465  }
466  }
467  }
468 
472  }
473  else /* SI_UVDT_STRETCH_AREA */ {
475  __func__);
476  BLI_addtail(&pd->edit_uv.totals, totals);
478  ob, me, &totals->total_area, &totals->total_area_uv);
479  }
480  if (geom) {
482  }
483  }
484  }
485 
486  if (draw_shadows && (has_active_object_uvmap || has_active_edit_uvmap)) {
487  if (pd->edit_uv.do_uv_shadow_overlay) {
488  geom = DRW_mesh_batch_cache_get_uv_edges(ob, ob->data);
489  if (geom) {
491  }
492  }
493  }
494 }
495 
497 {
498  OVERLAY_StorageList *stl = vedata->stl;
499  OVERLAY_PrivateData *pd = stl->pd;
500 
502  float total_area = 0.0f;
503  float total_area_uv = 0.0f;
504 
506  total_area += *totals->total_area;
507  total_area_uv += *totals->total_area_uv;
508  }
509 
510  if (total_area > FLT_EPSILON && total_area_uv > FLT_EPSILON) {
511  pd->edit_uv.total_area_ratio = total_area / total_area_uv;
512  }
513  }
515 }
516 
518 {
519  OVERLAY_StorageList *stl = vedata->stl;
520  OVERLAY_PrivateData *pd = stl->pd;
521 
524  }
525 }
526 
528 {
529  OVERLAY_StorageList *stl = vedata->stl;
530  OVERLAY_PrivateData *pd = stl->pd;
531 
532  if (pd->edit_uv.stencil_ibuf) {
535  pd->edit_uv.stencil_image = NULL;
536  pd->edit_uv.stencil_ibuf = NULL;
537  }
538 
540 }
541 
543 {
544  OVERLAY_PassList *psl = vedata->psl;
545  OVERLAY_StorageList *stl = vedata->stl;
546  OVERLAY_PrivateData *pd = stl->pd;
547 
550  }
551  if (pd->edit_uv.do_mask_overlay) {
552  /* Combined overlay renders in the default framebuffer and modifies the image in SRS.
553  * The alpha overlay renders in the overlay framebuffer. */
554  const bool is_combined_overlay = pd->edit_uv.mask_overlay_mode == MASK_OVERLAY_COMBINED;
555  GPUFrameBuffer *previous_framebuffer = NULL;
556  if (is_combined_overlay) {
558  previous_framebuffer = GPU_framebuffer_active_get();
560  }
562  if (previous_framebuffer) {
563  GPU_framebuffer_bind(previous_framebuffer);
564  }
565  }
566 
569  }
570 
571  if (pd->edit_uv.do_uv_overlay) {
572  if (pd->edit_uv.do_faces) {
574  }
576 
578  }
579  else if (pd->edit_uv.do_uv_shadow_overlay) {
581  }
582  if (pd->edit_uv.do_stencil_overlay) {
584  }
586 }
587 
typedef float(TangentPoint)[2]
CustomData interface, see also DNA_customdata_types.h.
int CustomData_get_active_layer(const struct CustomData *data, int type)
void BKE_image_release_ibuf(struct Image *ima, struct ImBuf *ibuf, void *lock)
struct ImBuf * BKE_image_acquire_ibuf(struct Image *ima, struct ImageUser *iuser, void **r_lock)
void BKE_image_get_size_fl(struct Image *image, struct ImageUser *iuser, float r_size[2])
struct GPUTexture * BKE_image_get_gpu_texture(struct Image *image, struct ImageUser *iuser, struct ImBuf *ibuf)
Definition: image_gpu.cc:438
#define BKE_view_layer_array_from_objects_in_mode_unique_data(view_layer, v3d, r_len, mode)
Definition: BKE_layer.h:560
void BKE_maskrasterize_handle_free(MaskRasterHandle *mr_handle)
void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mask, int width, int height, bool do_aspect_correct, bool do_mask_aa, bool do_feather)
MaskRasterHandle * BKE_maskrasterize_handle_new(void)
void BKE_maskrasterize_buffer(MaskRasterHandle *mr_handle, unsigned int width, unsigned int height, float *buffer)
Rasterize a buffer from a single mask (threaded execution).
General operations, lookup, etc. for blender objects.
@ OB_VISIBLE_SELF
Definition: BKE_object.h:150
struct Brush * BKE_paint_brush(struct Paint *paint)
Definition: paint.c:607
#define LISTBASE_FOREACH(type, var, list)
Definition: BLI_listbase.h:336
BLI_INLINE void BLI_listbase_clear(struct ListBase *lb)
Definition: BLI_listbase.h:273
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
Definition: listbase.c:466
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:80
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define M_SQRT2
Definition: BLI_math_base.h:29
MINLINE void srgb_to_linearrgb_v4(float linear[4], const float srgb[4])
void unit_m4(float m[4][4])
Definition: rct.c:1090
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:70
unsigned int uint
Definition: BLI_sys_types.h:67
#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_SRC_TILED
@ IMA_TYPE_MULTILAYER
@ IMA_TYPE_UV_TEST
@ IMA_TYPE_IMAGE
@ MASK_OVERLAY_COMBINED
#define MASK_DRAWFLAG_OVERLAY
@ OB_MODE_EDIT
@ OB_MODE_TEXTURE_PAINT
@ OB_MODE_OBJECT
@ OB_MESH
#define UV_SELECT_EDGE
#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:298
@ DRW_STATE_BLEND_ALPHA
Definition: DRW_render.h:328
@ DRW_STATE_WRITE_DEPTH
Definition: DRW_render.h:302
@ DRW_STATE_WRITE_COLOR
Definition: DRW_render.h:303
@ DRW_STATE_DEPTH_LESS_EQUAL
Definition: DRW_render.h:311
@ DRW_STATE_DEPTH_ALWAYS
Definition: DRW_render.h:309
@ DRW_STATE_BLEND_ALPHA_PREMUL
Definition: DRW_render.h:330
@ DRW_STATE_BLEND_MUL
Definition: DRW_render.h:333
#define DRW_PASS_CREATE(pass, state)
Definition: DRW_render.h:690
#define DRW_shgroup_uniform_block(shgroup, name, ubo)
Definition: DRW_render.h:651
#define DRW_shgroup_call_obmat(shgroup, geom, obmat)
Definition: DRW_render.h:420
#define DRW_TEXTURE_FREE_SAFE(tex)
Definition: DRW_render.h:183
void ED_space_image_get_uv_aspect(struct SpaceImage *sima, float *r_aspx, float *r_aspy)
Definition: image_edit.c:262
void ED_space_image_get_size(struct SpaceImage *sima, int *r_width, int *r_height)
Definition: image_edit.c:201
void ED_space_image_get_aspect(struct SpaceImage *sima, float *r_aspx, float *r_aspy)
Definition: image_edit.c:236
GPUBatch
Definition: GPU_batch.h:78
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 height
_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
struct GPUShader GPUShader
Definition: GPU_shader.h:20
struct GPUTexture GPUTexture
Definition: GPU_texture.h:17
GPUTexture * GPU_texture_create_2d(const char *name, int w, int h, int mip_len, eGPUTextureFormat format, const float *data)
Definition: gpu_texture.cc:291
@ GPU_R16F
Definition: GPU_texture.h:113
Contains defines and structs used throughout the imbuf module.
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert a color
#define UI_DPI_FAC
Definition: UI_interface.h:305
@ TH_BACK
Definition: UI_resources.h:39
@ TH_FACEDOT_SIZE
Definition: UI_resources.h:96
@ TH_VERTEX
Definition: UI_resources.h:77
@ TH_VERTEX_SIZE
Definition: UI_resources.h:81
@ TH_FACE_SELECT
Definition: UI_resources.h:89
void UI_GetThemeColor4fv(int colorid, float col[4])
Definition: resources.c:1173
void UI_GetThemeColorShade4fv(int colorid, int offset, float col[4])
Definition: resources.c:1331
void UI_GetThemeColorShade4ubv(int colorid, int offset, unsigned char col[4])
Definition: resources.c:1241
float UI_GetThemeValuef(int colorid)
Definition: resources.c:1141
unsigned int U
Definition: btGjkEpa3.h:78
Scene scene
GPUBatch * DRW_cache_quad_get(void)
Definition: draw_cache.c:389
GPUBatch * DRW_cache_quad_wires_get(void)
Definition: draw_cache.c:409
void DRW_mesh_batch_cache_validate(struct Object *object, struct Mesh *me)
struct GPUBatch * DRW_mesh_batch_cache_get_edituv_faces(struct Object *object, struct Mesh *me)
struct GPUBatch * DRW_mesh_batch_cache_get_edituv_facedots(struct Object *object, struct Mesh *me)
struct GPUBatch * DRW_mesh_batch_cache_get_edituv_faces_stretch_angle(struct Object *object, struct Mesh *me)
struct GPUBatch * DRW_mesh_batch_cache_get_edituv_verts(struct Object *object, struct Mesh *me)
struct GPUBatch * DRW_mesh_batch_cache_get_edituv_faces_stretch_area(struct Object *object, struct Mesh *me, float **tot_area, float **tot_uv_area)
struct GPUBatch * DRW_mesh_batch_cache_get_edituv_edges(struct Object *object, struct Mesh *me)
struct GPUBatch * DRW_mesh_batch_cache_get_uv_edges(struct Object *object, struct Mesh *me)
struct DRW_Global G_draw
Definition: draw_common.c:32
bool DRW_object_is_in_edit_mode(const Object *ob)
Definition: draw_manager.c:196
DefaultFramebufferList * DRW_viewport_framebuffer_list_get(void)
Definition: draw_manager.c:633
int DRW_object_visibility_in_active_context(const Object *ob)
Definition: draw_manager.c:209
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_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
depth_tx normal_tx diffuse_light_tx specular_light_tx volume_light_tx environment_tx ambient_occlusion_tx aov_value_tx in_weight_img image(1, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D_ARRAY, "out_weight_img") .image(3
ccl_global float * buffer
ccl_global const KernelWorkTile * tile
const int state
ccl_gpu_kernel_postfix ccl_global float int int int int sh
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:27
void *(* MEM_mallocN)(size_t len, const char *str)
Definition: mallocn.c:33
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
Definition: math_float4.h:513
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)
GPUShader * OVERLAY_shader_edit_uv_edges_for_edge_select_get(void)
struct BMesh * bm
Definition: BKE_editmesh.h:40
CustomData ldata
Definition: bmesh_class.h:337
struct Image * image
float offset[2]
struct BrushClone clone
struct Object * obact
Definition: DRW_render.h:983
struct Scene * scene
Definition: DRW_render.h:979
struct SpaceLink * space_data
Definition: DRW_render.h:977
struct Depsgraph * depsgraph
Definition: DRW_render.h:987
struct ViewLayer * view_layer
Definition: DRW_render.h:980
eObjectMode object_mode
Definition: DRW_render.h:991
struct Object * object_edit
Definition: DRW_render.h:1003
struct GPUUniformBuf * block_ubo
Definition: draw_common.h:129
struct GPUFrameBuffer * default_fb
struct Mask * mask
struct BMEditMesh * edit_mesh
CustomData 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
struct OVERLAY_PrivateData::@255 edit_uv
DRWShadingGroup * edit_uv_edges_grp
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