Blender  V2.93
image_buttons.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
17  * All rights reserved.
18  */
19 
24 #include <stdio.h>
25 #include <string.h>
26 
27 #include "DNA_node_types.h"
28 #include "DNA_scene_types.h"
29 
30 #include "MEM_guardedalloc.h"
31 
32 #include "BLI_blenlib.h"
33 #include "BLI_utildefines.h"
34 
35 #include "BLT_translation.h"
36 
37 #include "BKE_context.h"
38 #include "BKE_image.h"
39 #include "BKE_node.h"
40 #include "BKE_scene.h"
41 #include "BKE_screen.h"
42 
43 #include "RE_pipeline.h"
44 
45 #include "IMB_colormanagement.h"
46 #include "IMB_imbuf.h"
47 #include "IMB_imbuf_types.h"
48 
49 #include "ED_gpencil.h"
50 #include "ED_image.h"
51 #include "ED_screen.h"
52 
53 #include "RNA_access.h"
54 
55 #include "WM_api.h"
56 #include "WM_types.h"
57 
58 #include "UI_interface.h"
59 #include "UI_resources.h"
60 
61 #include "image_intern.h"
62 
63 #define B_NOP -1
64 #define MAX_IMAGE_INFO_LEN 128
65 
66 /* gets active viewer user */
68 {
69  bNode *node;
70 
71  if (ntree) {
72  for (node = ntree->nodes.first; node; node = node->next) {
74  if (node->flag & NODE_DO_OUTPUT) {
75  return node->storage;
76  }
77  }
78  }
79  }
80  return NULL;
81 }
82 
83 /* ********************* callbacks for standard image buttons *************** */
84 
85 static void ui_imageuser_slot_menu(bContext *UNUSED(C), uiLayout *layout, void *image_p)
86 {
87  uiBlock *block = uiLayoutGetBlock(layout);
88  Image *image = image_p;
89 
90  int slot_id;
91  LISTBASE_FOREACH_INDEX (RenderSlot *, slot, &image->renderslots, slot_id) {
92  char str[64];
93  if (slot->name[0] != '\0') {
94  BLI_strncpy(str, slot->name, sizeof(str));
95  }
96  else {
97  BLI_snprintf(str, sizeof(str), IFACE_("Slot %d"), slot_id + 1);
98  }
99  uiDefButS(block,
101  B_NOP,
102  str,
103  0,
104  0,
105  UI_UNIT_X * 5,
106  UI_UNIT_X,
107  &image->render_slot,
108  (float)slot_id,
109  0.0,
110  0,
111  -1,
112  "");
113  }
114 
115  uiItemS(layout);
116  uiDefBut(block,
118  0,
119  IFACE_("Slot"),
120  0,
121  0,
122  UI_UNIT_X * 5,
123  UI_UNIT_Y,
124  NULL,
125  0.0,
126  0.0,
127  0,
128  0,
129  "");
130 }
131 
132 static bool ui_imageuser_slot_menu_step(bContext *C, int direction, void *image_p)
133 {
134  Image *image = image_p;
135 
136  if (ED_image_slot_cycle(image, direction)) {
138  return true;
139  }
140  return true;
141 }
142 
144 {
145  RenderView *rv = RE_RenderViewGetById(rr, 0);
146  if (rv->rectf) {
147  return IFACE_("Composite");
148  }
149  if (rv->rect32) {
150  return IFACE_("Sequence");
151  }
152  return NULL;
153 }
154 
155 /* workaround for passing many args */
156 struct ImageUI_Data {
160 };
161 
162 static struct ImageUI_Data *ui_imageuser_data_copy(const struct ImageUI_Data *rnd_pt_src)
163 {
164  struct ImageUI_Data *rnd_pt_dst = MEM_mallocN(sizeof(*rnd_pt_src), __func__);
165  memcpy(rnd_pt_dst, rnd_pt_src, sizeof(*rnd_pt_src));
166  return rnd_pt_dst;
167 }
168 
169 static void ui_imageuser_layer_menu(bContext *UNUSED(C), uiLayout *layout, void *rnd_pt)
170 {
171  struct ImageUI_Data *rnd_data = rnd_pt;
172  uiBlock *block = uiLayoutGetBlock(layout);
173  Image *image = rnd_data->image;
174  ImageUser *iuser = rnd_data->iuser;
175  Scene *scene = iuser->scene;
176 
177  /* May have been freed since drawing. */
179  if (UNLIKELY(rr == NULL)) {
180  return;
181  }
182 
183  UI_block_layout_set_current(block, layout);
184  uiLayoutColumn(layout, false);
185 
186  const char *fake_name = ui_imageuser_layer_fake_name(rr);
187  if (fake_name) {
188  uiDefButS(block,
190  B_NOP,
191  fake_name,
192  0,
193  0,
194  UI_UNIT_X * 5,
195  UI_UNIT_X,
196  &iuser->layer,
197  0.0,
198  0.0,
199  0,
200  -1,
201  "");
202  }
203 
204  int nr = fake_name ? 1 : 0;
205  for (RenderLayer *rl = rr->layers.first; rl; rl = rl->next, nr++) {
206  uiDefButS(block,
208  B_NOP,
209  rl->name,
210  0,
211  0,
212  UI_UNIT_X * 5,
213  UI_UNIT_X,
214  &iuser->layer,
215  (float)nr,
216  0.0,
217  0,
218  -1,
219  "");
220  }
221 
222  uiItemS(layout);
223  uiDefBut(block,
225  0,
226  IFACE_("Layer"),
227  0,
228  0,
229  UI_UNIT_X * 5,
230  UI_UNIT_Y,
231  NULL,
232  0.0,
233  0.0,
234  0,
235  0,
236  "");
237 
239 }
240 
241 static void ui_imageuser_pass_menu(bContext *UNUSED(C), uiLayout *layout, void *rnd_pt)
242 {
243  struct ImageUI_Data *rnd_data = rnd_pt;
244  uiBlock *block = uiLayoutGetBlock(layout);
245  Image *image = rnd_data->image;
246  ImageUser *iuser = rnd_data->iuser;
247  /* (rpass_index == -1) means composite result */
248  const int rpass_index = rnd_data->rpass_index;
249  Scene *scene = iuser->scene;
250  RenderResult *rr;
251  RenderLayer *rl;
252  RenderPass *rpass;
253  int nr;
254 
255  /* may have been freed since drawing */
257  if (UNLIKELY(rr == NULL)) {
258  return;
259  }
260 
261  rl = BLI_findlink(&rr->layers, rpass_index);
262 
263  UI_block_layout_set_current(block, layout);
264  uiLayoutColumn(layout, false);
265 
266  nr = (rl == NULL) ? 1 : 0;
267 
268  ListBase added_passes;
269  BLI_listbase_clear(&added_passes);
270 
271  /* rendered results don't have a Combined pass */
272  /* multiview: the ordering must be ascending, so the left-most pass is always the one picked */
273  for (rpass = rl ? rl->passes.first : NULL; rpass; rpass = rpass->next, nr++) {
274  /* just show one pass of each kind */
275  if (BLI_findstring_ptr(&added_passes, rpass->name, offsetof(LinkData, data))) {
276  continue;
277  }
278  BLI_addtail(&added_passes, BLI_genericNodeN(rpass->name));
279 
280  uiDefButS(block,
282  B_NOP,
283  IFACE_(rpass->name),
284  0,
285  0,
286  UI_UNIT_X * 5,
287  UI_UNIT_X,
288  &iuser->pass,
289  (float)nr,
290  0.0,
291  0,
292  -1,
293  "");
294  }
295 
296  uiItemS(layout);
297  uiDefBut(block,
299  0,
300  IFACE_("Pass"),
301  0,
302  0,
303  UI_UNIT_X * 5,
304  UI_UNIT_Y,
305  NULL,
306  0.0,
307  0.0,
308  0,
309  0,
310  "");
311 
312  BLI_freelistN(&added_passes);
313 
315 }
316 
317 /**************************** view menus *****************************/
318 static void ui_imageuser_view_menu_rr(bContext *UNUSED(C), uiLayout *layout, void *rnd_pt)
319 {
320  struct ImageUI_Data *rnd_data = rnd_pt;
321  uiBlock *block = uiLayoutGetBlock(layout);
322  Image *image = rnd_data->image;
323  ImageUser *iuser = rnd_data->iuser;
324  RenderResult *rr;
325  RenderView *rview;
326  int nr;
327  Scene *scene = iuser->scene;
328 
329  /* may have been freed since drawing */
331  if (UNLIKELY(rr == NULL)) {
332  return;
333  }
334 
335  UI_block_layout_set_current(block, layout);
336  uiLayoutColumn(layout, false);
337 
338  uiDefBut(block,
340  0,
341  IFACE_("View"),
342  0,
343  0,
344  UI_UNIT_X * 5,
345  UI_UNIT_Y,
346  NULL,
347  0.0,
348  0.0,
349  0,
350  0,
351  "");
352 
353  uiItemS(layout);
354 
355  nr = (rr ? BLI_listbase_count(&rr->views) : 0) - 1;
356  for (rview = rr ? rr->views.last : NULL; rview; rview = rview->prev, nr--) {
357  uiDefButS(block,
359  B_NOP,
360  IFACE_(rview->name),
361  0,
362  0,
363  UI_UNIT_X * 5,
364  UI_UNIT_X,
365  &iuser->view,
366  (float)nr,
367  0.0,
368  0,
369  -1,
370  "");
371  }
372 
374 }
375 
376 static void ui_imageuser_view_menu_multiview(bContext *UNUSED(C), uiLayout *layout, void *rnd_pt)
377 {
378  struct ImageUI_Data *rnd_data = rnd_pt;
379  uiBlock *block = uiLayoutGetBlock(layout);
380  Image *image = rnd_data->image;
381  ImageUser *iuser = rnd_data->iuser;
382  int nr;
383  ImageView *iv;
384 
385  UI_block_layout_set_current(block, layout);
386  uiLayoutColumn(layout, false);
387 
388  uiDefBut(block,
390  0,
391  IFACE_("View"),
392  0,
393  0,
394  UI_UNIT_X * 5,
395  UI_UNIT_Y,
396  NULL,
397  0.0,
398  0.0,
399  0,
400  0,
401  "");
402 
403  uiItemS(layout);
404 
405  nr = BLI_listbase_count(&image->views) - 1;
406  for (iv = image->views.last; iv; iv = iv->prev, nr--) {
407  uiDefButS(block,
409  B_NOP,
410  IFACE_(iv->name),
411  0,
412  0,
413  UI_UNIT_X * 5,
414  UI_UNIT_X,
415  &iuser->view,
416  (float)nr,
417  0.0,
418  0,
419  -1,
420  "");
421  }
422 }
423 
424 /* 5 layer button callbacks... */
425 static void image_multi_cb(bContext *C, void *rnd_pt, void *rr_v)
426 {
427  struct ImageUI_Data *rnd_data = rnd_pt;
428  ImageUser *iuser = rnd_data->iuser;
429 
432 }
433 
434 static bool ui_imageuser_layer_menu_step(bContext *C, int direction, void *rnd_pt)
435 {
437  struct ImageUI_Data *rnd_data = rnd_pt;
438  Image *image = rnd_data->image;
439  ImageUser *iuser = rnd_data->iuser;
440  RenderResult *rr;
441  bool changed = false;
442 
444  if (UNLIKELY(rr == NULL)) {
445  return false;
446  }
447 
448  if (direction == -1) {
449  if (iuser->layer > 0) {
450  iuser->layer--;
451  changed = true;
452  }
453  }
454  else if (direction == 1) {
455  int tot = BLI_listbase_count(&rr->layers);
456 
457  if (RE_HasCombinedLayer(rr)) {
458  tot++; /* fake compo/sequencer layer */
459  }
460 
461  if (iuser->layer < tot - 1) {
462  iuser->layer++;
463  changed = true;
464  }
465  }
466  else {
467  BLI_assert(0);
468  }
469 
471 
472  if (changed) {
475  }
476 
477  return changed;
478 }
479 
480 static bool ui_imageuser_pass_menu_step(bContext *C, int direction, void *rnd_pt)
481 {
483  struct ImageUI_Data *rnd_data = rnd_pt;
484  Image *image = rnd_data->image;
485  ImageUser *iuser = rnd_data->iuser;
486  RenderResult *rr;
487  bool changed = false;
488  int layer = iuser->layer;
489  RenderLayer *rl;
490  RenderPass *rpass;
491 
493  if (UNLIKELY(rr == NULL)) {
495  return false;
496  }
497 
498  if (RE_HasCombinedLayer(rr)) {
499  layer -= 1;
500  }
501 
502  rl = BLI_findlink(&rr->layers, layer);
503  if (rl == NULL) {
505  return false;
506  }
507 
508  rpass = BLI_findlink(&rl->passes, iuser->pass);
509  if (rpass == NULL) {
511  return false;
512  }
513 
514  /* note, this looks reversed, but matches menu direction */
515  if (direction == -1) {
516  RenderPass *rp;
517  int rp_index = iuser->pass + 1;
518 
519  for (rp = rpass->next; rp; rp = rp->next, rp_index++) {
520  if (!STREQ(rp->name, rpass->name)) {
521  iuser->pass = rp_index;
522  changed = true;
523  break;
524  }
525  }
526  }
527  else if (direction == 1) {
528  RenderPass *rp;
529  int rp_index = 0;
530 
531  if (iuser->pass == 0) {
533  return false;
534  }
535 
536  for (rp = rl->passes.first; rp; rp = rp->next, rp_index++) {
537  if (STREQ(rp->name, rpass->name)) {
538  iuser->pass = rp_index - 1;
539  changed = true;
540  break;
541  }
542  }
543  }
544  else {
545  BLI_assert(0);
546  }
547 
549 
550  if (changed) {
553  }
554 
555  return changed;
556 }
557 
558 /* 5 view button callbacks... */
559 static void image_multiview_cb(bContext *C, void *rnd_pt, void *UNUSED(arg_v))
560 {
561  struct ImageUI_Data *rnd_data = rnd_pt;
562  Image *ima = rnd_data->image;
563  ImageUser *iuser = rnd_data->iuser;
564 
567 }
568 
570  Image *image,
571  RenderResult *rr,
572  ImageUser *iuser,
573  int w,
574  const short *render_slot)
575 {
576  struct ImageUI_Data rnd_pt_local, *rnd_pt = NULL;
577  uiBlock *block = uiLayoutGetBlock(layout);
578  uiBut *but;
579  RenderLayer *rl = NULL;
580  int wmenu1, wmenu2, wmenu3, wmenu4;
581  const char *fake_name;
582  const char *display_name = "";
583  const bool show_stereo = (iuser->flag & IMA_SHOW_STEREO) != 0;
584 
585  if (iuser->scene == NULL) {
586  return;
587  }
588 
589  uiLayoutRow(layout, true);
590 
591  /* layer menu is 1/3 larger than pass */
592  wmenu1 = (2 * w) / 5;
593  wmenu2 = (3 * w) / 5;
594  wmenu3 = (3 * w) / 6;
595  wmenu4 = (3 * w) / 6;
596 
597  rnd_pt_local.image = image;
598  rnd_pt_local.iuser = iuser;
599  rnd_pt_local.rpass_index = 0;
600 
601  /* menu buts */
602  if (render_slot) {
603  char str[64];
604  RenderSlot *slot = BKE_image_get_renderslot(image, *render_slot);
605  if (slot && slot->name[0] != '\0') {
606  BLI_strncpy(str, slot->name, sizeof(str));
607  }
608  else {
609  BLI_snprintf(str, sizeof(str), IFACE_("Slot %d"), *render_slot + 1);
610  }
611 
612  rnd_pt = ui_imageuser_data_copy(&rnd_pt_local);
613  but = uiDefMenuBut(
614  block, ui_imageuser_slot_menu, image, str, 0, 0, wmenu1, UI_UNIT_Y, TIP_("Select Slot"));
616  UI_but_funcN_set(but, image_multi_cb, rnd_pt, rr);
618  rnd_pt = NULL;
619  }
620 
621  if (rr) {
622  RenderPass *rpass;
623  RenderView *rview;
624  int rpass_index;
625 
626  /* layer */
627  fake_name = ui_imageuser_layer_fake_name(rr);
628  rpass_index = iuser->layer - (fake_name ? 1 : 0);
629  rl = BLI_findlink(&rr->layers, rpass_index);
630  rnd_pt_local.rpass_index = rpass_index;
631 
632  if (RE_layers_have_name(rr)) {
633  display_name = rl ? rl->name : (fake_name ? fake_name : "");
634  rnd_pt = ui_imageuser_data_copy(&rnd_pt_local);
635  but = uiDefMenuBut(block,
637  rnd_pt,
638  display_name,
639  0,
640  0,
641  wmenu2,
642  UI_UNIT_Y,
643  TIP_("Select Layer"));
645  UI_but_funcN_set(but, image_multi_cb, rnd_pt, rr);
647  rnd_pt = NULL;
648  }
649 
650  /* pass */
651  rpass = (rl ? BLI_findlink(&rl->passes, iuser->pass) : NULL);
652 
653  if (rl && RE_passes_have_name(rl)) {
654  display_name = rpass ? rpass->name : "";
655  rnd_pt = ui_imageuser_data_copy(&rnd_pt_local);
656  but = uiDefMenuBut(block,
658  rnd_pt,
659  IFACE_(display_name),
660  0,
661  0,
662  wmenu3,
663  UI_UNIT_Y,
664  TIP_("Select Pass"));
666  UI_but_funcN_set(but, image_multi_cb, rnd_pt, rr);
668  rnd_pt = NULL;
669  }
670 
671  /* view */
672  if (BLI_listbase_count_at_most(&rr->views, 2) > 1 &&
673  ((!show_stereo) || (!RE_RenderResult_is_stereo(rr)))) {
674  rview = BLI_findlink(&rr->views, iuser->view);
675  display_name = rview ? rview->name : "";
676 
677  rnd_pt = ui_imageuser_data_copy(&rnd_pt_local);
678  but = uiDefMenuBut(block,
680  rnd_pt,
681  display_name,
682  0,
683  0,
684  wmenu4,
685  UI_UNIT_Y,
686  TIP_("Select View"));
687  UI_but_funcN_set(but, image_multi_cb, rnd_pt, rr);
689  rnd_pt = NULL;
690  }
691  }
692 
693  /* stereo image */
694  else if ((BKE_image_is_stereo(image) && (!show_stereo)) ||
696  ImageView *iv;
697  int nr = 0;
698 
699  for (iv = image->views.first; iv; iv = iv->next) {
700  if (nr++ == iuser->view) {
701  display_name = iv->name;
702  break;
703  }
704  }
705 
706  rnd_pt = ui_imageuser_data_copy(&rnd_pt_local);
707  but = uiDefMenuBut(block,
709  rnd_pt,
710  display_name,
711  0,
712  0,
713  wmenu1,
714  UI_UNIT_Y,
715  TIP_("Select View"));
718  rnd_pt = NULL;
719  }
720 }
721 
722 typedef struct RNAUpdateCb {
723  PointerRNA ptr;
724  PropertyRNA *prop;
727 
728 static void rna_update_cb(bContext *C, void *arg_cb, void *UNUSED(arg))
729 {
730  RNAUpdateCb *cb = (RNAUpdateCb *)arg_cb;
731 
732  /* ideally this would be done by RNA itself, but there we have
733  * no image user available, so we just update this flag here */
734  cb->iuser->ok = 1;
735 
736  /* we call update here on the pointer property, this way the
737  * owner of the image pointer can still define its own update
738  * and notifier */
739  RNA_property_update(C, &cb->ptr, cb->prop);
740 }
741 
742 static bool image_has_alpha(Image *ima, ImageUser *iuser)
743 {
744  ImBuf *ibuf = BKE_image_acquire_ibuf(ima, iuser, NULL);
745  if (ibuf == NULL) {
746  return false;
747  }
748 
749  int imtype = BKE_image_ftype_to_imtype(ibuf->ftype, &ibuf->foptions);
750  char valid_channels = BKE_imtype_valid_channels(imtype, false);
751  bool has_alpha = (valid_channels & IMA_CHAN_FLAG_ALPHA) != 0;
752 
753  BKE_image_release_ibuf(ima, ibuf, NULL);
754 
755  return has_alpha;
756 }
757 
759  bContext *C,
760  PointerRNA *ptr,
761  const char *propname,
762  PointerRNA *userptr,
763  bool compact,
764  bool multiview)
765 {
766  if (!ptr->data) {
767  return;
768  }
769 
770  PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
771  if (!prop) {
772  printf(
773  "%s: property not found: %s.%s\n", __func__, RNA_struct_identifier(ptr->type), propname);
774  return;
775  }
776 
777  if (RNA_property_type(prop) != PROP_POINTER) {
778  printf("%s: expected pointer property for %s.%s\n",
779  __func__,
781  propname);
782  return;
783  }
784 
785  uiBlock *block = uiLayoutGetBlock(layout);
786 
787  PointerRNA imaptr = RNA_property_pointer_get(ptr, prop);
788  Image *ima = imaptr.data;
789  ImageUser *iuser = userptr->data;
790 
792  BKE_image_user_frame_calc(ima, iuser, (int)scene->r.cfra);
793 
794  uiLayoutSetContextPointer(layout, "edit_image", &imaptr);
795  uiLayoutSetContextPointer(layout, "edit_image_user", userptr);
796 
797  SpaceImage *space_image = CTX_wm_space_image(C);
798  if (!compact && (space_image == NULL || iuser != &space_image->iuser)) {
799  uiTemplateID(layout,
800  C,
801  ptr,
802  propname,
803  ima ? NULL : "IMAGE_OT_new",
804  "IMAGE_OT_open",
805  NULL,
807  false,
808  NULL);
809 
810  if (ima != NULL) {
811  uiItemS(layout);
812  }
813  }
814 
815  if (ima == NULL) {
816  return;
817  }
818 
819  if (ima->source == IMA_SRC_VIEWER) {
820  /* Viewer images. */
821  uiTemplateImageInfo(layout, C, ima, iuser);
822 
823  if (ima->type == IMA_TYPE_COMPOSITE) {
824  }
825  else if (ima->type == IMA_TYPE_R_RESULT) {
826  /* browse layer/passes */
827  RenderResult *rr;
828  const float dpi_fac = UI_DPI_FAC;
829  const int menus_width = 230 * dpi_fac;
830 
831  /* use BKE_image_acquire_renderresult so we get the correct slot in the menu */
833  uiblock_layer_pass_buttons(layout, ima, rr, iuser, menus_width, &ima->render_slot);
835  }
836 
837  return;
838  }
839 
840  /* Set custom callback for property updates. */
841  RNAUpdateCb *cb = MEM_callocN(sizeof(RNAUpdateCb), "RNAUpdateCb");
842  cb->ptr = *ptr;
843  cb->prop = prop;
844  cb->iuser = iuser;
846 
847  /* Disable editing if image was modified, to avoid losing changes. */
848  const bool is_dirty = BKE_image_is_dirty(ima);
849  if (is_dirty) {
850  uiLayout *row = uiLayoutRow(layout, true);
851  uiItemO(row, IFACE_("Save"), ICON_NONE, "image.save");
852  uiItemO(row, IFACE_("Discard"), ICON_NONE, "image.reload");
853  uiItemS(layout);
854  }
855 
856  layout = uiLayoutColumn(layout, false);
857  uiLayoutSetEnabled(layout, !is_dirty);
858  uiLayoutSetPropDecorate(layout, false);
859 
860  /* Image source */
861  {
862  uiLayout *col = uiLayoutColumn(layout, false);
863  uiLayoutSetPropSep(col, true);
864  uiItemR(col, &imaptr, "source", 0, NULL, ICON_NONE);
865  }
866 
867  /* Filepath */
868  const bool is_packed = BKE_image_has_packedfile(ima);
869  const bool no_filepath = is_packed && !BKE_image_has_filepath(ima);
870 
871  if ((ima->source != IMA_SRC_GENERATED) && !no_filepath) {
872  uiItemS(layout);
873 
874  uiLayout *row = uiLayoutRow(layout, true);
875  if (is_packed) {
876  uiItemO(row, "", ICON_PACKAGE, "image.unpack");
877  }
878  else {
879  uiItemO(row, "", ICON_UGLYPACKAGE, "image.pack");
880  }
881 
882  row = uiLayoutRow(row, true);
883  uiLayoutSetEnabled(row, is_packed == false);
884  uiItemR(row, &imaptr, "filepath", 0, "", ICON_NONE);
885  uiItemO(row, "", ICON_FILE_REFRESH, "image.reload");
886  }
887 
888  /* Image layers and Info */
889  if (ima->source == IMA_SRC_GENERATED) {
890  uiItemS(layout);
891 
892  /* Generated */
893  uiLayout *col = uiLayoutColumn(layout, false);
894  uiLayoutSetPropSep(col, true);
895 
896  uiLayout *sub = uiLayoutColumn(col, true);
897  uiItemR(sub, &imaptr, "generated_width", 0, "X", ICON_NONE);
898  uiItemR(sub, &imaptr, "generated_height", 0, "Y", ICON_NONE);
899 
900  uiItemR(col, &imaptr, "use_generated_float", 0, NULL, ICON_NONE);
901 
902  uiItemS(col);
903 
904  uiItemR(col, &imaptr, "generated_type", UI_ITEM_R_EXPAND, IFACE_("Type"), ICON_NONE);
905  if (ima->gen_type == IMA_GENTYPE_BLANK) {
906  uiItemR(col, &imaptr, "generated_color", 0, NULL, ICON_NONE);
907  }
908  }
909  else if (compact == 0) {
910  uiTemplateImageInfo(layout, C, ima, iuser);
911  }
912  if (ima->type == IMA_TYPE_MULTILAYER && ima->rr) {
913  uiItemS(layout);
914 
915  const float dpi_fac = UI_DPI_FAC;
916  uiblock_layer_pass_buttons(layout, ima, ima->rr, iuser, 230 * dpi_fac, NULL);
917  }
918 
919  if (BKE_image_is_animated(ima)) {
920  /* Animation */
921  uiItemS(layout);
922 
923  uiLayout *col = uiLayoutColumn(layout, true);
924  uiLayoutSetPropSep(col, true);
925 
926  uiLayout *sub = uiLayoutColumn(col, true);
927  uiLayout *row = uiLayoutRow(sub, true);
928  uiItemR(row, userptr, "frame_duration", 0, IFACE_("Frames"), ICON_NONE);
929  uiItemO(row, "", ICON_FILE_REFRESH, "IMAGE_OT_match_movie_length");
930 
931  uiItemR(sub, userptr, "frame_start", 0, IFACE_("Start"), ICON_NONE);
932  uiItemR(sub, userptr, "frame_offset", 0, NULL, ICON_NONE);
933 
934  uiItemR(col, userptr, "use_cyclic", 0, NULL, ICON_NONE);
935  uiItemR(col, userptr, "use_auto_refresh", 0, NULL, ICON_NONE);
936 
937  if (ima->source == IMA_SRC_MOVIE && compact == 0) {
938  uiItemR(col, &imaptr, "use_deinterlace", 0, IFACE_("Deinterlace"), ICON_NONE);
939  }
940  }
941 
942  /* Multiview */
943  if (multiview && compact == 0) {
944  if ((scene->r.scemode & R_MULTIVIEW) != 0) {
945  uiItemS(layout);
946 
947  uiLayout *col = uiLayoutColumn(layout, false);
948  uiLayoutSetPropSep(col, true);
949  uiItemR(col, &imaptr, "use_multiview", 0, NULL, ICON_NONE);
950 
951  if (RNA_boolean_get(&imaptr, "use_multiview")) {
952  uiTemplateImageViews(layout, &imaptr);
953  }
954  }
955  }
956 
957  /* Colorspace and alpha */
958  {
959  uiItemS(layout);
960 
961  uiLayout *col = uiLayoutColumn(layout, false);
962  uiLayoutSetPropSep(col, true);
963  uiTemplateColorspaceSettings(col, &imaptr, "colorspace_settings");
964 
965  if (compact == 0) {
966  if (ima->source != IMA_SRC_GENERATED) {
967  if (image_has_alpha(ima, iuser)) {
968  uiLayout *sub = uiLayoutColumn(col, false);
969  uiItemR(sub, &imaptr, "alpha_mode", 0, IFACE_("Alpha"), ICON_NONE);
970 
972  uiLayoutSetActive(sub, !is_data);
973  }
974 
975  if (ima && iuser) {
976  void *lock;
977  ImBuf *ibuf = BKE_image_acquire_ibuf(ima, iuser, &lock);
978 
979  if (ibuf && ibuf->rect_float && (ibuf->flags & IB_halffloat) == 0) {
980  uiItemR(col, &imaptr, "use_half_precision", 0, NULL, ICON_NONE);
981  }
982  BKE_image_release_ibuf(ima, ibuf, lock);
983  }
984  }
985 
986  uiItemR(col, &imaptr, "use_view_as_render", 0, NULL, ICON_NONE);
987  }
988  }
989 
990  UI_block_funcN_set(block, NULL, NULL, NULL);
991 }
992 
993 void uiTemplateImageSettings(uiLayout *layout, PointerRNA *imfptr, bool color_management)
994 {
995  ImageFormatData *imf = imfptr->data;
996  ID *id = imfptr->owner_id;
997  PointerRNA display_settings_ptr;
998  PropertyRNA *prop;
999  const int depth_ok = BKE_imtype_valid_depths(imf->imtype);
1000  /* some settings depend on this being a scene that's rendered */
1001  const bool is_render_out = (id && GS(id->name) == ID_SCE);
1002 
1003  uiLayout *col;
1004  bool show_preview = false;
1005 
1006  col = uiLayoutColumn(layout, false);
1007 
1008  uiLayoutSetPropSep(col, true);
1009  uiLayoutSetPropDecorate(col, false);
1010 
1011  uiItemR(col, imfptr, "file_format", 0, NULL, ICON_NONE);
1012  uiItemR(
1013  uiLayoutRow(col, true), imfptr, "color_mode", UI_ITEM_R_EXPAND, IFACE_("Color"), ICON_NONE);
1014 
1015  /* only display depth setting if multiple depths can be used */
1016  if ((ELEM(depth_ok,
1023  R_IMF_CHAN_DEPTH_32)) == 0) {
1024  uiItemR(uiLayoutRow(col, true), imfptr, "color_depth", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
1025  }
1026 
1027  if (BKE_imtype_supports_quality(imf->imtype)) {
1028  uiItemR(col, imfptr, "quality", 0, NULL, ICON_NONE);
1029  }
1030 
1032  uiItemR(col, imfptr, "compression", 0, NULL, ICON_NONE);
1033  }
1034 
1036  uiItemR(col, imfptr, "exr_codec", 0, NULL, ICON_NONE);
1037  }
1038 
1039  if (BKE_imtype_supports_zbuf(imf->imtype)) {
1040  uiItemR(col, imfptr, "use_zbuffer", 0, NULL, ICON_NONE);
1041  }
1042 
1043  if (is_render_out && ELEM(imf->imtype, R_IMF_IMTYPE_OPENEXR, R_IMF_IMTYPE_MULTILAYER)) {
1044  show_preview = true;
1045  uiItemR(col, imfptr, "use_preview", 0, NULL, ICON_NONE);
1046  }
1047 
1048  if (imf->imtype == R_IMF_IMTYPE_JP2) {
1049  uiItemR(col, imfptr, "jpeg2k_codec", 0, NULL, ICON_NONE);
1050 
1051  uiItemR(col, imfptr, "use_jpeg2k_cinema_preset", 0, NULL, ICON_NONE);
1052  uiItemR(col, imfptr, "use_jpeg2k_cinema_48", 0, NULL, ICON_NONE);
1053 
1054  uiItemR(col, imfptr, "use_jpeg2k_ycc", 0, NULL, ICON_NONE);
1055  }
1056 
1057  if (imf->imtype == R_IMF_IMTYPE_DPX) {
1058  uiItemR(col, imfptr, "use_cineon_log", 0, NULL, ICON_NONE);
1059  }
1060 
1061  if (imf->imtype == R_IMF_IMTYPE_CINEON) {
1062 #if 1
1063  uiItemL(col, IFACE_("Hard coded Non-Linear, Gamma:1.7"), ICON_NONE);
1064 #else
1065  uiItemR(col, imfptr, "use_cineon_log", 0, NULL, ICON_NONE);
1066  uiItemR(col, imfptr, "cineon_black", 0, NULL, ICON_NONE);
1067  uiItemR(col, imfptr, "cineon_white", 0, NULL, ICON_NONE);
1068  uiItemR(col, imfptr, "cineon_gamma", 0, NULL, ICON_NONE);
1069 #endif
1070  }
1071 
1072  if (imf->imtype == R_IMF_IMTYPE_TIFF) {
1073  uiItemR(col, imfptr, "tiff_codec", 0, NULL, ICON_NONE);
1074  }
1075 
1076  /* color management */
1077  if (color_management && (!BKE_imtype_requires_linear_float(imf->imtype) ||
1078  (show_preview && imf->flag & R_IMF_FLAG_PREVIEW_JPG))) {
1079  prop = RNA_struct_find_property(imfptr, "display_settings");
1080  display_settings_ptr = RNA_property_pointer_get(imfptr, prop);
1081 
1082  col = uiLayoutColumn(layout, false);
1083  uiItemL(col, IFACE_("Color Management"), ICON_NONE);
1084 
1085  uiItemR(col, &display_settings_ptr, "display_device", 0, NULL, ICON_NONE);
1086 
1087  uiTemplateColormanagedViewSettings(col, NULL, imfptr, "view_settings");
1088  }
1089 }
1090 
1091 void uiTemplateImageStereo3d(uiLayout *layout, PointerRNA *stereo3d_format_ptr)
1092 {
1093  Stereo3dFormat *stereo3d_format = stereo3d_format_ptr->data;
1094  uiLayout *col;
1095 
1096  col = uiLayoutColumn(layout, false);
1097  uiItemR(col, stereo3d_format_ptr, "display_mode", 0, NULL, ICON_NONE);
1098 
1099  switch (stereo3d_format->display_mode) {
1100  case S3D_DISPLAY_ANAGLYPH: {
1101  uiItemR(col, stereo3d_format_ptr, "anaglyph_type", 0, NULL, ICON_NONE);
1102  break;
1103  }
1104  case S3D_DISPLAY_INTERLACE: {
1105  uiItemR(col, stereo3d_format_ptr, "interlace_type", 0, NULL, ICON_NONE);
1106  uiItemR(col, stereo3d_format_ptr, "use_interlace_swap", 0, NULL, ICON_NONE);
1107  break;
1108  }
1109  case S3D_DISPLAY_SIDEBYSIDE: {
1110  uiItemR(col, stereo3d_format_ptr, "use_sidebyside_crosseyed", 0, NULL, ICON_NONE);
1112  }
1113  case S3D_DISPLAY_TOPBOTTOM: {
1114  uiItemR(col, stereo3d_format_ptr, "use_squeezed_frame", 0, NULL, ICON_NONE);
1115  break;
1116  }
1117  }
1118 }
1119 
1120 static void uiTemplateViewsFormat(uiLayout *layout,
1121  PointerRNA *ptr,
1122  PointerRNA *stereo3d_format_ptr)
1123 {
1124  uiLayout *col;
1125 
1126  col = uiLayoutColumn(layout, false);
1127 
1128  uiLayoutSetPropSep(col, true);
1129  uiLayoutSetPropDecorate(col, false);
1130 
1131  uiItemR(col, ptr, "views_format", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
1132 
1133  if (stereo3d_format_ptr && RNA_enum_get(ptr, "views_format") == R_IMF_VIEWS_STEREO_3D) {
1134  uiTemplateImageStereo3d(col, stereo3d_format_ptr);
1135  }
1136 }
1137 
1139 {
1140  Image *ima = imaptr->data;
1141 
1142  if (ima->type != IMA_TYPE_MULTILAYER) {
1143  PropertyRNA *prop;
1144  PointerRNA stereo3d_format_ptr;
1145 
1146  prop = RNA_struct_find_property(imaptr, "stereo_3d_format");
1147  stereo3d_format_ptr = RNA_property_pointer_get(imaptr, prop);
1148 
1149  uiTemplateViewsFormat(layout, imaptr, &stereo3d_format_ptr);
1150  }
1151  else {
1152  uiTemplateViewsFormat(layout, imaptr, NULL);
1153  }
1154 }
1155 
1157 {
1158  ImageFormatData *imf = imfptr->data;
1159 
1160  if (ptr != NULL) {
1161  uiItemR(layout, ptr, "use_multiview", 0, NULL, ICON_NONE);
1162  if (!RNA_boolean_get(ptr, "use_multiview")) {
1163  return;
1164  }
1165  }
1166 
1167  if (imf->imtype != R_IMF_IMTYPE_MULTILAYER) {
1168  PropertyRNA *prop;
1169  PointerRNA stereo3d_format_ptr;
1170 
1171  prop = RNA_struct_find_property(imfptr, "stereo_3d_format");
1172  stereo3d_format_ptr = RNA_property_pointer_get(imfptr, prop);
1173 
1174  uiTemplateViewsFormat(layout, imfptr, &stereo3d_format_ptr);
1175  }
1176  else {
1177  uiTemplateViewsFormat(layout, imfptr, NULL);
1178  }
1179 }
1180 
1182 {
1184 
1185  /* render layers and passes */
1186  if (ima && iuser) {
1187  RenderResult *rr;
1188  const float dpi_fac = UI_DPI_FAC;
1189  const int menus_width = 160 * dpi_fac;
1190  const bool is_render_result = (ima->type == IMA_TYPE_R_RESULT);
1191 
1192  /* use BKE_image_acquire_renderresult so we get the correct slot in the menu */
1195  layout, ima, rr, iuser, menus_width, is_render_result ? &ima->render_slot : NULL);
1197  }
1198 }
1199 
1200 void uiTemplateImageInfo(uiLayout *layout, bContext *C, Image *ima, ImageUser *iuser)
1201 {
1202  if (ima == NULL || iuser == NULL) {
1203  return;
1204  }
1205 
1206  /* Acquire image buffer. */
1207  void *lock;
1208  ImBuf *ibuf = BKE_image_acquire_ibuf(ima, iuser, &lock);
1209 
1210  uiLayout *col = uiLayoutColumn(layout, true);
1212 
1213  if (ibuf == NULL) {
1214  uiItemL(col, TIP_("Can't Load Image"), ICON_NONE);
1215  }
1216  else {
1217  char str[MAX_IMAGE_INFO_LEN] = {0};
1218  const int len = MAX_IMAGE_INFO_LEN;
1219  int ofs = 0;
1220 
1221  ofs += BLI_snprintf(str + ofs, len - ofs, TIP_("%d x %d, "), ibuf->x, ibuf->y);
1222 
1223  if (ibuf->rect_float) {
1224  if (ibuf->channels != 4) {
1225  ofs += BLI_snprintf(str + ofs, len - ofs, TIP_("%d float channel(s)"), ibuf->channels);
1226  }
1227  else if (ibuf->planes == R_IMF_PLANES_RGBA) {
1228  ofs += BLI_strncpy_rlen(str + ofs, TIP_(" RGBA float"), len - ofs);
1229  }
1230  else {
1231  ofs += BLI_strncpy_rlen(str + ofs, TIP_(" RGB float"), len - ofs);
1232  }
1233  }
1234  else {
1235  if (ibuf->planes == R_IMF_PLANES_RGBA) {
1236  ofs += BLI_strncpy_rlen(str + ofs, TIP_(" RGBA byte"), len - ofs);
1237  }
1238  else {
1239  ofs += BLI_strncpy_rlen(str + ofs, TIP_(" RGB byte"), len - ofs);
1240  }
1241  }
1242  if (ibuf->zbuf || ibuf->zbuf_float) {
1243  ofs += BLI_strncpy_rlen(str + ofs, TIP_(" + Z"), len - ofs);
1244  }
1245 
1246  uiItemL(col, str, ICON_NONE);
1247  }
1248 
1249  /* Frame number, even if we can't load the image. */
1250  if (ELEM(ima->source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE)) {
1251  /* don't use iuser->framenr directly because it may not be updated if auto-refresh is off */
1253  const int framenr = BKE_image_user_frame_get(iuser, CFRA, NULL);
1254  char str[MAX_IMAGE_INFO_LEN];
1255  int duration = 0;
1256 
1257  if (ima->source == IMA_SRC_MOVIE && BKE_image_has_anim(ima)) {
1258  struct anim *anim = ((ImageAnim *)ima->anims.first)->anim;
1259  if (anim) {
1261  }
1262  }
1263 
1264  if (duration > 0) {
1265  /* Movie duration */
1266  BLI_snprintf(str, MAX_IMAGE_INFO_LEN, TIP_("Frame %d / %d"), framenr, duration);
1267  }
1268  else if (ima->source == IMA_SRC_SEQUENCE && ibuf) {
1269  /* Image sequence frame number + filename */
1270  const char *filename = BLI_path_slash_rfind(ibuf->name);
1271  filename = (filename == NULL) ? ibuf->name : filename + 1;
1272  BLI_snprintf(str, MAX_IMAGE_INFO_LEN, TIP_("Frame %d: %s"), framenr, filename);
1273  }
1274  else {
1275  /* Frame number */
1276  BLI_snprintf(str, MAX_IMAGE_INFO_LEN, TIP_("Frame %d"), framenr);
1277  }
1278 
1279  uiItemL(col, str, ICON_NONE);
1280  }
1281 
1282  BKE_image_release_ibuf(ima, ibuf, lock);
1283 }
1284 
1285 #undef MAX_IMAGE_INFO_LEN
1286 
1288 {
1289  SpaceImage *space_image = CTX_wm_space_image(C);
1290  return space_image != NULL && space_image->image != NULL;
1291 }
1292 
1293 static void metadata_panel_context_draw(const bContext *C, Panel *panel)
1294 {
1295  void *lock;
1296  SpaceImage *space_image = CTX_wm_space_image(C);
1297  Image *image = space_image->image;
1298  ImBuf *ibuf = BKE_image_acquire_ibuf(image, &space_image->iuser, &lock);
1299  if (ibuf != NULL) {
1301  }
1302  BKE_image_release_ibuf(image, ibuf, lock);
1303 }
1304 
1306 {
1307  PanelType *pt;
1308 
1309  pt = MEM_callocN(sizeof(PanelType), "spacetype image panel metadata");
1310  strcpy(pt->idname, "IMAGE_PT_metadata");
1311  strcpy(pt->label, N_("Metadata"));
1312  strcpy(pt->category, "Image");
1314  pt->order = 10;
1318  BLI_addtail(&art->paneltypes, pt);
1319 }
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1034
struct SpaceImage * CTX_wm_space_image(const bContext *C)
Definition: context.c:800
void BKE_image_multiview_index(struct Image *ima, struct ImageUser *iuser)
Definition: image.c:3846
void BKE_image_release_ibuf(struct Image *ima, struct ImBuf *ibuf, void *lock)
Definition: image.c:5113
bool BKE_imtype_supports_compress(const char imtype)
Definition: image.c:1467
bool BKE_image_is_stereo(struct Image *ima)
Definition: image.c:3889
bool BKE_image_has_filepath(struct Image *ima)
Definition: image.c:5632
struct RenderResult * BKE_image_acquire_renderresult(struct Scene *scene, struct Image *ima)
Definition: image.c:3925
bool BKE_image_is_animated(struct Image *image)
Definition: image.c:5640
bool BKE_image_has_packedfile(struct Image *image)
Definition: image.c:5627
bool BKE_imtype_supports_zbuf(const char imtype)
Definition: image.c:1457
bool BKE_imtype_requires_linear_float(const char imtype)
Definition: image.c:1487
struct ImBuf * BKE_image_acquire_ibuf(struct Image *ima, struct ImageUser *iuser, void **r_lock)
Definition: image.c:5100
char BKE_imtype_valid_depths(const char imtype)
Definition: image.c:1541
bool BKE_image_is_multiview(struct Image *ima)
Definition: image.c:3883
char BKE_image_ftype_to_imtype(const int ftype, const struct ImbFormatOptions *options)
struct RenderPass * BKE_image_multilayer_index(struct RenderResult *rr, struct ImageUser *iuser)
Definition: image.c:3813
#define IMA_CHAN_FLAG_ALPHA
Definition: BKE_image.h:172
char BKE_imtype_valid_channels(const char imtype, bool write_file)
Definition: image.c:1500
int BKE_image_user_frame_get(const struct ImageUser *iuser, int cfra, bool *r_is_in_range)
bool BKE_image_has_anim(struct Image *image)
Definition: image.c:5622
bool BKE_image_is_dirty(struct Image *image)
Definition: image.c:5681
bool BKE_imtype_supports_quality(const char imtype)
Definition: image.c:1476
void BKE_image_release_renderresult(struct Scene *scene, struct Image *ima)
Definition: image.c:3947
void BKE_image_user_frame_calc(struct Image *ima, struct ImageUser *iuser, int cfra)
Definition: image.c:5335
struct RenderSlot * BKE_image_get_renderslot(struct Image *ima, int index)
Definition: image.c:5976
@ PANEL_TYPE_DEFAULT_CLOSED
Definition: BKE_screen.h:297
#define BLI_assert(a)
Definition: BLI_assert.h:58
#define ATTR_FALLTHROUGH
void * BLI_findstring_ptr(const struct ListBase *listbase, const char *id, const int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
BLI_INLINE void BLI_listbase_clear(struct ListBase *lb)
Definition: BLI_listbase.h:128
struct LinkData * BLI_genericNodeN(void *data)
Definition: listbase.c:923
#define LISTBASE_FOREACH_INDEX(type, var, list, index_var)
Definition: BLI_listbase.h:180
int BLI_listbase_count_at_most(const struct ListBase *listbase, const int count_max) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
Definition: listbase.c:547
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:110
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:1962
size_t BLI_strncpy_rlen(char *__restrict dst, const char *__restrict src, const size_t maxncpy) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition: string.c:187
size_t BLI_snprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, const size_t maxncpy) ATTR_NONNULL()
Definition: string.c:108
#define UNUSED(x)
#define UNLIKELY(x)
#define ELEM(...)
#define STREQ(a, b)
#define TIP_(msgid)
#define IFACE_(msgid)
#define BLT_I18NCONTEXT_DEFAULT_BPYRNA
#define N_(msgid)
@ ID_SCE
Definition: DNA_ID_enums.h:57
@ IMA_GENTYPE_BLANK
@ IMA_TYPE_MULTILAYER
@ IMA_TYPE_R_RESULT
@ IMA_TYPE_COMPOSITE
@ IMA_SRC_MOVIE
@ IMA_SRC_GENERATED
@ IMA_SRC_VIEWER
@ IMA_SRC_SEQUENCE
#define IMA_SHOW_STEREO
#define NODE_DO_OUTPUT
#define R_MULTIVIEW
#define R_IMF_IMTYPE_CINEON
#define CFRA
#define R_IMF_IMTYPE_TIFF
#define R_IMF_IMTYPE_JP2
#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_FLAG_PREVIEW_JPG
#define R_IMF_IMTYPE_OPENEXR
bool ED_image_slot_cycle(struct Image *image, int direction)
Definition: image_edit.c:382
void ED_region_image_metadata_panel_draw(struct ImBuf *ibuf, struct uiLayout *layout)
Definition: area.c:3531
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:1671
@ IMB_TC_RECORD_RUN
Definition: IMB_imbuf.h:304
Contains defines and structs used throughout the imbuf module.
@ IB_halffloat
Read Guarded memory(de)allocation.
Group RGB to Bright Vector Camera Vector Combine Material Light Line Style Layer Add Ambient Diffuse Glossy Refraction Transparent Toon Principled Hair Volume Principled Light Particle Volume Image Sky Noise Wave Voronoi Brick Texture Vector Combine Vertex Separate Vector White RGB Map Separate Set Z Dilate Combine Combine Color Channel CMP_NODE_SPLITVIEWER
Group RGB to Bright Vector Camera Vector Combine Material Light Line Style Layer Add Ambient Diffuse Glossy Refraction Transparent Toon Principled Hair Volume Principled Light Particle Volume Image Sky Noise Wave Voronoi Brick Texture Vector Combine Vertex Separate Vector White CMP_NODE_VIEWER
@ PROP_POINTER
Definition: RNA_types.h:78
#define C
Definition: RandGen.cpp:39
#define UI_UNIT_Y
void uiLayoutSetActive(uiLayout *layout, bool active)
@ UI_ITEM_R_EXPAND
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.c:4687
void uiTemplateColorspaceSettings(struct uiLayout *layout, struct PointerRNA *ptr, const char *propname)
void uiItemL(uiLayout *layout, const char *name, int icon)
void UI_but_func_menu_step_set(uiBut *but, uiMenuStepFunc func)
Definition: interface.c:6318
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, const bool live_icon, const char *text)
void uiLayoutSetAlignment(uiLayout *layout, char alignment)
void uiLayoutSetPropSep(uiLayout *layout, bool is_sep)
void uiItemS(uiLayout *layout)
uiLayout * uiLayoutRow(uiLayout *layout, bool align)
@ UI_LAYOUT_ALIGN_RIGHT
@ UI_TEMPLATE_ID_FILTER_ALL
void UI_but_type_set_menu_from_pulldown(uiBut *but)
Definition: interface.c:6114
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.c:5020
#define UI_DPI_FAC
Definition: UI_interface.h:309
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.c:6393
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.c:6301
#define UI_UNIT_X
@ UI_BTYPE_BUT_MENU
Definition: UI_interface.h:339
@ UI_BTYPE_LABEL
Definition: UI_interface.h:358
void UI_block_funcN_set(uiBlock *block, uiButHandleNFunc funcN, void *argN, void *arg2)
Definition: interface.c:6266
#define ND_DRAW
Definition: WM_types.h:362
#define NC_IMAGE
Definition: WM_types.h:285
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition: btQuadWord.h:119
char gen_type
ListBase anims
ColorManagedColorspaceSettings colorspace_settings
ListBase renderslots
short type
short source
short render_slot
struct RenderResult * rr
ListBase views
OperationNode * node
Scene scene
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)
static bool image_has_alpha(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:64
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:63
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:85
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:67
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:241
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:45
void *(* MEM_mallocN)(size_t len, const char *str)
Definition: mallocn.c:47
bool RE_passes_have_name(struct RenderLayer *rl)
Definition: pipeline.c:2753
bool RE_layers_have_name(struct RenderResult *rr)
Definition: pipeline.c:2740
bool RE_HasCombinedLayer(RenderResult *rr)
RenderView * RE_RenderViewGetById(RenderResult *rr, const int view_id)
bool RE_RenderResult_is_stereo(RenderResult *rr)
const char * RNA_struct_identifier(const StructRNA *type)
Definition: rna_access.c:723
PropertyType RNA_property_type(PropertyRNA *prop)
Definition: rna_access.c:1155
PointerRNA RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop)
Definition: rna_access.c:3641
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
Definition: rna_access.c:866
void RNA_property_update(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
Definition: rna_access.c:2317
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:6261
int RNA_enum_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:6402
ListBase paneltypes
Definition: BKE_screen.h:216
Definition: DNA_ID.h:273
char name[66]
Definition: DNA_ID.h:283
float * zbuf_float
int channels
ImbFormatOptions foptions
unsigned char planes
char name[IMB_FILENAME_SIZE]
enum eImbFileType ftype
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:47
void * first
Definition: DNA_listBase.h:47
void(* draw)(const struct bContext *C, struct Panel *panel)
Definition: BKE_screen.h:266
bool(* poll)(const struct bContext *C, struct PanelType *pt)
Definition: BKE_screen.h:260
char idname[BKE_ST_MAXNAME]
Definition: BKE_screen.h:241
char translation_context[BKE_ST_MAXNAME]
Definition: BKE_screen.h:244
char category[BKE_ST_MAXNAME]
Definition: BKE_screen.h:246
char label[BKE_ST_MAXNAME]
Definition: BKE_screen.h:242
struct uiLayout * layout
struct StructRNA * type
Definition: RNA_types.h:51
void * data
Definition: RNA_types.h:52
struct ID * owner_id
Definition: RNA_types.h:50
ImageUser * iuser
PropertyRNA * prop
ListBase passes
Definition: RE_pipeline.h:108
char name[RE_MAXNAME]
Definition: RE_pipeline.h:100
char name[64]
Definition: RE_pipeline.h:80
struct RenderPass * next
Definition: RE_pipeline.h:78
ListBase views
Definition: RE_pipeline.h:138
ListBase layers
Definition: RE_pipeline.h:135
char name[64]
struct RenderView * prev
Definition: RE_pipeline.h:65
float * rectf
Definition: RE_pipeline.h:69
int * rect32
Definition: RE_pipeline.h:73
char name[64]
Definition: RE_pipeline.h:66
struct RenderData r
struct ImageUser iuser
struct Image * image
Definition: IMB_anim.h:87
ListBase nodes
uint len
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
PointerRNA * ptr
Definition: wm_files.c:3157