Blender  V3.3
eyedropper_color.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2009 Blender Foundation. All rights reserved. */
3 
13 #include "MEM_guardedalloc.h"
14 
15 #include "DNA_screen_types.h"
16 #include "DNA_space_types.h"
17 
18 #include "BLI_listbase.h"
19 #include "BLI_math_vector.h"
20 #include "BLI_string.h"
21 
22 #include "BKE_context.h"
23 #include "BKE_cryptomatte.h"
24 #include "BKE_image.h"
25 #include "BKE_main.h"
26 #include "BKE_node.h"
27 #include "BKE_screen.h"
28 
29 #include "NOD_composite.h"
30 
31 #include "RNA_access.h"
32 #include "RNA_prototypes.h"
33 
34 #include "UI_interface.h"
35 
36 #include "IMB_colormanagement.h"
37 #include "IMB_imbuf_types.h"
38 
39 #include "WM_api.h"
40 #include "WM_types.h"
41 
42 #include "RNA_define.h"
43 
44 #include "interface_intern.h"
45 
46 #include "ED_clip.h"
47 #include "ED_image.h"
48 #include "ED_node.h"
49 #include "ED_screen.h"
50 
51 #include "RE_pipeline.h"
52 
53 #include "eyedropper_intern.h"
54 
55 typedef struct Eyedropper {
57 
60  int index;
61  bool is_undo;
62 
63  bool is_set;
64  float init_col[3]; /* for resetting on cancel */
65 
66  bool accum_start; /* has mouse been pressed */
67  float accum_col[3];
68  int accum_tot;
69 
72 
76 
77 static void eyedropper_draw_cb(const wmWindow *window, void *arg)
78 {
79  Eyedropper *eye = arg;
81 }
82 
84 {
85  Eyedropper *eye = MEM_callocN(sizeof(Eyedropper), __func__);
86 
87  uiBut *but = UI_context_active_but_prop_get(C, &eye->ptr, &eye->prop, &eye->index);
88  const enum PropertySubType prop_subtype = eye->prop ? RNA_property_subtype(eye->prop) : 0;
89 
90  if ((eye->ptr.data == NULL) || (eye->prop == NULL) ||
91  (RNA_property_editable(&eye->ptr, eye->prop) == false) ||
92  (RNA_property_array_length(&eye->ptr, eye->prop) < 3) ||
93  (RNA_property_type(eye->prop) != PROP_FLOAT) ||
94  (ELEM(prop_subtype, PROP_COLOR, PROP_COLOR_GAMMA) == 0)) {
95  MEM_freeN(eye);
96  return false;
97  }
98  op->customdata = eye;
99 
101 
102  float col[4];
104  if (eye->ptr.type == &RNA_CompositorNodeCryptomatteV2) {
105  eye->crypto_node = (bNode *)eye->ptr.data;
107  eye->crypto_node);
109  }
110 
111  if (prop_subtype != PROP_COLOR) {
113  const char *display_device;
114 
115  display_device = scene->display_settings.display_device;
116  eye->display = IMB_colormanagement_display_get_named(display_device);
117 
118  /* store initial color */
119  if (eye->display) {
121  }
122  }
123  copy_v3_v3(eye->init_col, col);
124 
125  return true;
126 }
127 
129 {
130  Eyedropper *eye = op->customdata;
131  wmWindow *window = CTX_wm_window(C);
132  WM_cursor_modal_restore(window);
133 
134  if (eye->draw_handle_sample_text) {
137  }
138 
139  if (eye->cryptomatte_session) {
141  eye->cryptomatte_session = NULL;
142  }
143 
145 }
146 
147 /* *** eyedropper_color_ helper functions *** */
148 
150  const char *prefix,
151  const float fpos[2],
152  float r_col[3])
153 {
154  if (!render_layer) {
155  return false;
156  }
157 
158  const int render_layer_name_len = BLI_strnlen(render_layer->name, sizeof(render_layer->name));
159  if (strncmp(prefix, render_layer->name, render_layer_name_len) != 0) {
160  return false;
161  }
162 
163  const int prefix_len = strlen(prefix);
164  if (prefix_len <= render_layer_name_len + 1) {
165  return false;
166  }
167 
168  /* RenderResult from images can have no render layer name. */
169  const char *render_pass_name_prefix = render_layer_name_len ?
170  prefix + 1 + render_layer_name_len :
171  prefix;
172 
173  LISTBASE_FOREACH (RenderPass *, render_pass, &render_layer->passes) {
174  if (STRPREFIX(render_pass->name, render_pass_name_prefix) &&
175  !STREQLEN(render_pass->name, render_pass_name_prefix, sizeof(render_pass->name))) {
176  BLI_assert(render_pass->channels == 4);
177  const int x = (int)(fpos[0] * render_pass->rectx);
178  const int y = (int)(fpos[1] * render_pass->recty);
179  const int offset = 4 * (y * render_pass->rectx + x);
180  zero_v3(r_col);
181  r_col[0] = render_pass->rect[offset];
182  return true;
183  }
184  }
185 
186  return false;
187 }
189  const char *prefix,
190  const float fpos[2],
191  float r_col[3])
192 {
193  bool success = false;
194  Scene *scene = (Scene *)node->id;
197 
198  if (re) {
200  if (rr) {
201  LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) {
202  RenderLayer *render_layer = RE_GetRenderLayer(rr, view_layer->name);
203  success = eyedropper_cryptomatte_sample_renderlayer_fl(render_layer, prefix, fpos, r_col);
204  if (success) {
205  break;
206  }
207  }
208  }
209  RE_ReleaseResult(re);
210  }
211  return success;
212 }
213 
215  NodeCryptomatte *crypto,
216  const char *prefix,
217  const float fpos[2],
218  float r_col[3])
219 {
220  bool success = false;
221  Image *image = (Image *)node->id;
222  BLI_assert((image == NULL) || (GS(image->id.name) == ID_IM));
223  ImageUser *iuser = &crypto->iuser;
224 
225  if (image && image->type == IMA_TYPE_MULTILAYER) {
226  ImBuf *ibuf = BKE_image_acquire_ibuf(image, iuser, NULL);
227  if (image->rr) {
228  LISTBASE_FOREACH (RenderLayer *, render_layer, &image->rr->layers) {
229  success = eyedropper_cryptomatte_sample_renderlayer_fl(render_layer, prefix, fpos, r_col);
230  if (success) {
231  break;
232  }
233  }
234  }
236  }
237  return success;
238 }
239 
241  Eyedropper *eye,
242  const int m_xy[2],
243  float r_col[3])
244 {
245  bNode *node = eye->crypto_node;
246  NodeCryptomatte *crypto = node ? ((NodeCryptomatte *)node->storage) : NULL;
247 
248  if (!crypto) {
249  return false;
250  }
251 
252  bScreen *screen = CTX_wm_screen(C);
254  if (!area || !ELEM(area->spacetype, SPACE_IMAGE, SPACE_NODE, SPACE_CLIP)) {
255  return false;
256  }
257 
259  if (!region) {
260  return false;
261  }
262 
263  int mval[2] = {m_xy[0] - region->winrct.xmin, m_xy[1] - region->winrct.ymin};
264  float fpos[2] = {-1.0f, -1.0};
265  switch (area->spacetype) {
266  case SPACE_IMAGE: {
267  SpaceImage *sima = area->spacedata.first;
268  ED_space_image_get_position(sima, region, mval, fpos);
269  break;
270  }
271  case SPACE_NODE: {
272  Main *bmain = CTX_data_main(C);
273  SpaceNode *snode = area->spacedata.first;
274  ED_space_node_get_position(bmain, snode, region, mval, fpos);
275  break;
276  }
277  case SPACE_CLIP: {
278  SpaceClip *sc = area->spacedata.first;
279  ED_space_clip_get_position(sc, region, mval, fpos);
280  break;
281  }
282  default: {
283  break;
284  }
285  }
286 
287  if (fpos[0] < 0.0f || fpos[1] < 0.0f || fpos[0] >= 1.0f || fpos[1] >= 1.0f) {
288  return false;
289  }
290 
291  /* CMP_CRYPTOMATTE_SRC_RENDER and CMP_CRYPTOMATTE_SRC_IMAGE require a referenced image/scene to
292  * work properly. */
293  if (!node->id) {
294  return false;
295  }
296 
297  /* TODO(jbakker): Migrate this file to cc and use std::string as return param. */
298  char prefix[MAX_NAME + 1];
299  const Scene *scene = CTX_data_scene(C);
300  ntreeCompositCryptomatteLayerPrefix(scene, node, prefix, sizeof(prefix) - 1);
301  prefix[MAX_NAME] = '\0';
302 
303  if (node->custom1 == CMP_CRYPTOMATTE_SRC_RENDER) {
304  return eyedropper_cryptomatte_sample_render_fl(node, prefix, fpos, r_col);
305  }
306  if (node->custom1 == CMP_CRYPTOMATTE_SRC_IMAGE) {
307  return eyedropper_cryptomatte_sample_image_fl(node, crypto, prefix, fpos, r_col);
308  }
309  return false;
310 }
311 
312 void eyedropper_color_sample_fl(bContext *C, const int m_xy[2], float r_col[3])
313 {
314  /* we could use some clever */
315  Main *bmain = CTX_data_main(C);
317  const char *display_device = CTX_data_scene(C)->display_settings.display_device;
318  struct ColorManagedDisplay *display = IMB_colormanagement_display_get_named(display_device);
319 
320  int mval[2];
321  wmWindow *win;
322  ScrArea *area;
323  datadropper_win_area_find(C, m_xy, mval, &win, &area);
324 
325  if (area) {
326  if (area->spacetype == SPACE_IMAGE) {
328  if (region) {
329  SpaceImage *sima = area->spacedata.first;
330  const int region_mval[2] = {mval[0] - region->winrct.xmin, mval[1] - region->winrct.ymin};
331 
332  if (ED_space_image_color_sample(sima, region, region_mval, r_col, NULL)) {
333  return;
334  }
335  }
336  }
337  else if (area->spacetype == SPACE_NODE) {
339  if (region) {
340  SpaceNode *snode = area->spacedata.first;
341  const int region_mval[2] = {mval[0] - region->winrct.xmin, mval[1] - region->winrct.ymin};
342 
343  if (ED_space_node_color_sample(bmain, snode, region, region_mval, r_col)) {
344  return;
345  }
346  }
347  }
348  else if (area->spacetype == SPACE_CLIP) {
350  if (region) {
351  SpaceClip *sc = area->spacedata.first;
352  const int region_mval[2] = {mval[0] - region->winrct.xmin, mval[1] - region->winrct.ymin};
353 
354  if (ED_space_clip_color_sample(sc, region, region_mval, r_col)) {
355  return;
356  }
357  }
358  }
359  }
360 
361  if (win) {
362  /* Fallback to simple opengl picker. */
363  WM_window_pixel_sample_read(wm, win, mval, r_col);
365  }
366  else {
367  zero_v3(r_col);
368  }
369 }
370 
371 /* sets the sample color RGB, maintaining A */
372 static void eyedropper_color_set(bContext *C, Eyedropper *eye, const float col[3])
373 {
374  float col_conv[4];
375 
376  /* to maintain alpha */
377  RNA_property_float_get_array(&eye->ptr, eye->prop, col_conv);
378 
379  /* convert from linear rgb space to display space */
380  if (eye->display) {
381  copy_v3_v3(col_conv, col);
383  }
384  else {
385  copy_v3_v3(col_conv, col);
386  }
387 
388  RNA_property_float_set_array(&eye->ptr, eye->prop, col_conv);
389  eye->is_set = true;
390 
391  RNA_property_update(C, &eye->ptr, eye->prop);
392 }
393 
394 static void eyedropper_color_sample(bContext *C, Eyedropper *eye, const int m_xy[2])
395 {
396  /* Accumulate color. */
397  float col[3];
398  if (eye->crypto_node) {
399  if (!eyedropper_cryptomatte_sample_fl(C, eye, m_xy, col)) {
400  return;
401  }
402  }
403  else {
405  }
406 
407  if (!eye->crypto_node) {
408  add_v3_v3(eye->accum_col, col);
409  eye->accum_tot++;
410  }
411  else {
412  copy_v3_v3(eye->accum_col, col);
413  eye->accum_tot = 1;
414  }
415 
416  /* Apply to property. */
417  float accum_col[3];
418  if (eye->accum_tot > 1) {
419  mul_v3_v3fl(accum_col, eye->accum_col, 1.0f / (float)eye->accum_tot);
420  }
421  else {
422  copy_v3_v3(accum_col, eye->accum_col);
423  }
424  eyedropper_color_set(C, eye, accum_col);
425 }
426 
427 static void eyedropper_color_sample_text_update(bContext *C, Eyedropper *eye, const int m_xy[2])
428 {
429  float col[3];
430  eye->sample_text[0] = '\0';
431 
432  if (eye->cryptomatte_session) {
433  if (eyedropper_cryptomatte_sample_fl(C, eye, m_xy, col)) {
435  eye->cryptomatte_session, col[0], eye->sample_text, sizeof(eye->sample_text));
436  eye->sample_text[sizeof(eye->sample_text) - 1] = '\0';
437  }
438  }
439 }
440 
442 {
443  Eyedropper *eye = op->customdata;
444  if (eye->is_set) {
445  eyedropper_color_set(C, eye, eye->init_col);
446  }
447  eyedropper_exit(C, op);
448 }
449 
450 /* main modal status check */
451 static int eyedropper_modal(bContext *C, wmOperator *op, const wmEvent *event)
452 {
453  Eyedropper *eye = (Eyedropper *)op->customdata;
454 
455  /* handle modal keymap */
456  if (event->type == EVT_MODAL_MAP) {
457  switch (event->val) {
458  case EYE_MODAL_CANCEL:
459  eyedropper_cancel(C, op);
460  return OPERATOR_CANCELLED;
462  const bool is_undo = eye->is_undo;
463  if (eye->accum_tot == 0) {
464  eyedropper_color_sample(C, eye, event->xy);
465  }
466  eyedropper_exit(C, op);
467  /* Could support finished & undo-skip. */
468  return is_undo ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
469  }
471  /* enable accum and make first sample */
472  eye->accum_start = true;
473  eyedropper_color_sample(C, eye, event->xy);
474  break;
476  eye->accum_tot = 0;
477  zero_v3(eye->accum_col);
478  eyedropper_color_sample(C, eye, event->xy);
479  break;
480  }
481  }
482  else if (ISMOUSE_MOTION(event->type)) {
483  if (eye->accum_start) {
484  /* button is pressed so keep sampling */
485  eyedropper_color_sample(C, eye, event->xy);
486  }
487 
488  if (eye->draw_handle_sample_text) {
491  }
492  }
493 
494  return OPERATOR_RUNNING_MODAL;
495 }
496 
497 /* Modal Operator init */
498 static int eyedropper_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
499 {
500  /* init */
501  if (eyedropper_init(C, op)) {
502  wmWindow *win = CTX_wm_window(C);
503  /* Workaround for de-activating the button clearing the cursor, see T76794 */
506 
507  /* add temp handler */
509 
510  return OPERATOR_RUNNING_MODAL;
511  }
512  return OPERATOR_PASS_THROUGH;
513 }
514 
515 /* Repeat operator */
517 {
518  /* init */
519  if (eyedropper_init(C, op)) {
520 
521  /* do something */
522 
523  /* cleanup */
524  eyedropper_exit(C, op);
525 
526  return OPERATOR_FINISHED;
527  }
528  return OPERATOR_PASS_THROUGH;
529 }
530 
532 {
533  /* Actual test for active button happens later, since we don't
534  * know which one is active until mouse over. */
535  return (CTX_wm_window(C) != NULL);
536 }
537 
539 {
540  /* identifiers */
541  ot->name = "Eyedropper";
542  ot->idname = "UI_OT_eyedropper_color";
543  ot->description = "Sample a color from the Blender window to store in a property";
544 
545  /* api callbacks */
551 
552  /* flags */
554 }
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1090
struct wmWindowManager * CTX_wm_manager(const bContext *C)
Definition: context.c:713
struct bScreen * CTX_wm_screen(const bContext *C)
Definition: context.c:733
struct ARegion * CTX_wm_region(const bContext *C)
Definition: context.c:749
struct Main * CTX_data_main(const bContext *C)
Definition: context.c:1074
struct wmWindow * CTX_wm_window(const bContext *C)
Definition: context.c:723
bool BKE_cryptomatte_find_name(const struct CryptomatteSession *session, float encoded_hash, char *r_name, int name_len)
void BKE_cryptomatte_free(struct CryptomatteSession *session)
Definition: cryptomatte.cc:150
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)
#define CMP_CRYPTOMATTE_SRC_RENDER
Definition: BKE_node.h:1331
#define CMP_CRYPTOMATTE_SRC_IMAGE
Definition: BKE_node.h:1332
struct ScrArea struct ScrArea * BKE_screen_find_area_xy(struct bScreen *screen, int spacetype, const int xy[2]) ATTR_NONNULL(1
struct ARegion * BKE_area_find_region_xy(struct ScrArea *area, int regiontype, const int xy[2]) ATTR_NONNULL(3)
Definition: screen.c:898
#define BLI_assert(a)
Definition: BLI_assert.h:46
#define LISTBASE_FOREACH(type, var, list)
Definition: BLI_listbase.h:336
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void zero_v3(float r[3])
MINLINE void mul_v3_v3fl(float r[3], const float a[3], float f)
MINLINE void add_v3_v3(float r[3], const float a[3])
size_t BLI_strnlen(const char *str, size_t maxlen) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition: string.c:899
#define STRPREFIX(a, b)
#define STREQLEN(a, b, n)
#define UNUSED(x)
#define ELEM(...)
@ ID_IM
Definition: DNA_ID_enums.h:53
@ ID_SCE
Definition: DNA_ID_enums.h:45
#define MAX_NAME
Definition: DNA_defs.h:48
@ IMA_TYPE_MULTILAYER
@ RGN_TYPE_WINDOW
@ SPACE_CLIP
@ SPACE_NODE
@ SPACE_IMAGE
#define SPACE_TYPE_ANY
@ OPERATOR_CANCELLED
@ OPERATOR_FINISHED
@ OPERATOR_RUNNING_MODAL
@ OPERATOR_PASS_THROUGH
bool ED_space_clip_color_sample(struct SpaceClip *sc, struct ARegion *region, const int mval[2], float r_col[3])
Definition: clip_editor.c:295
bool ED_space_clip_get_position(struct SpaceClip *sc, struct ARegion *region, int mval[2], float fpos[2])
Definition: clip_editor.c:278
bool ED_space_image_color_sample(struct SpaceImage *sima, struct ARegion *region, const int mval[2], float r_col[3], bool *r_is_data)
Definition: image_ops.c:3215
bool ED_space_image_get_position(struct SpaceImage *sima, struct ARegion *region, int mval[2], float fpos[2])
Definition: image_ops.c:3196
bool ED_space_node_color_sample(struct Main *bmain, struct SpaceNode *snode, struct ARegion *region, const int mval[2], float r_col[3])
Definition: node_view.cc:476
bool ED_space_node_get_position(struct Main *bmain, struct SpaceNode *snode, struct ARegion *region, const int mval[2], float fpos[2])
Definition: node_view.cc:449
void ED_region_tag_redraw(struct ARegion *region)
Definition: area.c:655
_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 y
void IMB_colormanagement_display_to_scene_linear_v3(float pixel[3], struct ColorManagedDisplay *display)
void IMB_colormanagement_scene_linear_to_display_v3(float pixel[3], struct ColorManagedDisplay *display)
struct ColorManagedDisplay * IMB_colormanagement_display_get_named(const char *name)
Contains defines and structs used throughout the imbuf module.
Read Guarded memory(de)allocation.
#define MEM_SAFE_FREE(v)
@ PROP_FLOAT
Definition: RNA_types.h:61
PropertySubType
Definition: RNA_types.h:125
@ PROP_COLOR
Definition: RNA_types.h:153
@ PROP_COLOR_GAMMA
Definition: RNA_types.h:165
#define C
Definition: RandGen.cpp:25
@ UI_BUT_UNDO
Definition: UI_interface.h:205
void UI_context_active_but_clear(struct bContext *C, struct wmWindow *win, struct ARegion *region)
uiBut * UI_context_active_but_prop_get(const struct bContext *C, struct PointerRNA *r_ptr, struct PropertyRNA **r_prop, int *r_index)
bool UI_but_flag_is_set(uiBut *but, int flag)
Definition: interface.cc:5868
@ OPTYPE_INTERNAL
Definition: WM_types.h:168
@ OPTYPE_BLOCKING
Definition: WM_types.h:150
@ OPTYPE_UNDO
Definition: WM_types.h:148
OperationNode * node
Scene scene
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
static bool eyedropper_init(bContext *C, wmOperator *op)
static bool eyedropper_cryptomatte_sample_fl(bContext *C, Eyedropper *eye, const int m_xy[2], float r_col[3])
static void eyedropper_color_set(bContext *C, Eyedropper *eye, const float col[3])
static void eyedropper_cancel(bContext *C, wmOperator *op)
static void eyedropper_exit(bContext *C, wmOperator *op)
static bool eyedropper_cryptomatte_sample_renderlayer_fl(RenderLayer *render_layer, const char *prefix, const float fpos[2], float r_col[3])
void eyedropper_color_sample_fl(bContext *C, const int m_xy[2], float r_col[3])
get the color from the screen.
static int eyedropper_modal(bContext *C, wmOperator *op, const wmEvent *event)
static int eyedropper_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
static bool eyedropper_cryptomatte_sample_render_fl(const bNode *node, const char *prefix, const float fpos[2], float r_col[3])
void UI_OT_eyedropper_color(wmOperatorType *ot)
struct Eyedropper Eyedropper
static void eyedropper_draw_cb(const wmWindow *window, void *arg)
static bool eyedropper_poll(bContext *C)
static bool eyedropper_cryptomatte_sample_image_fl(const bNode *node, NodeCryptomatte *crypto, const char *prefix, const float fpos[2], float r_col[3])
static int eyedropper_exec(bContext *C, wmOperator *op)
static void eyedropper_color_sample_text_update(bContext *C, Eyedropper *eye, const int m_xy[2])
static void eyedropper_color_sample(bContext *C, Eyedropper *eye, const int m_xy[2])
@ EYE_MODAL_SAMPLE_BEGIN
@ EYE_MODAL_SAMPLE_RESET
@ EYE_MODAL_CANCEL
@ EYE_MODAL_SAMPLE_CONFIRM
void eyedropper_draw_cursor_text_window(const struct wmWindow *window, const char *name)
void datadropper_win_area_find(const struct bContext *C, const int mval[2], int r_mval[2], struct wmWindow **r_win, struct ScrArea **r_area)
uint col
#define GS(x)
Definition: iris.c:225
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:27
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:31
static void area(int d1, int d2, int e1, int e2, float weights[2])
CryptomatteSession * ntreeCompositCryptomatteSession(const Scene *scene, bNode *node)
void ntreeCompositCryptomatteLayerPrefix(const Scene *scene, const bNode *node, char *r_prefix, size_t prefix_len)
RenderResult * RE_AcquireResultRead(Render *re)
Definition: pipeline.c:314
Render * RE_GetSceneRender(const Scene *scene)
Definition: pipeline.c:551
RenderLayer * RE_GetRenderLayer(RenderResult *rr, const char *name)
Definition: pipeline.c:244
void RE_ReleaseResult(Render *re)
Definition: pipeline.c:351
bool RNA_property_editable(PointerRNA *ptr, PropertyRNA *prop)
Definition: rna_access.c:1966
void RNA_property_float_get_array(PointerRNA *ptr, PropertyRNA *prop, float *values)
Definition: rna_access.c:2879
PropertyType RNA_property_type(PropertyRNA *prop)
Definition: rna_access.c:1010
void RNA_property_update(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
Definition: rna_access.c:2138
int RNA_property_array_length(PointerRNA *ptr, PropertyRNA *prop)
Definition: rna_access.c:1075
void RNA_property_float_set_array(PointerRNA *ptr, PropertyRNA *prop, const float *values)
Definition: rna_access.c:2978
PropertySubType RNA_property_subtype(PropertyRNA *prop)
Definition: rna_access.c:1015
struct ColorManagedDisplay * display
bNode * crypto_node
struct CryptomatteSession * cryptomatte_session
char sample_text[MAX_NAME]
float accum_col[3]
float init_col[3]
PropertyRNA * prop
PointerRNA ptr
void * draw_handle_sample_text
char name[66]
Definition: DNA_ID.h:378
Definition: BKE_main.h:121
struct StructRNA * type
Definition: RNA_types.h:37
void * data
Definition: RNA_types.h:38
ListBase passes
Definition: RE_pipeline.h:95
char name[RE_MAXNAME]
Definition: RE_pipeline.h:87
ListBase view_layers
ColorManagedDisplaySettings display_settings
int ymin
Definition: DNA_vec_types.h:64
int xmin
Definition: DNA_vec_types.h:63
short val
Definition: WM_types.h:680
int xy[2]
Definition: WM_types.h:682
short type
Definition: WM_types.h:678
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:919
const char * name
Definition: WM_types.h:888
int(* modal)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:935
const char * idname
Definition: WM_types.h:890
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:943
void(* cancel)(struct bContext *, struct wmOperator *)
Definition: WM_types.h:927
const char * description
Definition: WM_types.h:893
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:903
void WM_cursor_modal_set(wmWindow *win, int val)
Definition: wm_cursors.c:191
void WM_cursor_modal_restore(wmWindow *win)
Definition: wm_cursors.c:200
@ WM_CURSOR_EYEDROPPER
Definition: wm_cursors.h:35
void WM_draw_cb_exit(wmWindow *win, void *handle)
Definition: wm_draw.c:574
void * WM_draw_cb_activate(wmWindow *win, void(*draw)(const struct wmWindow *, void *), void *customdata)
Definition: wm_draw.c:561
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
#define ISMOUSE_MOTION(event_type)
@ EVT_MODAL_MAP
wmOperatorType * ot
Definition: wm_files.c:3479
void WM_window_pixel_sample_read(const wmWindowManager *wm, const wmWindow *win, const int pos[2], float r_col[3])
Definition: wm_window.c:1922