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