Blender V4.3
node_view.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2008 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
9#include "DNA_node_types.h"
10
11#include "BLI_rect.h"
12#include "BLI_string_ref.hh"
13#include "BLI_utildefines.h"
14
15#include "BKE_context.hh"
16#include "BKE_image.hh"
17#include "BKE_node_runtime.hh"
18
19#include "ED_image.hh"
20#include "ED_node.hh" /* own include */
21#include "ED_screen.hh"
22#include "ED_space_api.hh"
23
24#include "RNA_access.hh"
25#include "RNA_define.hh"
26
27#include "WM_api.hh"
28#include "WM_types.hh"
29
30#include "UI_view2d.hh"
31
32#include "MEM_guardedalloc.h"
33
35#include "IMB_imbuf.hh"
36#include "IMB_imbuf_types.hh"
37
38#include "node_intern.hh" /* own include */
39
41
42/* -------------------------------------------------------------------- */
47{
49 return false;
50 }
51 const ARegion *region = CTX_wm_region(C);
52 if (!(region && region->regiontype == RGN_TYPE_WINDOW)) {
53 return false;
54 }
55 return true;
56}
57
59{
60 if (!composite_node_active(C)) {
61 return false;
62 }
63 const ARegion *region = CTX_wm_region(C);
64 if (!(region && region->regiontype == RGN_TYPE_WINDOW)) {
65 return false;
66 }
67 return true;
68}
69
72/* -------------------------------------------------------------------- */
77 bContext &C, SpaceNode &snode, ARegion &region, const int node_flag, const int smooth_viewtx)
78{
79 const float oldwidth = BLI_rctf_size_x(&region.v2d.cur);
80 const float oldheight = BLI_rctf_size_y(&region.v2d.cur);
81
82 const float old_aspect = oldwidth / oldheight;
83
84 rctf cur_new;
85 BLI_rctf_init_minmax(&cur_new);
86
87 int tot = 0;
88 bool has_frame = false;
89 if (snode.edittree) {
90 for (const bNode *node : snode.edittree->all_nodes()) {
91 if ((node->flag & node_flag) == node_flag) {
92 BLI_rctf_union(&cur_new, &node->runtime->totr);
93 tot++;
94
95 if (node->type == NODE_FRAME) {
96 has_frame = true;
97 }
98 }
99 }
100 }
101
102 if (tot == 0) {
103 return false;
104 }
105
106 const float width = BLI_rctf_size_x(&cur_new);
107 const float height = BLI_rctf_size_y(&cur_new);
108 const float new_aspect = width / height;
109
110 /* for single non-frame nodes, don't zoom in, just pan view,
111 * but do allow zooming out, this allows for big nodes to be zoomed out */
112 if ((tot == 1) && (has_frame == false) && ((oldwidth * oldheight) > (width * height))) {
113 /* center, don't zoom */
114 BLI_rctf_resize(&cur_new, oldwidth, oldheight);
115 }
116 else {
117 if (old_aspect < new_aspect) {
118 const float height_new = width / old_aspect;
119 cur_new.ymin = cur_new.ymin - height_new / 2.0f;
120 cur_new.ymax = cur_new.ymax + height_new / 2.0f;
121 }
122 else {
123 const float width_new = height * old_aspect;
124 cur_new.xmin = cur_new.xmin - width_new / 2.0f;
125 cur_new.xmax = cur_new.xmax + width_new / 2.0f;
126 }
127
128 /* add some padding */
129 BLI_rctf_scale(&cur_new, 1.1f);
130 }
131
132 UI_view2d_smooth_view(&C, &region, &cur_new, smooth_viewtx);
133
134 return true;
135}
136
138{
139 ARegion *region = CTX_wm_region(C);
140 SpaceNode *snode = CTX_wm_space_node(C);
141 const int smooth_viewtx = WM_operator_smooth_viewtx_get(op);
142
143 /* is this really needed? */
144 snode->xof = 0;
145 snode->yof = 0;
146
147 if (space_node_view_flag(*C, *snode, *region, 0, smooth_viewtx)) {
148 return OPERATOR_FINISHED;
149 }
150 return OPERATOR_CANCELLED;
151}
152
154{
155 /* identifiers */
156 ot->name = "Frame All";
157 ot->idname = "NODE_OT_view_all";
158 ot->description = "Resize view so you can see all nodes";
159
160 /* api callbacks */
163
164 /* flags */
165 ot->flag = 0;
166}
167
170/* -------------------------------------------------------------------- */
175{
176 ARegion *region = CTX_wm_region(C);
177 SpaceNode *snode = CTX_wm_space_node(C);
178 const int smooth_viewtx = WM_operator_smooth_viewtx_get(op);
179
180 if (space_node_view_flag(*C, *snode, *region, NODE_SELECT, smooth_viewtx)) {
181 return OPERATOR_FINISHED;
182 }
183 return OPERATOR_CANCELLED;
184}
185
187{
188 /* identifiers */
189 ot->name = "Frame Selected";
190 ot->idname = "NODE_OT_view_selected";
191 ot->description = "Resize view so you can see selected nodes";
192
193 /* api callbacks */
196
197 /* flags */
198 ot->flag = 0;
199}
200
203/* -------------------------------------------------------------------- */
213
214static int snode_bg_viewmove_modal(bContext *C, wmOperator *op, const wmEvent *event)
215{
216 SpaceNode *snode = CTX_wm_space_node(C);
217 ARegion *region = CTX_wm_region(C);
219
220 switch (event->type) {
221 case MOUSEMOVE:
222
223 snode->xof -= (nvm->mvalo.x - event->mval[0]);
224 snode->yof -= (nvm->mvalo.y - event->mval[1]);
225 nvm->mvalo.x = event->mval[0];
226 nvm->mvalo.y = event->mval[1];
227
228 /* prevent dragging image outside of the window and losing it! */
229 CLAMP(snode->xof, nvm->xmin, nvm->xmax);
230 CLAMP(snode->yof, nvm->ymin, nvm->ymax);
231
232 ED_region_tag_redraw(region);
235
236 break;
237
238 case LEFTMOUSE:
239 case MIDDLEMOUSE:
240 if (event->val == KM_RELEASE) {
241 MEM_freeN(nvm);
242 op->customdata = nullptr;
243 return OPERATOR_FINISHED;
244 }
245 break;
246 case EVT_ESCKEY:
247 case RIGHTMOUSE:
248 snode->xof = nvm->xof_orig;
249 snode->yof = nvm->yof_orig;
250 ED_region_tag_redraw(region);
253
254 MEM_freeN(nvm);
255 op->customdata = nullptr;
256
257 return OPERATOR_CANCELLED;
258 }
259
261}
262
263static int snode_bg_viewmove_invoke(bContext *C, wmOperator *op, const wmEvent *event)
264{
265 Main *bmain = CTX_data_main(C);
266 SpaceNode *snode = CTX_wm_space_node(C);
267 ARegion *region = CTX_wm_region(C);
268 NodeViewMove *nvm;
269 Image *ima;
270 ImBuf *ibuf;
271 const float pad = 32.0f; /* Better be bigger than scroll-bars. */
272
273 void *lock;
274
275 ima = BKE_image_ensure_viewer(bmain, IMA_TYPE_COMPOSITE, "Viewer Node");
276 ibuf = BKE_image_acquire_ibuf(ima, nullptr, &lock);
277
278 if (ibuf == nullptr) {
279 BKE_image_release_ibuf(ima, ibuf, lock);
280 return OPERATOR_CANCELLED;
281 }
282
283 nvm = MEM_cnew<NodeViewMove>(__func__);
284 op->customdata = nvm;
285 nvm->mvalo.x = event->mval[0];
286 nvm->mvalo.y = event->mval[1];
287
288 nvm->xmin = -(region->winx / 2) - (ibuf->x * (0.5f * snode->zoom)) + pad;
289 nvm->xmax = (region->winx / 2) + (ibuf->x * (0.5f * snode->zoom)) - pad;
290 nvm->ymin = -(region->winy / 2) - (ibuf->y * (0.5f * snode->zoom)) + pad;
291 nvm->ymax = (region->winy / 2) + (ibuf->y * (0.5f * snode->zoom)) - pad;
292
293 nvm->xof_orig = snode->xof;
294 nvm->yof_orig = snode->yof;
295
296 BKE_image_release_ibuf(ima, ibuf, lock);
297
298 /* add modal handler */
300
302}
303
305{
307 op->customdata = nullptr;
308}
309
311{
312 /* identifiers */
313 ot->name = "Background Image Move";
314 ot->description = "Move node backdrop";
315 ot->idname = "NODE_OT_backimage_move";
316
317 /* api callbacks */
322
323 /* flags */
325}
326
329/* -------------------------------------------------------------------- */
334{
335 SpaceNode *snode = CTX_wm_space_node(C);
336 ARegion *region = CTX_wm_region(C);
337 float fac = RNA_float_get(op->ptr, "factor");
338
339 snode->zoom *= fac;
340 ED_region_tag_redraw(region);
343
344 return OPERATOR_FINISHED;
345}
346
348{
349
350 /* identifiers */
351 ot->name = "Background Image Zoom";
352 ot->idname = "NODE_OT_backimage_zoom";
353 ot->description = "Zoom in/out the background image";
354
355 /* api callbacks */
358
359 /* flags */
361
362 /* internal */
363 RNA_def_float(ot->srna, "factor", 1.2f, 0.0f, 10.0f, "Factor", "", 0.0f, 10.0f);
364}
365
368/* -------------------------------------------------------------------- */
372static int backimage_fit_exec(bContext *C, wmOperator * /*op*/)
373{
374 Main *bmain = CTX_data_main(C);
375 SpaceNode *snode = CTX_wm_space_node(C);
376 ARegion *region = CTX_wm_region(C);
377
378 Image *ima;
379 ImBuf *ibuf;
380
381 const float pad = 32.0f;
382
383 void *lock;
384
385 float facx, facy;
386
387 ima = BKE_image_ensure_viewer(bmain, IMA_TYPE_COMPOSITE, "Viewer Node");
388 ibuf = BKE_image_acquire_ibuf(ima, nullptr, &lock);
389
390 if ((ibuf == nullptr) || (ibuf->x == 0) || (ibuf->y == 0)) {
391 BKE_image_release_ibuf(ima, ibuf, lock);
392 return OPERATOR_CANCELLED;
393 }
394
395 facx = 1.0f * (region->sizex - pad) / (ibuf->x * snode->zoom);
396 facy = 1.0f * (region->sizey - pad) / (ibuf->y * snode->zoom);
397
398 BKE_image_release_ibuf(ima, ibuf, lock);
399
400 snode->zoom *= min_ff(facx, facy) * UI_SCALE_FAC;
401
402 snode->xof = 0;
403 snode->yof = 0;
404
405 ED_region_tag_redraw(region);
408
409 return OPERATOR_FINISHED;
410}
411
413{
414
415 /* identifiers */
416 ot->name = "Background Image Fit";
417 ot->idname = "NODE_OT_backimage_fit";
418 ot->description = "Fit the background image to the view";
419
420 /* api callbacks */
423
424 /* flags */
426}
427
430/* -------------------------------------------------------------------- */
437 int x, y;
439
441 float colf[4];
442 float linearcol[4];
443
444 int draw;
446};
447
448static void sample_draw(const bContext *C, ARegion *region, void *arg_info)
449{
450 Scene *scene = CTX_data_scene(C);
451 ImageSampleInfo *info = (ImageSampleInfo *)arg_info;
452
453 if (info->draw) {
454 ED_image_draw_info(scene,
455 region,
456 info->color_manage,
457 false,
458 info->channels,
459 info->x,
460 info->y,
461 info->col,
462 info->colf,
463 info->linearcol);
464 }
465}
466
467} // namespace blender::ed::space_node
468
470 Main *bmain, SpaceNode *snode, ARegion *region, const int mval[2], float fpos[2])
471{
472 if (!ED_node_is_compositor(snode) || (snode->flag & SNODE_BACKDRAW) == 0) {
473 return false;
474 }
475
476 void *lock;
477 Image *ima = BKE_image_ensure_viewer(bmain, IMA_TYPE_COMPOSITE, "Viewer Node");
478 ImBuf *ibuf = BKE_image_acquire_ibuf(ima, nullptr, &lock);
479 if (!ibuf) {
480 BKE_image_release_ibuf(ima, ibuf, lock);
481 return false;
482 }
483
484 /* map the mouse coords to the backdrop image space */
485 float bufx = ibuf->x * snode->zoom;
486 float bufy = ibuf->y * snode->zoom;
487 fpos[0] = (bufx > 0.0f ? (float(mval[0]) - 0.5f * region->winx - snode->xof) / bufx + 0.5f :
488 0.0f);
489 fpos[1] = (bufy > 0.0f ? (float(mval[1]) - 0.5f * region->winy - snode->yof) / bufy + 0.5f :
490 0.0f);
491
492 BKE_image_release_ibuf(ima, ibuf, lock);
493 return true;
494}
495
497 Main *bmain, SpaceNode *snode, ARegion *region, const int mval[2], float r_col[3])
498{
499 void *lock;
500 Image *ima;
501 ImBuf *ibuf;
502 float fx, fy, bufx, bufy;
503 bool ret = false;
504
505 if (!ED_node_is_compositor(snode) || (snode->flag & SNODE_BACKDRAW) == 0) {
506 /* use viewer image for color sampling only if we're in compositor tree
507 * with backdrop enabled
508 */
509 return false;
510 }
511
512 ima = BKE_image_ensure_viewer(bmain, IMA_TYPE_COMPOSITE, "Viewer Node");
513 ibuf = BKE_image_acquire_ibuf(ima, nullptr, &lock);
514 if (!ibuf) {
515 return false;
516 }
517
518 /* map the mouse coords to the backdrop image space */
519 bufx = ibuf->x * snode->zoom;
520 bufy = ibuf->y * snode->zoom;
521 fx = (bufx > 0.0f ? (float(mval[0]) - 0.5f * region->winx - snode->xof) / bufx + 0.5f : 0.0f);
522 fy = (bufy > 0.0f ? (float(mval[1]) - 0.5f * region->winy - snode->yof) / bufy + 0.5f : 0.0f);
523
524 if (fx >= 0.0f && fy >= 0.0f && fx < 1.0f && fy < 1.0f) {
525 const float *fp;
526 uchar *cp;
527 int x = int(fx * ibuf->x), y = int(fy * ibuf->y);
528
529 CLAMP(x, 0, ibuf->x - 1);
530 CLAMP(y, 0, ibuf->y - 1);
531
532 if (ibuf->float_buffer.data) {
533 fp = (ibuf->float_buffer.data + (ibuf->channels) * (y * ibuf->x + x));
534 /* #IB_PROFILE_NONE is default but in fact its linear. */
535 copy_v3_v3(r_col, fp);
536 ret = true;
537 }
538 else if (ibuf->byte_buffer.data) {
539 cp = ibuf->byte_buffer.data + 4 * (y * ibuf->x + x);
540 rgb_uchar_to_float(r_col, cp);
542 ret = true;
543 }
544 }
545
546 BKE_image_release_ibuf(ima, ibuf, lock);
547
548 return ret;
549}
550
551namespace blender::ed::space_node {
552
553static void sample_apply(bContext *C, wmOperator *op, const wmEvent *event)
554{
555 Main *bmain = CTX_data_main(C);
556 SpaceNode *snode = CTX_wm_space_node(C);
557 ARegion *region = CTX_wm_region(C);
559 void *lock;
560 Image *ima;
561 ImBuf *ibuf;
562 float fx, fy, bufx, bufy;
563
564 ima = BKE_image_ensure_viewer(bmain, IMA_TYPE_COMPOSITE, "Viewer Node");
565 ibuf = BKE_image_acquire_ibuf(ima, nullptr, &lock);
566 if (!ibuf) {
567 info->draw = 0;
568 return;
569 }
570
571 if (!ibuf->byte_buffer.data) {
573 }
574
575 /* map the mouse coords to the backdrop image space */
576 bufx = ibuf->x * snode->zoom;
577 bufy = ibuf->y * snode->zoom;
578 fx = (bufx > 0.0f ? (float(event->mval[0]) - 0.5f * region->winx - snode->xof) / bufx + 0.5f :
579 0.0f);
580 fy = (bufy > 0.0f ? (float(event->mval[1]) - 0.5f * region->winy - snode->yof) / bufy + 0.5f :
581 0.0f);
582
583 if (fx >= 0.0f && fy >= 0.0f && fx < 1.0f && fy < 1.0f) {
584 const float *fp;
585 uchar *cp;
586 int x = int(fx * ibuf->x), y = int(fy * ibuf->y);
587
588 CLAMP(x, 0, ibuf->x - 1);
589 CLAMP(y, 0, ibuf->y - 1);
590
591 info->x = x;
592 info->y = y;
593 info->draw = 1;
594 info->channels = ibuf->channels;
595
596 if (ibuf->byte_buffer.data) {
597 cp = ibuf->byte_buffer.data + 4 * (y * ibuf->x + x);
598
599 info->col[0] = cp[0];
600 info->col[1] = cp[1];
601 info->col[2] = cp[2];
602 info->col[3] = cp[3];
603
604 info->colf[0] = float(cp[0]) / 255.0f;
605 info->colf[1] = float(cp[1]) / 255.0f;
606 info->colf[2] = float(cp[2]) / 255.0f;
607 info->colf[3] = float(cp[3]) / 255.0f;
608
609 copy_v4_v4(info->linearcol, info->colf);
611 info->linearcol, false, ibuf->byte_buffer.colorspace);
612
613 info->color_manage = true;
614 }
615 if (ibuf->float_buffer.data) {
616 fp = (ibuf->float_buffer.data + (ibuf->channels) * (y * ibuf->x + x));
617
618 info->colf[0] = fp[0];
619 info->colf[1] = fp[1];
620 info->colf[2] = fp[2];
621 info->colf[3] = fp[3];
622
623 info->color_manage = true;
624 }
625
627 }
628 else {
629 info->draw = 0;
630 ED_node_sample_set(nullptr);
631 }
632
633 BKE_image_release_ibuf(ima, ibuf, lock);
634
636}
637
638static void sample_exit(bContext *C, wmOperator *op)
639{
641
642 ED_node_sample_set(nullptr);
645 MEM_freeN(info);
646}
647
648static int sample_invoke(bContext *C, wmOperator *op, const wmEvent *event)
649{
650 SpaceNode *snode = CTX_wm_space_node(C);
651 ARegion *region = CTX_wm_region(C);
652 ImageSampleInfo *info;
653
654 /* Don't handle events intended for nodes (which rely on click/drag distinction).
655 * which this operator would use since sampling is normally activated on press, see: #98191. */
656 if (node_or_socket_isect_event(*C, *event)) {
658 }
659
660 if (!ED_node_is_compositor(snode) || !(snode->flag & SNODE_BACKDRAW)) {
661 return OPERATOR_CANCELLED;
662 }
663
664 info = MEM_cnew<ImageSampleInfo>("ImageSampleInfo");
665 info->art = region->type;
667 region->type, sample_draw, info, REGION_DRAW_POST_PIXEL);
668 op->customdata = info;
669
670 sample_apply(C, op, event);
671
673
675}
676
677static int sample_modal(bContext *C, wmOperator *op, const wmEvent *event)
678{
679 switch (event->type) {
680 case LEFTMOUSE:
681 case RIGHTMOUSE: /* XXX hardcoded */
682 if (event->val == KM_RELEASE) {
683 sample_exit(C, op);
684 return OPERATOR_CANCELLED;
685 }
686 break;
687 case MOUSEMOVE:
688 sample_apply(C, op, event);
689 break;
690 }
691
693}
694
696{
697 sample_exit(C, op);
698}
699
701{
702 /* identifiers */
703 ot->name = "Backimage Sample";
704 ot->idname = "NODE_OT_backimage_sample";
705 ot->description = "Use mouse to sample background image";
706
707 /* api callbacks */
712
713 /* flags */
715}
716
719} // namespace blender::ed::space_node
SpaceNode * CTX_wm_space_node(const bContext *C)
ScrArea * CTX_wm_area(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
Main * CTX_data_main(const bContext *C)
ARegion * CTX_wm_region(const bContext *C)
ImBuf * BKE_image_acquire_ibuf(Image *ima, ImageUser *iuser, void **r_lock)
Image * BKE_image_ensure_viewer(Main *bmain, int type, const char *name)
void BKE_image_release_ibuf(Image *ima, ImBuf *ibuf, void *lock)
#define NODE_FRAME
Definition BKE_node.hh:803
MINLINE float min_ff(float a, float b)
void rgb_uchar_to_float(float r_col[3], const unsigned char col_ub[3])
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_union(struct rctf *rct_a, const struct rctf *rct_b)
void BLI_rctf_scale(rctf *rect, float scale)
Definition rct.c:671
BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct)
Definition BLI_rect.h:197
void BLI_rctf_resize(struct rctf *rect, float x, float y)
Definition rct.c:651
BLI_INLINE float BLI_rctf_size_y(const struct rctf *rct)
Definition BLI_rect.h:201
void BLI_rctf_init_minmax(struct rctf *rect)
Definition rct.c:484
unsigned char uchar
#define CLAMP(a, b, c)
@ IMA_TYPE_COMPOSITE
@ NODE_SELECT
@ RGN_TYPE_WINDOW
@ SNODE_BACKDRAW
#define UI_SCALE_FAC
@ OPERATOR_RUNNING_MODAL
@ OPERATOR_PASS_THROUGH
void ED_image_draw_info(Scene *scene, 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])
void ED_node_sample_set(const float col[4])
Definition drawnode.cc:160
bool ED_node_is_compositor(const SpaceNode *snode)
Definition node_edit.cc:523
void ED_area_tag_redraw(ScrArea *area)
Definition area.cc:708
bool ED_operator_node_active(bContext *C)
void ED_region_tag_redraw(ARegion *region)
Definition area.cc:634
void * ED_region_draw_cb_activate(ARegionType *art, void(*draw)(const bContext *, ARegion *, void *), void *customdata, int type)
bool ED_region_draw_cb_exit(ARegionType *art, void *handle)
#define REGION_DRAW_POST_PIXEL
void IMB_colormanagement_colorspace_to_scene_linear_v3(float pixel[3], ColorSpace *colorspace)
void IMB_colormanagement_colorspace_to_scene_linear_v4(float pixel[4], bool predivide, ColorSpace *colorspace)
void IMB_rect_from_float(ImBuf *ibuf)
Definition divers.cc:694
Contains defines and structs used throughout the imbuf module.
Read Guarded memory(de)allocation.
void UI_view2d_smooth_view(const bContext *C, ARegion *region, const rctf *cur, int smooth_viewtx)
@ OPTYPE_BLOCKING
Definition WM_types.hh:164
@ OPTYPE_GRAB_CURSOR_XY
Definition WM_types.hh:168
#define NC_NODE
Definition WM_types.hh:361
@ KM_RELEASE
Definition WM_types.hh:285
#define ND_DISPLAY
Definition WM_types.hh:458
#define ND_SPACE_NODE_VIEW
Definition WM_types.hh:502
#define NC_SPACE
Definition WM_types.hh:359
int pad[32 - sizeof(int)]
volatile int lock
draw_view in_light_buf[] float
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
void MEM_freeN(void *vmemh)
Definition mallocn.cc:105
static bool space_node_composite_active_view_poll(bContext *C)
Definition node_view.cc:58
static int backimage_zoom_exec(bContext *C, wmOperator *op)
Definition node_view.cc:333
static int node_view_selected_exec(bContext *C, wmOperator *op)
Definition node_view.cc:174
bool space_node_view_flag(bContext &C, SpaceNode &snode, ARegion &region, int node_flag, int smooth_viewtx)
Definition node_view.cc:76
void NODE_OT_backimage_sample(wmOperatorType *ot)
Definition node_view.cc:700
static int sample_modal(bContext *C, wmOperator *op, const wmEvent *event)
Definition node_view.cc:677
void NODE_OT_backimage_zoom(wmOperatorType *ot)
Definition node_view.cc:347
void NODE_OT_backimage_move(wmOperatorType *ot)
Definition node_view.cc:310
static void sample_exit(bContext *C, wmOperator *op)
Definition node_view.cc:638
static int node_view_all_exec(bContext *C, wmOperator *op)
Definition node_view.cc:137
static void sample_cancel(bContext *C, wmOperator *op)
Definition node_view.cc:695
static int snode_bg_viewmove_modal(bContext *C, wmOperator *op, const wmEvent *event)
Definition node_view.cc:214
void NODE_OT_view_selected(wmOperatorType *ot)
Definition node_view.cc:186
static void sample_draw(const bContext *C, ARegion *region, void *arg_info)
Definition node_view.cc:448
static bool space_node_active_view_poll(bContext *C)
Definition node_view.cc:46
static void snode_bg_viewmove_cancel(bContext *, wmOperator *op)
Definition node_view.cc:304
void NODE_OT_view_all(wmOperatorType *ot)
Definition node_view.cc:153
bool node_or_socket_isect_event(const bContext &C, const wmEvent &event)
static int sample_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition node_view.cc:648
static int backimage_fit_exec(bContext *C, wmOperator *)
Definition node_view.cc:372
bool composite_node_active(bContext *C)
Definition node_edit.cc:436
static void sample_apply(bContext *C, wmOperator *op, const wmEvent *event)
Definition node_view.cc:553
static int snode_bg_viewmove_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition node_view.cc:263
void NODE_OT_backimage_fit(wmOperatorType *ot)
Definition node_view.cc:412
bool ED_space_node_get_position(Main *bmain, SpaceNode *snode, ARegion *region, const int mval[2], float fpos[2])
Definition node_view.cc:469
bool ED_space_node_color_sample(Main *bmain, SpaceNode *snode, ARegion *region, const int mval[2], float r_col[3])
Definition node_view.cc:496
return ret
float RNA_float_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, const float default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
ColorSpace * colorspace
ImBufFloatBuffer float_buffer
ImBufByteBuffer byte_buffer
struct bNodeTree * edittree
float xmax
float xmin
float ymax
float ymin
short val
Definition WM_types.hh:724
int mval[2]
Definition WM_types.hh:728
short type
Definition WM_types.hh:722
const char * name
Definition WM_types.hh:990
bool(* poll)(bContext *C) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1042
const char * idname
Definition WM_types.hh:992
int(* modal)(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1036
int(* invoke)(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1022
int(* exec)(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1006
const char * description
Definition WM_types.hh:996
StructRNA * srna
Definition WM_types.hh:1080
void(* cancel)(bContext *C, wmOperator *op)
Definition WM_types.hh:1028
struct PointerRNA * ptr
void WM_main_add_notifier(uint type, void *reference)
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
@ RIGHTMOUSE
@ MOUSEMOVE
@ LEFTMOUSE
@ MIDDLEMOUSE
@ EVT_ESCKEY
wmOperatorType * ot
Definition wm_files.cc:4125
int WM_operator_smooth_viewtx_get(const wmOperator *op)