Blender  V3.3
rna_image.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
7 #include <stdlib.h>
8 
9 #include "DNA_image_types.h"
10 #include "DNA_node_types.h"
11 #include "DNA_scene_types.h"
12 
13 #include "BLI_utildefines.h"
14 
15 #include "BKE_image.h"
16 #include "BKE_image_format.h"
17 #include "BKE_node_tree_update.h"
18 
19 #include "DEG_depsgraph.h"
20 #include "DEG_depsgraph_build.h"
21 
22 #include "RNA_access.h"
23 #include "RNA_define.h"
24 #include "RNA_enum_types.h"
25 
26 #include "rna_internal.h"
27 
28 #include "WM_api.h"
29 #include "WM_types.h"
30 
32  {IMA_GENTYPE_BLANK, "BLANK", 0, "Blank", "Generate a blank image"},
33  {IMA_GENTYPE_GRID, "UV_GRID", 0, "UV Grid", "Generated grid to test UV mappings"},
35  "COLOR_GRID",
36  0,
37  "Color Grid",
38  "Generated improved UV grid to test UV mappings"},
39  {0, NULL, 0, NULL, NULL},
40 };
41 
43  {IMA_SRC_FILE, "FILE", 0, "Single Image", "Single image file"},
44  {IMA_SRC_SEQUENCE, "SEQUENCE", 0, "Image Sequence", "Multiple image files, as a sequence"},
45  {IMA_SRC_MOVIE, "MOVIE", 0, "Movie", "Movie file"},
46  {IMA_SRC_GENERATED, "GENERATED", 0, "Generated", "Generated image"},
47  {IMA_SRC_VIEWER, "VIEWER", 0, "Viewer", "Compositing node viewer"},
48  {IMA_SRC_TILED, "TILED", 0, "UDIM Tiles", "Tiled UDIM image texture"},
49  {0, NULL, 0, NULL, NULL},
50 };
51 
52 #ifdef RNA_RUNTIME
53 
54 # include "BLI_math_base.h"
55 
56 # include "BKE_global.h"
57 
58 # include "GPU_texture.h"
59 
60 # include "IMB_imbuf.h"
61 # include "IMB_imbuf_types.h"
62 
63 # include "ED_node.h"
64 
65 static bool rna_Image_is_stereo_3d_get(PointerRNA *ptr)
66 {
67  return BKE_image_is_stereo((Image *)ptr->data);
68 }
69 
70 static bool rna_Image_is_multiview_get(PointerRNA *ptr)
71 {
73 }
74 
75 static bool rna_Image_dirty_get(PointerRNA *ptr)
76 {
77  return BKE_image_is_dirty((Image *)ptr->data);
78 }
79 
80 static void rna_Image_source_set(PointerRNA *ptr, int value)
81 {
82  Image *ima = (Image *)ptr->owner_id;
83 
84  if (value != ima->source) {
85  ima->source = value;
88  DEG_id_tag_update(&ima->id, 0);
91  }
92 }
93 
94 static void rna_Image_reload_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
95 {
96  Image *ima = (Image *)ptr->owner_id;
99  DEG_id_tag_update(&ima->id, 0);
101 }
102 
103 static void rna_Image_generated_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
104 {
105  Image *ima = (Image *)ptr->owner_id;
106  BKE_image_signal(bmain, ima, NULL, IMA_SIGNAL_FREE);
108 }
109 
110 static void rna_Image_colormanage_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
111 {
112  Image *ima = (Image *)ptr->owner_id;
114  DEG_id_tag_update(&ima->id, 0);
118 }
119 
120 static void rna_Image_alpha_mode_update(Main *bmain, Scene *scene, PointerRNA *ptr)
121 {
122  Image *ima = (Image *)ptr->owner_id;
123  /* When operating on a generated image, avoid re-generating when changing the alpha-mode
124  * as it doesn't impact generated images, causing them to reload pixel data, see T82785. */
125  if (ima->source == IMA_SRC_GENERATED) {
126  return;
127  }
128  rna_Image_colormanage_update(bmain, scene, ptr);
129 }
130 
131 static void rna_Image_views_format_update(Main *bmain, Scene *scene, PointerRNA *ptr)
132 {
133  Image *ima = (Image *)ptr->owner_id;
134  ImBuf *ibuf;
135  void *lock;
136 
137  ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
138 
139  if (ibuf) {
140  ImageUser iuser = {NULL};
141  iuser.scene = scene;
142  BKE_image_signal(bmain, ima, &iuser, IMA_SIGNAL_FREE);
143  }
144 
145  BKE_image_release_ibuf(ima, ibuf, lock);
147 }
148 
149 static void rna_ImageUser_update(Main *bmain, Scene *scene, PointerRNA *ptr)
150 {
151  ImageUser *iuser = ptr->data;
152  ID *id = ptr->owner_id;
153 
154  if (scene != NULL) {
156  }
157 
158  if (id) {
159  if (GS(id->name) == ID_NT) {
160  /* Special update for nodetrees. */
163  }
164  else {
165  /* Update material or texture for render preview. */
166  DEG_id_tag_update(id, 0);
168  }
169  }
170 }
171 
172 static void rna_ImageUser_relations_update(Main *bmain, Scene *scene, PointerRNA *ptr)
173 {
174  rna_ImageUser_update(bmain, scene, ptr);
176 }
177 
178 static char *rna_ImageUser_path(const PointerRNA *ptr)
179 {
180  if (ptr->owner_id) {
181  /* ImageUser *iuser = ptr->data; */
182 
183  switch (GS(ptr->owner_id->name)) {
184  case ID_OB:
185  case ID_TE:
186  return BLI_strdup("image_user");
187  case ID_NT:
189  case ID_CA:
191  default:
192  break;
193  }
194  }
195 
196  return BLI_strdup("");
197 }
198 
199 static void rna_Image_gpu_texture_update(Main *UNUSED(bmain),
200  Scene *UNUSED(scene),
201  PointerRNA *ptr)
202 {
203  Image *ima = (Image *)ptr->owner_id;
204 
205  if (!G.background) {
207  }
208 
210 }
211 
212 static const EnumPropertyItem *rna_Image_source_itemf(bContext *UNUSED(C),
213  PointerRNA *ptr,
214  PropertyRNA *UNUSED(prop),
215  bool *r_free)
216 {
217  Image *ima = (Image *)ptr->data;
218  EnumPropertyItem *item = NULL;
219  int totitem = 0;
220 
221  if (ima->source == IMA_SRC_VIEWER) {
223  }
224  else {
230  }
231 
232  RNA_enum_item_end(&item, &totitem);
233  *r_free = true;
234 
235  return item;
236 }
237 
238 static int rna_Image_file_format_get(PointerRNA *ptr)
239 {
240  Image *image = (Image *)ptr->data;
242  int imtype = BKE_ftype_to_imtype(ibuf ? ibuf->ftype : IMB_FTYPE_NONE,
243  ibuf ? &ibuf->foptions : NULL);
244 
246 
247  return imtype;
248 }
249 
250 static void rna_Image_file_format_set(PointerRNA *ptr, int value)
251 {
252  Image *image = (Image *)ptr->data;
253  if (BKE_imtype_is_movie(value) == 0) { /* should be able to throw an error here */
255  int ftype = BKE_imtype_to_ftype(value, &options);
257  }
258 }
259 
260 static void rna_UDIMTile_size_get(PointerRNA *ptr, int *values)
261 {
263  Image *image = (Image *)ptr->owner_id;
264 
265  ImageUser image_user;
266  BKE_imageuser_default(&image_user);
267  image_user.tile = tile->tile_number;
268 
269  void *lock;
270  ImBuf *ibuf = BKE_image_acquire_ibuf(image, &image_user, &lock);
271  if (ibuf) {
272  values[0] = ibuf->x;
273  values[1] = ibuf->y;
274  }
275  else {
276  values[0] = 0;
277  values[1] = 0;
278  }
279 
281 }
282 
283 static int rna_UDIMTile_channels_get(PointerRNA *ptr)
284 {
286  Image *image = (Image *)ptr->owner_id;
287 
288  ImageUser image_user;
289  BKE_imageuser_default(&image_user);
290  image_user.tile = tile->tile_number;
291 
292  int channels = 0;
293 
294  void *lock;
295  ImBuf *ibuf = BKE_image_acquire_ibuf(image, &image_user, &lock);
296  if (ibuf) {
297  channels = ibuf->channels;
298  }
299 
301 
302  return channels;
303 }
304 
305 static void rna_UDIMTile_label_get(PointerRNA *ptr, char *value)
306 {
308  Image *image = (Image *)ptr->owner_id;
309 
310  /* We don't know the length of the target string here, so we assume
311  * that it has been allocated according to what rna_UDIMTile_label_length returned. */
312  BKE_image_get_tile_label(image, tile, value, sizeof(tile->label));
313 }
314 
315 static int rna_UDIMTile_label_length(PointerRNA *ptr)
316 {
318  Image *image = (Image *)ptr->owner_id;
319 
320  char label[sizeof(tile->label)];
322 
323  return strlen(label);
324 }
325 
326 static void rna_UDIMTile_tile_number_set(PointerRNA *ptr, int value)
327 {
329  Image *image = (Image *)ptr->owner_id;
330 
331  /* Check that no other tile already has that number. */
332  ImageTile *cur_tile = BKE_image_get_tile(image, value);
333  if (cur_tile == NULL) {
335  }
336 }
337 
338 static int rna_Image_active_tile_index_get(PointerRNA *ptr)
339 {
340  Image *image = (Image *)ptr->data;
341  return image->active_tile_index;
342 }
343 
344 static void rna_Image_active_tile_index_set(PointerRNA *ptr, int value)
345 {
346  Image *image = (Image *)ptr->data;
347  int num_tiles = BLI_listbase_count(&image->tiles);
348 
349  image->active_tile_index = min_ii(value, num_tiles - 1);
350 }
351 
352 static void rna_Image_active_tile_index_range(
353  PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
354 {
355  Image *image = (Image *)ptr->data;
356  int num_tiles = BLI_listbase_count(&image->tiles);
357 
358  *min = 0;
359  *max = max_ii(0, num_tiles - 1);
360 }
361 
362 static PointerRNA rna_Image_active_tile_get(PointerRNA *ptr)
363 {
364  Image *image = (Image *)ptr->data;
365  ImageTile *tile = BLI_findlink(&image->tiles, image->active_tile_index);
366 
367  return rna_pointer_inherit_refine(ptr, &RNA_UDIMTile, tile);
368 }
369 
370 static void rna_Image_active_tile_set(PointerRNA *ptr,
371  PointerRNA value,
372  struct ReportList *UNUSED(reports))
373 {
374  Image *image = (Image *)ptr->data;
375  ImageTile *tile = (ImageTile *)value.data;
376  const int index = BLI_findindex(&image->tiles, tile);
377  if (index != -1) {
378  image->active_tile_index = index;
379  }
380 }
381 
382 static bool rna_Image_has_data_get(PointerRNA *ptr)
383 {
384  Image *image = (Image *)ptr->data;
385 
387 }
388 
389 static void rna_Image_size_get(PointerRNA *ptr, int *values)
390 {
391  Image *im = (Image *)ptr->data;
392  ImBuf *ibuf;
393  void *lock;
394 
395  ibuf = BKE_image_acquire_ibuf(im, NULL, &lock);
396  if (ibuf) {
397  values[0] = ibuf->x;
398  values[1] = ibuf->y;
399  }
400  else {
401  values[0] = 0;
402  values[1] = 0;
403  }
404 
405  BKE_image_release_ibuf(im, ibuf, lock);
406 }
407 
408 static void rna_Image_resolution_get(PointerRNA *ptr, float *values)
409 {
410  Image *im = (Image *)ptr->data;
411  ImBuf *ibuf;
412  void *lock;
413 
414  ibuf = BKE_image_acquire_ibuf(im, NULL, &lock);
415  if (ibuf) {
416  values[0] = ibuf->ppm[0];
417  values[1] = ibuf->ppm[1];
418  }
419  else {
420  values[0] = 0;
421  values[1] = 0;
422  }
423 
424  BKE_image_release_ibuf(im, ibuf, lock);
425 }
426 
427 static void rna_Image_resolution_set(PointerRNA *ptr, const float *values)
428 {
429  Image *im = (Image *)ptr->data;
430  ImBuf *ibuf;
431  void *lock;
432 
433  ibuf = BKE_image_acquire_ibuf(im, NULL, &lock);
434  if (ibuf) {
435  ibuf->ppm[0] = values[0];
436  ibuf->ppm[1] = values[1];
437  }
438 
439  BKE_image_release_ibuf(im, ibuf, lock);
440 }
441 
442 static int rna_Image_bindcode_get(PointerRNA *ptr)
443 {
444  Image *ima = (Image *)ptr->data;
447 }
448 
449 static int rna_Image_depth_get(PointerRNA *ptr)
450 {
451  Image *im = (Image *)ptr->data;
452  ImBuf *ibuf;
453  void *lock;
454  int planes;
455 
456  ibuf = BKE_image_acquire_ibuf(im, NULL, &lock);
457 
458  if (!ibuf) {
459  planes = 0;
460  }
461  else if (ibuf->rect_float) {
462  planes = ibuf->planes * 4;
463  }
464  else {
465  planes = ibuf->planes;
466  }
467 
468  BKE_image_release_ibuf(im, ibuf, lock);
469 
470  return planes;
471 }
472 
473 static int rna_Image_frame_duration_get(PointerRNA *ptr)
474 {
475  Image *ima = (Image *)ptr->owner_id;
476  int duration = 1;
477 
478  if (!BKE_image_has_anim(ima)) {
479  /* Ensure image has been loaded into memory and frame duration is known. */
480  void *lock;
481  ImBuf *ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
482  BKE_image_release_ibuf(ima, ibuf, lock);
483  }
484 
485  if (BKE_image_has_anim(ima)) {
486  struct anim *anim = ((ImageAnim *)ima->anims.first)->anim;
487  if (anim) {
489  }
490  }
491 
492  return duration;
493 }
494 
495 static int rna_Image_pixels_get_length(const PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION])
496 {
497  Image *ima = (Image *)ptr->owner_id;
498  ImBuf *ibuf;
499  void *lock;
500 
501  ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
502 
503  if (ibuf) {
504  length[0] = ibuf->x * ibuf->y * ibuf->channels;
505  }
506  else {
507  length[0] = 0;
508  }
509 
510  BKE_image_release_ibuf(ima, ibuf, lock);
511 
512  return length[0];
513 }
514 
515 static void rna_Image_pixels_get(PointerRNA *ptr, float *values)
516 {
517  Image *ima = (Image *)ptr->owner_id;
518  ImBuf *ibuf;
519  void *lock;
520  int i, size;
521 
522  ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
523 
524  if (ibuf) {
525  size = ibuf->x * ibuf->y * ibuf->channels;
526 
527  if (ibuf->rect_float) {
528  memcpy(values, ibuf->rect_float, sizeof(float) * size);
529  }
530  else {
531  for (i = 0; i < size; i++) {
532  values[i] = ((unsigned char *)ibuf->rect)[i] * (1.0f / 255.0f);
533  }
534  }
535  }
536 
537  BKE_image_release_ibuf(ima, ibuf, lock);
538 }
539 
540 static void rna_Image_pixels_set(PointerRNA *ptr, const float *values)
541 {
542  Image *ima = (Image *)ptr->owner_id;
543  ImBuf *ibuf;
544  void *lock;
545  int i, size;
546 
547  ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
548 
549  if (ibuf) {
550  size = ibuf->x * ibuf->y * ibuf->channels;
551 
552  if (ibuf->rect_float) {
553  memcpy(ibuf->rect_float, values, sizeof(float) * size);
554  }
555  else {
556  for (i = 0; i < size; i++) {
557  ((unsigned char *)ibuf->rect)[i] = unit_float_to_uchar_clamp(values[i]);
558  }
559  }
560 
562  BKE_image_mark_dirty(ima, ibuf);
563  if (!G.background) {
565  }
567  }
568 
569  BKE_image_release_ibuf(ima, ibuf, lock);
570 }
571 
572 static int rna_Image_channels_get(PointerRNA *ptr)
573 {
574  Image *im = (Image *)ptr->data;
575  ImBuf *ibuf;
576  void *lock;
577  int channels = 0;
578 
579  ibuf = BKE_image_acquire_ibuf(im, NULL, &lock);
580  if (ibuf) {
581  channels = ibuf->channels;
582  }
583 
584  BKE_image_release_ibuf(im, ibuf, lock);
585 
586  return channels;
587 }
588 
589 static bool rna_Image_is_float_get(PointerRNA *ptr)
590 {
591  Image *im = (Image *)ptr->data;
592  ImBuf *ibuf;
593  void *lock;
594  bool is_float = false;
595 
596  ibuf = BKE_image_acquire_ibuf(im, NULL, &lock);
597  if (ibuf) {
598  is_float = ibuf->rect_float != NULL;
599  }
600 
601  BKE_image_release_ibuf(im, ibuf, lock);
602 
603  return is_float;
604 }
605 
606 static PointerRNA rna_Image_packed_file_get(PointerRNA *ptr)
607 {
608  Image *ima = (Image *)ptr->owner_id;
609 
611  ImagePackedFile *imapf = ima->packedfiles.first;
612  return rna_pointer_inherit_refine(ptr, &RNA_PackedFile, imapf->packedfile);
613  }
614  else {
615  return PointerRNA_NULL;
616  }
617 }
618 
619 static void rna_RenderSlot_clear(ID *id, RenderSlot *slot, ImageUser *iuser)
620 {
621  Image *image = (Image *)id;
622  int index = BLI_findindex(&image->renderslots, slot);
623  BKE_image_clear_renderslot(image, iuser, index);
624 
626 }
627 
628 static PointerRNA rna_render_slots_active_get(PointerRNA *ptr)
629 {
630  Image *image = (Image *)ptr->owner_id;
631  RenderSlot *render_slot = BKE_image_get_renderslot(image, image->render_slot);
632 
633  return rna_pointer_inherit_refine(ptr, &RNA_RenderSlot, render_slot);
634 }
635 
636 static void rna_render_slots_active_set(PointerRNA *ptr,
637  PointerRNA value,
638  struct ReportList *UNUSED(reports))
639 {
640  Image *image = (Image *)ptr->owner_id;
641  if (value.owner_id == &image->id) {
642  RenderSlot *slot = (RenderSlot *)value.data;
643  int index = BLI_findindex(&image->renderslots, slot);
644  if (index != -1) {
645  image->render_slot = index;
647  }
648  }
649 }
650 
651 static int rna_render_slots_active_index_get(PointerRNA *ptr)
652 {
653  Image *image = (Image *)ptr->owner_id;
654  return image->render_slot;
655 }
656 
657 static void rna_render_slots_active_index_set(PointerRNA *ptr, int value)
658 {
659  Image *image = (Image *)ptr->owner_id;
660  int num_slots = BLI_listbase_count(&image->renderslots);
661  image->render_slot = value;
663  CLAMP(image->render_slot, 0, num_slots - 1);
664 }
665 
666 static void rna_render_slots_active_index_range(
667  PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
668 {
669  Image *image = (Image *)ptr->owner_id;
670  *min = 0;
671  *max = max_ii(0, BLI_listbase_count(&image->renderslots) - 1);
672 }
673 
674 static ImageTile *rna_UDIMTile_new(Image *image, int tile_number, const char *label)
675 {
676  ImageTile *tile = BKE_image_add_tile(image, tile_number, label);
677 
679 
680  return tile;
681 }
682 
683 static void rna_UDIMTile_remove(Image *image, PointerRNA *ptr)
684 {
687 
689 }
690 
691 #else
692 
693 static void rna_def_imageuser(BlenderRNA *brna)
694 {
695  StructRNA *srna;
696  PropertyRNA *prop;
697 
698  srna = RNA_def_struct(brna, "ImageUser", NULL);
700  srna,
701  "Image User",
702  "Parameters defining how an Image data-block is used by another data-block");
703  RNA_def_struct_path_func(srna, "rna_ImageUser_path");
704 
706 
707  prop = RNA_def_property(srna, "use_auto_refresh", PROP_BOOLEAN, PROP_NONE);
709  RNA_def_property_ui_text(prop, "Auto Refresh", "Always refresh image on frame changes");
710  RNA_def_property_update(prop, 0, "rna_ImageUser_relations_update");
712 
713  prop = RNA_def_property(srna, "frame_current", PROP_INT, PROP_TIME);
714  RNA_def_property_int_sdna(prop, NULL, "framenr");
717  prop, "Current Frame", "Current frame number in image sequence or movie");
718 
719  /* animation */
720  prop = RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE);
721  RNA_def_property_boolean_sdna(prop, NULL, "cycl", 0);
722  RNA_def_property_ui_text(prop, "Cyclic", "Cycle the images in the movie");
723  RNA_def_property_update(prop, 0, "rna_ImageUser_update");
725 
726  prop = RNA_def_property(srna, "frame_duration", PROP_INT, PROP_NONE);
727  RNA_def_property_int_sdna(prop, NULL, "frames");
729  RNA_def_property_ui_text(prop, "Frames", "Number of images of a movie to use");
730  RNA_def_property_update(prop, 0, "rna_ImageUser_update");
732 
733  prop = RNA_def_property(srna, "frame_offset", PROP_INT, PROP_NONE);
734  RNA_def_property_int_sdna(prop, NULL, "offset");
736  prop, "Offset", "Offset the number of the frame to use in the animation");
737  RNA_def_property_update(prop, 0, "rna_ImageUser_update");
738 
739  prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
740  RNA_def_property_int_sdna(prop, NULL, "sfra");
743  prop,
744  "Start Frame",
745  "Global starting frame of the movie/sequence, assuming first picture has a #1");
746  RNA_def_property_update(prop, 0, "rna_ImageUser_update");
748 
749  prop = RNA_def_property(srna, "multilayer_layer", PROP_INT, PROP_UNSIGNED);
750  RNA_def_property_int_sdna(prop, NULL, "layer");
751  RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* image_multi_cb */
752  RNA_def_property_ui_text(prop, "Layer", "Layer in multilayer image");
753 
754  prop = RNA_def_property(srna, "multilayer_pass", PROP_INT, PROP_UNSIGNED);
755  RNA_def_property_int_sdna(prop, NULL, "pass");
756  RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* image_multi_cb */
757  RNA_def_property_ui_text(prop, "Pass", "Pass in multilayer image");
758 
759  prop = RNA_def_property(srna, "multilayer_view", PROP_INT, PROP_UNSIGNED);
760  RNA_def_property_int_sdna(prop, NULL, "view");
761  RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* image_multi_cb */
762  RNA_def_property_ui_text(prop, "View", "View in multilayer image");
763 
764  prop = RNA_def_property(srna, "tile", PROP_INT, PROP_UNSIGNED);
765  RNA_def_property_int_sdna(prop, NULL, "tile");
767  RNA_def_property_ui_text(prop, "Tile", "Tile in tiled image");
768 
770 }
771 
772 /* image.packed_files */
774 {
775  StructRNA *srna;
776  PropertyRNA *prop;
777 
778  srna = RNA_def_struct(brna, "ImagePackedFile", NULL);
779  RNA_def_struct_sdna(srna, "ImagePackedFile");
780 
781  prop = RNA_def_property(srna, "packed_file", PROP_POINTER, PROP_NONE);
782  RNA_def_property_pointer_sdna(prop, NULL, "packedfile");
783  RNA_def_property_ui_text(prop, "Packed File", "");
785 
786  prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
787  RNA_def_property_string_sdna(prop, NULL, "filepath");
788  RNA_def_struct_name_property(srna, prop);
789 
790  prop = RNA_def_property(srna, "view", PROP_INT, PROP_NONE);
791  RNA_def_property_int_sdna(prop, NULL, "view");
792  RNA_def_property_ui_text(prop, "View Index", "");
794 
795  prop = RNA_def_property(srna, "tile_number", PROP_INT, PROP_NONE);
796  RNA_def_property_int_sdna(prop, NULL, "tile_number");
797  RNA_def_property_ui_text(prop, "Tile Number", "");
799 
801 }
802 
803 static void rna_def_render_slot(BlenderRNA *brna)
804 {
805  StructRNA *srna;
806  PropertyRNA *prop, *parm;
807  FunctionRNA *func;
808 
809  srna = RNA_def_struct(brna, "RenderSlot", NULL);
810  RNA_def_struct_ui_text(srna, "Render Slot", "Parameters defining the render slot");
811 
812  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
813  RNA_def_property_string_sdna(prop, NULL, "name");
814  RNA_def_property_ui_text(prop, "Name", "Render slot name");
816 
817  func = RNA_def_function(srna, "clear", "rna_RenderSlot_clear");
819  RNA_def_function_ui_description(func, "Clear the render slot");
820  parm = RNA_def_pointer(func, "iuser", "ImageUser", "ImageUser", "");
822 }
823 
824 static void rna_def_render_slots(BlenderRNA *brna, PropertyRNA *cprop)
825 {
826  StructRNA *srna;
827  FunctionRNA *func;
828  PropertyRNA *prop, *parm;
829 
830  RNA_def_property_srna(cprop, "RenderSlots");
831  srna = RNA_def_struct(brna, "RenderSlots", NULL);
832  RNA_def_struct_sdna(srna, "Image");
833  RNA_def_struct_ui_text(srna, "Render Layers", "Collection of render layers");
834 
835  prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
836  RNA_def_property_int_sdna(prop, NULL, "render_slot");
838  "rna_render_slots_active_index_get",
839  "rna_render_slots_active_index_set",
840  "rna_render_slots_active_index_range");
841  RNA_def_property_ui_text(prop, "Active", "Active render slot of the image");
843 
844  prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
845  RNA_def_property_struct_type(prop, "RenderSlot");
847  prop, "rna_render_slots_active_get", "rna_render_slots_active_set", NULL, NULL);
849  RNA_def_property_ui_text(prop, "Active", "Active render slot of the image");
851 
852  func = RNA_def_function(srna, "new", "BKE_image_add_renderslot");
853  RNA_def_function_ui_description(func, "Add a render slot to the image");
854  parm = RNA_def_string(func, "name", NULL, 0, "Name", "New name for the render slot");
855  parm = RNA_def_pointer(func, "result", "RenderSlot", "", "Newly created render layer");
856  RNA_def_function_return(func, parm);
857 }
858 
859 static void rna_def_udim_tile(BlenderRNA *brna)
860 {
861  StructRNA *srna;
862  PropertyRNA *prop;
863 
864  srna = RNA_def_struct(brna, "UDIMTile", NULL);
865  RNA_def_struct_sdna(srna, "ImageTile");
866  RNA_def_struct_ui_text(srna, "UDIM Tile", "Properties of the UDIM tile");
867 
868  prop = RNA_def_property(srna, "label", PROP_STRING, PROP_NONE);
869  RNA_def_property_string_sdna(prop, NULL, "label");
870  RNA_def_property_ui_text(prop, "Label", "Tile label");
871  RNA_def_property_string_funcs(prop, "rna_UDIMTile_label_get", "rna_UDIMTile_label_length", NULL);
873 
874  prop = RNA_def_property(srna, "number", PROP_INT, PROP_NONE);
875  RNA_def_property_int_sdna(prop, NULL, "tile_number");
876  RNA_def_property_ui_text(prop, "Number", "Number of the position that this tile covers");
877  RNA_def_property_int_funcs(prop, NULL, "rna_UDIMTile_tile_number_set", NULL);
879 
880  prop = RNA_def_int_vector(
881  srna,
882  "size",
883  2,
884  NULL,
885  0,
886  0,
887  "Size",
888  "Width and height of the tile buffer in pixels, zero when image data can't be loaded",
889  0,
890  0);
892  RNA_def_property_int_funcs(prop, "rna_UDIMTile_size_get", NULL, NULL);
894 
895  prop = RNA_def_property(srna, "channels", PROP_INT, PROP_UNSIGNED);
896  RNA_def_property_int_funcs(prop, "rna_UDIMTile_channels_get", NULL, NULL);
897  RNA_def_property_ui_text(prop, "Channels", "Number of channels in the tile pixels buffer");
899 }
900 
901 static void rna_def_udim_tiles(BlenderRNA *brna, PropertyRNA *cprop)
902 {
903  StructRNA *srna;
904  PropertyRNA *prop;
905 
906  FunctionRNA *func;
907  PropertyRNA *parm;
908 
909  RNA_def_property_srna(cprop, "UDIMTiles");
910  srna = RNA_def_struct(brna, "UDIMTiles", NULL);
911  RNA_def_struct_sdna(srna, "Image");
912  RNA_def_struct_ui_text(srna, "UDIM Tiles", "Collection of UDIM tiles");
913 
914  prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
915  RNA_def_property_int_sdna(prop, NULL, "active_tile_index");
917  "rna_Image_active_tile_index_get",
918  "rna_Image_active_tile_index_set",
919  "rna_Image_active_tile_index_range");
920  RNA_def_property_ui_text(prop, "Active Tile Index", "Active index in tiles array");
921 
922  prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
923  RNA_def_property_struct_type(prop, "UDIMTile");
925  prop, "rna_Image_active_tile_get", "rna_Image_active_tile_set", NULL, NULL);
927  RNA_def_property_ui_text(prop, "Active Image Tile", "Active Image Tile");
928 
929  func = RNA_def_function(srna, "new", "rna_UDIMTile_new");
930  RNA_def_function_ui_description(func, "Add a tile to the image");
931  parm = RNA_def_int(
932  func, "tile_number", 1, 1, INT_MAX, "", "Number of the newly created tile", 1, 100);
934  parm = RNA_def_string(func, "label", NULL, 0, "", "Optional label for the tile");
935  parm = RNA_def_pointer(func, "result", "UDIMTile", "", "Newly created image tile");
936  RNA_def_function_return(func, parm);
937 
938  func = RNA_def_function(srna, "get", "BKE_image_get_tile");
939  RNA_def_function_ui_description(func, "Get a tile based on its tile number");
940  parm = RNA_def_int(func, "tile_number", 0, 0, INT_MAX, "", "Number of the tile", 0, 100);
942  parm = RNA_def_pointer(func, "result", "UDIMTile", "", "The tile");
943  RNA_def_function_return(func, parm);
944 
945  func = RNA_def_function(srna, "remove", "rna_UDIMTile_remove");
946  RNA_def_function_ui_description(func, "Remove an image tile");
947  parm = RNA_def_pointer(func, "tile", "UDIMTile", "", "Image tile to remove");
950 }
951 
952 static void rna_def_image(BlenderRNA *brna)
953 {
954  StructRNA *srna;
955  PropertyRNA *prop;
956  static const EnumPropertyItem prop_type_items[] = {
957  {IMA_TYPE_IMAGE, "IMAGE", 0, "Image", ""},
958  {IMA_TYPE_MULTILAYER, "MULTILAYER", 0, "Multilayer", ""},
959  {IMA_TYPE_UV_TEST, "UV_TEST", 0, "UV Test", ""},
960  {IMA_TYPE_R_RESULT, "RENDER_RESULT", 0, "Render Result", ""},
961  {IMA_TYPE_COMPOSITE, "COMPOSITING", 0, "Compositing", ""},
962  {0, NULL, 0, NULL, NULL},
963  };
964  static const EnumPropertyItem alpha_mode_items[] = {
966  "STRAIGHT",
967  0,
968  "Straight",
969  "Store RGB and alpha channels separately with alpha acting as a mask, also known as "
970  "unassociated alpha. Commonly used by image editing applications and file formats like "
971  "PNG"},
973  "PREMUL",
974  0,
975  "Premultiplied",
976  "Store RGB channels with alpha multiplied in, also known as associated alpha. The natural "
977  "format for renders and used by file formats like OpenEXR"},
979  "CHANNEL_PACKED",
980  0,
981  "Channel Packed",
982  "Different images are packed in the RGB and alpha channels, and they should not "
983  "affect each other. Channel packing is commonly used by game engines to save memory"},
985  "NONE",
986  0,
987  "None",
988  "Ignore alpha channel from the file and make image fully opaque"},
989  {0, NULL, 0, NULL, NULL},
990  };
991 
992  srna = RNA_def_struct(brna, "Image", "ID");
994  srna, "Image", "Image data-block referencing an external or packed image");
995  RNA_def_struct_ui_icon(srna, ICON_IMAGE_DATA);
996 
997  prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
999  RNA_def_property_string_sdna(prop, NULL, "filepath");
1000  RNA_def_property_ui_text(prop, "File Name", "Image/Movie file name");
1001  RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_reload_update");
1002 
1003  /* eek. this is horrible but needed so we can save to a new name without blanking the data :( */
1004  prop = RNA_def_property(srna, "filepath_raw", PROP_STRING, PROP_FILEPATH);
1005  RNA_def_property_string_sdna(prop, NULL, "filepath");
1006  RNA_def_property_ui_text(prop, "File Name", "Image/Movie file name (without data refreshing)");
1007 
1008  prop = RNA_def_property(srna, "file_format", PROP_ENUM, PROP_NONE);
1011  prop, "rna_Image_file_format_get", "rna_Image_file_format_set", NULL);
1012  RNA_def_property_ui_text(prop, "File Format", "Format used for re-saving this file");
1013 
1014  prop = RNA_def_property(srna, "source", PROP_ENUM, PROP_NONE);
1016  RNA_def_property_enum_funcs(prop, NULL, "rna_Image_source_set", "rna_Image_source_itemf");
1017  RNA_def_property_ui_text(prop, "Source", "Where the image comes from");
1019 
1020  prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
1021  RNA_def_property_enum_items(prop, prop_type_items);
1023  RNA_def_property_ui_text(prop, "Type", "How to generate the image");
1025 
1026  prop = RNA_def_property(srna, "packed_file", PROP_POINTER, PROP_NONE);
1027  RNA_def_property_struct_type(prop, "PackedFile");
1028  RNA_def_property_pointer_sdna(prop, NULL, "packedfile");
1029  RNA_def_property_pointer_funcs(prop, "rna_Image_packed_file_get", NULL, NULL, NULL);
1030  RNA_def_property_ui_text(prop, "Packed File", "First packed file of the image");
1031 
1032  prop = RNA_def_property(srna, "packed_files", PROP_COLLECTION, PROP_NONE);
1033  RNA_def_property_collection_sdna(prop, NULL, "packedfiles", NULL);
1034  RNA_def_property_struct_type(prop, "ImagePackedFile");
1036  RNA_def_property_ui_text(prop, "Packed Files", "Collection of packed images");
1037 
1038  prop = RNA_def_property(srna, "use_view_as_render", PROP_BOOLEAN, PROP_NONE);
1042  prop,
1043  "View as Render",
1044  "Apply render part of display transformation when displaying this image on the screen");
1046 
1047  prop = RNA_def_property(srna, "use_deinterlace", PROP_BOOLEAN, PROP_NONE);
1050  RNA_def_property_ui_text(prop, "Deinterlace", "Deinterlace movie file on load");
1051  RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_reload_update");
1052 
1053  prop = RNA_def_property(srna, "use_multiview", PROP_BOOLEAN, PROP_NONE);
1056  RNA_def_property_ui_text(prop, "Use Multi-View", "Use Multiple Views (when available)");
1057  RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_views_format_update");
1058 
1059  prop = RNA_def_property(srna, "is_stereo_3d", PROP_BOOLEAN, PROP_NONE);
1061  RNA_def_property_boolean_funcs(prop, "rna_Image_is_stereo_3d_get", NULL);
1062  RNA_def_property_ui_text(prop, "Stereo 3D", "Image has left and right views");
1064 
1065  prop = RNA_def_property(srna, "is_multiview", PROP_BOOLEAN, PROP_NONE);
1067  RNA_def_property_boolean_funcs(prop, "rna_Image_is_multiview_get", NULL);
1068  RNA_def_property_ui_text(prop, "Multiple Views", "Image has more than one view");
1070 
1071  prop = RNA_def_property(srna, "is_dirty", PROP_BOOLEAN, PROP_NONE);
1073  RNA_def_property_boolean_funcs(prop, "rna_Image_dirty_get", NULL);
1075  RNA_def_property_ui_text(prop, "Dirty", "Image has changed and is not saved");
1076 
1077  /* generated image (image_generated_change_cb) */
1078  prop = RNA_def_property(srna, "generated_type", PROP_ENUM, PROP_NONE);
1079  RNA_def_property_enum_sdna(prop, NULL, "gen_type");
1081  RNA_def_property_ui_text(prop, "Generated Type", "Generated image type");
1082  RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update");
1084 
1085  prop = RNA_def_property(srna, "generated_width", PROP_INT, PROP_PIXEL);
1086  RNA_def_property_int_sdna(prop, NULL, "gen_x");
1088  RNA_def_property_range(prop, 1, 65536);
1089  RNA_def_property_ui_text(prop, "Generated Width", "Generated image width");
1090  RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update");
1092 
1093  prop = RNA_def_property(srna, "generated_height", PROP_INT, PROP_PIXEL);
1094  RNA_def_property_int_sdna(prop, NULL, "gen_y");
1096  RNA_def_property_range(prop, 1, 65536);
1097  RNA_def_property_ui_text(prop, "Generated Height", "Generated image height");
1098  RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update");
1100 
1101  prop = RNA_def_property(srna, "use_generated_float", PROP_BOOLEAN, PROP_NONE);
1102  RNA_def_property_boolean_sdna(prop, NULL, "gen_flag", IMA_GEN_FLOAT);
1103  RNA_def_property_ui_text(prop, "Float Buffer", "Generate floating-point buffer");
1104  RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update");
1106 
1107  prop = RNA_def_property(srna, "generated_color", PROP_FLOAT, PROP_COLOR_GAMMA);
1108  RNA_def_property_float_sdna(prop, NULL, "gen_color");
1109  RNA_def_property_array(prop, 4);
1110  RNA_def_property_ui_text(prop, "Color", "Fill color for the generated image");
1111  RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update");
1113 
1114  prop = RNA_def_property(srna, "display_aspect", PROP_FLOAT, PROP_XYZ);
1116  RNA_def_property_float_sdna(prop, NULL, "aspx");
1117  RNA_def_property_array(prop, 2);
1118  RNA_def_property_range(prop, 0.1f, FLT_MAX);
1119  RNA_def_property_ui_range(prop, 0.1f, 5000.0f, 1, 2);
1121  prop, "Display Aspect", "Display Aspect for this image, does not affect rendering");
1123 
1124  prop = RNA_def_property(srna, "bindcode", PROP_INT, PROP_UNSIGNED);
1125  RNA_def_property_int_funcs(prop, "rna_Image_bindcode_get", NULL, NULL);
1127  RNA_def_property_ui_text(prop, "Bindcode", "OpenGL bindcode");
1129 
1130  prop = RNA_def_property(srna, "render_slots", PROP_COLLECTION, PROP_NONE);
1131  RNA_def_property_struct_type(prop, "RenderSlot");
1132  RNA_def_property_collection_sdna(prop, NULL, "renderslots", NULL);
1133  RNA_def_property_ui_text(prop, "Render Slots", "Render slots of the image");
1134  rna_def_render_slots(brna, prop);
1135 
1136  prop = RNA_def_property(srna, "tiles", PROP_COLLECTION, PROP_NONE);
1137  RNA_def_property_struct_type(prop, "UDIMTile");
1138  RNA_def_property_collection_sdna(prop, NULL, "tiles", NULL);
1139  RNA_def_property_ui_text(prop, "Image Tiles", "Tiles of the image");
1140  rna_def_udim_tiles(brna, prop);
1141 
1142  /*
1143  * Image.has_data and Image.depth are temporary,
1144  * Update import_obj.py when they are replaced (Arystan)
1145  */
1146  prop = RNA_def_property(srna, "has_data", PROP_BOOLEAN, PROP_NONE);
1147  RNA_def_property_boolean_funcs(prop, "rna_Image_has_data_get", NULL);
1149  RNA_def_property_ui_text(prop, "Has Data", "True if the image data is loaded into memory");
1150 
1151  prop = RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED);
1152  RNA_def_property_int_funcs(prop, "rna_Image_depth_get", NULL, NULL);
1153  RNA_def_property_ui_text(prop, "Depth", "Image bit depth");
1155 
1156  prop = RNA_def_int_vector(
1157  srna,
1158  "size",
1159  2,
1160  NULL,
1161  0,
1162  0,
1163  "Size",
1164  "Width and height of the image buffer in pixels, zero when image data can't be loaded",
1165  0,
1166  0);
1168  RNA_def_property_int_funcs(prop, "rna_Image_size_get", NULL, NULL);
1170 
1171  prop = RNA_def_float_vector(srna,
1172  "resolution",
1173  2,
1174  NULL,
1175  0,
1176  0,
1177  "Resolution",
1178  "X/Y pixels per meter, for the image buffer",
1179  0,
1180  0);
1182  RNA_def_property_float_funcs(prop, "rna_Image_resolution_get", "rna_Image_resolution_set", NULL);
1183 
1184  prop = RNA_def_property(srna, "frame_duration", PROP_INT, PROP_UNSIGNED);
1185  RNA_def_property_int_funcs(prop, "rna_Image_frame_duration_get", NULL, NULL);
1187  prop, "Duration", "Duration (in frames) of the image (1 when not a video/sequence)");
1189 
1190  /* NOTE: About pixels/channels/is_float:
1191  * These properties describe how the image is stored internally (inside of ImBuf),
1192  * not how it was saved to disk or how it'll be saved on disk.
1193  */
1194  prop = RNA_def_property(srna, "pixels", PROP_FLOAT, PROP_NONE);
1197  RNA_def_property_ui_text(prop, "Pixels", "Image buffer pixels in floating-point values");
1198  RNA_def_property_dynamic_array_funcs(prop, "rna_Image_pixels_get_length");
1199  RNA_def_property_float_funcs(prop, "rna_Image_pixels_get", "rna_Image_pixels_set", NULL);
1200 
1201  prop = RNA_def_property(srna, "channels", PROP_INT, PROP_UNSIGNED);
1202  RNA_def_property_int_funcs(prop, "rna_Image_channels_get", NULL, NULL);
1203  RNA_def_property_ui_text(prop, "Channels", "Number of channels in pixels buffer");
1205 
1206  prop = RNA_def_property(srna, "is_float", PROP_BOOLEAN, PROP_NONE);
1207  RNA_def_property_boolean_funcs(prop, "rna_Image_is_float_get", NULL);
1210  prop, "Is Float", "True if this image is stored in floating-point buffer");
1211 
1212  prop = RNA_def_property(srna, "colorspace_settings", PROP_POINTER, PROP_NONE);
1213  RNA_def_property_pointer_sdna(prop, NULL, "colorspace_settings");
1214  RNA_def_property_struct_type(prop, "ColorManagedInputColorspaceSettings");
1215  RNA_def_property_ui_text(prop, "Color Space Settings", "Input color space settings");
1216 
1217  prop = RNA_def_property(srna, "alpha_mode", PROP_ENUM, PROP_NONE);
1219  RNA_def_property_enum_items(prop, alpha_mode_items);
1221  "Alpha Mode",
1222  "Representation of alpha in the image file, to convert to and from "
1223  "when saving and loading the image");
1224  RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_alpha_mode_update");
1225 
1226  prop = RNA_def_property(srna, "use_half_precision", PROP_BOOLEAN, PROP_NONE);
1229  "Half Float Precision",
1230  "Use 16 bits per channel to lower the memory usage during rendering");
1231  RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_gpu_texture_update");
1232 
1233  /* multiview */
1234  prop = RNA_def_property(srna, "views_format", PROP_ENUM, PROP_NONE);
1236  RNA_def_property_enum_sdna(prop, NULL, "views_format");
1238  RNA_def_property_ui_text(prop, "Views Format", "Mode to load image views");
1239  RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_views_format_update");
1240 
1241  prop = RNA_def_property(srna, "stereo_3d_format", PROP_POINTER, PROP_NONE);
1242  RNA_def_property_pointer_sdna(prop, NULL, "stereo3d_format");
1244  RNA_def_property_struct_type(prop, "Stereo3dFormat");
1245  RNA_def_property_ui_text(prop, "Stereo 3D Format", "Settings for stereo 3d");
1246 
1247  RNA_api_image(srna);
1248 }
1249 
1251 {
1252  rna_def_render_slot(brna);
1253  rna_def_udim_tile(brna);
1254  rna_def_image(brna);
1255  rna_def_imageuser(brna);
1257 }
1258 
1259 #endif
#define G_MAIN
Definition: BKE_global.h:267
bool BKE_image_remove_tile(struct Image *ima, struct ImageTile *tile)
void BKE_image_release_ibuf(struct Image *ima, struct ImBuf *ibuf, void *lock)
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_loaded_ibuf(struct Image *image)
void BKE_image_partial_update_mark_full_update(struct Image *image)
Mark the whole image to be updated.
bool BKE_image_is_stereo(const struct Image *ima)
#define IMA_SIGNAL_COLORMANAGE
Definition: BKE_image.h:135
bool BKE_image_clear_renderslot(struct Image *ima, struct ImageUser *iuser, int slot)
#define IMA_SIGNAL_FREE
Definition: BKE_image.h:130
void BKE_image_free_gputextures(struct Image *ima)
Definition: image_gpu.cc:516
void BKE_image_mark_dirty(struct Image *image, struct ImBuf *ibuf)
bool BKE_image_has_packedfile(const struct Image *image)
#define IMA_SIGNAL_SRC_CHANGE
Definition: BKE_image.h:132
bool BKE_image_has_anim(struct Image *image)
bool BKE_image_is_dirty(struct Image *image)
#define IMA_SIGNAL_RELOAD
Definition: BKE_image.h:129
void BKE_image_file_format_set(struct Image *image, int ftype, const struct ImbFormatOptions *options)
void BKE_image_signal(struct Main *bmain, struct Image *ima, struct ImageUser *iuser, int signal)
struct ImageTile * BKE_image_add_tile(struct Image *ima, int tile_number, const char *label)
void BKE_image_user_frame_calc(struct Image *ima, struct ImageUser *iuser, int cfra)
void BKE_imageuser_default(struct ImageUser *iuser)
void BKE_image_get_tile_label(struct Image *ima, struct ImageTile *tile, char *label, int len_label)
struct RenderSlot * BKE_image_get_renderslot(struct Image *ima, int index)
void BKE_image_reassign_tile(struct Image *ima, struct ImageTile *tile, int new_tile_number)
char BKE_ftype_to_imtype(int ftype, const struct ImbFormatOptions *options)
int BKE_imtype_to_ftype(char imtype, struct ImbFormatOptions *r_options)
Definition: image_format.cc:69
bool BKE_imtype_is_movie(char imtype)
bool BKE_id_is_in_global_main(struct ID *id)
Definition: lib_id.c:1902
void BKE_ntree_update_tag_image_user_changed(struct bNodeTree *ntree, struct ImageUser *iuser)
#define BLI_assert(a)
Definition: BLI_assert.h:46
int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
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)
MINLINE int min_ii(int a, int b)
MINLINE int max_ii(int a, int b)
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL() ATTR_MALLOC
Definition: string.c:42
#define UNUSED(x)
void DEG_id_tag_update(struct ID *id, int flag)
void DEG_relations_tag_update(struct Main *bmain)
@ ID_RECALC_EDITORS
Definition: DNA_ID.h:828
@ ID_CA
Definition: DNA_ID_enums.h:56
@ ID_TE
Definition: DNA_ID_enums.h:52
@ ID_NT
Definition: DNA_ID_enums.h:68
@ ID_OB
Definition: DNA_ID_enums.h:47
@ IMA_GENTYPE_GRID_COLOR
@ IMA_GENTYPE_GRID
@ IMA_GENTYPE_BLANK
@ IMA_DEINTERLACE
@ IMA_HIGH_BITDEPTH
@ IMA_USE_VIEWS
@ IMA_VIEW_AS_RENDER
@ IMA_GEN_FLOAT
#define IMA_ANIM_ALWAYS
@ IMA_ALPHA_IGNORE
@ IMA_ALPHA_STRAIGHT
@ IMA_ALPHA_PREMUL
@ IMA_ALPHA_CHANNEL_PACKED
@ IMA_SRC_FILE
@ IMA_SRC_MOVIE
@ IMA_SRC_GENERATED
@ IMA_SRC_VIEWER
@ IMA_SRC_TILED
@ IMA_SRC_SEQUENCE
@ IMA_TYPE_MULTILAYER
@ IMA_TYPE_UV_TEST
@ IMA_TYPE_R_RESULT
@ IMA_TYPE_COMPOSITE
@ IMA_TYPE_IMAGE
@ TEXTARGET_2D
#define MINAFRAME
#define MAXFRAMEF
#define MINAFRAMEF
#define MAXFRAME
void ED_node_tree_propagate_change(const struct bContext *C, struct Main *bmain, struct bNodeTree *ntree)
struct GPUTexture GPUTexture
Definition: GPU_texture.h:17
int GPU_texture_opengl_bindcode(const GPUTexture *tex)
Definition: gpu_texture.cc:683
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_MIPMAP_INVALID
@ IB_DISPLAY_BUFFER_INVALID
#define IMB_FTYPE_NONE
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position CLAMP
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert a producing a negative Combine Generate a color from its and blue channels(Deprecated)") DefNode(ShaderNode
#define RNA_MAX_ARRAY_DIMENSION
Definition: RNA_define.h:28
@ PARM_RNAPTR
Definition: RNA_types.h:354
@ PARM_REQUIRED
Definition: RNA_types.h:352
@ FUNC_USE_SELF_ID
Definition: RNA_types.h:650
@ PROP_FLOAT
Definition: RNA_types.h:61
@ PROP_BOOLEAN
Definition: RNA_types.h:59
@ PROP_ENUM
Definition: RNA_types.h:63
@ PROP_INT
Definition: RNA_types.h:60
@ PROP_STRING
Definition: RNA_types.h:62
@ PROP_POINTER
Definition: RNA_types.h:64
@ PROP_COLLECTION
Definition: RNA_types.h:65
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
Definition: RNA_types.h:312
@ PROP_THICK_WRAP
Definition: RNA_types.h:285
@ PROP_DYNAMIC
Definition: RNA_types.h:290
@ PROP_ANIMATABLE
Definition: RNA_types.h:202
@ PROP_PROPORTIONAL
Definition: RNA_types.h:223
@ PROP_EDITABLE
Definition: RNA_types.h:189
@ PROP_NEVER_NULL
Definition: RNA_types.h:239
@ PROP_TIME
Definition: RNA_types.h:146
@ PROP_XYZ
Definition: RNA_types.h:162
@ PROP_PIXEL
Definition: RNA_types.h:141
@ PROP_NONE
Definition: RNA_types.h:126
@ PROP_COLOR_GAMMA
Definition: RNA_types.h:165
@ PROP_UNSIGNED
Definition: RNA_types.h:142
@ PROP_FILEPATH
Definition: RNA_types.h:129
#define C
Definition: RandGen.cpp:25
#define ND_DRAW
Definition: WM_types.h:410
#define ND_DISPLAY
Definition: WM_types.h:439
#define NA_EDITED
Definition: WM_types.h:523
#define NC_IMAGE
Definition: WM_types.h:334
volatile int lock
return(oflags[bm->toolflag_index].f &oflag) !=0
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
struct ListBase packedfiles
ListBase anims
struct GPUTexture * gputexture[3][2]
short source
CCL_NAMESPACE_BEGIN struct Options options
const char * label
Scene scene
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
#define GS(x)
Definition: iris.c:225
ccl_gpu_kernel_postfix ccl_global KernelWorkTile const int num_tiles
ccl_global const KernelWorkTile * tile
MINLINE unsigned char unit_float_to_uchar_clamp(float val)
#define G(x, y, z)
T length(const vec_base< T, Size > &a)
const PointerRNA PointerRNA_NULL
Definition: rna_access.c:61
PointerRNA rna_pointer_inherit_refine(PointerRNA *ptr, StructRNA *type, void *data)
Definition: rna_access.c:186
void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2740
void RNA_define_lib_overridable(const bool make_overridable)
Definition: rna_define.c:742
void RNA_def_struct_path_func(StructRNA *srna, const char *path)
Definition: rna_define.c:1193
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
Definition: rna_define.c:4170
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t bit)
Definition: rna_define.c:2236
void RNA_def_parameter_clear_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
Definition: rna_define.c:1526
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
Definition: rna_define.c:3285
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
Definition: rna_define.c:4312
void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
Definition: rna_define.c:3126
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
Definition: rna_define.c:1645
void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2695
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier, const char *call)
Definition: rna_define.c:4273
void RNA_def_property_srna(PropertyRNA *prop, const char *type)
Definition: rna_define.c:3474
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
Definition: rna_define.c:1237
void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const char *set)
Definition: rna_define.c:2944
void RNA_def_property_dynamic_array_funcs(PropertyRNA *prop, const char *getlength)
Definition: rna_define.c:2926
void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, const int length[])
Definition: rna_define.c:1598
PropertyRNA * RNA_def_float_vector(StructOrFunctionRNA *cont_, const char *identifier, int len, const float *default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
Definition: rna_define.c:3862
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
Definition: rna_define.c:1872
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
Definition: rna_define.c:1048
void RNA_def_property_array(PropertyRNA *prop, int length)
Definition: rna_define.c:1539
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
Definition: rna_define.c:1737
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
Definition: rna_define.c:1772
void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, const char *propname, const char *lengthpropname)
Definition: rna_define.c:2769
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
Definition: rna_define.c:4347
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
Definition: rna_define.c:2900
void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char *set, const char *item)
Definition: rna_define.c:3224
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
Definition: rna_define.c:1257
PropertyRNA * RNA_def_int_vector(StructOrFunctionRNA *cont_, const char *identifier, int len, const int *default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
Definition: rna_define.c:3623
void RNA_enum_item_end(EnumPropertyItem **items, int *totitem)
Definition: rna_define.c:4487
void RNA_def_struct_name_property(struct StructRNA *srna, struct PropertyRNA *prop)
Definition: rna_define.c:1103
void RNA_def_function_flag(FunctionRNA *func, int flag)
Definition: rna_define.c:4342
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1495
void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set, const char *type_fn, const char *poll)
Definition: rna_define.c:3385
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
Definition: rna_define.c:1028
void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2601
void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
Definition: rna_define.c:3028
void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
Definition: rna_define.c:1245
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3687
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1490
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, int default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
Definition: rna_define.c:3597
void RNA_def_property_subtype(PropertyRNA *prop, PropertySubType subtype)
Definition: rna_define.c:1534
void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2493
void RNA_enum_items_add_value(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item, int value)
Definition: rna_define.c:4472
void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision)
Definition: rna_define.c:1664
void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2343
void RNA_def_property_boolean_negative_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
Definition: rna_define.c:2327
void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
Definition: rna_define.c:1503
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
Definition: rna_define.c:1518
void RNA_def_image(BlenderRNA *brna)
Definition: rna_image.c:1250
static void rna_def_image(BlenderRNA *brna)
Definition: rna_image.c:952
static void rna_def_render_slot(BlenderRNA *brna)
Definition: rna_image.c:803
static void rna_def_render_slots(BlenderRNA *brna, PropertyRNA *cprop)
Definition: rna_image.c:824
static const EnumPropertyItem image_source_items[]
Definition: rna_image.c:42
static void rna_def_image_packed_files(BlenderRNA *brna)
Definition: rna_image.c:773
static void rna_def_udim_tile(BlenderRNA *brna)
Definition: rna_image.c:859
static void rna_def_udim_tiles(BlenderRNA *brna, PropertyRNA *cprop)
Definition: rna_image.c:901
static void rna_def_imageuser(BlenderRNA *brna)
Definition: rna_image.c:693
const EnumPropertyItem rna_enum_image_generated_type_items[]
Definition: rna_image.c:31
void RNA_api_image(StructRNA *srna)
void RNA_api_image_packed_file(StructRNA *srna)
char * rna_CameraBackgroundImage_image_or_movieclip_user_path(const struct PointerRNA *ptr)
char * rna_Node_ImageUser_path(const struct PointerRNA *ptr)
const EnumPropertyItem rna_enum_image_type_items[]
Definition: rna_scene.c:370
const EnumPropertyItem rna_enum_views_format_items[]
Definition: rna_scene.c:485
#define min(a, b)
Definition: sort.c:35
Definition: DNA_ID.h:368
char name[66]
Definition: DNA_ID.h:378
int channels
int userflags
unsigned char planes
unsigned int * rect
float * rect_float
double ppm[2]
struct PackedFile * packedfile
struct Scene * scene
void * first
Definition: DNA_listBase.h:31
Definition: BKE_main.h:121
void * data
Definition: RNA_types.h:38
struct ID * owner_id
Definition: RNA_types.h:36
struct RenderData r
Definition: IMB_anim.h:71
float max
void WM_main_add_notifier(unsigned int type, void *reference)
PointerRNA * ptr
Definition: wm_files.c:3480