Blender V5.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
8
9#include "DNA_node_types.h"
10
11#include "BLI_rect.hh"
12#include "BLI_utildefines.hh"
13
14#include "BKE_context.hh"
15#include "BKE_image.hh"
16#include "BKE_node_runtime.hh"
17#include "BKE_screen.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
40namespace blender {
41
42namespace ed::space_node {
43
44/* -------------------------------------------------------------------- */
47
49{
51 return false;
52 }
53 const ARegion *region = CTX_wm_region(C);
54 if (!(region && region->regiontype == RGN_TYPE_WINDOW)) {
55 return false;
56 }
57 return true;
58}
59
61{
63 return false;
64 }
65 const ARegion *region = CTX_wm_region(C);
66 if (!(region && region->regiontype == RGN_TYPE_WINDOW)) {
67 return false;
68 }
69 return true;
70}
71
73
74/* -------------------------------------------------------------------- */
77
79 bContext &C, SpaceNode &snode, ARegion &region, const int node_flag, const int smooth_viewtx)
80{
81 const float oldwidth = BLI_rctf_size_x(&region.v2d.cur);
82 const float oldheight = BLI_rctf_size_y(&region.v2d.cur);
83
84 const float old_aspect = oldwidth / oldheight;
85
86 rctf cur_new;
87 BLI_rctf_init_minmax(&cur_new);
88
89 int tot = 0;
90 if (snode.edittree) {
91 for (const bNode *node : snode.edittree->all_nodes()) {
92 if ((node->flag & node_flag) == node_flag) {
93 BLI_rctf_union(&cur_new, &node->runtime->draw_bounds);
94 tot++;
95 }
96 }
97 }
98
99 if (tot == 0) {
100 return false;
101 }
102
103 const float width = BLI_rctf_size_x(&cur_new);
104 const float height = BLI_rctf_size_y(&cur_new);
105 const float new_aspect = width / height;
106
107 if (old_aspect < new_aspect) {
108 const float height_new = width / old_aspect;
109 cur_new.ymin = cur_new.ymin - height_new / 4.0f;
110 cur_new.ymax = cur_new.ymax + height_new / 4.0f;
111 }
112 else {
113 const float width_new = height * old_aspect;
114 cur_new.xmin = cur_new.xmin - width_new / 4.0f;
115 cur_new.xmax = cur_new.xmax + width_new / 4.0f;
116 }
117
118 /* add some padding */
119 BLI_rctf_scale(&cur_new, 1.1f);
120
121 ui::view2d_smooth_view(&C, &region, &cur_new, smooth_viewtx);
122
123 return true;
124}
125
127{
128 ARegion *region = CTX_wm_region(C);
129 SpaceNode *snode = CTX_wm_space_node(C);
130 const int smooth_viewtx = WM_operator_smooth_viewtx_get(op);
131
132 /* is this really needed? */
133 snode->xof = 0;
134 snode->yof = 0;
135
136 if (space_node_view_flag(*C, *snode, *region, 0, smooth_viewtx)) {
137 return OPERATOR_FINISHED;
138 }
139 return OPERATOR_CANCELLED;
140}
141
143{
144 /* identifiers */
145 ot->name = "Frame All";
146 ot->idname = "NODE_OT_view_all";
147 ot->description = "Resize view so you can see all nodes";
148
149 /* API callbacks. */
152
153 /* flags */
154 ot->flag = 0;
155}
156
158
159/* -------------------------------------------------------------------- */
162
164{
165 ARegion *region = CTX_wm_region(C);
166 SpaceNode *snode = CTX_wm_space_node(C);
167 const int smooth_viewtx = WM_operator_smooth_viewtx_get(op);
168
169 if (space_node_view_flag(*C, *snode, *region, NODE_SELECT, smooth_viewtx)) {
170 return OPERATOR_FINISHED;
171 }
172 return OPERATOR_CANCELLED;
173}
174
176{
177 /* identifiers */
178 ot->name = "Frame Selected";
179 ot->idname = "NODE_OT_view_selected";
180 ot->description = "Resize view so you can see selected nodes";
181
182 /* API callbacks. */
185
186 /* flags */
187 ot->flag = 0;
188}
189
191
192/* -------------------------------------------------------------------- */
195
202
204{
205 SpaceNode *snode = CTX_wm_space_node(C);
206 ARegion *region = CTX_wm_region(C);
207 NodeViewMove *nvm = static_cast<NodeViewMove *>(op->customdata);
208
209 switch (event->type) {
210 case MOUSEMOVE:
211
212 snode->xof -= (nvm->mvalo.x - event->mval[0]);
213 snode->yof -= (nvm->mvalo.y - event->mval[1]);
214 nvm->mvalo.x = event->mval[0];
215 nvm->mvalo.y = event->mval[1];
216
217 /* prevent dragging image outside of the window and losing it! */
218 CLAMP(snode->xof, nvm->xmin, nvm->xmax);
219 CLAMP(snode->yof, nvm->ymin, nvm->ymax);
220
221 ED_region_tag_redraw(region);
224
225 break;
226
227 case LEFTMOUSE:
228 case MIDDLEMOUSE:
229 if (event->val == KM_RELEASE) {
230 MEM_delete(nvm);
231 op->customdata = nullptr;
232 return OPERATOR_FINISHED;
233 }
234 break;
235 case EVT_ESCKEY:
236 case RIGHTMOUSE:
237 snode->xof = nvm->xof_orig;
238 snode->yof = nvm->yof_orig;
239 ED_region_tag_redraw(region);
242
243 MEM_delete(nvm);
244 op->customdata = nullptr;
245
246 return OPERATOR_CANCELLED;
247 default: {
248 break;
249 }
250 }
251
253}
254
256{
257 Main *bmain = CTX_data_main(C);
258 SpaceNode *snode = CTX_wm_space_node(C);
259 ARegion *region = CTX_wm_region(C);
260 NodeViewMove *nvm;
261 Image *ima;
262 ImBuf *ibuf;
263 const float pad = 32.0f; /* Better be bigger than scroll-bars. */
264
265 void *lock;
266
267 ima = BKE_image_ensure_viewer(bmain, IMA_TYPE_COMPOSITE, "Viewer Node");
268 ibuf = BKE_image_acquire_ibuf(ima, nullptr, &lock);
269
270 if (ibuf == nullptr) {
271 BKE_image_release_ibuf(ima, ibuf, lock);
272 return OPERATOR_CANCELLED;
273 }
274
275 nvm = MEM_new_zeroed<NodeViewMove>(__func__);
276 op->customdata = nvm;
277 nvm->mvalo.x = event->mval[0];
278 nvm->mvalo.y = event->mval[1];
279
280 nvm->xmin = -(region->winx / 2) - (ibuf->x * (0.5f * snode->zoom)) + pad;
281 nvm->xmax = (region->winx / 2) + (ibuf->x * (0.5f * snode->zoom)) - pad;
282 nvm->ymin = -(region->winy / 2) - (ibuf->y * (0.5f * snode->zoom)) + pad;
283 nvm->ymax = (region->winy / 2) + (ibuf->y * (0.5f * snode->zoom)) - pad;
284
285 nvm->xof_orig = snode->xof;
286 nvm->yof_orig = snode->yof;
287
288 BKE_image_release_ibuf(ima, ibuf, lock);
289
290 /* add modal handler */
292
294}
295
297{
298 NodeViewMove *nvm = static_cast<NodeViewMove *>(op->customdata);
299 MEM_delete(nvm);
300 op->customdata = nullptr;
301}
302
304{
305 /* identifiers */
306 ot->name = "Background Image Move";
307 ot->description = "Move node backdrop";
308 ot->idname = "NODE_OT_backimage_move";
309
310 /* API callbacks. */
315
316 /* flags */
318}
319
321
322/* -------------------------------------------------------------------- */
325
326/* Simple struct for background image zoom data */
331
333{
335
336 SpaceNode *snode = CTX_wm_space_node(C);
337
339 op->customdata = zdata;
340
341 zdata->factor = RNA_float_get(op->ptr, "factor");
342 zdata->offset = {snode->xof, snode->yof}; /* Current img offset for execute. */
343}
344
346{
347 ARegion *region = CTX_wm_region(C);
348 SpaceNode *snode = CTX_wm_space_node(C);
349
350 /* If executed without invoking, initialize the customdata here. */
351 if (op->customdata == nullptr) {
353 }
354
355 backImageZoomData *zdata = static_cast<backImageZoomData *>(op->customdata);
356
357 snode->zoom *= zdata->factor;
358 snode->xof = zdata->offset.x;
359 snode->yof = zdata->offset.y;
360
361 ED_region_tag_redraw(region);
364
365 MEM_SAFE_DELETE(zdata);
366 op->customdata = nullptr;
367
368 return OPERATOR_FINISHED;
369}
370
372{
373 ARegion *region = CTX_wm_region(C);
374 SpaceNode *snode = CTX_wm_space_node(C);
375
377 backImageZoomData *zdata = static_cast<backImageZoomData *>(op->customdata);
378
379 /* If the not set in the preference, no need to do all the checks below. */
380 if ((U.uiflag & USER_ZOOM_TO_MOUSEPOS) == 0) {
381 return backimage_zoom_exec(C, op);
382 }
383
384 if (RNA_boolean_get(op->ptr, "use_mouse_pos")) {
385 float fac = RNA_float_get(op->ptr, "factor");
386
387 float2 img_center = {snode->xof + region->winx / 2.0f, snode->yof + region->winy / 2.0f};
388
389 float2 img_offset = {snode->xof + (event->mval[0] - img_center.x) * (1 - fac),
390 snode->yof + (event->mval[1] - img_center.y) * (1 - fac)};
391
392 zdata->offset = {img_offset.x, img_offset.y};
393 }
394
395 return backimage_zoom_exec(C, op);
396}
397
399{
400
401 /* identifiers */
402 ot->name = "Background Image Zoom";
403 ot->idname = "NODE_OT_backimage_zoom";
404 ot->description = "Zoom in/out the background image";
405
406 /* API callbacks. */
410
411 /* flags */
412 ot->flag = OPTYPE_BLOCKING;
413
414 /* internal */
415 RNA_def_float(ot->srna, "factor", 1.2f, 0.0f, 10.0f, "Factor", "", 0.0f, 10.0f);
416 RNA_def_boolean(ot->srna, "use_mouse_pos", true, "Use Mouse Position", "Zoom to mouse position");
417}
418
420
421/* -------------------------------------------------------------------- */
424
426{
427 Main *bmain = CTX_data_main(C);
428 SpaceNode *snode = CTX_wm_space_node(C);
429 ARegion *region = CTX_wm_region(C);
430
431 Image *ima;
432 ImBuf *ibuf;
433
434 const float pad = 32.0f;
435
436 void *lock;
437
438 float facx, facy;
439
440 ima = BKE_image_ensure_viewer(bmain, IMA_TYPE_COMPOSITE, "Viewer Node");
441 ibuf = BKE_image_acquire_ibuf(ima, nullptr, &lock);
442
443 if ((ibuf == nullptr) || (ibuf->x == 0) || (ibuf->y == 0)) {
444 BKE_image_release_ibuf(ima, ibuf, lock);
445 return OPERATOR_CANCELLED;
446 }
447
448 facx = 1.0f * (region->sizex - pad) / (ibuf->x * snode->zoom);
449 facy = 1.0f * (region->sizey - pad) / (ibuf->y * snode->zoom);
450
451 BKE_image_release_ibuf(ima, ibuf, lock);
452
453 snode->zoom *= min_ff(facx, facy) * UI_SCALE_FAC;
454
455 snode->xof = 0;
456 snode->yof = 0;
457
458 ED_region_tag_redraw(region);
461
462 return OPERATOR_FINISHED;
463}
464
466{
467
468 /* identifiers */
469 ot->name = "Background Image Fit";
470 ot->idname = "NODE_OT_backimage_fit";
471 ot->description = "Fit the background image to the view";
472
473 /* API callbacks. */
476
477 /* flags */
478 ot->flag = OPTYPE_BLOCKING;
479}
480
482
483/* -------------------------------------------------------------------- */
486
490 int x, y;
492
494 float colf[4];
495 float linearcol[4];
496
497 int draw;
499};
500
501static void sample_draw(const bContext *C, ARegion *region, void *arg_info)
502{
503 Scene *scene = CTX_data_scene(C);
504 ImageSampleInfo *info = static_cast<ImageSampleInfo *>(arg_info);
505
506 if (info->draw) {
507 ED_image_draw_info(scene,
508 region,
509 info->color_manage,
510 false,
511 info->channels,
512 info->x,
513 info->y,
514 info->col,
515 info->colf,
516 info->linearcol);
517 }
518}
519
520} // namespace ed::space_node
521
523 Main *bmain, SpaceNode *snode, ARegion *region, const int mval[2], float fpos[2])
524{
525 if (!ED_node_is_compositor(snode) || (snode->flag & SNODE_BACKDRAW) == 0) {
526 return false;
527 }
528
529 void *lock;
530 Image *ima = BKE_image_ensure_viewer(bmain, IMA_TYPE_COMPOSITE, "Viewer Node");
531 ImBuf *ibuf = BKE_image_acquire_ibuf(ima, nullptr, &lock);
532 if (!ibuf) {
533 BKE_image_release_ibuf(ima, ibuf, lock);
534 return false;
535 }
536
537 /* map the mouse coords to the backdrop image space */
538 float bufx = ibuf->x * snode->zoom;
539 float bufy = ibuf->y * snode->zoom;
540 fpos[0] = (bufx > 0.0f ? (float(mval[0]) - 0.5f * region->winx - snode->xof) / bufx + 0.5f :
541 0.0f);
542 fpos[1] = (bufy > 0.0f ? (float(mval[1]) - 0.5f * region->winy - snode->yof) / bufy + 0.5f :
543 0.0f);
544
545 BKE_image_release_ibuf(ima, ibuf, lock);
546 return true;
547}
548
550 Main *bmain, SpaceNode *snode, ARegion *region, const int mval[2], float r_col[3])
551{
552 void *lock;
553 Image *ima;
554 ImBuf *ibuf;
555 float fx, fy, bufx, bufy;
556 bool ret = false;
557
558 if (!ED_node_is_compositor(snode) || (snode->flag & SNODE_BACKDRAW) == 0) {
559 /* use viewer image for color sampling only if we're in compositor tree
560 * with backdrop enabled
561 */
562 return false;
563 }
564
565 ima = BKE_image_ensure_viewer(bmain, IMA_TYPE_COMPOSITE, "Viewer Node");
566 ibuf = BKE_image_acquire_ibuf(ima, nullptr, &lock);
567 if (!ibuf) {
568 return false;
569 }
570
571 /* map the mouse coords to the backdrop image space */
572 bufx = ibuf->x * snode->zoom;
573 bufy = ibuf->y * snode->zoom;
574 fx = (bufx > 0.0f ? (float(mval[0]) - 0.5f * region->winx - snode->xof) / bufx + 0.5f : 0.0f);
575 fy = (bufy > 0.0f ? (float(mval[1]) - 0.5f * region->winy - snode->yof) / bufy + 0.5f : 0.0f);
576
577 if (fx >= 0.0f && fy >= 0.0f && fx < 1.0f && fy < 1.0f) {
578 const float *fp;
579 const uchar *cp;
580 int x = int(fx * ibuf->x), y = int(fy * ibuf->y);
581
582 CLAMP(x, 0, ibuf->x - 1);
583 CLAMP(y, 0, ibuf->y - 1);
584
585 if (const float *float_data = ibuf->float_data()) {
586 fp = (float_data + (ibuf->channels) * (y * ibuf->x + x));
587 copy_v3_v3(r_col, fp);
588 ret = true;
589 }
590 else if (const uchar *byte_data = ibuf->byte_data()) {
591 cp = byte_data + 4 * (y * ibuf->x + x);
592 rgb_uchar_to_float(r_col, cp);
594 ret = true;
595 }
596 }
597
598 BKE_image_release_ibuf(ima, ibuf, lock);
599
600 return ret;
601}
602
603namespace ed::space_node {
604
605static void sample_apply(bContext *C, wmOperator *op, const wmEvent *event)
606{
607 Main *bmain = CTX_data_main(C);
608 SpaceNode *snode = CTX_wm_space_node(C);
609 ARegion *region = CTX_wm_region(C);
610 ImageSampleInfo *info = static_cast<ImageSampleInfo *>(op->customdata);
611 void *lock;
612 Image *ima;
613 ImBuf *ibuf;
614 float fx, fy, bufx, bufy;
615
616 ima = BKE_image_ensure_viewer(bmain, IMA_TYPE_COMPOSITE, "Viewer Node");
617 ibuf = BKE_image_acquire_ibuf(ima, nullptr, &lock);
618 if (!ibuf) {
619 info->draw = 0;
620 return;
621 }
622
623 if (!ibuf->byte_data()) {
625 }
626
627 /* map the mouse coords to the backdrop image space */
628 bufx = ibuf->x * snode->zoom;
629 bufy = ibuf->y * snode->zoom;
630 fx = (bufx > 0.0f ? (float(event->mval[0]) - 0.5f * region->winx - snode->xof) / bufx + 0.5f :
631 0.0f);
632 fy = (bufy > 0.0f ? (float(event->mval[1]) - 0.5f * region->winy - snode->yof) / bufy + 0.5f :
633 0.0f);
634
635 if (fx >= 0.0f && fy >= 0.0f && fx < 1.0f && fy < 1.0f) {
636 const float *fp;
637 const uchar *cp;
638 int x = int(fx * ibuf->x), y = int(fy * ibuf->y);
639
640 CLAMP(x, 0, ibuf->x - 1);
641 CLAMP(y, 0, ibuf->y - 1);
642
643 info->x = x;
644 info->y = y;
645 info->draw = 1;
646 info->channels = ibuf->channels;
647
648 if (const uchar *byte_data = ibuf->byte_data()) {
649 cp = byte_data + 4 * (y * ibuf->x + x);
650
651 info->col[0] = cp[0];
652 info->col[1] = cp[1];
653 info->col[2] = cp[2];
654 info->col[3] = cp[3];
655
656 info->colf[0] = float(cp[0]) / 255.0f;
657 info->colf[1] = float(cp[1]) / 255.0f;
658 info->colf[2] = float(cp[2]) / 255.0f;
659 info->colf[3] = float(cp[3]) / 255.0f;
660
661 copy_v4_v4(info->linearcol, info->colf);
663 info->linearcol, false, ibuf->byte_buffer.colorspace);
664
665 info->color_manage = true;
666 }
667 if (const float *float_data = ibuf->float_data()) {
668 fp = float_data + (ibuf->channels) * (y * ibuf->x + x);
669
670 info->colf[0] = fp[0];
671 info->colf[1] = fp[1];
672 info->colf[2] = fp[2];
673 info->colf[3] = fp[3];
674
675 info->color_manage = true;
676 }
677
679 }
680 else {
681 info->draw = 0;
682 ED_node_sample_set(nullptr);
683 }
684
685 BKE_image_release_ibuf(ima, ibuf, lock);
686
688}
689
691{
692 ImageSampleInfo *info = static_cast<ImageSampleInfo *>(op->customdata);
693
694 ED_node_sample_set(nullptr);
697 MEM_delete(info);
698}
699
701{
702 SpaceNode *snode = CTX_wm_space_node(C);
703 ARegion *region = CTX_wm_region(C);
704 ImageSampleInfo *info;
705
706 /* Don't handle events intended for nodes (which rely on click/drag distinction).
707 * which this operator would use since sampling is normally activated on press, see: #98191. */
708 if (node_or_socket_isect_event(*C, *event)) {
710 }
711
712 if (!ED_node_is_compositor(snode) || !(snode->flag & SNODE_BACKDRAW)) {
713 return OPERATOR_CANCELLED;
714 }
715
716 info = MEM_new_zeroed<ImageSampleInfo>("ImageSampleInfo");
717 info->art = region->runtime->type;
720 op->customdata = info;
721
722 sample_apply(C, op, event);
723
725
727}
728
730{
731 switch (event->type) {
732 case LEFTMOUSE:
733 case RIGHTMOUSE: /* XXX hardcoded */
734 if (event->val == KM_RELEASE) {
735 sample_exit(C, op);
736 return OPERATOR_CANCELLED;
737 }
738 break;
739 case MOUSEMOVE:
740 sample_apply(C, op, event);
741 break;
742 default: {
743 break;
744 }
745 }
746
748}
749
751{
752 sample_exit(C, op);
753}
754
756{
757 /* identifiers */
758 ot->name = "Backimage Sample";
759 ot->idname = "NODE_OT_backimage_sample";
760 ot->description = "Use mouse to sample background image";
761
762 /* API callbacks. */
763 ot->invoke = sample_invoke;
764 ot->modal = sample_modal;
765 ot->cancel = sample_cancel;
767
768 /* flags */
769 ot->flag = OPTYPE_BLOCKING;
770}
771
773
774} // namespace ed::space_node
775
776} // namespace blender
#define UI_SCALE_FAC
#define REGION_DRAW_POST_PIXEL
Read Blender memory allocation and freeing.
#define C
Definition RandGen.cpp:29
#define NC_NODE
Definition WM_types.hh:407
#define ND_DISPLAY
Definition WM_types.hh:534
#define ND_SPACE_NODE_VIEW
Definition WM_types.hh:579
#define NC_SPACE
Definition WM_types.hh:405
int pad[32 - sizeof(int)]
volatile int lock
#define CLAMP(a, b, c)
static bool space_node_composite_active_view_poll(bContext *C)
Definition node_view.cc:60
static wmOperatorStatus node_view_all_exec(bContext *C, wmOperator *op)
Definition node_view.cc:126
static wmOperatorStatus backimage_fit_exec(bContext *C, wmOperator *)
Definition node_view.cc:425
bool space_node_view_flag(bContext &C, SpaceNode &snode, ARegion &region, int node_flag, int smooth_viewtx)
Definition node_view.cc:78
void NODE_OT_backimage_sample(wmOperatorType *ot)
Definition node_view.cc:755
static wmOperatorStatus sample_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition node_view.cc:700
void NODE_OT_backimage_zoom(wmOperatorType *ot)
Definition node_view.cc:398
static wmOperatorStatus node_view_selected_exec(bContext *C, wmOperator *op)
Definition node_view.cc:163
void NODE_OT_backimage_move(wmOperatorType *ot)
Definition node_view.cc:303
static void sample_exit(bContext *C, wmOperator *op)
Definition node_view.cc:690
static void sample_cancel(bContext *C, wmOperator *op)
Definition node_view.cc:750
void NODE_OT_view_selected(wmOperatorType *ot)
Definition node_view.cc:175
static wmOperatorStatus backimage_zoom_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition node_view.cc:371
static wmOperatorStatus sample_modal(bContext *C, wmOperator *op, const wmEvent *event)
Definition node_view.cc:729
static wmOperatorStatus snode_bg_viewmove_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition node_view.cc:255
static void sample_draw(const bContext *C, ARegion *region, void *arg_info)
Definition node_view.cc:501
static bool space_node_active_view_poll(bContext *C)
Definition node_view.cc:48
static void snode_bg_viewmove_cancel(bContext *, wmOperator *op)
Definition node_view.cc:296
void NODE_OT_view_all(wmOperatorType *ot)
Definition node_view.cc:142
bool node_or_socket_isect_event(const bContext &C, const wmEvent &event)
static void backimage_zoom_init(bContext *C, wmOperator *op)
Definition node_view.cc:332
static wmOperatorStatus backimage_zoom_exec(bContext *C, wmOperator *op)
Definition node_view.cc:345
bool composite_node_active(bContext *C)
Definition node_edit.cc:91
static void sample_apply(bContext *C, wmOperator *op, const wmEvent *event)
Definition node_view.cc:605
static wmOperatorStatus snode_bg_viewmove_modal(bContext *C, wmOperator *op, const wmEvent *event)
Definition node_view.cc:203
void NODE_OT_backimage_fit(wmOperatorType *ot)
Definition node_view.cc:465
void view2d_smooth_view(const bContext *C, ARegion *region, const rctf *cur, int smooth_viewtx)
BMesh Iterators.
MINLINE float min_ff(float a, float b)
void WM_main_add_notifier(uint type, void *reference)
bool ED_node_is_compositor(const SpaceNode *snode)
Definition node_edit.cc:135
UserDef U
Definition blender.cc:58
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
bool ED_operator_node_active(bContext *C)
ScrArea * CTX_wm_area(const bContext *C)
MINLINE void copy_v3_v3(float r[3], const float a[3])
void ED_node_sample_set(const float col[4])
Definition drawnode.cc:138
int WM_operator_smooth_viewtx_get(const wmOperator *op)
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 BLI_rctf_scale(rctf *rect, float scale)
Definition rct.cc:691
void ED_region_tag_redraw(ARegion *region)
Definition area.cc:681
void IMB_colormanagement_colorspace_to_scene_linear_v3(float pixel[3], const ColorSpace *colorspace)
void * ED_region_draw_cb_activate(ARegionType *art, void(*draw)(const bContext *, ARegion *, void *), void *customdata, int type)
VecBase< int32_t, 2 > int2
VecBase< float, 2 > float2
void * MEM_new_zeroed(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2)
unsigned char uchar
Definition BKE_text.h:58
bool ED_region_draw_cb_exit(ARegionType *art, void *handle)
BLI_INLINE float BLI_rctf_size_y(const struct rctf *rct)
Definition BLI_rect.hh:215
void BLI_rctf_init_minmax(struct rctf *rect)
Definition rct.cc:494
SpaceNode * CTX_wm_space_node(const bContext *C)
bool ED_space_node_color_sample(Main *bmain, SpaceNode *snode, ARegion *region, const int mval[2], float r_col[3])
Definition node_view.cc:549
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
void IMB_colormanagement_colorspace_to_scene_linear_v4(float pixel[4], bool predivide, const ColorSpace *colorspace)
void BLI_rctf_union(struct rctf *rct_a, const struct rctf *rct_b)
ImBuf * BKE_image_acquire_ibuf(Image *ima, ImageUser *iuser, void **r_lock)
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
Main * CTX_data_main(const bContext *C)
void IMB_byte_from_float(ImBuf *ibuf)
BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct)
Definition BLI_rect.hh:211
Image * BKE_image_ensure_viewer(Main *bmain, int type, const char *name)
@ KM_RELEASE
Definition WM_types.hh:325
MINLINE void rgb_uchar_to_float(float r_col[3], const unsigned char col_ub[3])
Scene * CTX_data_scene(const bContext *C)
MINLINE void copy_v4_v4(float r[4], const float a[4])
@ OPTYPE_BLOCKING
Definition WM_types.hh:192
@ OPTYPE_GRAB_CURSOR_XY
Definition WM_types.hh:196
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
bool ED_space_node_get_position(Main *bmain, SpaceNode *snode, ARegion *region, const int mval[2], float fpos[2])
Definition node_view.cc:522
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)
ARegion * CTX_wm_region(const bContext *C)
float RNA_float_get(PointerRNA *ptr, const char *name)
void ED_area_tag_redraw(ScrArea *area)
Definition area.cc:784
void BKE_image_release_ibuf(Image *ima, ImBuf *ibuf, void *lock)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
bke::ARegionRuntime * runtime
eRegion_Type regiontype
const ColorSpace * colorspace
ImBufByteBuffer byte_buffer
const uint8_t * byte_data() const
const float * float_data() const
struct bNodeTree * edittree
eSpaceNode_Flag flag
struct ARegionType * type
wmEventType type
Definition WM_types.hh:817
wmOperatorStatus(*) exec(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1125
const char * description
Definition WM_types.hh:1115
void(*) cancel(bContext *C, wmOperator *op)
Definition WM_types.hh:1149
bool(*) poll(bContext *C) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1165
wmOperatorStatus(*) invoke(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1141
wmOperatorStatus(*) modal(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1157