Blender V5.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
8
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_listbase.hh"
18#include "BLI_path_utils.hh"
19#include "BLI_string.hh"
20#include "BLI_string_utf8.hh"
21#include "BLI_utildefines.hh"
22
23#include "BLT_translation.hh"
24
25#include "BKE_context.hh"
26#include "BKE_image.hh"
27#include "BKE_image_format.hh"
28#include "BKE_node.hh"
30#include "BKE_node_runtime.hh"
31#include "BKE_screen.hh"
32
33#include "RE_pipeline.h"
34
36#include "IMB_imbuf.hh"
37#include "IMB_imbuf_types.hh"
38
39#include "MOV_read.hh"
40
41#include "ED_image.hh"
42#include "ED_screen.hh"
43
44#include "RNA_access.hh"
45
46#include "WM_api.hh"
47#include "WM_types.hh"
48
49#include "UI_interface.hh"
51#include "UI_resources.hh"
52
53#include "image_intern.hh"
54
55namespace blender {
56
57#define B_NOP -1
58#define MAX_IMAGE_INFO_LEN 128
59
61{
62 if (ntree) {
63 for (bNode *node : ntree->all_nodes()) {
64 if (node->type_legacy == CMP_NODE_VIEWER) {
65 if (node->flag & NODE_DO_OUTPUT) {
66 return static_cast<ImageUser *>(node->storage);
67 }
68 }
69 }
70 }
71 return nullptr;
72}
73
74/* ********************* callbacks for standard image buttons *************** */
75
76static void ui_imageuser_slot_menu(bContext *C, ui::Layout *layout, void *image_p)
77{
78 ui::Block *block = layout->block();
79 Image *image = static_cast<Image *>(image_p);
80
81 /* The scene isn't expected to be null, check since it's not a requirement
82 * for the value to be non-null for this function to work.
83 * It's OK if `has_active_render` is false. */
84 Scene *scene = CTX_data_scene(C);
85 bool has_active_render = scene && (RE_GetSceneRender(scene) != nullptr);
86
87 for (const auto [slot_id, slot] : image->renderslots.enumerate()) {
88 char str[64];
89 if (slot.name[0] != '\0') {
90 STRNCPY_UTF8(str, slot.name);
91 }
92 else {
93 SNPRINTF_UTF8(str, IFACE_("Slot %d"), slot_id + 1);
94 }
95 /* Default to "blank" for nicer alignment. */
96 int icon = ICON_BLANK1;
97 if (slot_id == image->last_render_slot) {
98 if (has_active_render) {
99 icon = ICON_RENDER_RESULT;
100 }
101 }
102 else if (slot.render != nullptr) {
103 icon = ICON_DOT;
104 }
105 ui::Button *but = uiDefIconTextBut(
106 block, ui::ButtonType::ButMenu, icon, str, 0, 0, UI_UNIT_X * 5, UI_UNIT_X, nullptr, "");
107 button_func_set(
108 but, [image, slot_id = slot_id](bContext & /*C*/) { image->render_slot = slot_id; });
109 }
110
111 layout->separator();
112 uiDefBut(block,
114 IFACE_("Slot"),
115 0,
116 0,
117 UI_UNIT_X * 5,
118 UI_UNIT_Y,
119 nullptr,
120 0.0,
121 0.0,
122 "");
123}
124
125static bool ui_imageuser_slot_menu_step(bContext *C, int direction, void *image_p)
126{
127 Image *image = static_cast<Image *>(image_p);
128
129 if (ED_image_slot_cycle(image, direction)) {
131 return true;
132 }
133 return true;
134}
135
137{
138 RenderView *rv = RE_RenderViewGetById(rr, 0);
139 ImBuf *ibuf = rv->ibuf;
140 if (!ibuf) {
141 return nullptr;
142 }
143 if (ibuf->float_data()) {
144 return IFACE_("Composite");
145 }
146 if (ibuf->byte_data()) {
147 return IFACE_("Sequence");
148 }
149 return nullptr;
150}
151
152/* workaround for passing many args */
158
160{
162 memcpy(rnd_pt_dst, rnd_pt_src, sizeof(*rnd_pt_src));
163 return rnd_pt_dst;
164}
165
166static void ui_imageuser_layer_menu(bContext * /*C*/, ui::Layout *layout, void *rnd_pt)
167{
168 ImageUI_Data *rnd_data = static_cast<ImageUI_Data *>(rnd_pt);
169 ui::Block *block = layout->block();
170 Image *image = rnd_data->image;
171 ImageUser *iuser = rnd_data->iuser;
172 Scene *scene = iuser->scene;
173
174 /* May have been freed since drawing. */
176 if (rr == nullptr) [[unlikely]] {
178 return;
179 }
180
181 layout->column(false);
182
183 const char *fake_name = ui_imageuser_layer_fake_name(rr);
184 if (fake_name) {
185 ui::Button *but = uiDefButV(block,
187 fake_name,
188 0,
189 0,
190 UI_UNIT_X * 5,
191 UI_UNIT_X,
192 &iuser->layer,
193 0.0,
194 0.0,
195 "");
196 button_enum_prop_value_set(but, 0);
197 }
198
199 int nr = fake_name ? 1 : 0;
200 for (RenderLayer *rl = rr->layers.first(); rl; rl = rl->next, nr++) {
201 ui::Button *but = uiDefButV(block,
203 rl->name,
204 0,
205 0,
206 UI_UNIT_X * 5,
207 UI_UNIT_X,
208 &iuser->layer,
209 0.0,
210 0.0,
211 "");
212 button_enum_prop_value_set(but, nr);
213 }
214
215 layout->separator();
216 uiDefBut(block,
218 IFACE_("Layer"),
219 0,
220 0,
221 UI_UNIT_X * 5,
222 UI_UNIT_Y,
223 nullptr,
224 0.0,
225 0.0,
226 "");
227
229}
230
231static void ui_imageuser_pass_menu(bContext * /*C*/, ui::Layout *layout, void *rnd_pt)
232{
233 ImageUI_Data *rnd_data = static_cast<ImageUI_Data *>(rnd_pt);
234 ui::Block *block = layout->block();
235 Image *image = rnd_data->image;
236 ImageUser *iuser = rnd_data->iuser;
237 /* (rpass_index == -1) means composite result */
238 const int rpass_index = rnd_data->rpass_index;
239 Scene *scene = iuser->scene;
240 RenderResult *rr;
241 RenderLayer *rl;
242 RenderPass *rpass;
243 int nr;
244
245 /* may have been freed since drawing */
247 if (rr == nullptr) [[unlikely]] {
249 return;
250 }
251
252 rl = static_cast<RenderLayer *>(BLI_findlink(&rr->layers, rpass_index));
253
254 layout->column(false);
255
256 nr = (rl == nullptr) ? 1 : 0;
257
258 ListBaseT<LinkData> added_passes;
259 added_passes.clear_no_delete();
260
261 /* rendered results don't have a Combined pass */
262 /* multiview: the ordering must be ascending, so the left-most pass is always the one picked */
263 for (rpass = rl ? rl->passes.first() : nullptr; rpass; rpass = rpass->next, nr++) {
264 /* just show one pass of each kind */
265 if (BLI_findstring_ptr(&added_passes, rpass->name, offsetof(LinkData, data))) {
266 continue;
267 }
268 BLI_addtail(&added_passes, BLI_genericNodeN(rpass->name));
269
270 ui::Button *but = uiDefButV(block,
272 IFACE_(rpass->name),
273 0,
274 0,
275 UI_UNIT_X * 5,
276 UI_UNIT_X,
277 &iuser->pass,
278 0.0,
279 0.0,
280 "");
281 button_enum_prop_value_set(but, nr);
282 }
283
284 layout->separator();
285 uiDefBut(block,
287 IFACE_("Pass"),
288 0,
289 0,
290 UI_UNIT_X * 5,
291 UI_UNIT_Y,
292 nullptr,
293 0.0,
294 0.0,
295 "");
296
297 added_passes.free_no_destruct();
298
300}
301
302/**************************** view menus *****************************/
303static void ui_imageuser_view_menu_rr(bContext * /*C*/, ui::Layout *layout, void *rnd_pt)
304{
305 ImageUI_Data *rnd_data = static_cast<ImageUI_Data *>(rnd_pt);
306 ui::Block *block = layout->block();
307 Image *image = rnd_data->image;
308 ImageUser *iuser = rnd_data->iuser;
309 RenderResult *rr;
310 RenderView *rview;
311 int nr;
312 Scene *scene = iuser->scene;
313
314 /* may have been freed since drawing */
316 if (rr == nullptr) [[unlikely]] {
318 return;
319 }
320
321 layout->column(false);
322
323 uiDefBut(block,
325 IFACE_("View"),
326 0,
327 0,
328 UI_UNIT_X * 5,
329 UI_UNIT_Y,
330 nullptr,
331 0.0,
332 0.0,
333 "");
334
335 layout->separator();
336
337 nr = (rr ? rr->views.count() : 0) - 1;
338 for (rview = rr ? rr->views.last() : nullptr; rview; rview = rview->prev, nr--) {
339 ui::Button *but = uiDefButV(block,
341 IFACE_(rview->name),
342 0,
343 0,
344 UI_UNIT_X * 5,
345 UI_UNIT_X,
346 &iuser->view,
347 0.0,
348 0.0,
349 "");
350 button_enum_prop_value_set(but, nr);
351 }
352
354}
355
356static void ui_imageuser_view_menu_multiview(bContext * /*C*/, ui::Layout *layout, void *rnd_pt)
357{
358 ImageUI_Data *rnd_data = static_cast<ImageUI_Data *>(rnd_pt);
359 ui::Block *block = layout->block();
360 Image *image = rnd_data->image;
361 ImageUser *iuser = rnd_data->iuser;
362 int nr;
363 ImageView *iv;
364
365 layout->column(false);
366
367 uiDefBut(block,
369 IFACE_("View"),
370 0,
371 0,
372 UI_UNIT_X * 5,
373 UI_UNIT_Y,
374 nullptr,
375 0.0,
376 0.0,
377 "");
378
379 layout->separator();
380
381 nr = image->views.count() - 1;
382 for (iv = image->views.last(); iv; iv = iv->prev, nr--) {
383 ui::Button *but = uiDefButV(block,
385 IFACE_(iv->name),
386 0,
387 0,
388 UI_UNIT_X * 5,
389 UI_UNIT_X,
390 &iuser->view,
391 0.0,
392 0.0,
393 "");
394 button_enum_prop_value_set(but, nr);
395 }
396}
397
398/* 5 layer button callbacks... */
399static void image_multi_cb(bContext *C, void *rnd_pt, void * /*unused*/)
400{
401 Scene *scene = CTX_data_scene(C);
402 ImageUI_Data *rnd_data = static_cast<ImageUI_Data *>(rnd_pt);
403 Image *image = rnd_data->image;
404 ImageUser *iuser = rnd_data->iuser;
405
409
411}
412
413static bool ui_imageuser_layer_menu_step(bContext *C, int direction, void *rnd_pt)
414{
415 Scene *scene = CTX_data_scene(C);
416 ImageUI_Data *rnd_data = static_cast<ImageUI_Data *>(rnd_pt);
417 Image *image = rnd_data->image;
418 ImageUser *iuser = rnd_data->iuser;
419 RenderResult *rr;
420 bool changed = false;
421
423 if (rr == nullptr) [[unlikely]] {
425 return false;
426 }
427
428 if (direction == -1) {
429 if (iuser->layer > 0) {
430 iuser->layer--;
431 changed = true;
432 }
433 }
434 else if (direction == 1) {
435 int tot = rr->layers.count();
436
437 if (RE_HasCombinedLayer(rr)) {
438 tot++; /* fake compo/sequencer layer */
439 }
440
441 if (iuser->layer < tot - 1) {
442 iuser->layer++;
443 changed = true;
444 }
445 }
446 else {
447 BLI_assert(0);
448 }
449
450 if (changed) {
453 }
454
456
457 return changed;
458}
459
460static bool ui_imageuser_pass_menu_step(bContext *C, int direction, void *rnd_pt)
461{
462 Scene *scene = CTX_data_scene(C);
463 ImageUI_Data *rnd_data = static_cast<ImageUI_Data *>(rnd_pt);
464 Image *image = rnd_data->image;
465 ImageUser *iuser = rnd_data->iuser;
466 RenderResult *rr;
467 bool changed = false;
468 int layer = iuser->layer;
469 RenderLayer *rl;
470 RenderPass *rpass;
471
473 if (rr == nullptr) [[unlikely]] {
475 return false;
476 }
477
478 if (RE_HasCombinedLayer(rr)) {
479 layer -= 1;
480 }
481
482 rl = static_cast<RenderLayer *>(BLI_findlink(&rr->layers, layer));
483 if (rl == nullptr) {
485 return false;
486 }
487
488 rpass = static_cast<RenderPass *>(BLI_findlink(&rl->passes, iuser->pass));
489 if (rpass == nullptr) {
491 return false;
492 }
493
494 if (direction == 1) {
495 RenderPass *rp;
496 int rp_index = iuser->pass + 1;
497
498 for (rp = rpass->next; rp; rp = rp->next, rp_index++) {
499 if (!STREQ(rp->name, rpass->name)) {
500 iuser->pass = rp_index;
501 changed = true;
502 break;
503 }
504 }
505 }
506 else if (direction == -1) {
507 RenderPass *rp;
508 int rp_index = 0;
509
510 if (iuser->pass == 0) {
512 return false;
513 }
514
515 for (rp = rl->passes.first(); rp; rp = rp->next, rp_index++) {
516 if (STREQ(rp->name, rpass->name)) {
517 iuser->pass = rp_index - 1;
518 changed = true;
519 break;
520 }
521 }
522 }
523 else {
524 BLI_assert(0);
525 }
526
527 if (changed) {
530 }
531
533
534 return changed;
535}
536
537/* 5 view button callbacks... */
538static void image_multiview_cb(bContext *C, void *rnd_pt, void * /*arg_v*/)
539{
540 ImageUI_Data *rnd_data = static_cast<ImageUI_Data *>(rnd_pt);
541 Image *ima = rnd_data->image;
542 ImageUser *iuser = rnd_data->iuser;
543
544 BKE_image_multiview_index(ima, iuser);
546}
547
549 Image *image,
550 RenderResult *rr,
551 ImageUser *iuser,
552 int w,
553 const short *render_slot)
554{
555 ImageUI_Data rnd_pt_local, *rnd_pt = nullptr;
556 ui::Block *block = layout.block();
557 ui::Button *but;
558 RenderLayer *rl = nullptr;
559 int wmenu1, wmenu2, wmenu3, wmenu4;
560 const char *fake_name;
561 const char *display_name = "";
562 const bool show_stereo = (iuser->flag & IMA_SHOW_STEREO) != 0;
563
564 if (iuser->scene == nullptr) {
565 return;
566 }
567
568 layout.row(true);
569
570 /* layer menu is 1/3 larger than pass */
571 wmenu1 = (2 * w) / 5;
572 wmenu2 = (3 * w) / 5;
573 wmenu3 = (3 * w) / 6;
574 wmenu4 = (3 * w) / 6;
575
576 rnd_pt_local.image = image;
577 rnd_pt_local.iuser = iuser;
578 rnd_pt_local.rpass_index = 0;
579
580 /* menu buts */
581 if (render_slot) {
582 RenderSlot *slot = BKE_image_get_renderslot(image, *render_slot);
583 char str[sizeof(slot->name)];
584 if (slot && slot->name[0] != '\0') {
585 STRNCPY_UTF8(str, slot->name);
586 }
587 else {
588 SNPRINTF_UTF8(str, IFACE_("Slot %d"), *render_slot + 1);
589 }
590
591 rnd_pt = ui_imageuser_data_copy(&rnd_pt_local);
592 but = uiDefMenuBut(
593 block, ui_imageuser_slot_menu, image, str, 0, 0, wmenu1, UI_UNIT_Y, TIP_("Select Slot"));
594 button_func_menu_step_set(but, ui_imageuser_slot_menu_step);
595 button_funcN_set(but, image_multi_cb, rnd_pt, nullptr);
596 button_type_set_menu_from_pulldown(but);
597 rnd_pt = nullptr;
598 }
599
600 if (rr) {
601 RenderPass *rpass;
602 RenderView *rview;
603 int rpass_index;
604
605 /* layer */
606 fake_name = ui_imageuser_layer_fake_name(rr);
607 rpass_index = iuser->layer - (fake_name ? 1 : 0);
608 rl = static_cast<RenderLayer *>(BLI_findlink(&rr->layers, rpass_index));
609 rnd_pt_local.rpass_index = rpass_index;
610
611 if (RE_layers_have_name(rr)) {
612 display_name = rl ? rl->name : (fake_name ? fake_name : "");
613 rnd_pt = ui_imageuser_data_copy(&rnd_pt_local);
614 but = uiDefMenuBut(block,
616 rnd_pt,
617 display_name,
618 0,
619 0,
620 wmenu2,
621 UI_UNIT_Y,
622 TIP_("Select Layer"));
623 button_func_menu_step_set(but, ui_imageuser_layer_menu_step);
624 button_funcN_set(but, image_multi_cb, rnd_pt, nullptr);
625 button_type_set_menu_from_pulldown(but);
626 rnd_pt = nullptr;
627 }
628
629 /* pass */
630 rpass = static_cast<RenderPass *>(rl ? BLI_findlink(&rl->passes, iuser->pass) : nullptr);
631
632 if (rl && RE_passes_have_name(rl)) {
633 display_name = rpass ? rpass->name : "";
634 rnd_pt = ui_imageuser_data_copy(&rnd_pt_local);
635 but = uiDefMenuBut(block,
637 rnd_pt,
638 IFACE_(display_name),
639 0,
640 0,
641 wmenu3,
642 UI_UNIT_Y,
643 TIP_("Select Pass"));
644 button_func_menu_step_set(but, ui_imageuser_pass_menu_step);
645 button_funcN_set(but, image_multi_cb, rnd_pt, nullptr);
646 button_type_set_menu_from_pulldown(but);
647 rnd_pt = nullptr;
648 }
649
650 /* view */
651 if (BLI_listbase_count_at_most(&rr->views, 2) > 1 &&
652 ((!show_stereo) || !RE_RenderResult_is_stereo(rr)))
653 {
654 rview = static_cast<RenderView *>(BLI_findlink(&rr->views, iuser->view));
655 display_name = rview ? rview->name : "";
656
657 rnd_pt = ui_imageuser_data_copy(&rnd_pt_local);
658 but = uiDefMenuBut(block,
660 rnd_pt,
661 display_name,
662 0,
663 0,
664 wmenu4,
665 UI_UNIT_Y,
666 TIP_("Select View"));
667 button_funcN_set(but, image_multi_cb, rnd_pt, nullptr);
668 button_type_set_menu_from_pulldown(but);
669 rnd_pt = nullptr;
670 }
671 }
672
673 /* stereo image */
674 else if ((BKE_image_is_stereo(image) && (!show_stereo)) ||
676 {
677 int nr = 0;
678
679 for (ImageView &iv : image->views) {
680 if (nr++ == iuser->view) {
681 display_name = iv.name;
682 break;
683 }
684 }
685
686 rnd_pt = ui_imageuser_data_copy(&rnd_pt_local);
687 but = uiDefMenuBut(block,
689 rnd_pt,
690 display_name,
691 0,
692 0,
693 wmenu1,
694 UI_UNIT_Y,
695 TIP_("Select View"));
696 button_funcN_set(but, image_multiview_cb, rnd_pt, nullptr);
697 button_type_set_menu_from_pulldown(but);
698 rnd_pt = nullptr;
699 }
700}
701
702namespace {
703
704struct RNAUpdateCb {
705 PointerRNA ptr = {};
706 PropertyRNA *prop;
707 ImageUser *iuser;
708};
709
710}; // namespace
711
712static void rna_update_cb(bContext *C, void *arg_cb, void * /*arg*/)
713{
714 RNAUpdateCb *cb = static_cast<RNAUpdateCb *>(arg_cb);
715
716 /* we call update here on the pointer property, this way the
717 * owner of the image pointer can still define its own update
718 * and notifier */
719 RNA_property_update(C, &cb->ptr, cb->prop);
720}
721
723 bContext *C,
724 PointerRNA *ptr,
725 const StringRefNull propname,
726 PointerRNA *userptr,
727 bool compact,
728 bool multiview)
729{
730 if (!*ptr) {
731 return;
732 }
733
734 PropertyRNA *prop = RNA_struct_find_property(ptr, propname.c_str());
735 if (!prop) {
736 printf("%s: property not found: %s.%s\n",
737 __func__,
739 propname.c_str());
740 return;
741 }
742
743 if (RNA_property_type(prop) != PROP_POINTER) {
744 printf("%s: expected pointer property for %s.%s\n",
745 __func__,
747 propname.c_str());
748 return;
749 }
750
751 ui::Block *block = layout->block();
752
753 PointerRNA imaptr = RNA_property_pointer_get(ptr, prop);
754 Image *ima = static_cast<Image *>(imaptr.data);
755 ImageUser *iuser = static_cast<ImageUser *>(userptr->data);
756
757 Scene *scene = CTX_data_scene(C);
758 BKE_image_user_frame_calc(ima, iuser, scene->r.cfra);
759
760 layout->context_ptr_set("edit_image", &imaptr);
761 layout->context_ptr_set("edit_image_user", userptr);
762
763 SpaceImage *space_image = CTX_wm_space_image(C);
764 if (!compact && (space_image == nullptr || iuser != &space_image->iuser)) {
765 template_id(
766 layout, C, ptr, propname, ima ? nullptr : "IMAGE_OT_new", "IMAGE_OT_open", nullptr);
767
768 if (ima != nullptr) {
769 layout->separator();
770 }
771 }
772
773 if (ima == nullptr) {
774 return;
775 }
776
777 if (ima->source == IMA_SRC_VIEWER) {
778 /* Viewer images. */
779 uiTemplateImageInfo(layout, C, ima, iuser);
780
781 if (ima->type == IMA_TYPE_COMPOSITE) {
782 }
783 else if (ima->type == IMA_TYPE_R_RESULT) {
784 /* browse layer/passes */
785 RenderResult *rr;
786 const float dpi_fac = UI_SCALE_FAC;
787 const int menus_width = 230 * dpi_fac;
788
789 /* Use #BKE_image_acquire_renderresult so we get the correct slot in the menu. */
790 rr = BKE_image_acquire_renderresult(scene, ima);
791 uiblock_layer_pass_buttons(*layout, ima, rr, iuser, menus_width, &ima->render_slot);
792 BKE_image_release_renderresult(scene, ima, rr);
793 }
794
795 return;
796 }
797
798 /* Set custom callback for property updates. */
799 RNAUpdateCb *cb = MEM_new<RNAUpdateCb>(__func__);
800 cb->ptr = *ptr;
801 cb->prop = prop;
802 cb->iuser = iuser;
803 block_funcN_set(block,
805 cb,
806 nullptr,
809
810 /* Disable editing if image was modified, to avoid losing changes. */
811 const bool is_dirty = BKE_image_is_dirty(ima);
812 if (is_dirty) {
813 ui::Layout &row = layout->row(true);
814 row.op("image.save", IFACE_("Save"), ICON_NONE);
815 row.op("image.reload", IFACE_("Discard"), ICON_NONE);
816 layout->separator();
817 }
818
819 layout = &layout->column(false);
820 layout->enabled_set(!is_dirty);
821 layout->use_property_decorate_set(false);
822
823 /* Image source */
824 {
825 ui::Layout &col = layout->column(false);
826 col.use_property_split_set(true);
827 col.prop(&imaptr, "source", UI_ITEM_NONE, std::nullopt, ICON_NONE);
828 }
829
830 /* Filepath */
831 const bool is_packed = BKE_image_has_packedfile(ima);
832 const bool no_filepath = is_packed && !BKE_image_has_filepath(ima);
833
834 if ((ima->source != IMA_SRC_GENERATED) && !no_filepath) {
835 layout->separator();
836
837 ui::Layout &row = layout->row(true);
838 if (is_packed) {
839 row.op("image.unpack", "", ICON_PACKAGE);
840 }
841 else {
842 row.op("image.pack", "", ICON_UGLYPACKAGE);
843 }
844
845 ui::Layout &sub = row.row(true);
846 sub.enabled_set(is_packed == false);
847
848 prop = RNA_struct_find_property(&imaptr, "filepath");
849 uiDefAutoButR(block, &imaptr, prop, -1, "", ICON_NONE, 0, 0, 200, UI_UNIT_Y);
850 sub.op("image.file_browse", "", ICON_FILEBROWSER);
851 sub.op("image.reload", "", ICON_FILE_REFRESH);
852 }
853
854 /* Image layers and Info */
855 if (ima->source == IMA_SRC_GENERATED) {
856 layout->separator();
857
858 /* Generated */
859 ui::Layout &col = layout->column(false);
860 col.use_property_split_set(true);
861
862 ui::Layout &sub = col.column(true);
863 sub.prop(&imaptr, "generated_width", UI_ITEM_NONE, IFACE_("X"), ICON_NONE);
864 sub.prop(&imaptr, "generated_height", UI_ITEM_NONE, IFACE_("Y"), ICON_NONE);
865
866 col.prop(&imaptr, "use_generated_float", UI_ITEM_NONE, std::nullopt, ICON_NONE);
867
868 col.separator();
869
870 col.prop(&imaptr, "generated_type", ui::ITEM_R_EXPAND, IFACE_("Type"), ICON_NONE);
871 ImageTile *base_tile = BKE_image_get_tile(ima, 0);
872 if (base_tile->gen_type == IMA_GENTYPE_BLANK) {
873 col.prop(&imaptr, "generated_color", UI_ITEM_NONE, std::nullopt, ICON_NONE);
874 }
875 }
876 else if (compact == 0) {
877 uiTemplateImageInfo(layout, C, ima, iuser);
878 }
879 if (ima->type == IMA_TYPE_MULTILAYER && ima->rr) {
880 layout->separator();
881
882 const float dpi_fac = UI_SCALE_FAC;
883 uiblock_layer_pass_buttons(*layout, ima, ima->rr, iuser, 230 * dpi_fac, nullptr);
884 }
885
886 if (BKE_image_is_animated(ima)) {
887 /* Animation */
888 layout->separator();
889
890 ui::Layout &col = layout->column(true);
891 col.use_property_split_set(true);
892
893 ui::Layout &sub = col.column(true);
894 ui::Layout &row = sub.row(true);
895 row.prop(userptr, "frame_duration", UI_ITEM_NONE, IFACE_("Frames"), ICON_NONE);
896 row.op("IMAGE_OT_match_movie_length", "", ICON_FILE_REFRESH);
897
898 sub.prop(userptr, "frame_start", UI_ITEM_NONE, IFACE_("Start"), ICON_NONE);
899 sub.prop(userptr, "frame_offset", UI_ITEM_NONE, std::nullopt, ICON_NONE);
900
901 col.prop(userptr, "use_cyclic", UI_ITEM_NONE, std::nullopt, ICON_NONE);
902 col.prop(userptr, "use_auto_refresh", UI_ITEM_NONE, std::nullopt, ICON_NONE);
903
904 if (ima->source == IMA_SRC_MOVIE && compact == 0) {
905 col.prop(&imaptr, "use_deinterlace", UI_ITEM_NONE, IFACE_("Deinterlace"), ICON_NONE);
906 }
907 }
908
909 /* Multiview */
910 if (multiview && compact == 0) {
911 if ((scene->r.scemode & R_MULTIVIEW) != 0) {
912 layout->separator();
913
914 ui::Layout &col = layout->column(false);
915 col.use_property_split_set(true);
916 col.prop(&imaptr, "use_multiview", UI_ITEM_NONE, std::nullopt, ICON_NONE);
917
918 if (RNA_boolean_get(&imaptr, "use_multiview")) {
919 uiTemplateImageViews(layout, &imaptr);
920 }
921 }
922 }
923
924 /* Color-space and alpha. */
925 {
926 layout->separator();
927
928 ui::Layout &col = layout->column(false);
929 col.use_property_split_set(true);
930 template_colorspace_settings(&col, &imaptr, "colorspace_settings");
931
932 if (compact == 0) {
933 if (ima->source != IMA_SRC_GENERATED) {
934 if (BKE_image_has_alpha(ima)) {
935 ui::Layout &sub = col.column(false);
936 sub.prop(&imaptr, "alpha_mode", UI_ITEM_NONE, IFACE_("Alpha"), ICON_NONE);
937
938 bool is_data = IMB_colormanagement_space_name_is_data(ima->colorspace_settings.name);
939 sub.active_set(!is_data);
940 }
941
942 if (ima && iuser) {
943 void *lock;
944 ImBuf *ibuf = BKE_image_acquire_ibuf(ima, iuser, &lock);
945
946 if (ibuf && ibuf->float_data() && (ibuf->foptions.flag & OPENEXR_HALF) == 0) {
947 col.prop(&imaptr, "use_half_precision", UI_ITEM_NONE, std::nullopt, ICON_NONE);
948 }
949 BKE_image_release_ibuf(ima, ibuf, lock);
950 }
951 }
952
953 col.prop(&imaptr, "use_view_as_render", UI_ITEM_NONE, std::nullopt, ICON_NONE);
954 col.prop(&imaptr, "seam_margin", UI_ITEM_NONE, std::nullopt, ICON_NONE);
955 }
956 }
957
958 block_funcN_set(block, nullptr, nullptr, nullptr);
959}
960
962 bContext *C,
963 PointerRNA *imfptr,
964 bool color_management,
965 const char *panel_idname)
966{
967 ImageFormatData *imf = static_cast<ImageFormatData *>(imfptr->data);
968 ID *id = imfptr->owner_id;
969 /* Note: this excludes any video formats; for them the image template does
970 * not show the color depth. Color depth instead is shown as part of encoding UI block,
971 * which is less confusing. */
972 const eImageFormatDepth depth_ok = BKE_imtype_valid_depths(imf->imtype);
973 /* some settings depend on this being a scene that's rendered */
974 const bool is_render_out = (id && GS(id->name) == ID_SCE);
975
976 ui::Layout &col = layout->column(false);
977
978 col.use_property_split_set(true);
979 col.use_property_decorate_set(false);
980
981 /* The file output node draws the media type itself. */
982 const bool is_file_output = (id && GS(id->name) == ID_NT);
983 if (!is_file_output) {
984 col.prop(imfptr, "media_type", UI_ITEM_NONE, std::nullopt, ICON_NONE);
985 }
986
987 /* Multi layer images and video media types only have a single supported format,
988 * so we needn't draw the format enum. */
989 if (imf->media_type == MEDIA_TYPE_IMAGE) {
990 col.prop(imfptr, "file_format", UI_ITEM_NONE, std::nullopt, ICON_NONE);
991 }
992
993 /* Multi-layer always saves raw unmodified channels. */
994 if (imf->imtype != R_IMF_IMTYPE_MULTILAYER) {
995 col.row(true).prop(imfptr, "color_mode", ui::ITEM_R_EXPAND, IFACE_("Color"), ICON_NONE);
996 }
997
998 /* only display depth setting if multiple depths can be used */
999 if (ELEM(depth_ok,
1004 R_IMF_CHAN_DEPTH_32) == 0)
1005 {
1006 col.row(true).prop(imfptr, "color_depth", ui::ITEM_R_EXPAND, std::nullopt, ICON_NONE);
1007 }
1008
1010 col.prop(imfptr, "quality", UI_ITEM_NONE, std::nullopt, ICON_NONE);
1011 }
1012
1014 col.prop(imfptr, "compression", UI_ITEM_NONE, std::nullopt, ICON_NONE);
1015 }
1016
1018 col.prop(imfptr, "exr_codec", UI_ITEM_NONE, std::nullopt, ICON_NONE);
1020 col.prop(imfptr, "quality", UI_ITEM_NONE, std::nullopt, ICON_NONE);
1021 }
1022 }
1023 if (imf->imtype == R_IMF_IMTYPE_MULTILAYER) {
1024 col.prop(imfptr, "use_exr_interleave", UI_ITEM_NONE, std::nullopt, ICON_NONE);
1025 }
1026
1027 if (is_render_out && ELEM(imf->imtype, R_IMF_IMTYPE_OPENEXR, R_IMF_IMTYPE_MULTILAYER)) {
1028 col.prop(imfptr, "use_preview", UI_ITEM_NONE, std::nullopt, ICON_NONE);
1029 }
1030
1031 if (imf->imtype == R_IMF_IMTYPE_JP2) {
1032 col.prop(imfptr, "jpeg2k_codec", UI_ITEM_NONE, std::nullopt, ICON_NONE);
1033
1034 col.prop(imfptr, "use_jpeg2k_cinema_preset", UI_ITEM_NONE, std::nullopt, ICON_NONE);
1035 col.prop(imfptr, "use_jpeg2k_cinema_48", UI_ITEM_NONE, std::nullopt, ICON_NONE);
1036
1037 col.prop(imfptr, "use_jpeg2k_ycc", UI_ITEM_NONE, std::nullopt, ICON_NONE);
1038 }
1039
1040 if (imf->imtype == R_IMF_IMTYPE_DPX) {
1041 col.prop(imfptr, "use_cineon_log", UI_ITEM_NONE, std::nullopt, ICON_NONE);
1042 }
1043
1044 if (imf->imtype == R_IMF_IMTYPE_CINEON) {
1045#if 1
1046 col.label(RPT_("Hard coded Non-Linear, Gamma:1.7"), ICON_NONE);
1047#else
1048 col.prop(imfptr, "use_cineon_log", UI_ITEM_NONE, std::nullopt, ICON_NONE);
1049 col.prop(imfptr, "cineon_black", UI_ITEM_NONE, std::nullopt, ICON_NONE);
1050 col.prop(imfptr, "cineon_white", UI_ITEM_NONE, std::nullopt, ICON_NONE);
1051 col.prop(imfptr, "cineon_gamma", UI_ITEM_NONE, std::nullopt, ICON_NONE);
1052#endif
1053 }
1054
1055 if (imf->imtype == R_IMF_IMTYPE_TIFF) {
1056 col.prop(imfptr, "tiff_codec", UI_ITEM_NONE, std::nullopt, ICON_NONE);
1057 }
1058
1059 /* Override color management */
1060 if (color_management) {
1061 StringRef idname = panel_idname ? panel_idname : "settings_color_management";
1062 if (ui::Layout *panel = col.panel(C, idname, true, IFACE_("Color Management"))) {
1063 panel->separator();
1064 panel->row(true).prop(imfptr, "color_management", ui::ITEM_R_EXPAND, " ", ICON_NONE);
1065
1066 ui::Layout &color_settings = panel->column(true);
1069 PointerRNA linear_settings_ptr = RNA_pointer_get(imfptr, "linear_colorspace_settings");
1070 color_settings.prop_with_menu(&linear_settings_ptr,
1071 "name",
1073 IFACE_("Color Space"),
1074 ICON_NONE,
1075 "UI_MT_color_space_select");
1076 }
1077 }
1078 else {
1079 PointerRNA display_settings_ptr = RNA_pointer_get(imfptr, "display_settings");
1080 color_settings.prop(
1081 &display_settings_ptr, "display_device", UI_ITEM_NONE, std::nullopt, ICON_NONE);
1082 template_colormanaged_view_settings(&color_settings, nullptr, imfptr, "view_settings");
1084 }
1085 }
1086 }
1087}
1088
1089void uiTemplateImageStereo3d(ui::Layout *layout, PointerRNA *stereo3d_format_ptr)
1090{
1091 Stereo3dFormat *stereo3d_format = static_cast<Stereo3dFormat *>(stereo3d_format_ptr->data);
1092
1093 ui::Layout &col = layout->column(false);
1094 col.prop(stereo3d_format_ptr, "display_mode", UI_ITEM_NONE, std::nullopt, ICON_NONE);
1095
1096 switch (stereo3d_format->display_mode) {
1097 case S3D_DISPLAY_ANAGLYPH: {
1098 col.prop(stereo3d_format_ptr, "anaglyph_type", UI_ITEM_NONE, std::nullopt, ICON_NONE);
1099 break;
1100 }
1101 case S3D_DISPLAY_INTERLACE: {
1102 col.prop(stereo3d_format_ptr, "interlace_type", UI_ITEM_NONE, std::nullopt, ICON_NONE);
1103 col.prop(stereo3d_format_ptr, "use_interlace_swap", UI_ITEM_NONE, std::nullopt, ICON_NONE);
1104 break;
1105 }
1107 col.prop(
1108 stereo3d_format_ptr, "use_sidebyside_crosseyed", UI_ITEM_NONE, std::nullopt, ICON_NONE);
1110 }
1111 case S3D_DISPLAY_TOPBOTTOM: {
1112 col.prop(stereo3d_format_ptr, "use_squeezed_frame", UI_ITEM_NONE, std::nullopt, ICON_NONE);
1113 break;
1114 }
1116 break;
1117 }
1118}
1119
1121 PointerRNA *ptr,
1122 PointerRNA *stereo3d_format_ptr)
1123{
1124 ui::Layout &col = layout->column(false);
1125
1126 col.use_property_split_set(true);
1127 col.use_property_decorate_set(false);
1128
1129 col.prop(ptr, "views_format", ui::ITEM_R_EXPAND, std::nullopt, ICON_NONE);
1130
1131 if (stereo3d_format_ptr && RNA_enum_get(ptr, "views_format") == R_IMF_VIEWS_STEREO_3D) {
1132 uiTemplateImageStereo3d(&col, stereo3d_format_ptr);
1133 }
1134}
1135
1137{
1138 Image *ima = static_cast<Image *>(imaptr->data);
1139
1140 if (ima->type != IMA_TYPE_MULTILAYER) {
1141 PropertyRNA *prop;
1142 PointerRNA stereo3d_format_ptr;
1143
1144 prop = RNA_struct_find_property(imaptr, "stereo_3d_format");
1145 stereo3d_format_ptr = RNA_property_pointer_get(imaptr, prop);
1146
1147 uiTemplateViewsFormat(layout, imaptr, &stereo3d_format_ptr);
1148 }
1149 else {
1150 uiTemplateViewsFormat(layout, imaptr, nullptr);
1151 }
1152}
1153
1155{
1156 ImageFormatData *imf = static_cast<ImageFormatData *>(imfptr->data);
1157
1158 if (ptr != nullptr) {
1159 layout->prop(ptr, "use_multiview", UI_ITEM_NONE, std::nullopt, ICON_NONE);
1160 if (!RNA_boolean_get(ptr, "use_multiview")) {
1161 return;
1162 }
1163 }
1164
1165 if (imf->imtype != R_IMF_IMTYPE_MULTILAYER) {
1166 PropertyRNA *prop;
1167 PointerRNA stereo3d_format_ptr;
1168
1169 prop = RNA_struct_find_property(imfptr, "stereo_3d_format");
1170 stereo3d_format_ptr = RNA_property_pointer_get(imfptr, prop);
1171
1172 uiTemplateViewsFormat(layout, imfptr, &stereo3d_format_ptr);
1173 }
1174 else {
1175 uiTemplateViewsFormat(layout, imfptr, nullptr);
1176 }
1177}
1178
1180{
1181 Scene *scene = CTX_data_scene(C);
1182
1183 /* render layers and passes */
1184 if (ima && iuser) {
1185 RenderResult *rr;
1186 const float dpi_fac = UI_SCALE_FAC;
1187 const int menus_width = 160 * dpi_fac;
1188 const bool is_render_result = (ima->type == IMA_TYPE_R_RESULT);
1189
1190 /* Use BKE_image_acquire_renderresult so we get the correct slot in the menu. */
1191 rr = BKE_image_acquire_renderresult(scene, ima);
1193 *layout, ima, rr, iuser, menus_width, is_render_result ? &ima->render_slot : nullptr);
1194 BKE_image_release_renderresult(scene, ima, rr);
1195 }
1196}
1197
1199{
1200 if (ima == nullptr || iuser == nullptr) {
1201 return;
1202 }
1203
1204 /* Acquire image buffer. */
1205 void *lock;
1206 ImBuf *ibuf = BKE_image_acquire_ibuf_gpu(ima, iuser, &lock);
1207
1208 ui::Layout &col = layout->column(true);
1210
1211 if (ibuf == nullptr) {
1212 col.label(RPT_("Cannot Load Image"), ICON_NONE);
1213 }
1214 else {
1215 char str[MAX_IMAGE_INFO_LEN] = {0};
1216 const int len = MAX_IMAGE_INFO_LEN;
1217 int ofs = 0;
1218
1219 ofs += BLI_snprintf_utf8_rlen(str + ofs, len - ofs, RPT_("%d \u00D7 %d, "), ibuf->x, ibuf->y);
1220
1221 if (ibuf->float_data() || ibuf->gpu.texture) {
1222 if (ibuf->channels != 4) {
1224 str + ofs, len - ofs, RPT_("%d float channel(s)"), ibuf->channels);
1225 }
1226 else if (ibuf->color_mode == ImColorMode::RGBA) {
1227 ofs += BLI_strncpy_utf8_rlen(str + ofs, RPT_(" RGBA float"), len - ofs);
1228 }
1229 else {
1230 ofs += BLI_strncpy_utf8_rlen(str + ofs, RPT_(" RGB float"), len - ofs);
1231 }
1232 }
1233 else {
1234 if (ibuf->color_mode == ImColorMode::RGBA) {
1235 ofs += BLI_strncpy_utf8_rlen(str + ofs, RPT_(" RGBA byte"), len - ofs);
1236 }
1237 else {
1238 ofs += BLI_strncpy_utf8_rlen(str + ofs, RPT_(" RGB byte"), len - ofs);
1239 }
1240 }
1241
1243
1244 /* Try to see if this texture is a compressed format, if not, get the generic format.
1245 * A modified image is uploaded uncompressed so it can be written to. */
1246 const bool is_compressed = (ibuf->userflags & IB_BITMAPDIRTY) == 0 &&
1247 IMB_gpu_get_compressed_format(ibuf, &texture_format);
1248 if (!is_compressed) {
1249 texture_format = IMB_gpu_get_texture_format(
1250 ibuf, ima->flag & IMA_HIGH_BITDEPTH, ibuf->color_mode == ImColorMode::BW);
1251 }
1252
1253 const char *texture_format_description = GPU_texture_format_name(texture_format);
1254 ofs += BLI_snprintf_utf8_rlen(str + ofs, len - ofs, RPT_(", %s"), texture_format_description);
1255
1256 col.label(str, ICON_NONE);
1257 }
1258
1259 /* Frame number, even if we can't load the image. */
1260 if (ELEM(ima->source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE)) {
1261 /* don't use iuser->framenr directly because it may not be updated if auto-refresh is off */
1262 Scene *scene = CTX_data_scene(C);
1263 const int framenr = BKE_image_user_frame_get(iuser, scene->r.cfra, nullptr);
1264 char str[MAX_IMAGE_INFO_LEN];
1265 int duration = 0;
1266
1267 if (ima->source == IMA_SRC_MOVIE && BKE_image_has_anim(ima)) {
1268 MovieReader *anim = (ima->anims.first())->anim;
1269 if (anim) {
1270 duration = MOV_get_duration_frames(anim);
1271 }
1272 }
1273
1274 if (duration > 0) {
1275 /* Movie duration */
1276 SNPRINTF_UTF8(str, RPT_("Frame %d / %d"), framenr, duration);
1277 }
1278 else if (ima->source == IMA_SRC_SEQUENCE && ibuf) {
1279 /* Image sequence frame number + filename */
1280 const char *filename = BLI_path_basename(ibuf->filepath.c_str());
1281 SNPRINTF_UTF8(str, RPT_("Frame %d: %s"), framenr, filename);
1282 }
1283 else {
1284 /* Frame number */
1285 SNPRINTF_UTF8(str, RPT_("Frame %d"), framenr);
1286 }
1287
1288 col.label(str, ICON_NONE);
1289 }
1290
1291 BKE_image_release_ibuf(ima, ibuf, lock);
1292}
1293
1294#undef MAX_IMAGE_INFO_LEN
1295
1297{
1298 SpaceImage *space_image = CTX_wm_space_image(C);
1299 return space_image != nullptr && space_image->image != nullptr;
1300}
1301
1302static void metadata_panel_context_draw(const bContext *C, Panel *panel)
1303{
1304 void *lock;
1305 SpaceImage *space_image = CTX_wm_space_image(C);
1306 Image *image = space_image->image;
1307 ImBuf *ibuf = BKE_image_acquire_ibuf(image, &space_image->iuser, &lock);
1308 if (ibuf != nullptr) {
1310 }
1312}
1313
1315{
1316 PanelType *pt;
1317
1318 pt = MEM_new_zeroed<PanelType>("spacetype image panel metadata");
1319 STRNCPY_UTF8(pt->idname, "IMAGE_PT_metadata");
1320 STRNCPY_UTF8(pt->label, N_("Metadata"));
1321 STRNCPY_UTF8(pt->category, "Image");
1323 pt->order = 10;
1327 BLI_addtail(&art->paneltypes, pt);
1328}
1329
1330} // namespace blender
#define CMP_NODE_VIEWER
#define ATTR_FALLTHROUGH
#define SNPRINTF_UTF8(dst, format,...)
#define STRNCPY_UTF8(dst, src)
#define RPT_(msgid)
#define TIP_(msgid)
#define IFACE_(msgid)
#define BLT_I18NCONTEXT_DEFAULT_BPYRNA
#define UI_SCALE_FAC
#define OPENEXR_CODEC_MASK
Read Blender memory allocation and freeing.
#define C
Definition RandGen.cpp:29
#define UI_UNIT_Y
#define UI_UNIT_X
#define UI_ITEM_NONE
#define ND_DRAW
Definition WM_types.hh:502
#define NC_IMAGE
Definition WM_types.hh:397
volatile int lock
#define ELEM(...)
#define STREQ(a, b)
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition btQuadWord.h:119
constexpr const char * c_str() const
#define offsetof(t, d)
#define str(s)
#define layer
#define OPENEXR_HALF
#define MAX_IMAGE_INFO_LEN
ccl_device_inline dual1 len(const ccl_private dual< T > &a)
Definition math_dual.h:263
std::string filename(const std::string_view &str, size_t pos)
void * but_func_argN_copy(const void *argN)
void but_func_argN_free(void *argN)
BMesh Iterators.
bool BKE_image_is_multiview(const Image *ima)
void BKE_image_user_frame_calc(Image *ima, ImageUser *iuser, int cfra)
void * MEM_new_uninitialized(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
RenderResult * BKE_image_acquire_renderresult(Scene *scene, Image *ima)
static bool ui_imageuser_slot_menu_step(bContext *C, int direction, void *image_p)
PointerRNA RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop)
bool BKE_image_is_animated(Image *image)
void uiTemplateImage(ui::Layout *layout, bContext *C, PointerRNA *ptr, StringRefNull propname, PointerRNA *userptr, bool compact, bool multiview)
int RNA_enum_get(PointerRNA *ptr, const char *name)
RenderView * RE_RenderViewGetById(RenderResult *rr, const int view_id)
void BKE_image_multiview_index(const Image *ima, ImageUser *iuser)
bool IMB_gpu_get_compressed_format(const ImBuf *ibuf, gpu::TextureFormat *r_texture_format)
Definition util_gpu.cc:115
bool ED_image_slot_cycle(Image *image, int direction)
@ IMA_TYPE_MULTILAYER
void uiTemplateImageFormatViews(ui::Layout *layout, PointerRNA *imfptr, PointerRNA *ptr)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
void RNA_property_update(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
bool RE_HasCombinedLayer(const RenderResult *result)
static bool metadata_panel_context_poll(const bContext *C, PanelType *)
bool RE_layers_have_name(RenderResult *result)
void BKE_image_release_renderresult(Scene *scene, Image *ima, RenderResult *render_result)
char size_t BLI_strncpy_utf8_rlen(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
static void ui_imageuser_view_menu_rr(bContext *, ui::Layout *layout, void *rnd_pt)
bool BKE_image_has_filepath(const Image *ima)
static void image_multiview_cb(bContext *C, void *rnd_pt, void *)
@ S3D_DISPLAY_SIDEBYSIDE
@ S3D_DISPLAY_TOPBOTTOM
@ S3D_DISPLAY_INTERLACE
ImageTile * BKE_image_get_tile(Image *ima, int tile_number)
gpu::TextureFormat IMB_gpu_get_texture_format(const ImBuf *ibuf, bool high_bitdepth, bool use_grayscale)
Definition util_gpu.cc:826
static ImageUI_Data * ui_imageuser_data_copy(const ImageUI_Data *rnd_pt_src)
@ R_IMF_COLOR_MANAGEMENT_OVERRIDE
void image_buttons_register(ARegionType *art)
static void ui_imageuser_layer_menu(bContext *, ui::Layout *layout, void *rnd_pt)
bool RE_RenderResult_is_stereo(const RenderResult *result)
bool BKE_imtype_supports_compress(char imtype)
void uiTemplateImageStereo3d(ui::Layout *layout, PointerRNA *stereo3d_format_ptr)
PropertyType RNA_property_type(PropertyRNA *prop)
void void void const char * BLI_path_basename(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
@ R_IMF_IMTYPE_MULTILAYER
void * BLI_findlink(const ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:541
static void ui_imageuser_view_menu_multiview(bContext *, ui::Layout *layout, void *rnd_pt)
Render * RE_GetSceneRender(const Scene *scene)
ImBuf * BKE_image_acquire_ibuf_gpu(Image *ima, ImageUser *iuser, void **r_lock, bool *r_load_failed=nullptr, bool cached_only=false)
void * BLI_findstring_ptr(const ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:658
void * MEM_new_zeroed(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2)
@ PROP_POINTER
Definition RNA_types.hh:215
bool BKE_image_is_stereo(const Image *ima)
RenderPass * BKE_image_multilayer_index(RenderResult *rr, ImageUser *iuser)
BMesh const char void * data
static void uiblock_layer_pass_buttons(ui::Layout &layout, Image *image, RenderResult *rr, ImageUser *iuser, int w, const short *render_slot)
static void ui_imageuser_pass_menu(bContext *, ui::Layout *layout, void *rnd_pt)
static const char * ui_imageuser_layer_fake_name(RenderResult *rr)
RenderSlot * BKE_image_get_renderslot(Image *ima, int index)
void uiTemplateImageLayers(ui::Layout *layout, bContext *C, Image *ima, ImageUser *iuser)
LinkData * BLI_genericNodeN(void *data)
Definition listbase.cc:936
bool BKE_imtype_supports_quality(char imtype)
void uiTemplateImageInfo(ui::Layout *layout, bContext *C, Image *ima, ImageUser *iuser)
static bool ui_imageuser_layer_menu_step(bContext *C, int direction, void *rnd_pt)
void uiTemplateImageViews(ui::Layout *layout, PointerRNA *imaptr)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
void ED_region_image_metadata_panel_draw(ImBuf *ibuf, ui::Layout *layout)
Definition area.cc:4623
void uiTemplateImageSettings(ui::Layout *layout, bContext *C, PointerRNA *imfptr, bool color_management, const char *panel_idname=nullptr)
ImageUser * ntree_get_active_iuser(bNodeTree *ntree)
static void image_multi_cb(bContext *C, void *rnd_pt, void *)
int BLI_listbase_count_at_most(const ListBase *listbase, int count_max) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:518
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
eImageFormatDepth BKE_imtype_valid_depths(char imtype)
PointerRNA RNA_pointer_get(PointerRNA *ptr, const char *name)
bool BKE_imtype_requires_linear_float(char imtype)
const char * RNA_struct_identifier(const StructRNA *type)
ImBuf * BKE_image_acquire_ibuf(Image *ima, ImageUser *iuser, void **r_lock)
SpaceImage * CTX_wm_space_image(const bContext *C)
bool RE_passes_have_name(RenderLayer *rl)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:118
@ PANEL_TYPE_DEFAULT_CLOSED
static void metadata_panel_context_draw(const bContext *C, Panel *panel)
ID_Type GS(const char *name)
Definition DNA_ID.h:410
@ R_IMF_VIEWS_STEREO_3D
const char * GPU_texture_format_name(gpu::TextureFormat format)
static bool ui_imageuser_pass_menu_step(bContext *C, int direction, void *rnd_pt)
static void uiTemplateViewsFormat(ui::Layout *layout, PointerRNA *ptr, PointerRNA *stereo3d_format_ptr)
Scene * CTX_data_scene(const bContext *C)
static void rna_update_cb(bContext *C, void *arg_cb, void *)
bool BKE_image_has_packedfile(const Image *image)
bool IMB_colormanagement_space_name_is_data(const char *name)
int MOV_get_duration_frames(const MovieReader *anim)
int BKE_image_user_frame_get(const ImageUser *iuser, int cfra, bool *r_is_in_range)
size_t BLI_snprintf_utf8_rlen(char *__restrict dst, size_t dst_maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
static void ui_imageuser_slot_menu(bContext *C, ui::Layout *layout, void *image_p)
void BKE_image_release_ibuf(Image *ima, ImBuf *ibuf, void *lock)
ListBaseT< PanelType > paneltypes
std::atomic< gpu::Texture * > texture
ImbFormatOptions foptions
const uint8_t * byte_data() const
const float * float_data() const
std::string filepath
ImColorMode color_mode
eImageGenType gen_type
eImageUser_Flag flag
struct Scene * scene
struct ImageView * prev
char translation_context[BKE_ST_MAXNAME]
void(*) draw(const bContext *C, Panel *panel)
char category[BKE_ST_MAXNAME]
bool(*) poll(const bContext *C, PanelType *pt)
char idname[BKE_ST_MAXNAME]
char label[BKE_ST_MAXNAME]
ui::Layout * layout
StructRNA * type
Definition RNA_types.hh:63
ListBaseT< RenderPass > passes
Definition RE_pipeline.h:99
char name[RE_MAXNAME]
Definition RE_pipeline.h:94
struct RenderPass * next
Definition RE_pipeline.h:58
ListBaseT< RenderView > views
ListBaseT< RenderLayer > layers
struct ImBuf * ibuf
Definition RE_pipeline.h:54
struct RenderView * prev
Definition RE_pipeline.h:46
struct RenderData r
struct ImageUser iuser
eStereoDisplayMode display_mode
void enabled_set(bool enabled)
void alignment_set(LayoutAlign alignment)
void use_property_decorate_set(bool is_decorate)
void use_property_split_set(bool is_sep)
void label(StringRef name, int icon)
PointerRNA op(wmOperatorType *ot, std::optional< StringRef > name, int icon, wm::OpCallContext context, eUI_Item_Flag flag)
PanelLayout panel(const bContext *C, StringRef idname, bool default_closed)
void prop_with_menu(PointerRNA *ptr, blender::StringRefNull propname, eUI_Item_Flag flag, std::optional< blender::StringRefNull > name, int icon, const char *menu_type)
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< StringRef > name_opt, int icon, std::optional< StringRef > placeholder=std::nullopt)
void active_set(bool active)
Layout & column(bool align)
void separator(float factor=1.0f, LayoutSeparatorType type=LayoutSeparatorType::Auto)
Layout & row(bool align)
void context_ptr_set(StringRef name, const PointerRNA *ptr)
#define N_(msgid)