Blender  V2.93
node_view.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  * The Original Code is Copyright (C) 2008 Blender Foundation.
17  * All rights reserved.
18  */
19 
24 #include "DNA_node_types.h"
25 
26 #include "BLI_math.h"
27 #include "BLI_rect.h"
28 #include "BLI_utildefines.h"
29 
30 #include "BKE_context.h"
31 #include "BKE_image.h"
32 #include "BKE_main.h"
33 #include "BKE_node.h"
34 #include "BKE_screen.h"
35 
36 #include "ED_image.h"
37 #include "ED_node.h" /* own include */
38 #include "ED_screen.h"
39 #include "ED_space_api.h"
40 
41 #include "RNA_access.h"
42 #include "RNA_define.h"
43 
44 #include "WM_api.h"
45 #include "WM_types.h"
46 
47 #include "UI_view2d.h"
48 
49 #include "MEM_guardedalloc.h"
50 
51 #include "IMB_colormanagement.h"
52 #include "IMB_imbuf.h"
53 #include "IMB_imbuf_types.h"
54 
55 #include "node_intern.h" /* own include */
56 
57 /* -------------------------------------------------------------------- */
62  bContext *C, SpaceNode *snode, ARegion *region, const int node_flag, const int smooth_viewtx)
63 {
64  bNode *node;
65  rctf cur_new;
66  float oldwidth, oldheight, width, height;
67  float oldasp, asp;
68  int tot = 0;
69  bool has_frame = false;
70 
71  oldwidth = BLI_rctf_size_x(&region->v2d.cur);
72  oldheight = BLI_rctf_size_y(&region->v2d.cur);
73 
74  oldasp = oldwidth / oldheight;
75 
76  BLI_rctf_init_minmax(&cur_new);
77 
78  if (snode->edittree) {
79  for (node = snode->edittree->nodes.first; node; node = node->next) {
80  if ((node->flag & node_flag) == node_flag) {
81  BLI_rctf_union(&cur_new, &node->totr);
82  tot++;
83 
84  if (node->type == NODE_FRAME) {
85  has_frame = true;
86  }
87  }
88  }
89  }
90 
91  if (tot) {
92  width = BLI_rctf_size_x(&cur_new);
93  height = BLI_rctf_size_y(&cur_new);
94  asp = width / height;
95 
96  /* for single non-frame nodes, don't zoom in, just pan view,
97  * but do allow zooming out, this allows for big nodes to be zoomed out */
98  if ((tot == 1) && (has_frame == false) && ((oldwidth * oldheight) > (width * height))) {
99  /* center, don't zoom */
100  BLI_rctf_resize(&cur_new, oldwidth, oldheight);
101  }
102  else {
103  if (oldasp < asp) {
104  const float height_new = width / oldasp;
105  cur_new.ymin = cur_new.ymin - height_new / 2.0f;
106  cur_new.ymax = cur_new.ymax + height_new / 2.0f;
107  }
108  else {
109  const float width_new = height * oldasp;
110  cur_new.xmin = cur_new.xmin - width_new / 2.0f;
111  cur_new.xmax = cur_new.xmax + width_new / 2.0f;
112  }
113 
114  /* add some padding */
115  BLI_rctf_scale(&cur_new, 1.1f);
116  }
117 
118  UI_view2d_smooth_view(C, region, &cur_new, smooth_viewtx);
119  }
120 
121  return (tot != 0);
122 }
123 
125 {
126  ARegion *region = CTX_wm_region(C);
127  SpaceNode *snode = CTX_wm_space_node(C);
128  const int smooth_viewtx = WM_operator_smooth_viewtx_get(op);
129 
130  /* is this really needed? */
131  snode->xof = 0;
132  snode->yof = 0;
133 
134  if (space_node_view_flag(C, snode, region, 0, smooth_viewtx)) {
135  return OPERATOR_FINISHED;
136  }
137  return OPERATOR_CANCELLED;
138 }
139 
141 {
142  /* identifiers */
143  ot->name = "Frame All";
144  ot->idname = "NODE_OT_view_all";
145  ot->description = "Resize view so you can see all nodes";
146 
147  /* api callbacks */
150 
151  /* flags */
152  ot->flag = 0;
153 }
154 
157 /* -------------------------------------------------------------------- */
162 {
163  ARegion *region = CTX_wm_region(C);
164  SpaceNode *snode = CTX_wm_space_node(C);
165  const int smooth_viewtx = WM_operator_smooth_viewtx_get(op);
166 
167  if (space_node_view_flag(C, snode, region, NODE_SELECT, smooth_viewtx)) {
168  return OPERATOR_FINISHED;
169  }
170  return OPERATOR_CANCELLED;
171 }
172 
174 {
175  /* identifiers */
176  ot->name = "Frame Selected";
177  ot->idname = "NODE_OT_view_selected";
178  ot->description = "Resize view so you can see selected nodes";
179 
180  /* api callbacks */
183 
184  /* flags */
185  ot->flag = 0;
186 }
187 
190 /* -------------------------------------------------------------------- */
194 typedef struct NodeViewMove {
195  int mvalo[2];
196  int xmin, ymin, xmax, ymax;
198 
199 static int snode_bg_viewmove_modal(bContext *C, wmOperator *op, const wmEvent *event)
200 {
201  SpaceNode *snode = CTX_wm_space_node(C);
202  ARegion *region = CTX_wm_region(C);
203  NodeViewMove *nvm = op->customdata;
204 
205  switch (event->type) {
206  case MOUSEMOVE:
207 
208  snode->xof -= (nvm->mvalo[0] - event->mval[0]);
209  snode->yof -= (nvm->mvalo[1] - event->mval[1]);
210  nvm->mvalo[0] = event->mval[0];
211  nvm->mvalo[1] = event->mval[1];
212 
213  /* prevent dragging image outside of the window and losing it! */
214  CLAMP(snode->xof, nvm->xmin, nvm->xmax);
215  CLAMP(snode->yof, nvm->ymin, nvm->ymax);
216 
217  ED_region_tag_redraw(region);
220 
221  break;
222 
223  case LEFTMOUSE:
224  case MIDDLEMOUSE:
225  case RIGHTMOUSE:
226  if (event->val == KM_RELEASE) {
227  MEM_freeN(nvm);
228  op->customdata = NULL;
229  return OPERATOR_FINISHED;
230  }
231  break;
232  }
233 
234  return OPERATOR_RUNNING_MODAL;
235 }
236 
237 static int snode_bg_viewmove_invoke(bContext *C, wmOperator *op, const wmEvent *event)
238 {
239  Main *bmain = CTX_data_main(C);
240  SpaceNode *snode = CTX_wm_space_node(C);
241  ARegion *region = CTX_wm_region(C);
242  NodeViewMove *nvm;
243  Image *ima;
244  ImBuf *ibuf;
245  const float pad = 32.0f; /* better be bigger than scrollbars */
246 
247  void *lock;
248 
249  ima = BKE_image_ensure_viewer(bmain, IMA_TYPE_COMPOSITE, "Viewer Node");
250  ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
251 
252  if (ibuf == NULL) {
253  BKE_image_release_ibuf(ima, ibuf, lock);
254  return OPERATOR_CANCELLED;
255  }
256 
257  nvm = MEM_callocN(sizeof(NodeViewMove), "NodeViewMove struct");
258  op->customdata = nvm;
259  nvm->mvalo[0] = event->mval[0];
260  nvm->mvalo[1] = event->mval[1];
261 
262  nvm->xmin = -(region->winx / 2) - (ibuf->x * (0.5f * snode->zoom)) + pad;
263  nvm->xmax = (region->winx / 2) + (ibuf->x * (0.5f * snode->zoom)) - pad;
264  nvm->ymin = -(region->winy / 2) - (ibuf->y * (0.5f * snode->zoom)) + pad;
265  nvm->ymax = (region->winy / 2) + (ibuf->y * (0.5f * snode->zoom)) - pad;
266 
267  BKE_image_release_ibuf(ima, ibuf, lock);
268 
269  /* add modal handler */
271 
272  return OPERATOR_RUNNING_MODAL;
273 }
274 
276 {
277  MEM_freeN(op->customdata);
278  op->customdata = NULL;
279 }
280 
282 {
283  /* identifiers */
284  ot->name = "Background Image Move";
285  ot->description = "Move node backdrop";
286  ot->idname = "NODE_OT_backimage_move";
287 
288  /* api callbacks */
293 
294  /* flags */
296 }
297 
300 /* -------------------------------------------------------------------- */
305 {
306  SpaceNode *snode = CTX_wm_space_node(C);
307  ARegion *region = CTX_wm_region(C);
308  float fac = RNA_float_get(op->ptr, "factor");
309 
310  snode->zoom *= fac;
311  ED_region_tag_redraw(region);
314 
315  return OPERATOR_FINISHED;
316 }
317 
319 {
320 
321  /* identifiers */
322  ot->name = "Background Image Zoom";
323  ot->idname = "NODE_OT_backimage_zoom";
324  ot->description = "Zoom in/out the background image";
325 
326  /* api callbacks */
329 
330  /* flags */
332 
333  /* internal */
334  RNA_def_float(ot->srna, "factor", 1.2f, 0.0f, 10.0f, "Factor", "", 0.0f, 10.0f);
335 }
336 
339 /* -------------------------------------------------------------------- */
344 {
345  Main *bmain = CTX_data_main(C);
346  SpaceNode *snode = CTX_wm_space_node(C);
347  ARegion *region = CTX_wm_region(C);
348 
349  Image *ima;
350  ImBuf *ibuf;
351 
352  const float pad = 32.0f;
353 
354  void *lock;
355 
356  float facx, facy;
357 
358  ima = BKE_image_ensure_viewer(bmain, IMA_TYPE_COMPOSITE, "Viewer Node");
359  ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
360 
361  if ((ibuf == NULL) || (ibuf->x == 0) || (ibuf->y == 0)) {
362  BKE_image_release_ibuf(ima, ibuf, lock);
363  return OPERATOR_CANCELLED;
364  }
365 
366  facx = 1.0f * (region->sizex - pad) / (ibuf->x * snode->zoom);
367  facy = 1.0f * (region->sizey - pad) / (ibuf->y * snode->zoom);
368 
369  BKE_image_release_ibuf(ima, ibuf, lock);
370 
371  snode->zoom *= min_ff(facx, facy) * U.dpi_fac;
372 
373  snode->xof = 0;
374  snode->yof = 0;
375 
376  ED_region_tag_redraw(region);
379 
380  return OPERATOR_FINISHED;
381 }
382 
384 {
385 
386  /* identifiers */
387  ot->name = "Background Image Fit";
388  ot->idname = "NODE_OT_backimage_fit";
389  ot->description = "Fit the background image to the view";
390 
391  /* api callbacks */
394 
395  /* flags */
397 }
398 
401 /* -------------------------------------------------------------------- */
405 typedef struct ImageSampleInfo {
407  void *draw_handle;
408  int x, y;
409  int channels;
410 
411  uchar col[4];
412  float colf[4];
413  float linearcol[4];
414 
415  int z;
416  float zf;
417 
418  int *zp;
419  float *zfp;
420 
421  int draw;
424 
425 static void sample_draw(const bContext *C, ARegion *region, void *arg_info)
426 {
428  ImageSampleInfo *info = arg_info;
429 
430  if (info->draw) {
432  region,
433  info->color_manage,
434  false,
435  info->channels,
436  info->x,
437  info->y,
438  info->col,
439  info->colf,
440  info->linearcol,
441  info->zp,
442  info->zfp);
443  }
444 }
445 
446 /* Returns mouse position in image space. */
448  Main *bmain, SpaceNode *snode, struct ARegion *ar, const int mval[2], float fpos[2])
449 {
450  if (!ED_node_is_compositor(snode) || (snode->flag & SNODE_BACKDRAW) == 0) {
451  return false;
452  }
453 
454  void *lock;
455  Image *ima = BKE_image_ensure_viewer(bmain, IMA_TYPE_COMPOSITE, "Viewer Node");
456  ImBuf *ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
457  if (!ibuf) {
458  BKE_image_release_ibuf(ima, ibuf, lock);
459  return false;
460  }
461 
462  /* map the mouse coords to the backdrop image space */
463  float bufx = ibuf->x * snode->zoom;
464  float bufy = ibuf->y * snode->zoom;
465  fpos[0] = (bufx > 0.0f ? ((float)mval[0] - 0.5f * ar->winx - snode->xof) / bufx + 0.5f : 0.0f);
466  fpos[1] = (bufy > 0.0f ? ((float)mval[1] - 0.5f * ar->winy - snode->yof) / bufy + 0.5f : 0.0f);
467 
468  BKE_image_release_ibuf(ima, ibuf, lock);
469  return true;
470 }
471 
472 /* Returns color in linear space, matching ED_space_image_color_sample().
473  * And here we've got recursion in the comments tips...
474  */
476  Main *bmain, SpaceNode *snode, ARegion *region, const int mval[2], float r_col[3])
477 {
478  void *lock;
479  Image *ima;
480  ImBuf *ibuf;
481  float fx, fy, bufx, bufy;
482  bool ret = false;
483 
484  if (!ED_node_is_compositor(snode) || (snode->flag & SNODE_BACKDRAW) == 0) {
485  /* use viewer image for color sampling only if we're in compositor tree
486  * with backdrop enabled
487  */
488  return false;
489  }
490 
491  ima = BKE_image_ensure_viewer(bmain, IMA_TYPE_COMPOSITE, "Viewer Node");
492  ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
493  if (!ibuf) {
494  return false;
495  }
496 
497  /* map the mouse coords to the backdrop image space */
498  bufx = ibuf->x * snode->zoom;
499  bufy = ibuf->y * snode->zoom;
500  fx = (bufx > 0.0f ? ((float)mval[0] - 0.5f * region->winx - snode->xof) / bufx + 0.5f : 0.0f);
501  fy = (bufy > 0.0f ? ((float)mval[1] - 0.5f * region->winy - snode->yof) / bufy + 0.5f : 0.0f);
502 
503  if (fx >= 0.0f && fy >= 0.0f && fx < 1.0f && fy < 1.0f) {
504  const float *fp;
505  uchar *cp;
506  int x = (int)(fx * ibuf->x), y = (int)(fy * ibuf->y);
507 
508  CLAMP(x, 0, ibuf->x - 1);
509  CLAMP(y, 0, ibuf->y - 1);
510 
511  if (ibuf->rect_float) {
512  fp = (ibuf->rect_float + (ibuf->channels) * (y * ibuf->x + x));
513  /* #IB_PROFILE_NONE is default but in fact its linear. */
514  copy_v3_v3(r_col, fp);
515  ret = true;
516  }
517  else if (ibuf->rect) {
518  cp = (uchar *)(ibuf->rect + y * ibuf->x + x);
519  rgb_uchar_to_float(r_col, cp);
521  ret = true;
522  }
523  }
524 
525  BKE_image_release_ibuf(ima, ibuf, lock);
526 
527  return ret;
528 }
529 
530 static void sample_apply(bContext *C, wmOperator *op, const wmEvent *event)
531 {
532  Main *bmain = CTX_data_main(C);
533  SpaceNode *snode = CTX_wm_space_node(C);
534  ARegion *region = CTX_wm_region(C);
535  ImageSampleInfo *info = op->customdata;
536  void *lock;
537  Image *ima;
538  ImBuf *ibuf;
539  float fx, fy, bufx, bufy;
540 
541  ima = BKE_image_ensure_viewer(bmain, IMA_TYPE_COMPOSITE, "Viewer Node");
542  ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
543  if (!ibuf) {
544  info->draw = 0;
545  return;
546  }
547 
548  if (!ibuf->rect) {
549  IMB_rect_from_float(ibuf);
550  }
551 
552  /* map the mouse coords to the backdrop image space */
553  bufx = ibuf->x * snode->zoom;
554  bufy = ibuf->y * snode->zoom;
555  fx = (bufx > 0.0f ? ((float)event->mval[0] - 0.5f * region->winx - snode->xof) / bufx + 0.5f :
556  0.0f);
557  fy = (bufy > 0.0f ? ((float)event->mval[1] - 0.5f * region->winy - snode->yof) / bufy + 0.5f :
558  0.0f);
559 
560  if (fx >= 0.0f && fy >= 0.0f && fx < 1.0f && fy < 1.0f) {
561  const float *fp;
562  uchar *cp;
563  int x = (int)(fx * ibuf->x), y = (int)(fy * ibuf->y);
564 
565  CLAMP(x, 0, ibuf->x - 1);
566  CLAMP(y, 0, ibuf->y - 1);
567 
568  info->x = x;
569  info->y = y;
570  info->draw = 1;
571  info->channels = ibuf->channels;
572 
573  info->zp = NULL;
574  info->zfp = NULL;
575 
576  if (ibuf->rect) {
577  cp = (uchar *)(ibuf->rect + y * ibuf->x + x);
578 
579  info->col[0] = cp[0];
580  info->col[1] = cp[1];
581  info->col[2] = cp[2];
582  info->col[3] = cp[3];
583 
584  info->colf[0] = (float)cp[0] / 255.0f;
585  info->colf[1] = (float)cp[1] / 255.0f;
586  info->colf[2] = (float)cp[2] / 255.0f;
587  info->colf[3] = (float)cp[3] / 255.0f;
588 
589  copy_v4_v4(info->linearcol, info->colf);
591  info->linearcol, false, ibuf->rect_colorspace);
592 
593  info->color_manage = true;
594  }
595  if (ibuf->rect_float) {
596  fp = (ibuf->rect_float + (ibuf->channels) * (y * ibuf->x + x));
597 
598  info->colf[0] = fp[0];
599  info->colf[1] = fp[1];
600  info->colf[2] = fp[2];
601  info->colf[3] = fp[3];
602 
603  info->color_manage = true;
604  }
605 
606  if (ibuf->zbuf) {
607  info->z = ibuf->zbuf[y * ibuf->x + x];
608  info->zp = &info->z;
609  }
610  if (ibuf->zbuf_float) {
611  info->zf = ibuf->zbuf_float[y * ibuf->x + x];
612  info->zfp = &info->zf;
613  }
614 
615  ED_node_sample_set(info->colf);
616  }
617  else {
618  info->draw = 0;
620  }
621 
622  BKE_image_release_ibuf(ima, ibuf, lock);
623 
625 }
626 
627 static void sample_exit(bContext *C, wmOperator *op)
628 {
629  ImageSampleInfo *info = op->customdata;
630 
632  ED_region_draw_cb_exit(info->art, info->draw_handle);
634  MEM_freeN(info);
635 }
636 
637 static int sample_invoke(bContext *C, wmOperator *op, const wmEvent *event)
638 {
639  SpaceNode *snode = CTX_wm_space_node(C);
640  ARegion *region = CTX_wm_region(C);
641  ImageSampleInfo *info;
642 
643  if (!ED_node_is_compositor(snode) || !(snode->flag & SNODE_BACKDRAW)) {
644  return OPERATOR_CANCELLED;
645  }
646 
647  info = MEM_callocN(sizeof(ImageSampleInfo), "ImageSampleInfo");
648  info->art = region->type;
650  region->type, sample_draw, info, REGION_DRAW_POST_PIXEL);
651  op->customdata = info;
652 
653  sample_apply(C, op, event);
654 
656 
657  return OPERATOR_RUNNING_MODAL;
658 }
659 
660 static int sample_modal(bContext *C, wmOperator *op, const wmEvent *event)
661 {
662  switch (event->type) {
663  case LEFTMOUSE:
664  case RIGHTMOUSE: /* XXX hardcoded */
665  if (event->val == KM_RELEASE) {
666  sample_exit(C, op);
667  return OPERATOR_CANCELLED;
668  }
669  break;
670  case MOUSEMOVE:
671  sample_apply(C, op, event);
672  break;
673  }
674 
675  return OPERATOR_RUNNING_MODAL;
676 }
677 
678 static void sample_cancel(bContext *C, wmOperator *op)
679 {
680  sample_exit(C, op);
681 }
682 
684 {
685  /* identifiers */
686  ot->name = "Backimage Sample";
687  ot->idname = "NODE_OT_backimage_sample";
688  ot->description = "Use mouse to sample background image";
689 
690  /* api callbacks */
692  ot->modal = sample_modal;
695 
696  /* flags */
698 }
699 
typedef float(TangentPoint)[2]
struct ScrArea * CTX_wm_area(const bContext *C)
Definition: context.c:714
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1034
struct SpaceNode * CTX_wm_space_node(const bContext *C)
Definition: context.c:854
struct ARegion * CTX_wm_region(const bContext *C)
Definition: context.c:725
struct Main * CTX_data_main(const bContext *C)
Definition: context.c:1018
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
struct Image * BKE_image_ensure_viewer(struct Main *bmain, int type, const char *name)
Definition: image.c:3162
#define NODE_FRAME
Definition: BKE_node.h:872
MINLINE float min_ff(float a, float b)
void rgb_uchar_to_float(float r_col[3], const unsigned char col_ub[3])
Definition: math_color.c:407
MINLINE void copy_v4_v4(float r[4], const float a[4])
MINLINE void copy_v3_v3(float r[3], const float a[3])
void BLI_rctf_scale(rctf *rect, const float scale)
Definition: rct.c:694
BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct)
Definition: BLI_rect.h:161
void BLI_rctf_resize(struct rctf *rect, float x, float y)
Definition: rct.c:674
BLI_INLINE float BLI_rctf_size_y(const struct rctf *rct)
Definition: BLI_rect.h:165
void BLI_rctf_union(struct rctf *rct1, const struct rctf *rct2)
void BLI_rctf_init_minmax(struct rctf *rect)
Definition: rct.c:522
unsigned char uchar
Definition: BLI_sys_types.h:86
#define UNUSED(x)
@ IMA_TYPE_COMPOSITE
#define NODE_SELECT
@ SNODE_BACKDRAW
@ OPERATOR_CANCELLED
@ OPERATOR_FINISHED
@ OPERATOR_RUNNING_MODAL
void ED_image_draw_info(struct Scene *scene, struct ARegion *region, bool color_manage, bool use_default_view, int channels, int x, int y, const unsigned char cp[4], const float fp[4], const float linearcol[4], const int *zp, const float *zpf)
Definition: image_draw.c:145
bool ED_node_is_compositor(struct SpaceNode *snode)
Definition: node_edit.c:449
void ED_node_sample_set(const float col[4])
Definition: drawnode.c:170
void ED_area_tag_redraw(ScrArea *area)
Definition: area.c:745
bool ED_operator_node_active(struct bContext *C)
Definition: screen_ops.c:292
void ED_region_tag_redraw(struct ARegion *region)
Definition: area.c:667
void * ED_region_draw_cb_activate(struct ARegionType *art, void(*draw)(const struct bContext *, struct ARegion *, void *), void *customdata, int type)
Definition: spacetypes.c:238
#define REGION_DRAW_POST_PIXEL
Definition: ED_space_api.h:67
void ED_region_draw_cb_exit(struct ARegionType *, void *)
Definition: spacetypes.c:253
_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
_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_colorspace_to_scene_linear_v4(float pixel[4], bool predivide, struct ColorSpace *colorspace)
void IMB_colormanagement_colorspace_to_scene_linear_v3(float pixel[3], struct ColorSpace *colorspace)
void IMB_rect_from_float(struct ImBuf *ibuf)
Definition: divers.c:720
Contains defines and structs used throughout the imbuf module.
Read Guarded memory(de)allocation.
Group RGB to Bright Vector Camera CLAMP
#define C
Definition: RandGen.cpp:39
void UI_view2d_smooth_view(struct bContext *C, struct ARegion *region, const struct rctf *cur, const int smooth_viewtx)
#define NC_NODE
Definition: WM_types.h:295
@ OPTYPE_BLOCKING
Definition: WM_types.h:157
@ OPTYPE_GRAB_CURSOR_XY
Definition: WM_types.h:161
#define ND_DISPLAY
Definition: WM_types.h:391
#define ND_SPACE_NODE_VIEW
Definition: WM_types.h:431
#define NC_SPACE
Definition: WM_types.h:293
#define KM_RELEASE
Definition: WM_types.h:243
unsigned int U
Definition: btGjkEpa3.h:78
OperationNode * node
Scene scene
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:41
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:45
bool composite_node_active(bContext *C)
Definition: node_edit.c:370
struct ImageSampleInfo ImageSampleInfo
static int backimage_zoom_exec(bContext *C, wmOperator *op)
Definition: node_view.c:304
static int backimage_fit_exec(bContext *C, wmOperator *UNUSED(op))
Definition: node_view.c:343
static void sample_exit(bContext *C, wmOperator *op)
Definition: node_view.c:627
static void sample_draw(const bContext *C, ARegion *region, void *arg_info)
Definition: node_view.c:425
void NODE_OT_backimage_move(wmOperatorType *ot)
Definition: node_view.c:281
struct NodeViewMove NodeViewMove
bool ED_space_node_get_position(Main *bmain, SpaceNode *snode, struct ARegion *ar, const int mval[2], float fpos[2])
Definition: node_view.c:447
void NODE_OT_view_selected(wmOperatorType *ot)
Definition: node_view.c:173
bool ED_space_node_color_sample(Main *bmain, SpaceNode *snode, ARegion *region, const int mval[2], float r_col[3])
Definition: node_view.c:475
static int node_view_all_exec(bContext *C, wmOperator *op)
Definition: node_view.c:124
void NODE_OT_backimage_sample(wmOperatorType *ot)
Definition: node_view.c:683
static void snode_bg_viewmove_cancel(bContext *UNUSED(C), wmOperator *op)
Definition: node_view.c:275
void NODE_OT_backimage_zoom(wmOperatorType *ot)
Definition: node_view.c:318
int space_node_view_flag(bContext *C, SpaceNode *snode, ARegion *region, const int node_flag, const int smooth_viewtx)
Definition: node_view.c:61
void NODE_OT_backimage_fit(wmOperatorType *ot)
Definition: node_view.c:383
static int snode_bg_viewmove_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition: node_view.c:237
static int sample_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition: node_view.c:637
static void sample_apply(bContext *C, wmOperator *op, const wmEvent *event)
Definition: node_view.c:530
static int node_view_selected_exec(bContext *C, wmOperator *op)
Definition: node_view.c:161
static int sample_modal(bContext *C, wmOperator *op, const wmEvent *event)
Definition: node_view.c:660
void NODE_OT_view_all(wmOperatorType *ot)
Definition: node_view.c:140
static int snode_bg_viewmove_modal(bContext *C, wmOperator *op, const wmEvent *event)
Definition: node_view.c:199
static void sample_cancel(bContext *C, wmOperator *op)
Definition: node_view.c:678
return ret
float RNA_float_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:6355
PropertyRNA * RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, float default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
Definition: rna_define.c:3825
struct ARegionType * type
float * zbuf_float
int channels
struct ColorSpace * rect_colorspace
unsigned int * rect
float * rect_float
int * zbuf
void * draw_handle
Definition: node_view.c:407
ARegionType * art
Definition: node_view.c:406
uchar col[4]
Definition: node_view.c:411
float colf[4]
Definition: node_view.c:412
float linearcol[4]
Definition: node_view.c:413
void * first
Definition: DNA_listBase.h:47
Definition: BKE_main.h:116
int mvalo[2]
Definition: node_view.c:195
struct bNodeTree * edittree
ListBase nodes
float xmax
Definition: DNA_vec_types.h:85
float xmin
Definition: DNA_vec_types.h:85
float ymax
Definition: DNA_vec_types.h:86
float ymin
Definition: DNA_vec_types.h:86
short val
Definition: WM_types.h:579
int mval[2]
Definition: WM_types.h:583
short type
Definition: WM_types.h:577
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:752
const char * name
Definition: WM_types.h:721
int(* modal)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:768
const char * idname
Definition: WM_types.h:723
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:776
void(* cancel)(struct bContext *, struct wmOperator *)
Definition: WM_types.h:760
struct StructRNA * srna
Definition: WM_types.h:802
const char * description
Definition: WM_types.h:726
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:736
struct PointerRNA * ptr
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
void WM_main_add_notifier(unsigned int type, void *reference)
@ RIGHTMOUSE
@ MOUSEMOVE
@ LEFTMOUSE
@ MIDDLEMOUSE
wmOperatorType * ot
Definition: wm_files.c:3156
int WM_operator_smooth_viewtx_get(const wmOperator *op)
Definition: wm_operators.c:944