Blender V4.3
image_buttons.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
9#include <cstdio>
10#include <cstring>
11
12#include "DNA_node_types.h"
13#include "DNA_scene_types.h"
14
15#include "MEM_guardedalloc.h"
16
17#include "BLI_blenlib.h"
18#include "BLI_utildefines.h"
19
20#include "BLT_translation.hh"
21
22#include "BKE_context.hh"
23#include "BKE_image.hh"
24#include "BKE_image_format.hh"
25#include "BKE_node.hh"
26#include "BKE_screen.hh"
27
28#include "RE_pipeline.h"
29
31#include "IMB_imbuf.hh"
32#include "IMB_imbuf_types.hh"
33
34#include "ED_image.hh"
35#include "ED_screen.hh"
36
37#include "RNA_access.hh"
38
39#include "WM_api.hh"
40#include "WM_types.hh"
41
42#include "UI_interface.hh"
43#include "UI_resources.hh"
44
45#include "image_intern.hh"
46
47#define B_NOP -1
48#define MAX_IMAGE_INFO_LEN 128
49
51{
52 if (ntree) {
53 LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
54 if (node->type == CMP_NODE_VIEWER) {
55 if (node->flag & NODE_DO_OUTPUT) {
56 return static_cast<ImageUser *>(node->storage);
57 }
58 }
59 }
60 }
61 return nullptr;
62}
63
64/* ********************* callbacks for standard image buttons *************** */
65
66static void ui_imageuser_slot_menu(bContext * /*C*/, uiLayout *layout, void *image_p)
67{
68 uiBlock *block = uiLayoutGetBlock(layout);
69 Image *image = static_cast<Image *>(image_p);
70
71 int slot_id;
72 LISTBASE_FOREACH_INDEX (RenderSlot *, slot, &image->renderslots, slot_id) {
73 char str[64];
74 if (slot->name[0] != '\0') {
75 STRNCPY(str, slot->name);
76 }
77 else {
78 SNPRINTF(str, IFACE_("Slot %d"), slot_id + 1);
79 }
80 uiDefButS(block,
82 B_NOP,
83 str,
84 0,
85 0,
86 UI_UNIT_X * 5,
88 &image->render_slot,
89 float(slot_id),
90 0.0,
91 "");
92 }
93
94 uiItemS(layout);
95 uiDefBut(block,
97 0,
98 IFACE_("Slot"),
99 0,
100 0,
101 UI_UNIT_X * 5,
102 UI_UNIT_Y,
103 nullptr,
104 0.0,
105 0.0,
106 "");
107}
108
109static bool ui_imageuser_slot_menu_step(bContext *C, int direction, void *image_p)
110{
111 Image *image = static_cast<Image *>(image_p);
112
113 if (ED_image_slot_cycle(image, direction)) {
115 return true;
116 }
117 return true;
118}
119
121{
122 RenderView *rv = RE_RenderViewGetById(rr, 0);
123 ImBuf *ibuf = rv->ibuf;
124 if (!ibuf) {
125 return nullptr;
126 }
127 if (ibuf->float_buffer.data) {
128 return IFACE_("Composite");
129 }
130 if (ibuf->byte_buffer.data) {
131 return IFACE_("Sequence");
132 }
133 return nullptr;
134}
135
136/* workaround for passing many args */
142
144{
145 ImageUI_Data *rnd_pt_dst = static_cast<ImageUI_Data *>(
146 MEM_mallocN(sizeof(*rnd_pt_src), __func__));
147 memcpy(rnd_pt_dst, rnd_pt_src, sizeof(*rnd_pt_src));
148 return rnd_pt_dst;
149}
150
151static void ui_imageuser_layer_menu(bContext * /*C*/, uiLayout *layout, void *rnd_pt)
152{
153 ImageUI_Data *rnd_data = static_cast<ImageUI_Data *>(rnd_pt);
154 uiBlock *block = uiLayoutGetBlock(layout);
155 Image *image = rnd_data->image;
156 ImageUser *iuser = rnd_data->iuser;
157 Scene *scene = iuser->scene;
158
159 /* May have been freed since drawing. */
161 if (UNLIKELY(rr == nullptr)) {
162 return;
163 }
164
165 UI_block_layout_set_current(block, layout);
166 uiLayoutColumn(layout, false);
167
168 const char *fake_name = ui_imageuser_layer_fake_name(rr);
169 if (fake_name) {
170 uiDefButS(block,
172 B_NOP,
173 fake_name,
174 0,
175 0,
176 UI_UNIT_X * 5,
177 UI_UNIT_X,
178 &iuser->layer,
179 0.0,
180 0.0,
181 "");
182 }
183
184 int nr = fake_name ? 1 : 0;
185 for (RenderLayer *rl = static_cast<RenderLayer *>(rr->layers.first); rl; rl = rl->next, nr++) {
186 uiDefButS(block,
188 B_NOP,
189 rl->name,
190 0,
191 0,
192 UI_UNIT_X * 5,
193 UI_UNIT_X,
194 &iuser->layer,
195 float(nr),
196 0.0,
197 "");
198 }
199
200 uiItemS(layout);
201 uiDefBut(block,
203 0,
204 IFACE_("Layer"),
205 0,
206 0,
207 UI_UNIT_X * 5,
208 UI_UNIT_Y,
209 nullptr,
210 0.0,
211 0.0,
212 "");
213
214 BKE_image_release_renderresult(scene, image, rr);
215}
216
217static void ui_imageuser_pass_menu(bContext * /*C*/, uiLayout *layout, void *rnd_pt)
218{
219 ImageUI_Data *rnd_data = static_cast<ImageUI_Data *>(rnd_pt);
220 uiBlock *block = uiLayoutGetBlock(layout);
221 Image *image = rnd_data->image;
222 ImageUser *iuser = rnd_data->iuser;
223 /* (rpass_index == -1) means composite result */
224 const int rpass_index = rnd_data->rpass_index;
225 Scene *scene = iuser->scene;
226 RenderResult *rr;
227 RenderLayer *rl;
228 RenderPass *rpass;
229 int nr;
230
231 /* may have been freed since drawing */
232 rr = BKE_image_acquire_renderresult(scene, image);
233 if (UNLIKELY(rr == nullptr)) {
234 return;
235 }
236
237 rl = static_cast<RenderLayer *>(BLI_findlink(&rr->layers, rpass_index));
238
239 UI_block_layout_set_current(block, layout);
240 uiLayoutColumn(layout, false);
241
242 nr = (rl == nullptr) ? 1 : 0;
243
244 ListBase added_passes;
245 BLI_listbase_clear(&added_passes);
246
247 /* rendered results don't have a Combined pass */
248 /* multiview: the ordering must be ascending, so the left-most pass is always the one picked */
249 for (rpass = static_cast<RenderPass *>(rl ? rl->passes.first : nullptr); rpass;
250 rpass = rpass->next, nr++)
251 {
252 /* just show one pass of each kind */
253 if (BLI_findstring_ptr(&added_passes, rpass->name, offsetof(LinkData, data))) {
254 continue;
255 }
256 BLI_addtail(&added_passes, BLI_genericNodeN(rpass->name));
257
258 uiDefButS(block,
260 B_NOP,
261 IFACE_(rpass->name),
262 0,
263 0,
264 UI_UNIT_X * 5,
265 UI_UNIT_X,
266 &iuser->pass,
267 float(nr),
268 0.0,
269 "");
270 }
271
272 uiItemS(layout);
273 uiDefBut(block,
275 0,
276 IFACE_("Pass"),
277 0,
278 0,
279 UI_UNIT_X * 5,
280 UI_UNIT_Y,
281 nullptr,
282 0.0,
283 0.0,
284 "");
285
286 BLI_freelistN(&added_passes);
287
288 BKE_image_release_renderresult(scene, image, rr);
289}
290
291/**************************** view menus *****************************/
292static void ui_imageuser_view_menu_rr(bContext * /*C*/, uiLayout *layout, void *rnd_pt)
293{
294 ImageUI_Data *rnd_data = static_cast<ImageUI_Data *>(rnd_pt);
295 uiBlock *block = uiLayoutGetBlock(layout);
296 Image *image = rnd_data->image;
297 ImageUser *iuser = rnd_data->iuser;
298 RenderResult *rr;
299 RenderView *rview;
300 int nr;
301 Scene *scene = iuser->scene;
302
303 /* may have been freed since drawing */
304 rr = BKE_image_acquire_renderresult(scene, image);
305 if (UNLIKELY(rr == nullptr)) {
306 return;
307 }
308
309 UI_block_layout_set_current(block, layout);
310 uiLayoutColumn(layout, false);
311
312 uiDefBut(block,
314 0,
315 IFACE_("View"),
316 0,
317 0,
318 UI_UNIT_X * 5,
319 UI_UNIT_Y,
320 nullptr,
321 0.0,
322 0.0,
323 "");
324
325 uiItemS(layout);
326
327 nr = (rr ? BLI_listbase_count(&rr->views) : 0) - 1;
328 for (rview = static_cast<RenderView *>(rr ? rr->views.last : nullptr); rview;
329 rview = rview->prev, nr--)
330 {
331 uiDefButS(block,
333 B_NOP,
334 IFACE_(rview->name),
335 0,
336 0,
337 UI_UNIT_X * 5,
338 UI_UNIT_X,
339 &iuser->view,
340 float(nr),
341 0.0,
342 "");
343 }
344
345 BKE_image_release_renderresult(scene, image, rr);
346}
347
348static void ui_imageuser_view_menu_multiview(bContext * /*C*/, uiLayout *layout, void *rnd_pt)
349{
350 ImageUI_Data *rnd_data = static_cast<ImageUI_Data *>(rnd_pt);
351 uiBlock *block = uiLayoutGetBlock(layout);
352 Image *image = rnd_data->image;
353 ImageUser *iuser = rnd_data->iuser;
354 int nr;
355 ImageView *iv;
356
357 UI_block_layout_set_current(block, layout);
358 uiLayoutColumn(layout, false);
359
360 uiDefBut(block,
362 0,
363 IFACE_("View"),
364 0,
365 0,
366 UI_UNIT_X * 5,
367 UI_UNIT_Y,
368 nullptr,
369 0.0,
370 0.0,
371 "");
372
373 uiItemS(layout);
374
375 nr = BLI_listbase_count(&image->views) - 1;
376 for (iv = static_cast<ImageView *>(image->views.last); iv; iv = iv->prev, nr--) {
377 uiDefButS(block,
379 B_NOP,
380 IFACE_(iv->name),
381 0,
382 0,
383 UI_UNIT_X * 5,
384 UI_UNIT_X,
385 &iuser->view,
386 float(nr),
387 0.0,
388 "");
389 }
390}
391
392/* 5 layer button callbacks... */
393static void image_multi_cb(bContext *C, void *rnd_pt, void *rr_v)
394{
395 ImageUI_Data *rnd_data = static_cast<ImageUI_Data *>(rnd_pt);
396 ImageUser *iuser = rnd_data->iuser;
397
398 BKE_image_multilayer_index(static_cast<RenderResult *>(rr_v), iuser);
400}
401
402static bool ui_imageuser_layer_menu_step(bContext *C, int direction, void *rnd_pt)
403{
404 Scene *scene = CTX_data_scene(C);
405 ImageUI_Data *rnd_data = static_cast<ImageUI_Data *>(rnd_pt);
406 Image *image = rnd_data->image;
407 ImageUser *iuser = rnd_data->iuser;
408 RenderResult *rr;
409 bool changed = false;
410
411 rr = BKE_image_acquire_renderresult(scene, image);
412 if (UNLIKELY(rr == nullptr)) {
413 return false;
414 }
415
416 if (direction == -1) {
417 if (iuser->layer > 0) {
418 iuser->layer--;
419 changed = true;
420 }
421 }
422 else if (direction == 1) {
423 int tot = BLI_listbase_count(&rr->layers);
424
425 if (RE_HasCombinedLayer(rr)) {
426 tot++; /* fake compo/sequencer layer */
427 }
428
429 if (iuser->layer < tot - 1) {
430 iuser->layer++;
431 changed = true;
432 }
433 }
434 else {
435 BLI_assert(0);
436 }
437
438 BKE_image_release_renderresult(scene, image, rr);
439
440 if (changed) {
443 }
444
445 return changed;
446}
447
448static bool ui_imageuser_pass_menu_step(bContext *C, int direction, void *rnd_pt)
449{
450 Scene *scene = CTX_data_scene(C);
451 ImageUI_Data *rnd_data = static_cast<ImageUI_Data *>(rnd_pt);
452 Image *image = rnd_data->image;
453 ImageUser *iuser = rnd_data->iuser;
454 RenderResult *rr;
455 bool changed = false;
456 int layer = iuser->layer;
457 RenderLayer *rl;
458 RenderPass *rpass;
459
460 rr = BKE_image_acquire_renderresult(scene, image);
461 if (UNLIKELY(rr == nullptr)) {
462 BKE_image_release_renderresult(scene, image, rr);
463 return false;
464 }
465
466 if (RE_HasCombinedLayer(rr)) {
467 layer -= 1;
468 }
469
470 rl = static_cast<RenderLayer *>(BLI_findlink(&rr->layers, layer));
471 if (rl == nullptr) {
472 BKE_image_release_renderresult(scene, image, rr);
473 return false;
474 }
475
476 rpass = static_cast<RenderPass *>(BLI_findlink(&rl->passes, iuser->pass));
477 if (rpass == nullptr) {
478 BKE_image_release_renderresult(scene, image, rr);
479 return false;
480 }
481
482 /* NOTE: this looks reversed, but matches menu direction. */
483 if (direction == -1) {
484 RenderPass *rp;
485 int rp_index = iuser->pass + 1;
486
487 for (rp = rpass->next; rp; rp = rp->next, rp_index++) {
488 if (!STREQ(rp->name, rpass->name)) {
489 iuser->pass = rp_index;
490 changed = true;
491 break;
492 }
493 }
494 }
495 else if (direction == 1) {
496 RenderPass *rp;
497 int rp_index = 0;
498
499 if (iuser->pass == 0) {
500 BKE_image_release_renderresult(scene, image, rr);
501 return false;
502 }
503
504 for (rp = static_cast<RenderPass *>(rl->passes.first); rp; rp = rp->next, rp_index++) {
505 if (STREQ(rp->name, rpass->name)) {
506 iuser->pass = rp_index - 1;
507 changed = true;
508 break;
509 }
510 }
511 }
512 else {
513 BLI_assert(0);
514 }
515
516 BKE_image_release_renderresult(scene, image, rr);
517
518 if (changed) {
521 }
522
523 return changed;
524}
525
526/* 5 view button callbacks... */
527static void image_multiview_cb(bContext *C, void *rnd_pt, void * /*arg_v*/)
528{
529 ImageUI_Data *rnd_data = static_cast<ImageUI_Data *>(rnd_pt);
530 Image *ima = rnd_data->image;
531 ImageUser *iuser = rnd_data->iuser;
532
533 BKE_image_multiview_index(ima, iuser);
535}
536
538 Image *image,
539 RenderResult *rr,
540 ImageUser *iuser,
541 int w,
542 const short *render_slot)
543{
544 ImageUI_Data rnd_pt_local, *rnd_pt = nullptr;
545 uiBlock *block = uiLayoutGetBlock(layout);
546 uiBut *but;
547 RenderLayer *rl = nullptr;
548 int wmenu1, wmenu2, wmenu3, wmenu4;
549 const char *fake_name;
550 const char *display_name = "";
551 const bool show_stereo = (iuser->flag & IMA_SHOW_STEREO) != 0;
552
553 if (iuser->scene == nullptr) {
554 return;
555 }
556
557 uiLayoutRow(layout, true);
558
559 /* layer menu is 1/3 larger than pass */
560 wmenu1 = (2 * w) / 5;
561 wmenu2 = (3 * w) / 5;
562 wmenu3 = (3 * w) / 6;
563 wmenu4 = (3 * w) / 6;
564
565 rnd_pt_local.image = image;
566 rnd_pt_local.iuser = iuser;
567 rnd_pt_local.rpass_index = 0;
568
569 /* menu buts */
570 if (render_slot) {
571 char str[64];
572 RenderSlot *slot = BKE_image_get_renderslot(image, *render_slot);
573 if (slot && slot->name[0] != '\0') {
574 STRNCPY(str, slot->name);
575 }
576 else {
577 SNPRINTF(str, IFACE_("Slot %d"), *render_slot + 1);
578 }
579
580 rnd_pt = ui_imageuser_data_copy(&rnd_pt_local);
581 but = uiDefMenuBut(
582 block, ui_imageuser_slot_menu, image, str, 0, 0, wmenu1, UI_UNIT_Y, TIP_("Select Slot"));
584 UI_but_funcN_set(but, image_multi_cb, rnd_pt, rr);
586 rnd_pt = nullptr;
587 }
588
589 if (rr) {
590 RenderPass *rpass;
591 RenderView *rview;
592 int rpass_index;
593
594 /* layer */
595 fake_name = ui_imageuser_layer_fake_name(rr);
596 rpass_index = iuser->layer - (fake_name ? 1 : 0);
597 rl = static_cast<RenderLayer *>(BLI_findlink(&rr->layers, rpass_index));
598 rnd_pt_local.rpass_index = rpass_index;
599
600 if (RE_layers_have_name(rr)) {
601 display_name = rl ? rl->name : (fake_name ? fake_name : "");
602 rnd_pt = ui_imageuser_data_copy(&rnd_pt_local);
603 but = uiDefMenuBut(block,
605 rnd_pt,
606 display_name,
607 0,
608 0,
609 wmenu2,
610 UI_UNIT_Y,
611 TIP_("Select Layer"));
613 UI_but_funcN_set(but, image_multi_cb, rnd_pt, rr);
615 rnd_pt = nullptr;
616 }
617
618 /* pass */
619 rpass = static_cast<RenderPass *>(rl ? BLI_findlink(&rl->passes, iuser->pass) : nullptr);
620
621 if (rl && RE_passes_have_name(rl)) {
622 display_name = rpass ? rpass->name : "";
623 rnd_pt = ui_imageuser_data_copy(&rnd_pt_local);
624 but = uiDefMenuBut(block,
626 rnd_pt,
627 IFACE_(display_name),
628 0,
629 0,
630 wmenu3,
631 UI_UNIT_Y,
632 TIP_("Select Pass"));
634 UI_but_funcN_set(but, image_multi_cb, rnd_pt, rr);
636 rnd_pt = nullptr;
637 }
638
639 /* view */
640 if (BLI_listbase_count_at_most(&rr->views, 2) > 1 &&
641 ((!show_stereo) || !RE_RenderResult_is_stereo(rr)))
642 {
643 rview = static_cast<RenderView *>(BLI_findlink(&rr->views, iuser->view));
644 display_name = rview ? rview->name : "";
645
646 rnd_pt = ui_imageuser_data_copy(&rnd_pt_local);
647 but = uiDefMenuBut(block,
649 rnd_pt,
650 display_name,
651 0,
652 0,
653 wmenu4,
654 UI_UNIT_Y,
655 TIP_("Select View"));
656 UI_but_funcN_set(but, image_multi_cb, rnd_pt, rr);
658 rnd_pt = nullptr;
659 }
660 }
661
662 /* stereo image */
663 else if ((BKE_image_is_stereo(image) && (!show_stereo)) ||
665 {
666 int nr = 0;
667
668 LISTBASE_FOREACH (ImageView *, iv, &image->views) {
669 if (nr++ == iuser->view) {
670 display_name = iv->name;
671 break;
672 }
673 }
674
675 rnd_pt = ui_imageuser_data_copy(&rnd_pt_local);
676 but = uiDefMenuBut(block,
678 rnd_pt,
679 display_name,
680 0,
681 0,
682 wmenu1,
683 UI_UNIT_Y,
684 TIP_("Select View"));
685 UI_but_funcN_set(but, image_multiview_cb, rnd_pt, nullptr);
687 rnd_pt = nullptr;
688 }
689}
690
691struct RNAUpdateCb {
695};
696
697static void rna_update_cb(bContext *C, void *arg_cb, void * /*arg*/)
698{
699 RNAUpdateCb *cb = (RNAUpdateCb *)arg_cb;
700
701 /* we call update here on the pointer property, this way the
702 * owner of the image pointer can still define its own update
703 * and notifier */
704 RNA_property_update(C, &cb->ptr, cb->prop);
705}
706
708 bContext *C,
710 const char *propname,
711 PointerRNA *userptr,
712 bool compact,
713 bool multiview)
714{
715 if (!ptr->data) {
716 return;
717 }
718
719 PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
720 if (!prop) {
721 printf(
722 "%s: property not found: %s.%s\n", __func__, RNA_struct_identifier(ptr->type), propname);
723 return;
724 }
725
726 if (RNA_property_type(prop) != PROP_POINTER) {
727 printf("%s: expected pointer property for %s.%s\n",
728 __func__,
730 propname);
731 return;
732 }
733
734 uiBlock *block = uiLayoutGetBlock(layout);
735
737 Image *ima = static_cast<Image *>(imaptr.data);
738 ImageUser *iuser = static_cast<ImageUser *>(userptr->data);
739
740 Scene *scene = CTX_data_scene(C);
741 BKE_image_user_frame_calc(ima, iuser, int(scene->r.cfra));
742
743 uiLayoutSetContextPointer(layout, "edit_image", &imaptr);
744 uiLayoutSetContextPointer(layout, "edit_image_user", userptr);
745
746 SpaceImage *space_image = CTX_wm_space_image(C);
747 if (!compact && (space_image == nullptr || iuser != &space_image->iuser)) {
749 layout, C, ptr, propname, ima ? nullptr : "IMAGE_OT_new", "IMAGE_OT_open", nullptr);
750
751 if (ima != nullptr) {
752 uiItemS(layout);
753 }
754 }
755
756 if (ima == nullptr) {
757 return;
758 }
759
760 if (ima->source == IMA_SRC_VIEWER) {
761 /* Viewer images. */
762 uiTemplateImageInfo(layout, C, ima, iuser);
763
764 if (ima->type == IMA_TYPE_COMPOSITE) {
765 }
766 else if (ima->type == IMA_TYPE_R_RESULT) {
767 /* browse layer/passes */
768 RenderResult *rr;
769 const float dpi_fac = UI_SCALE_FAC;
770 const int menus_width = 230 * dpi_fac;
771
772 /* Use #BKE_image_acquire_renderresult so we get the correct slot in the menu. */
773 rr = BKE_image_acquire_renderresult(scene, ima);
774 uiblock_layer_pass_buttons(layout, ima, rr, iuser, menus_width, &ima->render_slot);
775 BKE_image_release_renderresult(scene, ima, rr);
776 }
777
778 return;
779 }
780
781 /* Set custom callback for property updates. */
782 RNAUpdateCb *cb = static_cast<RNAUpdateCb *>(MEM_callocN(sizeof(RNAUpdateCb), "RNAUpdateCb"));
783 cb->ptr = *ptr;
784 cb->prop = prop;
785 cb->iuser = iuser;
786 UI_block_funcN_set(block, rna_update_cb, cb, nullptr);
787
788 /* Disable editing if image was modified, to avoid losing changes. */
789 const bool is_dirty = BKE_image_is_dirty(ima);
790 if (is_dirty) {
791 uiLayout *row = uiLayoutRow(layout, true);
792 uiItemO(row, IFACE_("Save"), ICON_NONE, "image.save");
793 uiItemO(row, IFACE_("Discard"), ICON_NONE, "image.reload");
794 uiItemS(layout);
795 }
796
797 layout = uiLayoutColumn(layout, false);
798 uiLayoutSetEnabled(layout, !is_dirty);
799 uiLayoutSetPropDecorate(layout, false);
800
801 /* Image source */
802 {
803 uiLayout *col = uiLayoutColumn(layout, false);
804 uiLayoutSetPropSep(col, true);
805 uiItemR(col, &imaptr, "source", UI_ITEM_NONE, nullptr, ICON_NONE);
806 }
807
808 /* Filepath */
809 const bool is_packed = BKE_image_has_packedfile(ima);
810 const bool no_filepath = is_packed && !BKE_image_has_filepath(ima);
811
812 if ((ima->source != IMA_SRC_GENERATED) && !no_filepath) {
813 uiItemS(layout);
814
815 uiLayout *row = uiLayoutRow(layout, true);
816 if (is_packed) {
817 uiItemO(row, "", ICON_PACKAGE, "image.unpack");
818 }
819 else {
820 uiItemO(row, "", ICON_UGLYPACKAGE, "image.pack");
821 }
822
823 row = uiLayoutRow(row, true);
824 uiLayoutSetEnabled(row, is_packed == false);
825
826 prop = RNA_struct_find_property(&imaptr, "filepath");
827 uiDefAutoButR(block, &imaptr, prop, -1, "", ICON_NONE, 0, 0, 200, UI_UNIT_Y);
828 uiItemO(row, "", ICON_FILEBROWSER, "image.file_browse");
829 uiItemO(row, "", ICON_FILE_REFRESH, "image.reload");
830 }
831
832 /* Image layers and Info */
833 if (ima->source == IMA_SRC_GENERATED) {
834 uiItemS(layout);
835
836 /* Generated */
837 uiLayout *col = uiLayoutColumn(layout, false);
838 uiLayoutSetPropSep(col, true);
839
840 uiLayout *sub = uiLayoutColumn(col, true);
841 uiItemR(sub, &imaptr, "generated_width", UI_ITEM_NONE, "X", ICON_NONE);
842 uiItemR(sub, &imaptr, "generated_height", UI_ITEM_NONE, "Y", ICON_NONE);
843
844 uiItemR(col, &imaptr, "use_generated_float", UI_ITEM_NONE, nullptr, ICON_NONE);
845
846 uiItemS(col);
847
848 uiItemR(col, &imaptr, "generated_type", UI_ITEM_R_EXPAND, IFACE_("Type"), ICON_NONE);
849 ImageTile *base_tile = BKE_image_get_tile(ima, 0);
850 if (base_tile->gen_type == IMA_GENTYPE_BLANK) {
851 uiItemR(col, &imaptr, "generated_color", UI_ITEM_NONE, nullptr, ICON_NONE);
852 }
853 }
854 else if (compact == 0) {
855 uiTemplateImageInfo(layout, C, ima, iuser);
856 }
857 if (ima->type == IMA_TYPE_MULTILAYER && ima->rr) {
858 uiItemS(layout);
859
860 const float dpi_fac = UI_SCALE_FAC;
861 uiblock_layer_pass_buttons(layout, ima, ima->rr, iuser, 230 * dpi_fac, nullptr);
862 }
863
864 if (BKE_image_is_animated(ima)) {
865 /* Animation */
866 uiItemS(layout);
867
868 uiLayout *col = uiLayoutColumn(layout, true);
869 uiLayoutSetPropSep(col, true);
870
871 uiLayout *sub = uiLayoutColumn(col, true);
872 uiLayout *row = uiLayoutRow(sub, true);
873 uiItemR(row, userptr, "frame_duration", UI_ITEM_NONE, IFACE_("Frames"), ICON_NONE);
874 uiItemO(row, "", ICON_FILE_REFRESH, "IMAGE_OT_match_movie_length");
875
876 uiItemR(sub, userptr, "frame_start", UI_ITEM_NONE, IFACE_("Start"), ICON_NONE);
877 uiItemR(sub, userptr, "frame_offset", UI_ITEM_NONE, nullptr, ICON_NONE);
878
879 uiItemR(col, userptr, "use_cyclic", UI_ITEM_NONE, nullptr, ICON_NONE);
880 uiItemR(col, userptr, "use_auto_refresh", UI_ITEM_NONE, nullptr, ICON_NONE);
881
882 if (ima->source == IMA_SRC_MOVIE && compact == 0) {
883 uiItemR(col, &imaptr, "use_deinterlace", UI_ITEM_NONE, IFACE_("Deinterlace"), ICON_NONE);
884 }
885 }
886
887 /* Multiview */
888 if (multiview && compact == 0) {
889 if ((scene->r.scemode & R_MULTIVIEW) != 0) {
890 uiItemS(layout);
891
892 uiLayout *col = uiLayoutColumn(layout, false);
893 uiLayoutSetPropSep(col, true);
894 uiItemR(col, &imaptr, "use_multiview", UI_ITEM_NONE, nullptr, ICON_NONE);
895
896 if (RNA_boolean_get(&imaptr, "use_multiview")) {
897 uiTemplateImageViews(layout, &imaptr);
898 }
899 }
900 }
901
902 /* Color-space and alpha. */
903 {
904 uiItemS(layout);
905
906 uiLayout *col = uiLayoutColumn(layout, false);
907 uiLayoutSetPropSep(col, true);
908 uiTemplateColorspaceSettings(col, &imaptr, "colorspace_settings");
909
910 if (compact == 0) {
911 if (ima->source != IMA_SRC_GENERATED) {
912 if (BKE_image_has_alpha(ima)) {
913 uiLayout *sub = uiLayoutColumn(col, false);
914 uiItemR(sub, &imaptr, "alpha_mode", UI_ITEM_NONE, IFACE_("Alpha"), ICON_NONE);
915
917 uiLayoutSetActive(sub, !is_data);
918 }
919
920 if (ima && iuser) {
921 void *lock;
922 ImBuf *ibuf = BKE_image_acquire_ibuf(ima, iuser, &lock);
923
924 if (ibuf && ibuf->float_buffer.data && (ibuf->flags & IB_halffloat) == 0) {
925 uiItemR(col, &imaptr, "use_half_precision", UI_ITEM_NONE, nullptr, ICON_NONE);
926 }
927 BKE_image_release_ibuf(ima, ibuf, lock);
928 }
929 }
930
931 uiItemR(col, &imaptr, "use_view_as_render", UI_ITEM_NONE, nullptr, ICON_NONE);
932 uiItemR(col, &imaptr, "seam_margin", UI_ITEM_NONE, nullptr, ICON_NONE);
933 }
934 }
935
936 UI_block_funcN_set(block, nullptr, nullptr, nullptr);
937}
938
939void uiTemplateImageSettings(uiLayout *layout, PointerRNA *imfptr, bool color_management)
940{
941 ImageFormatData *imf = static_cast<ImageFormatData *>(imfptr->data);
942 ID *id = imfptr->owner_id;
943 const int depth_ok = BKE_imtype_valid_depths(imf->imtype);
944 /* some settings depend on this being a scene that's rendered */
945 const bool is_render_out = (id && GS(id->name) == ID_SCE);
946
947 uiLayout *col;
948
949 col = uiLayoutColumn(layout, false);
950
951 uiLayoutSetPropSep(col, true);
953
954 uiItemR(col, imfptr, "file_format", UI_ITEM_NONE, nullptr, ICON_NONE);
955
956 /* Multi-layer always saves raw unmodified channels. */
957 if (imf->imtype != R_IMF_IMTYPE_MULTILAYER) {
958 uiItemR(uiLayoutRow(col, true),
959 imfptr,
960 "color_mode",
962 IFACE_("Color"),
963 ICON_NONE);
964 }
965
966 /* only display depth setting if multiple depths can be used */
967 if (ELEM(depth_ok,
975 {
976 uiItemR(uiLayoutRow(col, true), imfptr, "color_depth", UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
977 }
978
980 uiItemR(col, imfptr, "quality", UI_ITEM_NONE, nullptr, ICON_NONE);
981 }
982
984 uiItemR(col, imfptr, "compression", UI_ITEM_NONE, nullptr, ICON_NONE);
985 }
986
988 uiItemR(col, imfptr, "exr_codec", UI_ITEM_NONE, nullptr, ICON_NONE);
989 }
990
991 if (is_render_out && ELEM(imf->imtype, R_IMF_IMTYPE_OPENEXR, R_IMF_IMTYPE_MULTILAYER)) {
992 uiItemR(col, imfptr, "use_preview", UI_ITEM_NONE, nullptr, ICON_NONE);
993 }
994
995 if (imf->imtype == R_IMF_IMTYPE_JP2) {
996 uiItemR(col, imfptr, "jpeg2k_codec", UI_ITEM_NONE, nullptr, ICON_NONE);
997
998 uiItemR(col, imfptr, "use_jpeg2k_cinema_preset", UI_ITEM_NONE, nullptr, ICON_NONE);
999 uiItemR(col, imfptr, "use_jpeg2k_cinema_48", UI_ITEM_NONE, nullptr, ICON_NONE);
1000
1001 uiItemR(col, imfptr, "use_jpeg2k_ycc", UI_ITEM_NONE, nullptr, ICON_NONE);
1002 }
1003
1004 if (imf->imtype == R_IMF_IMTYPE_DPX) {
1005 uiItemR(col, imfptr, "use_cineon_log", UI_ITEM_NONE, nullptr, ICON_NONE);
1006 }
1007
1008 if (imf->imtype == R_IMF_IMTYPE_CINEON) {
1009#if 1
1010 uiItemL(col, RPT_("Hard coded Non-Linear, Gamma:1.7"), ICON_NONE);
1011#else
1012 uiItemR(col, imfptr, "use_cineon_log", UI_ITEM_NONE, nullptr, ICON_NONE);
1013 uiItemR(col, imfptr, "cineon_black", UI_ITEM_NONE, nullptr, ICON_NONE);
1014 uiItemR(col, imfptr, "cineon_white", UI_ITEM_NONE, nullptr, ICON_NONE);
1015 uiItemR(col, imfptr, "cineon_gamma", UI_ITEM_NONE, nullptr, ICON_NONE);
1016#endif
1017 }
1018
1019 if (imf->imtype == R_IMF_IMTYPE_TIFF) {
1020 uiItemR(col, imfptr, "tiff_codec", UI_ITEM_NONE, nullptr, ICON_NONE);
1021 }
1022
1023 /* Override color management */
1024 if (color_management) {
1025 uiItemS(col);
1026 uiItemR(col, imfptr, "color_management", UI_ITEM_NONE, nullptr, ICON_NONE);
1027
1030 PointerRNA linear_settings_ptr = RNA_pointer_get(imfptr, "linear_colorspace_settings");
1031 uiItemR(col, &linear_settings_ptr, "name", UI_ITEM_NONE, IFACE_("Color Space"), ICON_NONE);
1032 }
1033 else {
1034 PointerRNA display_settings_ptr = RNA_pointer_get(imfptr, "display_settings");
1035 uiItemR(col, &display_settings_ptr, "display_device", UI_ITEM_NONE, nullptr, ICON_NONE);
1036 uiTemplateColormanagedViewSettings(col, nullptr, imfptr, "view_settings");
1037 }
1038 }
1039 }
1040}
1041
1042void uiTemplateImageStereo3d(uiLayout *layout, PointerRNA *stereo3d_format_ptr)
1043{
1044 Stereo3dFormat *stereo3d_format = static_cast<Stereo3dFormat *>(stereo3d_format_ptr->data);
1045 uiLayout *col;
1046
1047 col = uiLayoutColumn(layout, false);
1048 uiItemR(col, stereo3d_format_ptr, "display_mode", UI_ITEM_NONE, nullptr, ICON_NONE);
1049
1050 switch (stereo3d_format->display_mode) {
1051 case S3D_DISPLAY_ANAGLYPH: {
1052 uiItemR(col, stereo3d_format_ptr, "anaglyph_type", UI_ITEM_NONE, nullptr, ICON_NONE);
1053 break;
1054 }
1055 case S3D_DISPLAY_INTERLACE: {
1056 uiItemR(col, stereo3d_format_ptr, "interlace_type", UI_ITEM_NONE, nullptr, ICON_NONE);
1057 uiItemR(col, stereo3d_format_ptr, "use_interlace_swap", UI_ITEM_NONE, nullptr, ICON_NONE);
1058 break;
1059 }
1061 uiItemR(
1062 col, stereo3d_format_ptr, "use_sidebyside_crosseyed", UI_ITEM_NONE, nullptr, ICON_NONE);
1064 }
1065 case S3D_DISPLAY_TOPBOTTOM: {
1066 uiItemR(col, stereo3d_format_ptr, "use_squeezed_frame", UI_ITEM_NONE, nullptr, ICON_NONE);
1067 break;
1068 }
1069 }
1070}
1071
1073 PointerRNA *ptr,
1074 PointerRNA *stereo3d_format_ptr)
1075{
1076 uiLayout *col;
1077
1078 col = uiLayoutColumn(layout, false);
1079
1080 uiLayoutSetPropSep(col, true);
1082
1083 uiItemR(col, ptr, "views_format", UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
1084
1085 if (stereo3d_format_ptr && RNA_enum_get(ptr, "views_format") == R_IMF_VIEWS_STEREO_3D) {
1086 uiTemplateImageStereo3d(col, stereo3d_format_ptr);
1087 }
1088}
1089
1091{
1092 Image *ima = static_cast<Image *>(imaptr->data);
1093
1094 if (ima->type != IMA_TYPE_MULTILAYER) {
1095 PropertyRNA *prop;
1096 PointerRNA stereo3d_format_ptr;
1097
1098 prop = RNA_struct_find_property(imaptr, "stereo_3d_format");
1099 stereo3d_format_ptr = RNA_property_pointer_get(imaptr, prop);
1100
1101 uiTemplateViewsFormat(layout, imaptr, &stereo3d_format_ptr);
1102 }
1103 else {
1104 uiTemplateViewsFormat(layout, imaptr, nullptr);
1105 }
1106}
1107
1109{
1110 ImageFormatData *imf = static_cast<ImageFormatData *>(imfptr->data);
1111
1112 if (ptr != nullptr) {
1113 uiItemR(layout, ptr, "use_multiview", UI_ITEM_NONE, nullptr, ICON_NONE);
1114 if (!RNA_boolean_get(ptr, "use_multiview")) {
1115 return;
1116 }
1117 }
1118
1119 if (imf->imtype != R_IMF_IMTYPE_MULTILAYER) {
1120 PropertyRNA *prop;
1121 PointerRNA stereo3d_format_ptr;
1122
1123 prop = RNA_struct_find_property(imfptr, "stereo_3d_format");
1124 stereo3d_format_ptr = RNA_property_pointer_get(imfptr, prop);
1125
1126 uiTemplateViewsFormat(layout, imfptr, &stereo3d_format_ptr);
1127 }
1128 else {
1129 uiTemplateViewsFormat(layout, imfptr, nullptr);
1130 }
1131}
1132
1134{
1135 Scene *scene = CTX_data_scene(C);
1136
1137 /* render layers and passes */
1138 if (ima && iuser) {
1139 RenderResult *rr;
1140 const float dpi_fac = UI_SCALE_FAC;
1141 const int menus_width = 160 * dpi_fac;
1142 const bool is_render_result = (ima->type == IMA_TYPE_R_RESULT);
1143
1144 /* Use BKE_image_acquire_renderresult so we get the correct slot in the menu. */
1145 rr = BKE_image_acquire_renderresult(scene, ima);
1147 layout, ima, rr, iuser, menus_width, is_render_result ? &ima->render_slot : nullptr);
1148 BKE_image_release_renderresult(scene, ima, rr);
1149 }
1150}
1151
1152void uiTemplateImageInfo(uiLayout *layout, bContext *C, Image *ima, ImageUser *iuser)
1153{
1154 if (ima == nullptr || iuser == nullptr) {
1155 return;
1156 }
1157
1158 /* Acquire image buffer. */
1159 void *lock;
1160 ImBuf *ibuf = BKE_image_acquire_ibuf(ima, iuser, &lock);
1161
1162 uiLayout *col = uiLayoutColumn(layout, true);
1164
1165 if (ibuf == nullptr) {
1166 uiItemL(col, RPT_("Can't Load Image"), ICON_NONE);
1167 }
1168 else {
1169 char str[MAX_IMAGE_INFO_LEN] = {0};
1170 const int len = MAX_IMAGE_INFO_LEN;
1171 int ofs = 0;
1172
1173 ofs += BLI_snprintf_rlen(str + ofs, len - ofs, RPT_("%d \u00D7 %d, "), ibuf->x, ibuf->y);
1174
1175 if (ibuf->float_buffer.data) {
1176 if (ibuf->channels != 4) {
1177 ofs += BLI_snprintf_rlen(
1178 str + ofs, len - ofs, RPT_("%d float channel(s)"), ibuf->channels);
1179 }
1180 else if (ibuf->planes == R_IMF_PLANES_RGBA) {
1181 ofs += BLI_strncpy_rlen(str + ofs, RPT_(" RGBA float"), len - ofs);
1182 }
1183 else {
1184 ofs += BLI_strncpy_rlen(str + ofs, RPT_(" RGB float"), len - ofs);
1185 }
1186 }
1187 else {
1188 if (ibuf->planes == R_IMF_PLANES_RGBA) {
1189 ofs += BLI_strncpy_rlen(str + ofs, RPT_(" RGBA byte"), len - ofs);
1190 }
1191 else {
1192 ofs += BLI_strncpy_rlen(str + ofs, RPT_(" RGB byte"), len - ofs);
1193 }
1194 }
1195
1197 ibuf, ima->flag & IMA_HIGH_BITDEPTH, ibuf->planes >= 8);
1198 const char *texture_format_description = GPU_texture_format_name(texture_format);
1199 ofs += BLI_snprintf_rlen(str + ofs, len - ofs, RPT_(", %s"), texture_format_description);
1200
1201 uiItemL(col, str, ICON_NONE);
1202 }
1203
1204 /* Frame number, even if we can't load the image. */
1206 /* don't use iuser->framenr directly because it may not be updated if auto-refresh is off */
1207 Scene *scene = CTX_data_scene(C);
1208 const int framenr = BKE_image_user_frame_get(iuser, scene->r.cfra, nullptr);
1209 char str[MAX_IMAGE_INFO_LEN];
1210 int duration = 0;
1211
1212 if (ima->source == IMA_SRC_MOVIE && BKE_image_has_anim(ima)) {
1213 ImBufAnim *anim = ((ImageAnim *)ima->anims.first)->anim;
1214 if (anim) {
1215 duration = IMB_anim_get_duration(anim, IMB_TC_RECORD_RUN);
1216 }
1217 }
1218
1219 if (duration > 0) {
1220 /* Movie duration */
1221 SNPRINTF(str, RPT_("Frame %d / %d"), framenr, duration);
1222 }
1223 else if (ima->source == IMA_SRC_SEQUENCE && ibuf) {
1224 /* Image sequence frame number + filename */
1225 const char *filename = BLI_path_basename(ibuf->filepath);
1226 SNPRINTF(str, RPT_("Frame %d: %s"), framenr, filename);
1227 }
1228 else {
1229 /* Frame number */
1230 SNPRINTF(str, RPT_("Frame %d"), framenr);
1231 }
1232
1233 uiItemL(col, str, ICON_NONE);
1234 }
1235
1236 BKE_image_release_ibuf(ima, ibuf, lock);
1237}
1238
1239#undef MAX_IMAGE_INFO_LEN
1240
1241static bool metadata_panel_context_poll(const bContext *C, PanelType * /*pt*/)
1242{
1243 SpaceImage *space_image = CTX_wm_space_image(C);
1244 return space_image != nullptr && space_image->image != nullptr;
1245}
1246
1247static void metadata_panel_context_draw(const bContext *C, Panel *panel)
1248{
1249 void *lock;
1250 SpaceImage *space_image = CTX_wm_space_image(C);
1251 Image *image = space_image->image;
1252 ImBuf *ibuf = BKE_image_acquire_ibuf(image, &space_image->iuser, &lock);
1253 if (ibuf != nullptr) {
1255 }
1256 BKE_image_release_ibuf(image, ibuf, lock);
1257}
1258
1260{
1261 PanelType *pt;
1262
1263 pt = static_cast<PanelType *>(MEM_callocN(sizeof(PanelType), "spacetype image panel metadata"));
1264 STRNCPY(pt->idname, "IMAGE_PT_metadata");
1265 STRNCPY(pt->label, N_("Metadata"));
1266 STRNCPY(pt->category, "Image");
1268 pt->order = 10;
1272 BLI_addtail(&art->paneltypes, pt);
1273}
SpaceImage * CTX_wm_space_image(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
RenderSlot * BKE_image_get_renderslot(Image *ima, int index)
ImBuf * BKE_image_acquire_ibuf(Image *ima, ImageUser *iuser, void **r_lock)
bool BKE_image_has_alpha(Image *image)
void BKE_image_user_frame_calc(Image *ima, ImageUser *iuser, int cfra)
bool BKE_image_has_filepath(const Image *ima)
RenderPass * BKE_image_multilayer_index(RenderResult *rr, ImageUser *iuser)
void BKE_image_release_ibuf(Image *ima, ImBuf *ibuf, void *lock)
bool BKE_image_is_dirty(Image *image)
void BKE_image_release_renderresult(Scene *scene, Image *ima, RenderResult *render_result)
int BKE_image_user_frame_get(const ImageUser *iuser, int cfra, bool *r_is_in_range)
bool BKE_image_has_anim(Image *image)
bool BKE_image_is_stereo(const Image *ima)
bool BKE_image_is_multiview(const Image *ima)
bool BKE_image_has_packedfile(const Image *image)
bool BKE_image_is_animated(Image *image)
RenderResult * BKE_image_acquire_renderresult(Scene *scene, Image *ima)
void BKE_image_multiview_index(const Image *ima, ImageUser *iuser)
bool BKE_imtype_supports_compress(char imtype)
bool BKE_imtype_supports_quality(char imtype)
char BKE_imtype_valid_depths(char imtype)
bool BKE_imtype_requires_linear_float(char imtype)
@ PANEL_TYPE_DEFAULT_CLOSED
#define BLI_assert(a)
Definition BLI_assert.h:50
#define ATTR_FALLTHROUGH
#define LISTBASE_FOREACH(type, var, list)
BLI_INLINE void BLI_listbase_clear(struct ListBase *lb)
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define LISTBASE_FOREACH_INDEX(type, var, list, index_var)
int BLI_listbase_count_at_most(const struct ListBase *listbase, int count_max) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
Definition listbase.cc:496
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:110
struct LinkData * BLI_genericNodeN(void *data)
Definition listbase.cc:909
void * BLI_findstring_ptr(const struct ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void void void const char * BLI_path_basename(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
#define STRNCPY(dst, src)
Definition BLI_string.h:593
#define SNPRINTF(dst, format,...)
Definition BLI_string.h:597
size_t BLI_snprintf_rlen(char *__restrict dst, size_t dst_maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
char char size_t BLI_strncpy_rlen(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
#define UNLIKELY(x)
#define ELEM(...)
#define STREQ(a, b)
#define RPT_(msgid)
#define TIP_(msgid)
#define IFACE_(msgid)
#define BLT_I18NCONTEXT_DEFAULT_BPYRNA
@ ID_SCE
@ IMA_SHOW_STEREO
@ IMA_SRC_MOVIE
@ IMA_SRC_GENERATED
@ IMA_SRC_VIEWER
@ IMA_SRC_SEQUENCE
@ IMA_TYPE_MULTILAYER
@ IMA_TYPE_R_RESULT
@ IMA_TYPE_COMPOSITE
@ IMA_HIGH_BITDEPTH
@ IMA_GENTYPE_BLANK
@ NODE_DO_OUTPUT
@ R_MULTIVIEW
@ R_IMF_VIEWS_STEREO_3D
@ S3D_DISPLAY_ANAGLYPH
@ S3D_DISPLAY_INTERLACE
@ S3D_DISPLAY_TOPBOTTOM
@ S3D_DISPLAY_SIDEBYSIDE
@ R_IMF_CHAN_DEPTH_24
@ R_IMF_CHAN_DEPTH_8
@ R_IMF_CHAN_DEPTH_16
@ R_IMF_CHAN_DEPTH_12
@ R_IMF_CHAN_DEPTH_1
@ R_IMF_CHAN_DEPTH_10
@ R_IMF_CHAN_DEPTH_32
@ R_IMF_IMTYPE_TIFF
@ R_IMF_IMTYPE_DPX
@ R_IMF_IMTYPE_JP2
@ R_IMF_IMTYPE_OPENEXR
@ R_IMF_IMTYPE_MULTILAYER
@ R_IMF_IMTYPE_CINEON
@ R_IMF_PLANES_RGBA
@ R_IMF_COLOR_MANAGEMENT_OVERRIDE
#define UI_SCALE_FAC
bool ED_image_slot_cycle(Image *image, int direction)
void ED_region_image_metadata_panel_draw(ImBuf *ibuf, uiLayout *layout)
Definition area.cc:3859
const char * GPU_texture_format_name(eGPUTextureFormat format)
eGPUTextureFormat
bool IMB_colormanagement_space_name_is_data(const char *name)
eGPUTextureFormat IMB_gpu_get_texture_format(const ImBuf *ibuf, bool high_bitdepth, bool use_grayscale)
Definition util_gpu.cc:395
int IMB_anim_get_duration(ImBufAnim *anim, IMB_Timecode_Type tc)
@ IMB_TC_RECORD_RUN
Contains defines and structs used throughout the imbuf module.
@ IB_halffloat
Read Guarded memory(de)allocation.
@ PROP_POINTER
Definition RNA_types.hh:70
uiBut * uiDefButS(uiBlock *block, int type, int retval, blender::StringRef str, int x, int y, short width, short height, short *poin, float min, float max, const char *tip)
#define UI_UNIT_Y
void uiLayoutSetActive(uiLayout *layout, bool active)
void uiTemplateColorspaceSettings(uiLayout *layout, PointerRNA *ptr, const char *propname)
void uiLayoutSetEnabled(uiLayout *layout, bool enabled)
@ UI_LAYOUT_ALIGN_RIGHT
uiBut * uiDefBut(uiBlock *block, int type, int retval, blender::StringRef str, int x, int y, short width, short height, void *poin, float min, float max, const char *tip)
void uiItemL(uiLayout *layout, const char *name, int icon)
uiBlock * uiLayoutGetBlock(uiLayout *layout)
uiLayout * uiLayoutRow(uiLayout *layout, bool align)
void UI_but_func_menu_step_set(uiBut *but, uiMenuStepFunc func)
void uiLayoutSetAlignment(uiLayout *layout, char alignment)
void uiLayoutSetPropSep(uiLayout *layout, bool is_sep)
void uiItemS(uiLayout *layout)
#define UI_ITEM_NONE
void UI_but_type_set_menu_from_pulldown(uiBut *but)
uiBut * uiDefMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, blender::StringRef str, int x, int y, short width, short height, const char *tip)
void uiTemplateColormanagedViewSettings(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname)
void uiItemO(uiLayout *layout, const char *name, int icon, const char *opname)
void uiLayoutSetPropDecorate(uiLayout *layout, bool is_sep)
void UI_block_funcN_set(uiBlock *block, uiButHandleNFunc funcN, void *argN, void *arg2, uiButArgNFree func_argN_free_fn=MEM_freeN, uiButArgNCopy func_argN_copy_fn=MEM_dupallocN)
void uiTemplateID(uiLayout *layout, const bContext *C, PointerRNA *ptr, const char *propname, const char *newop, const char *openop, const char *unlinkop, int filter=UI_TEMPLATE_ID_FILTER_ALL, bool live_icon=false, const char *text=nullptr)
uiLayout * uiLayoutColumn(uiLayout *layout, bool align)
void UI_block_layout_set_current(uiBlock *block, uiLayout *layout)
#define UI_UNIT_X
@ UI_BTYPE_BUT_MENU
@ UI_BTYPE_LABEL
void UI_but_funcN_set(uiBut *but, uiButHandleNFunc funcN, void *argN, void *arg2, uiButArgNFree func_argN_free_fn=MEM_freeN, uiButArgNCopy func_argN_copy_fn=MEM_dupallocN)
uiBut * uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int index, const char *name, int icon, int x, int y, int width, int height)
void uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, eUI_Item_Flag flag, const char *name, int icon)
@ UI_ITEM_R_EXPAND
void uiLayoutSetContextPointer(uiLayout *layout, const char *name, PointerRNA *ptr)
#define ND_DRAW
Definition WM_types.hh:428
#define NC_IMAGE
Definition WM_types.hh:351
volatile int lock
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition btQuadWord.h:119
input_tx image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "preview_img") .compute_source("compositor_compute_preview.glsl") .do_static_compilation(true)
#define printf
#define offsetof(t, d)
int len
#define str(s)
uint col
static const char * ui_imageuser_layer_fake_name(RenderResult *rr)
static void uiTemplateViewsFormat(uiLayout *layout, PointerRNA *ptr, PointerRNA *stereo3d_format_ptr)
void image_buttons_register(ARegionType *art)
static void image_multiview_cb(bContext *C, void *rnd_pt, void *)
static void ui_imageuser_view_menu_rr(bContext *, uiLayout *layout, void *rnd_pt)
static void ui_imageuser_pass_menu(bContext *, uiLayout *layout, void *rnd_pt)
static void ui_imageuser_view_menu_multiview(bContext *, uiLayout *layout, void *rnd_pt)
static void image_multi_cb(bContext *C, void *rnd_pt, void *rr_v)
void uiTemplateImageLayers(uiLayout *layout, bContext *C, Image *ima, ImageUser *iuser)
static void ui_imageuser_slot_menu(bContext *, uiLayout *layout, void *image_p)
void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, PointerRNA *userptr, bool compact, bool multiview)
void uiTemplateImageSettings(uiLayout *layout, PointerRNA *imfptr, bool color_management)
ImageUser * ntree_get_active_iuser(bNodeTree *ntree)
#define MAX_IMAGE_INFO_LEN
void uiTemplateImageViews(uiLayout *layout, PointerRNA *imaptr)
static bool ui_imageuser_slot_menu_step(bContext *C, int direction, void *image_p)
static bool ui_imageuser_layer_menu_step(bContext *C, int direction, void *rnd_pt)
static void ui_imageuser_layer_menu(bContext *, uiLayout *layout, void *rnd_pt)
#define B_NOP
static ImageUI_Data * ui_imageuser_data_copy(const ImageUI_Data *rnd_pt_src)
void uiTemplateImageStereo3d(uiLayout *layout, PointerRNA *stereo3d_format_ptr)
void uiTemplateImageFormatViews(uiLayout *layout, PointerRNA *imfptr, PointerRNA *ptr)
static void uiblock_layer_pass_buttons(uiLayout *layout, Image *image, RenderResult *rr, ImageUser *iuser, int w, const short *render_slot)
static bool metadata_panel_context_poll(const bContext *C, PanelType *)
static void rna_update_cb(bContext *C, void *arg_cb, void *)
static bool ui_imageuser_pass_menu_step(bContext *C, int direction, void *rnd_pt)
static void metadata_panel_context_draw(const bContext *C, Panel *panel)
void uiTemplateImageInfo(uiLayout *layout, bContext *C, Image *ima, ImageUser *iuser)
#define GS(x)
Definition iris.cc:202
void *(* MEM_mallocN)(size_t len, const char *str)
Definition mallocn.cc:44
void *(* MEM_callocN)(size_t len, const char *str)
Definition mallocn.cc:42
bool RE_HasCombinedLayer(const RenderResult *result)
RenderView * RE_RenderViewGetById(RenderResult *rr, const int view_id)
bool RE_RenderResult_is_stereo(const RenderResult *result)
PointerRNA RNA_pointer_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
PropertyType RNA_property_type(PropertyRNA *prop)
PointerRNA RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop)
void RNA_property_update(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
const char * RNA_struct_identifier(const StructRNA *type)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
int RNA_enum_get(PointerRNA *ptr, const char *name)
bool RE_passes_have_name(RenderLayer *rl)
bool RE_layers_have_name(RenderResult *result)
ListBase paneltypes
Definition DNA_ID.h:413
char filepath[IMB_FILEPATH_SIZE]
ImBufFloatBuffer float_buffer
ImBufByteBuffer byte_buffer
unsigned char planes
ImageUser * iuser
struct Scene * scene
char name[64]
struct ImageView * prev
ListBase anims
ColorManagedColorspaceSettings colorspace_settings
short source
short render_slot
struct RenderResult * rr
void * last
void * first
void(* draw)(const bContext *C, Panel *panel)
char idname[BKE_ST_MAXNAME]
bool(* poll)(const bContext *C, PanelType *pt)
char translation_context[BKE_ST_MAXNAME]
char category[BKE_ST_MAXNAME]
char label[BKE_ST_MAXNAME]
struct uiLayout * layout
ID * owner_id
Definition RNA_types.hh:40
StructRNA * type
Definition RNA_types.hh:41
void * data
Definition RNA_types.hh:42
ImageUser * iuser
ListBase passes
Definition RE_pipeline.h:97
char name[RE_MAXNAME]
Definition RE_pipeline.h:89
char name[64]
Definition RE_pipeline.h:58
struct RenderPass * next
Definition RE_pipeline.h:56
ListBase views
ListBase layers
char name[64]
struct ImBuf * ibuf
Definition RE_pipeline.h:52
struct RenderView * prev
Definition RE_pipeline.h:46
char name[64]
Definition RE_pipeline.h:47
struct ImageUser iuser
struct Image * image
ListBase nodes
std::string name
void * BKE_image_get_tile
Definition stubs.c:36
#define N_(msgid)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
PointerRNA * ptr
Definition wm_files.cc:4126