Blender  V2.93
rna_image.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 
21 #include <stdlib.h>
22 
23 #include "DNA_image_types.h"
24 #include "DNA_node_types.h"
25 #include "DNA_scene_types.h"
26 
27 #include "BLI_utildefines.h"
28 
29 #include "BKE_image.h"
30 
31 #include "DEG_depsgraph.h"
32 #include "DEG_depsgraph_build.h"
33 
34 #include "RNA_access.h"
35 #include "RNA_define.h"
36 #include "RNA_enum_types.h"
37 
38 #include "rna_internal.h"
39 
40 #include "WM_api.h"
41 #include "WM_types.h"
42 
44  {IMA_GENTYPE_BLANK, "BLANK", 0, "Blank", "Generate a blank image"},
45  {IMA_GENTYPE_GRID, "UV_GRID", 0, "UV Grid", "Generated grid to test UV mappings"},
47  "COLOR_GRID",
48  0,
49  "Color Grid",
50  "Generated improved UV grid to test UV mappings"},
51  {0, NULL, 0, NULL, NULL},
52 };
53 
55  {IMA_SRC_FILE, "FILE", 0, "Single Image", "Single image file"},
56  {IMA_SRC_SEQUENCE, "SEQUENCE", 0, "Image Sequence", "Multiple image files, as a sequence"},
57  {IMA_SRC_MOVIE, "MOVIE", 0, "Movie", "Movie file"},
58  {IMA_SRC_GENERATED, "GENERATED", 0, "Generated", "Generated image"},
59  {IMA_SRC_VIEWER, "VIEWER", 0, "Viewer", "Compositing node viewer"},
60  {IMA_SRC_TILED, "TILED", 0, "UDIM Tiles", "Tiled UDIM image texture"},
61  {0, NULL, 0, NULL, NULL},
62 };
63 
64 #ifdef RNA_RUNTIME
65 
66 # include "BLI_math_base.h"
67 
68 # include "BKE_global.h"
69 
70 # include "GPU_texture.h"
71 
72 # include "IMB_imbuf.h"
73 # include "IMB_imbuf_types.h"
74 
75 # include "ED_node.h"
76 
77 static bool rna_Image_is_stereo_3d_get(PointerRNA *ptr)
78 {
79  return BKE_image_is_stereo((Image *)ptr->data);
80 }
81 
82 static bool rna_Image_is_multiview_get(PointerRNA *ptr)
83 {
85 }
86 
87 static bool rna_Image_dirty_get(PointerRNA *ptr)
88 {
89  return BKE_image_is_dirty((Image *)ptr->data);
90 }
91 
92 static void rna_Image_source_set(PointerRNA *ptr, int value)
93 {
94  Image *ima = (Image *)ptr->owner_id;
95 
96  if (value != ima->source) {
97  ima->source = value;
100  DEG_id_tag_update(&ima->id, 0);
103  }
104 }
105 
106 static void rna_Image_reload_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
107 {
108  Image *ima = (Image *)ptr->owner_id;
111  DEG_id_tag_update(&ima->id, 0);
113 }
114 
115 static void rna_Image_generated_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
116 {
117  Image *ima = (Image *)ptr->owner_id;
118  BKE_image_signal(bmain, ima, NULL, IMA_SIGNAL_FREE);
119 }
120 
121 static void rna_Image_colormanage_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
122 {
123  Image *ima = (Image *)ptr->owner_id;
125  DEG_id_tag_update(&ima->id, 0);
129 }
130 
131 static void rna_Image_alpha_mode_update(Main *bmain, Scene *scene, PointerRNA *ptr)
132 {
133  Image *ima = (Image *)ptr->owner_id;
134  /* When operating on a generated image, avoid re-generating when changing the alpha-mode
135  * as it doesn't impact generated images, causing them to reload pixel data, see T82785. */
136  if (ima->source == IMA_SRC_GENERATED) {
137  return;
138  }
139  rna_Image_colormanage_update(bmain, scene, ptr);
140 }
141 
142 static void rna_Image_views_format_update(Main *bmain, Scene *scene, PointerRNA *ptr)
143 {
144  Image *ima = (Image *)ptr->owner_id;
145  ImBuf *ibuf;
146  void *lock;
147 
148  ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
149 
150  if (ibuf) {
151  ImageUser iuser = {NULL};
152  iuser.scene = scene;
153  BKE_image_signal(bmain, ima, &iuser, IMA_SIGNAL_FREE);
154  }
155 
156  BKE_image_release_ibuf(ima, ibuf, lock);
157 }
158 
159 static void rna_ImageUser_update(Main *bmain, Scene *scene, PointerRNA *ptr)
160 {
161  ImageUser *iuser = ptr->data;
162  ID *id = ptr->owner_id;
163 
165 
166  if (id) {
167  if (GS(id->name) == ID_NT) {
168  /* Special update for nodetrees to find parent datablock. */
170  }
171  else {
172  /* Update material or texture for render preview. */
173  DEG_id_tag_update(id, 0);
175  }
176  }
177 }
178 
179 static void rna_ImageUser_relations_update(Main *bmain, Scene *scene, PointerRNA *ptr)
180 {
181  rna_ImageUser_update(bmain, scene, ptr);
183 }
184 
185 static char *rna_ImageUser_path(PointerRNA *ptr)
186 {
187  if (ptr->owner_id) {
188  /* ImageUser *iuser = ptr->data; */
189 
190  switch (GS(ptr->owner_id->name)) {
191  case ID_OB:
192  case ID_TE: {
193  return BLI_strdup("image_user");
194  }
195  case ID_NT: {
197  }
198  default:
199  break;
200  }
201  }
202 
203  return BLI_strdup("");
204 }
205 
206 static void rna_Image_gpu_texture_update(Main *UNUSED(bmain),
207  Scene *UNUSED(scene),
208  PointerRNA *ptr)
209 {
210  Image *ima = (Image *)ptr->owner_id;
211 
212  if (!G.background) {
214  }
215 
217 }
218 
219 static const EnumPropertyItem *rna_Image_source_itemf(bContext *UNUSED(C),
220  PointerRNA *ptr,
221  PropertyRNA *UNUSED(prop),
222  bool *r_free)
223 {
224  Image *ima = (Image *)ptr->data;
225  EnumPropertyItem *item = NULL;
226  int totitem = 0;
227 
228  if (ima->source == IMA_SRC_VIEWER) {
230  }
231  else {
237  }
238 
239  RNA_enum_item_end(&item, &totitem);
240  *r_free = true;
241 
242  return item;
243 }
244 
245 static int rna_Image_file_format_get(PointerRNA *ptr)
246 {
247  Image *image = (Image *)ptr->data;
248  ImBuf *ibuf = BKE_image_acquire_ibuf(image, NULL, NULL);
249  int imtype = BKE_image_ftype_to_imtype(ibuf ? ibuf->ftype : IMB_FTYPE_NONE,
250  ibuf ? &ibuf->foptions : NULL);
251 
252  BKE_image_release_ibuf(image, ibuf, NULL);
253 
254  return imtype;
255 }
256 
257 static void rna_Image_file_format_set(PointerRNA *ptr, int value)
258 {
259  Image *image = (Image *)ptr->data;
260  if (BKE_imtype_is_movie(value) == 0) { /* should be able to throw an error here */
262  int ftype = BKE_image_imtype_to_ftype(value, &options);
263  BKE_image_file_format_set(image, ftype, &options);
264  }
265 }
266 
267 static void rna_UDIMTile_label_get(PointerRNA *ptr, char *value)
268 {
269  ImageTile *tile = (ImageTile *)ptr->data;
270  Image *image = (Image *)ptr->owner_id;
271 
272  /* We don't know the length of the target string here, so we assume
273  * that it has been allocated according to what rna_UDIMTile_label_length returned. */
274  BKE_image_get_tile_label(image, tile, value, sizeof(tile->label));
275 }
276 
277 static int rna_UDIMTile_label_length(PointerRNA *ptr)
278 {
279  ImageTile *tile = (ImageTile *)ptr->data;
280  Image *image = (Image *)ptr->owner_id;
281 
282  char label[sizeof(tile->label)];
283  BKE_image_get_tile_label(image, tile, label, sizeof(label));
284 
285  return strlen(label);
286 }
287 
288 static void rna_UDIMTile_tile_number_set(PointerRNA *ptr, int value)
289 {
290  ImageTile *tile = (ImageTile *)ptr->data;
291  Image *image = (Image *)ptr->owner_id;
292 
293  /* The index of the first tile can't be changed. */
294  if (tile->tile_number == 1001) {
295  return;
296  }
297 
298  /* Check that no other tile already has that number. */
299  ImageTile *cur_tile = BKE_image_get_tile(image, value);
300  if (cur_tile == NULL || cur_tile == tile) {
301  tile->tile_number = value;
302  }
303 }
304 
305 static int rna_Image_active_tile_index_get(PointerRNA *ptr)
306 {
307  Image *image = (Image *)ptr->data;
308  return image->active_tile_index;
309 }
310 
311 static void rna_Image_active_tile_index_set(PointerRNA *ptr, int value)
312 {
313  Image *image = (Image *)ptr->data;
314  int num_tiles = BLI_listbase_count(&image->tiles);
315 
316  image->active_tile_index = min_ii(value, num_tiles - 1);
317 }
318 
319 static void rna_Image_active_tile_index_range(
320  PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
321 {
322  Image *image = (Image *)ptr->data;
323  int num_tiles = BLI_listbase_count(&image->tiles);
324 
325  *min = 0;
326  *max = max_ii(0, num_tiles - 1);
327 }
328 
329 static PointerRNA rna_Image_active_tile_get(PointerRNA *ptr)
330 {
331  Image *image = (Image *)ptr->data;
332  ImageTile *tile = BLI_findlink(&image->tiles, image->active_tile_index);
333 
334  return rna_pointer_inherit_refine(ptr, &RNA_UDIMTile, tile);
335 }
336 
337 static void rna_Image_active_tile_set(PointerRNA *ptr,
338  PointerRNA value,
339  struct ReportList *UNUSED(reports))
340 {
341  Image *image = (Image *)ptr->data;
342  ImageTile *tile = (ImageTile *)value.data;
343  const int index = BLI_findindex(&image->tiles, tile);
344  if (index != -1) {
345  image->active_tile_index = index;
346  }
347 }
348 
349 static bool rna_Image_has_data_get(PointerRNA *ptr)
350 {
351  Image *image = (Image *)ptr->data;
352 
353  return BKE_image_has_loaded_ibuf(image);
354 }
355 
356 static void rna_Image_size_get(PointerRNA *ptr, int *values)
357 {
358  Image *im = (Image *)ptr->data;
359  ImBuf *ibuf;
360  void *lock;
361 
362  ibuf = BKE_image_acquire_ibuf(im, NULL, &lock);
363  if (ibuf) {
364  values[0] = ibuf->x;
365  values[1] = ibuf->y;
366  }
367  else {
368  values[0] = 0;
369  values[1] = 0;
370  }
371 
372  BKE_image_release_ibuf(im, ibuf, lock);
373 }
374 
375 static void rna_Image_resolution_get(PointerRNA *ptr, float *values)
376 {
377  Image *im = (Image *)ptr->data;
378  ImBuf *ibuf;
379  void *lock;
380 
381  ibuf = BKE_image_acquire_ibuf(im, NULL, &lock);
382  if (ibuf) {
383  values[0] = ibuf->ppm[0];
384  values[1] = ibuf->ppm[1];
385  }
386  else {
387  values[0] = 0;
388  values[1] = 0;
389  }
390 
391  BKE_image_release_ibuf(im, ibuf, lock);
392 }
393 
394 static void rna_Image_resolution_set(PointerRNA *ptr, const float *values)
395 {
396  Image *im = (Image *)ptr->data;
397  ImBuf *ibuf;
398  void *lock;
399 
400  ibuf = BKE_image_acquire_ibuf(im, NULL, &lock);
401  if (ibuf) {
402  ibuf->ppm[0] = values[0];
403  ibuf->ppm[1] = values[1];
404  }
405 
406  BKE_image_release_ibuf(im, ibuf, lock);
407 }
408 
409 static int rna_Image_bindcode_get(PointerRNA *ptr)
410 {
411  Image *ima = (Image *)ptr->data;
414 }
415 
416 static int rna_Image_depth_get(PointerRNA *ptr)
417 {
418  Image *im = (Image *)ptr->data;
419  ImBuf *ibuf;
420  void *lock;
421  int planes;
422 
423  ibuf = BKE_image_acquire_ibuf(im, NULL, &lock);
424 
425  if (!ibuf) {
426  planes = 0;
427  }
428  else if (ibuf->rect_float) {
429  planes = ibuf->planes * 4;
430  }
431  else {
432  planes = ibuf->planes;
433  }
434 
435  BKE_image_release_ibuf(im, ibuf, lock);
436 
437  return planes;
438 }
439 
440 static int rna_Image_frame_duration_get(PointerRNA *ptr)
441 {
442  Image *ima = (Image *)ptr->owner_id;
443  int duration = 1;
444 
445  if (BKE_image_has_anim(ima)) {
446  struct anim *anim = ((ImageAnim *)ima->anims.first)->anim;
447  if (anim) {
449  }
450  }
451  else {
452  /* acquire ensures ima->anim is set, if possible! */
453  void *lock;
454  ImBuf *ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
455  BKE_image_release_ibuf(ima, ibuf, lock);
456  }
457 
458  return duration;
459 }
460 
461 static int rna_Image_pixels_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION])
462 {
463  Image *ima = (Image *)ptr->owner_id;
464  ImBuf *ibuf;
465  void *lock;
466 
467  ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
468 
469  if (ibuf) {
470  length[0] = ibuf->x * ibuf->y * ibuf->channels;
471  }
472  else {
473  length[0] = 0;
474  }
475 
476  BKE_image_release_ibuf(ima, ibuf, lock);
477 
478  return length[0];
479 }
480 
481 static void rna_Image_pixels_get(PointerRNA *ptr, float *values)
482 {
483  Image *ima = (Image *)ptr->owner_id;
484  ImBuf *ibuf;
485  void *lock;
486  int i, size;
487 
488  ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
489 
490  if (ibuf) {
491  size = ibuf->x * ibuf->y * ibuf->channels;
492 
493  if (ibuf->rect_float) {
494  memcpy(values, ibuf->rect_float, sizeof(float) * size);
495  }
496  else {
497  for (i = 0; i < size; i++) {
498  values[i] = ((unsigned char *)ibuf->rect)[i] * (1.0f / 255.0f);
499  }
500  }
501  }
502 
503  BKE_image_release_ibuf(ima, ibuf, lock);
504 }
505 
506 static void rna_Image_pixels_set(PointerRNA *ptr, const float *values)
507 {
508  Image *ima = (Image *)ptr->owner_id;
509  ImBuf *ibuf;
510  void *lock;
511  int i, size;
512 
513  ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
514 
515  if (ibuf) {
516  size = ibuf->x * ibuf->y * ibuf->channels;
517 
518  if (ibuf->rect_float) {
519  memcpy(ibuf->rect_float, values, sizeof(float) * size);
520  }
521  else {
522  for (i = 0; i < size; i++) {
523  ((unsigned char *)ibuf->rect)[i] = unit_float_to_uchar_clamp(values[i]);
524  }
525  }
526 
527  ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID | IB_MIPMAP_INVALID;
528  BKE_image_mark_dirty(ima, ibuf);
529  if (!G.background) {
531  }
533  }
534 
535  BKE_image_release_ibuf(ima, ibuf, lock);
536 }
537 
538 static int rna_Image_channels_get(PointerRNA *ptr)
539 {
540  Image *im = (Image *)ptr->data;
541  ImBuf *ibuf;
542  void *lock;
543  int channels = 0;
544 
545  ibuf = BKE_image_acquire_ibuf(im, NULL, &lock);
546  if (ibuf) {
547  channels = ibuf->channels;
548  }
549 
550  BKE_image_release_ibuf(im, ibuf, lock);
551 
552  return channels;
553 }
554 
555 static bool rna_Image_is_float_get(PointerRNA *ptr)
556 {
557  Image *im = (Image *)ptr->data;
558  ImBuf *ibuf;
559  void *lock;
560  bool is_float = false;
561 
562  ibuf = BKE_image_acquire_ibuf(im, NULL, &lock);
563  if (ibuf) {
564  is_float = ibuf->rect_float != NULL;
565  }
566 
567  BKE_image_release_ibuf(im, ibuf, lock);
568 
569  return is_float;
570 }
571 
572 static PointerRNA rna_Image_packed_file_get(PointerRNA *ptr)
573 {
574  Image *ima = (Image *)ptr->owner_id;
575 
577  ImagePackedFile *imapf = ima->packedfiles.first;
579  }
580  else {
581  return PointerRNA_NULL;
582  }
583 }
584 
585 static void rna_RenderSlot_clear(ID *id, RenderSlot *slot, ImageUser *iuser)
586 {
587  Image *image = (Image *)id;
588  int index = BLI_findindex(&image->renderslots, slot);
589  BKE_image_clear_renderslot(image, iuser, index);
590 
592 }
593 
594 static PointerRNA rna_render_slots_active_get(PointerRNA *ptr)
595 {
596  Image *image = (Image *)ptr->owner_id;
597  RenderSlot *render_slot = BKE_image_get_renderslot(image, image->render_slot);
598 
599  return rna_pointer_inherit_refine(ptr, &RNA_RenderSlot, render_slot);
600 }
601 
602 static void rna_render_slots_active_set(PointerRNA *ptr,
603  PointerRNA value,
604  struct ReportList *UNUSED(reports))
605 {
606  Image *image = (Image *)ptr->owner_id;
607  if (value.owner_id == &image->id) {
608  RenderSlot *slot = (RenderSlot *)value.data;
609  int index = BLI_findindex(&image->renderslots, slot);
610  if (index != -1) {
611  image->render_slot = index;
612  image->gpuflag |= IMA_GPU_REFRESH;
613  }
614  }
615 }
616 
617 static int rna_render_slots_active_index_get(PointerRNA *ptr)
618 {
619  Image *image = (Image *)ptr->owner_id;
620  return image->render_slot;
621 }
622 
623 static void rna_render_slots_active_index_set(PointerRNA *ptr, int value)
624 {
625  Image *image = (Image *)ptr->owner_id;
626  int num_slots = BLI_listbase_count(&image->renderslots);
627  image->render_slot = value;
628  image->gpuflag |= IMA_GPU_REFRESH;
629  CLAMP(image->render_slot, 0, num_slots - 1);
630 }
631 
632 static void rna_render_slots_active_index_range(
633  PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
634 {
635  Image *image = (Image *)ptr->owner_id;
636  *min = 0;
637  *max = max_ii(0, BLI_listbase_count(&image->renderslots) - 1);
638 }
639 
640 static ImageTile *rna_UDIMTile_new(Image *image, int tile_number, const char *label)
641 {
642  ImageTile *tile = BKE_image_add_tile(image, tile_number, label);
643 
645 
646  return tile;
647 }
648 
649 static void rna_UDIMTile_remove(Image *image, PointerRNA *ptr)
650 {
651  ImageTile *tile = (ImageTile *)ptr->data;
652  BKE_image_remove_tile(image, tile);
653 
655 }
656 
657 #else
658 
659 static void rna_def_imageuser(BlenderRNA *brna)
660 {
661  StructRNA *srna;
662  PropertyRNA *prop;
663 
664  srna = RNA_def_struct(brna, "ImageUser", NULL);
666  srna,
667  "Image User",
668  "Parameters defining how an Image data-block is used by another data-block");
669  RNA_def_struct_path_func(srna, "rna_ImageUser_path");
670 
671  prop = RNA_def_property(srna, "use_auto_refresh", PROP_BOOLEAN, PROP_NONE);
673  RNA_def_property_ui_text(prop, "Auto Refresh", "Always refresh image on frame changes");
674  RNA_def_property_update(prop, 0, "rna_ImageUser_relations_update");
676 
677  prop = RNA_def_property(srna, "frame_current", PROP_INT, PROP_TIME);
678  RNA_def_property_int_sdna(prop, NULL, "framenr");
681  prop, "Current Frame", "Current frame number in image sequence or movie");
682 
683  /* animation */
684  prop = RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE);
685  RNA_def_property_boolean_sdna(prop, NULL, "cycl", 0);
686  RNA_def_property_ui_text(prop, "Cyclic", "Cycle the images in the movie");
687  RNA_def_property_update(prop, 0, "rna_ImageUser_update");
689 
690  prop = RNA_def_property(srna, "frame_duration", PROP_INT, PROP_NONE);
691  RNA_def_property_int_sdna(prop, NULL, "frames");
693  RNA_def_property_ui_text(prop, "Frames", "Number of images of a movie to use");
694  RNA_def_property_update(prop, 0, "rna_ImageUser_update");
696 
697  prop = RNA_def_property(srna, "frame_offset", PROP_INT, PROP_NONE);
698  RNA_def_property_int_sdna(prop, NULL, "offset");
700  prop, "Offset", "Offset the number of the frame to use in the animation");
701  RNA_def_property_update(prop, 0, "rna_ImageUser_update");
702 
703  prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
704  RNA_def_property_int_sdna(prop, NULL, "sfra");
707  prop,
708  "Start Frame",
709  "Global starting frame of the movie/sequence, assuming first picture has a #1");
710  RNA_def_property_update(prop, 0, "rna_ImageUser_update");
712 
713  prop = RNA_def_property(srna, "multilayer_layer", PROP_INT, PROP_UNSIGNED);
714  RNA_def_property_int_sdna(prop, NULL, "layer");
715  RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* image_multi_cb */
716  RNA_def_property_ui_text(prop, "Layer", "Layer in multilayer image");
717 
718  prop = RNA_def_property(srna, "multilayer_pass", PROP_INT, PROP_UNSIGNED);
719  RNA_def_property_int_sdna(prop, NULL, "pass");
720  RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* image_multi_cb */
721  RNA_def_property_ui_text(prop, "Pass", "Pass in multilayer image");
722 
723  prop = RNA_def_property(srna, "multilayer_view", PROP_INT, PROP_UNSIGNED);
724  RNA_def_property_int_sdna(prop, NULL, "view");
725  RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* image_multi_cb */
726  RNA_def_property_ui_text(prop, "View", "View in multilayer image");
727 
728  prop = RNA_def_property(srna, "tile", PROP_INT, PROP_UNSIGNED);
729  RNA_def_property_int_sdna(prop, NULL, "tile");
731  RNA_def_property_ui_text(prop, "Tile", "Tile in tiled image");
732 }
733 
734 /* image.packed_files */
736 {
737  StructRNA *srna;
738  PropertyRNA *prop;
739 
740  srna = RNA_def_struct(brna, "ImagePackedFile", NULL);
741  RNA_def_struct_sdna(srna, "ImagePackedFile");
742 
743  prop = RNA_def_property(srna, "packed_file", PROP_POINTER, PROP_NONE);
744  RNA_def_property_pointer_sdna(prop, NULL, "packedfile");
745  RNA_def_property_ui_text(prop, "Packed File", "");
747 
748  prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
749  RNA_def_property_string_sdna(prop, NULL, "filepath");
750  RNA_def_struct_name_property(srna, prop);
751 
753 }
754 
755 static void rna_def_render_slot(BlenderRNA *brna)
756 {
757  StructRNA *srna;
758  PropertyRNA *prop, *parm;
759  FunctionRNA *func;
760 
761  srna = RNA_def_struct(brna, "RenderSlot", NULL);
762  RNA_def_struct_ui_text(srna, "Render Slot", "Parameters defining the render slot");
763 
764  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
765  RNA_def_property_string_sdna(prop, NULL, "name");
766  RNA_def_property_ui_text(prop, "Name", "Render slot name");
768 
769  func = RNA_def_function(srna, "clear", "rna_RenderSlot_clear");
771  RNA_def_function_ui_description(func, "Clear the render slot");
772  parm = RNA_def_pointer(func, "iuser", "ImageUser", "ImageUser", "");
774 }
775 
776 static void rna_def_render_slots(BlenderRNA *brna, PropertyRNA *cprop)
777 {
778  StructRNA *srna;
779  FunctionRNA *func;
780  PropertyRNA *prop, *parm;
781 
782  RNA_def_property_srna(cprop, "RenderSlots");
783  srna = RNA_def_struct(brna, "RenderSlots", NULL);
784  RNA_def_struct_sdna(srna, "Image");
785  RNA_def_struct_ui_text(srna, "Render Layers", "Collection of render layers");
786 
787  prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
788  RNA_def_property_int_sdna(prop, NULL, "render_slot");
790  "rna_render_slots_active_index_get",
791  "rna_render_slots_active_index_set",
792  "rna_render_slots_active_index_range");
793  RNA_def_property_ui_text(prop, "Active", "Active render slot of the image");
795 
796  prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
797  RNA_def_property_struct_type(prop, "RenderSlot");
799  prop, "rna_render_slots_active_get", "rna_render_slots_active_set", NULL, NULL);
801  RNA_def_property_ui_text(prop, "Active", "Active render slot of the image");
803 
804  func = RNA_def_function(srna, "new", "BKE_image_add_renderslot");
805  RNA_def_function_ui_description(func, "Add a render slot to the image");
806  parm = RNA_def_string(func, "name", NULL, 0, "Name", "New name for the render slot");
807  parm = RNA_def_pointer(func, "result", "RenderSlot", "", "Newly created render layer");
808  RNA_def_function_return(func, parm);
809 }
810 
811 static void rna_def_udim_tile(BlenderRNA *brna)
812 {
813  StructRNA *srna;
814  PropertyRNA *prop;
815 
816  srna = RNA_def_struct(brna, "UDIMTile", NULL);
817  RNA_def_struct_sdna(srna, "ImageTile");
818  RNA_def_struct_ui_text(srna, "UDIM Tile", "Properties of the UDIM tile");
819 
820  prop = RNA_def_property(srna, "label", PROP_STRING, PROP_NONE);
821  RNA_def_property_string_sdna(prop, NULL, "label");
822  RNA_def_property_ui_text(prop, "Label", "Tile label");
823  RNA_def_property_string_funcs(prop, "rna_UDIMTile_label_get", "rna_UDIMTile_label_length", NULL);
825 
826  prop = RNA_def_property(srna, "number", PROP_INT, PROP_NONE);
827  RNA_def_property_int_sdna(prop, NULL, "tile_number");
828  RNA_def_property_ui_text(prop, "Number", "Number of the position that this tile covers");
829  RNA_def_property_int_funcs(prop, NULL, "rna_UDIMTile_tile_number_set", NULL);
831 }
832 
833 static void rna_def_udim_tiles(BlenderRNA *brna, PropertyRNA *cprop)
834 {
835  StructRNA *srna;
836  PropertyRNA *prop;
837 
838  FunctionRNA *func;
839  PropertyRNA *parm;
840 
841  RNA_def_property_srna(cprop, "UDIMTiles");
842  srna = RNA_def_struct(brna, "UDIMTiles", NULL);
843  RNA_def_struct_sdna(srna, "Image");
844  RNA_def_struct_ui_text(srna, "UDIM Tiles", "Collection of UDIM tiles");
845 
846  prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
847  RNA_def_property_int_sdna(prop, NULL, "active_tile_index");
849  "rna_Image_active_tile_index_get",
850  "rna_Image_active_tile_index_set",
851  "rna_Image_active_tile_index_range");
852  RNA_def_property_ui_text(prop, "Active Tile Index", "Active index in tiles array");
853 
854  prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
855  RNA_def_property_struct_type(prop, "UDIMTile");
857  prop, "rna_Image_active_tile_get", "rna_Image_active_tile_set", NULL, NULL);
859  RNA_def_property_ui_text(prop, "Active Image Tile", "Active Image Tile");
860 
861  func = RNA_def_function(srna, "new", "rna_UDIMTile_new");
862  RNA_def_function_ui_description(func, "Add a tile to the image");
863  parm = RNA_def_int(
864  func, "tile_number", 1, 1, INT_MAX, "", "Number of the newly created tile", 1, 100);
866  parm = RNA_def_string(func, "label", NULL, 0, "", "Optional label for the tile");
867  parm = RNA_def_pointer(func, "result", "UDIMTile", "", "Newly created image tile");
868  RNA_def_function_return(func, parm);
869 
870  func = RNA_def_function(srna, "get", "BKE_image_get_tile");
871  RNA_def_function_ui_description(func, "Get a tile based on its tile number");
872  parm = RNA_def_int(func, "tile_number", 0, 0, INT_MAX, "", "Number of the tile", 0, 100);
874  parm = RNA_def_pointer(func, "result", "UDIMTile", "", "The tile");
875  RNA_def_function_return(func, parm);
876 
877  func = RNA_def_function(srna, "remove", "rna_UDIMTile_remove");
878  RNA_def_function_ui_description(func, "Remove an image tile");
879  parm = RNA_def_pointer(func, "tile", "UDIMTile", "", "Image tile to remove");
882 }
883 
884 static void rna_def_image(BlenderRNA *brna)
885 {
886  StructRNA *srna;
887  PropertyRNA *prop;
888  static const EnumPropertyItem prop_type_items[] = {
889  {IMA_TYPE_IMAGE, "IMAGE", 0, "Image", ""},
890  {IMA_TYPE_MULTILAYER, "MULTILAYER", 0, "Multilayer", ""},
891  {IMA_TYPE_UV_TEST, "UV_TEST", 0, "UV Test", ""},
892  {IMA_TYPE_R_RESULT, "RENDER_RESULT", 0, "Render Result", ""},
893  {IMA_TYPE_COMPOSITE, "COMPOSITING", 0, "Compositing", ""},
894  {0, NULL, 0, NULL, NULL},
895  };
896  static const EnumPropertyItem alpha_mode_items[] = {
898  "STRAIGHT",
899  0,
900  "Straight",
901  "Store RGB and alpha channels separately with alpha acting as a mask, also known as "
902  "unassociated alpha. Commonly used by image editing applications and file formats like "
903  "PNG"},
905  "PREMUL",
906  0,
907  "Premultiplied",
908  "Store RGB channels with alpha multiplied in, also known as associated alpha. The natural "
909  "format for renders and used by file formats like OpenEXR"},
911  "CHANNEL_PACKED",
912  0,
913  "Channel Packed",
914  "Different images are packed in the RGB and alpha channels, and they should not "
915  "affect each other. Channel packing is commonly used by game engines to save memory"},
917  "NONE",
918  0,
919  "None",
920  "Ignore alpha channel from the file and make image fully opaque"},
921  {0, NULL, 0, NULL, NULL},
922  };
923 
924  srna = RNA_def_struct(brna, "Image", "ID");
926  srna, "Image", "Image data-block referencing an external or packed image");
927  RNA_def_struct_ui_icon(srna, ICON_IMAGE_DATA);
928 
929  prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
931  RNA_def_property_string_sdna(prop, NULL, "filepath");
932  RNA_def_property_ui_text(prop, "File Name", "Image/Movie file name");
933  RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_reload_update");
934 
935  /* eek. this is horrible but needed so we can save to a new name without blanking the data :( */
936  prop = RNA_def_property(srna, "filepath_raw", PROP_STRING, PROP_FILEPATH);
937  RNA_def_property_string_sdna(prop, NULL, "filepath");
938  RNA_def_property_ui_text(prop, "File Name", "Image/Movie file name (without data refreshing)");
939 
940  prop = RNA_def_property(srna, "file_format", PROP_ENUM, PROP_NONE);
943  prop, "rna_Image_file_format_get", "rna_Image_file_format_set", NULL);
944  RNA_def_property_ui_text(prop, "File Format", "Format used for re-saving this file");
945 
946  prop = RNA_def_property(srna, "source", PROP_ENUM, PROP_NONE);
948  RNA_def_property_enum_funcs(prop, NULL, "rna_Image_source_set", "rna_Image_source_itemf");
949  RNA_def_property_ui_text(prop, "Source", "Where the image comes from");
951 
952  prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
953  RNA_def_property_enum_items(prop, prop_type_items);
955  RNA_def_property_ui_text(prop, "Type", "How to generate the image");
957 
958  prop = RNA_def_property(srna, "packed_file", PROP_POINTER, PROP_NONE);
959  RNA_def_property_struct_type(prop, "PackedFile");
960  RNA_def_property_pointer_sdna(prop, NULL, "packedfile");
961  RNA_def_property_pointer_funcs(prop, "rna_Image_packed_file_get", NULL, NULL, NULL);
962  RNA_def_property_ui_text(prop, "Packed File", "First packed file of the image");
963 
964  prop = RNA_def_property(srna, "packed_files", PROP_COLLECTION, PROP_NONE);
965  RNA_def_property_collection_sdna(prop, NULL, "packedfiles", NULL);
966  RNA_def_property_struct_type(prop, "ImagePackedFile");
968  RNA_def_property_ui_text(prop, "Packed Files", "Collection of packed images");
969 
970  prop = RNA_def_property(srna, "use_view_as_render", PROP_BOOLEAN, PROP_NONE);
974  prop,
975  "View as Render",
976  "Apply render part of display transformation when displaying this image on the screen");
978 
979  prop = RNA_def_property(srna, "use_deinterlace", PROP_BOOLEAN, PROP_NONE);
982  RNA_def_property_ui_text(prop, "Deinterlace", "Deinterlace movie file on load");
983  RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_reload_update");
984 
985  prop = RNA_def_property(srna, "use_multiview", PROP_BOOLEAN, PROP_NONE);
988  RNA_def_property_ui_text(prop, "Use Multi-View", "Use Multiple Views (when available)");
989  RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_views_format_update");
990 
991  prop = RNA_def_property(srna, "is_stereo_3d", PROP_BOOLEAN, PROP_NONE);
993  RNA_def_property_boolean_funcs(prop, "rna_Image_is_stereo_3d_get", NULL);
994  RNA_def_property_ui_text(prop, "Stereo 3D", "Image has left and right views");
996 
997  prop = RNA_def_property(srna, "is_multiview", PROP_BOOLEAN, PROP_NONE);
999  RNA_def_property_boolean_funcs(prop, "rna_Image_is_multiview_get", NULL);
1000  RNA_def_property_ui_text(prop, "Multiple Views", "Image has more than one view");
1002 
1003  prop = RNA_def_property(srna, "is_dirty", PROP_BOOLEAN, PROP_NONE);
1005  RNA_def_property_boolean_funcs(prop, "rna_Image_dirty_get", NULL);
1007  RNA_def_property_ui_text(prop, "Dirty", "Image has changed and is not saved");
1008 
1009  /* generated image (image_generated_change_cb) */
1010  prop = RNA_def_property(srna, "generated_type", PROP_ENUM, PROP_NONE);
1011  RNA_def_property_enum_sdna(prop, NULL, "gen_type");
1013  RNA_def_property_ui_text(prop, "Generated Type", "Generated image type");
1014  RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update");
1016 
1017  prop = RNA_def_property(srna, "generated_width", PROP_INT, PROP_PIXEL);
1018  RNA_def_property_int_sdna(prop, NULL, "gen_x");
1020  RNA_def_property_range(prop, 1, 65536);
1021  RNA_def_property_ui_text(prop, "Generated Width", "Generated image width");
1022  RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update");
1024 
1025  prop = RNA_def_property(srna, "generated_height", PROP_INT, PROP_PIXEL);
1026  RNA_def_property_int_sdna(prop, NULL, "gen_y");
1028  RNA_def_property_range(prop, 1, 65536);
1029  RNA_def_property_ui_text(prop, "Generated Height", "Generated image height");
1030  RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update");
1032 
1033  prop = RNA_def_property(srna, "use_generated_float", PROP_BOOLEAN, PROP_NONE);
1034  RNA_def_property_boolean_sdna(prop, NULL, "gen_flag", IMA_GEN_FLOAT);
1035  RNA_def_property_ui_text(prop, "Float Buffer", "Generate floating-point buffer");
1036  RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update");
1038 
1039  prop = RNA_def_property(srna, "generated_color", PROP_FLOAT, PROP_COLOR_GAMMA);
1040  RNA_def_property_float_sdna(prop, NULL, "gen_color");
1041  RNA_def_property_array(prop, 4);
1042  RNA_def_property_ui_text(prop, "Color", "Fill color for the generated image");
1043  RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update");
1045 
1046  prop = RNA_def_property(srna, "display_aspect", PROP_FLOAT, PROP_XYZ);
1048  RNA_def_property_float_sdna(prop, NULL, "aspx");
1049  RNA_def_property_array(prop, 2);
1050  RNA_def_property_range(prop, 0.1f, FLT_MAX);
1051  RNA_def_property_ui_range(prop, 0.1f, 5000.0f, 1, 2);
1053  prop, "Display Aspect", "Display Aspect for this image, does not affect rendering");
1055 
1056  prop = RNA_def_property(srna, "bindcode", PROP_INT, PROP_UNSIGNED);
1057  RNA_def_property_int_funcs(prop, "rna_Image_bindcode_get", NULL, NULL);
1059  RNA_def_property_ui_text(prop, "Bindcode", "OpenGL bindcode");
1061 
1062  prop = RNA_def_property(srna, "render_slots", PROP_COLLECTION, PROP_NONE);
1063  RNA_def_property_struct_type(prop, "RenderSlot");
1064  RNA_def_property_collection_sdna(prop, NULL, "renderslots", NULL);
1065  RNA_def_property_ui_text(prop, "Render Slots", "Render slots of the image");
1066  rna_def_render_slots(brna, prop);
1067 
1068  prop = RNA_def_property(srna, "tiles", PROP_COLLECTION, PROP_NONE);
1069  RNA_def_property_struct_type(prop, "UDIMTile");
1070  RNA_def_property_collection_sdna(prop, NULL, "tiles", NULL);
1071  RNA_def_property_ui_text(prop, "Image Tiles", "Tiles of the image");
1072  rna_def_udim_tiles(brna, prop);
1073 
1074  /*
1075  * Image.has_data and Image.depth are temporary,
1076  * Update import_obj.py when they are replaced (Arystan)
1077  */
1078  prop = RNA_def_property(srna, "has_data", PROP_BOOLEAN, PROP_NONE);
1079  RNA_def_property_boolean_funcs(prop, "rna_Image_has_data_get", NULL);
1081  RNA_def_property_ui_text(prop, "Has Data", "True if the image data is loaded into memory");
1082 
1083  prop = RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED);
1084  RNA_def_property_int_funcs(prop, "rna_Image_depth_get", NULL, NULL);
1085  RNA_def_property_ui_text(prop, "Depth", "Image bit depth");
1087 
1088  prop = RNA_def_int_vector(srna,
1089  "size",
1090  2,
1091  NULL,
1092  0,
1093  0,
1094  "Size",
1095  "Width and height in pixels, zero when image data cant be loaded",
1096  0,
1097  0);
1099  RNA_def_property_int_funcs(prop, "rna_Image_size_get", NULL, NULL);
1101 
1102  prop = RNA_def_float_vector(
1103  srna, "resolution", 2, NULL, 0, 0, "Resolution", "X/Y pixels per meter", 0, 0);
1105  RNA_def_property_float_funcs(prop, "rna_Image_resolution_get", "rna_Image_resolution_set", NULL);
1106 
1107  prop = RNA_def_property(srna, "frame_duration", PROP_INT, PROP_UNSIGNED);
1108  RNA_def_property_int_funcs(prop, "rna_Image_frame_duration_get", NULL, NULL);
1110  prop, "Duration", "Duration (in frames) of the image (1 when not a video/sequence)");
1112 
1113  /* NOTE about pixels/channels/is_float:
1114  * These properties describe how the image is stored internally (inside of ImBuf),
1115  * not how it was saved to disk or how it'll be saved on disk.
1116  */
1117  prop = RNA_def_property(srna, "pixels", PROP_FLOAT, PROP_NONE);
1120  RNA_def_property_ui_text(prop, "Pixels", "Image pixels in floating-point values");
1121  RNA_def_property_dynamic_array_funcs(prop, "rna_Image_pixels_get_length");
1122  RNA_def_property_float_funcs(prop, "rna_Image_pixels_get", "rna_Image_pixels_set", NULL);
1123 
1124  prop = RNA_def_property(srna, "channels", PROP_INT, PROP_UNSIGNED);
1125  RNA_def_property_int_funcs(prop, "rna_Image_channels_get", NULL, NULL);
1126  RNA_def_property_ui_text(prop, "Channels", "Number of channels in pixels buffer");
1128 
1129  prop = RNA_def_property(srna, "is_float", PROP_BOOLEAN, PROP_NONE);
1130  RNA_def_property_boolean_funcs(prop, "rna_Image_is_float_get", NULL);
1133  prop, "Is Float", "True if this image is stored in floating-point buffer");
1134 
1135  prop = RNA_def_property(srna, "colorspace_settings", PROP_POINTER, PROP_NONE);
1136  RNA_def_property_pointer_sdna(prop, NULL, "colorspace_settings");
1137  RNA_def_property_struct_type(prop, "ColorManagedInputColorspaceSettings");
1138  RNA_def_property_ui_text(prop, "Color Space Settings", "Input color space settings");
1139 
1140  prop = RNA_def_property(srna, "alpha_mode", PROP_ENUM, PROP_NONE);
1142  RNA_def_property_enum_items(prop, alpha_mode_items);
1144  "Alpha Mode",
1145  "Representation of alpha in the image file, to convert to and from "
1146  "when saving and loading the image");
1147  RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_alpha_mode_update");
1148 
1149  prop = RNA_def_property(srna, "use_half_precision", PROP_BOOLEAN, PROP_NONE);
1152  "Half Float Precision",
1153  "Use 16 bits per channel to lower the memory usage during rendering");
1154  RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_gpu_texture_update");
1155 
1156  /* multiview */
1157  prop = RNA_def_property(srna, "views_format", PROP_ENUM, PROP_NONE);
1159  RNA_def_property_enum_sdna(prop, NULL, "views_format");
1161  RNA_def_property_ui_text(prop, "Views Format", "Mode to load image views");
1162  RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_views_format_update");
1163 
1164  prop = RNA_def_property(srna, "stereo_3d_format", PROP_POINTER, PROP_NONE);
1165  RNA_def_property_pointer_sdna(prop, NULL, "stereo3d_format");
1167  RNA_def_property_struct_type(prop, "Stereo3dFormat");
1168  RNA_def_property_ui_text(prop, "Stereo 3D Format", "Settings for stereo 3d");
1169 
1170  RNA_api_image(srna);
1171 }
1172 
1174 {
1175  rna_def_render_slot(brna);
1176  rna_def_udim_tile(brna);
1177  rna_def_image(brna);
1178  rna_def_imageuser(brna);
1180 }
1181 
1182 #endif
#define G_MAIN
Definition: BKE_global.h:232
bool BKE_image_remove_tile(struct Image *ima, struct ImageTile *tile)
Definition: image.c:3765
void BKE_image_release_ibuf(struct Image *ima, struct ImBuf *ibuf, void *lock)
Definition: image.c:5113
bool BKE_image_is_stereo(struct Image *ima)
Definition: image.c:3889
bool BKE_image_has_packedfile(struct Image *image)
Definition: image.c:5627
struct ImBuf * BKE_image_acquire_ibuf(struct Image *ima, struct ImageUser *iuser, void **r_lock)
Definition: image.c:5100
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)
bool BKE_image_has_loaded_ibuf(struct Image *image)
Definition: image.c:5716
#define IMA_SIGNAL_COLORMANAGE
Definition: BKE_image.h:168
bool BKE_image_clear_renderslot(struct Image *ima, struct ImageUser *iuser, int slot)
Definition: image.c:5948
#define IMA_SIGNAL_FREE
Definition: BKE_image.h:163
void BKE_image_free_gputextures(struct Image *ima)
Definition: image_gpu.c:517
void BKE_image_mark_dirty(struct Image *image, struct ImBuf *ibuf)
#define IMA_SIGNAL_SRC_CHANGE
Definition: BKE_image.h:165
bool BKE_image_has_anim(struct Image *image)
Definition: image.c:5622
bool BKE_imtype_is_movie(const char imtype)
Definition: image.c:1443
bool BKE_image_is_dirty(struct Image *image)
Definition: image.c:5681
#define IMA_SIGNAL_RELOAD
Definition: BKE_image.h:162
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)
Definition: image.c:3499
int BKE_image_imtype_to_ftype(const char imtype, struct ImbFormatOptions *r_options)
Definition: image.c:1328
struct ImageTile * BKE_image_add_tile(struct Image *ima, int tile_number, const char *label)
Definition: image.c:3712
void BKE_image_user_frame_calc(struct Image *ima, struct ImageUser *iuser, int cfra)
Definition: image.c:5335
void BKE_image_get_tile_label(struct Image *ima, struct ImageTile *tile, char *label, int len_label)
Definition: image.c:3697
struct RenderSlot * BKE_image_get_renderslot(struct Image *ima, int index)
Definition: image.c:5976
bool BKE_id_is_in_global_main(struct ID *id)
Definition: lib_id.c:2287
#define BLI_assert(a)
Definition: BLI_assert.h:58
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:70
#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:648
@ ID_TE
Definition: DNA_ID_enums.h:64
@ ID_NT
Definition: DNA_ID_enums.h:80
@ ID_OB
Definition: DNA_ID_enums.h:59
@ IMA_DEINTERLACE
@ IMA_HIGH_BITDEPTH
@ IMA_USE_VIEWS
@ IMA_VIEW_AS_RENDER
@ IMA_GPU_REFRESH
#define IMA_ANIM_ALWAYS
@ IMA_GENTYPE_GRID_COLOR
@ IMA_GENTYPE_GRID
@ IMA_GENTYPE_BLANK
@ IMA_GEN_FLOAT
@ IMA_TYPE_MULTILAYER
@ IMA_TYPE_UV_TEST
@ IMA_TYPE_R_RESULT
@ IMA_TYPE_COMPOSITE
@ IMA_TYPE_IMAGE
@ 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
@ TEXTARGET_2D
#define MINAFRAME
#define MAXFRAMEF
#define MINAFRAMEF
#define MAXFRAME
void ED_node_tag_update_nodetree(struct Main *bmain, struct bNodeTree *ntree, struct bNode *node)
Definition: node_draw.cc:164
struct GPUTexture GPUTexture
Definition: GPU_texture.h:33
int GPU_texture_opengl_bindcode(const GPUTexture *tex)
Definition: gpu_texture.cc:585
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_MIPMAP_INVALID
@ IB_DISPLAY_BUFFER_INVALID
#define IMB_FTYPE_NONE
Group RGB to Bright Vector Camera CLAMP
StructRNA RNA_PackedFile
#define RNA_MAX_ARRAY_DIMENSION
Definition: RNA_define.h:42
@ PARM_RNAPTR
Definition: RNA_types.h:339
@ PARM_REQUIRED
Definition: RNA_types.h:337
@ FUNC_USE_SELF_ID
Definition: RNA_types.h:565
@ PROP_FLOAT
Definition: RNA_types.h:75
@ PROP_BOOLEAN
Definition: RNA_types.h:73
@ PROP_ENUM
Definition: RNA_types.h:77
@ PROP_INT
Definition: RNA_types.h:74
@ PROP_STRING
Definition: RNA_types.h:76
@ PROP_POINTER
Definition: RNA_types.h:78
@ PROP_COLLECTION
Definition: RNA_types.h:79
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
Definition: RNA_types.h:297
@ PROP_THICK_WRAP
Definition: RNA_types.h:270
@ PROP_DYNAMIC
Definition: RNA_types.h:275
@ PROP_ANIMATABLE
Definition: RNA_types.h:188
@ PROP_PROPORTIONAL
Definition: RNA_types.h:209
@ PROP_EDITABLE
Definition: RNA_types.h:175
@ PROP_NEVER_NULL
Definition: RNA_types.h:225
@ PROP_TIME
Definition: RNA_types.h:133
@ PROP_XYZ
Definition: RNA_types.h:148
@ PROP_PIXEL
Definition: RNA_types.h:128
@ PROP_NONE
Definition: RNA_types.h:113
@ PROP_COLOR_GAMMA
Definition: RNA_types.h:151
@ PROP_UNSIGNED
Definition: RNA_types.h:129
@ PROP_FILEPATH
Definition: RNA_types.h:116
#define C
Definition: RandGen.cpp:39
#define ND_DRAW
Definition: WM_types.h:362
#define ND_DISPLAY
Definition: WM_types.h:391
#define NA_EDITED
Definition: WM_types.h:462
#define NC_IMAGE
Definition: WM_types.h:285
return(oflags[bm->toolflag_index].f &oflag) !=0
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
SIMD_FORCE_INLINE btScalar length(const btQuaternion &q)
Return the length of a quaternion.
Definition: btQuaternion.h:895
short gpuflag
struct ListBase packedfiles
ListBase anims
ListBase renderslots
ListBase tiles
struct GPUTexture * gputexture[3][2]
short source
short render_slot
int active_tile_index
CCL_NAMESPACE_BEGIN struct Options options
const char * label
Scene scene
#define GS(x)
Definition: iris.c:241
MINLINE unsigned char unit_float_to_uchar_clamp(float val)
const PointerRNA PointerRNA_NULL
Definition: rna_access.c:71
PointerRNA rna_pointer_inherit_refine(PointerRNA *ptr, StructRNA *type, void *data)
Definition: rna_access.c:196
void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2762
void RNA_def_struct_path_func(StructRNA *srna, const char *path)
Definition: rna_define.c:1212
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
Definition: rna_define.c:4159
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t bit)
Definition: rna_define.c:2257
void RNA_def_parameter_clear_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
Definition: rna_define.c:1555
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
Definition: rna_define.c:3312
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
Definition: rna_define.c:4302
void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
Definition: rna_define.c:3153
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
Definition: rna_define.c:1676
void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2717
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier, const char *call)
Definition: rna_define.c:4262
void RNA_def_property_srna(PropertyRNA *prop, const char *type)
Definition: rna_define.c:3462
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
Definition: rna_define.c:1259
void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const char *set)
Definition: rna_define.c:2971
void RNA_def_property_dynamic_array_funcs(PropertyRNA *prop, const char *getlength)
Definition: rna_define.c:2953
void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, const int length[])
Definition: rna_define.c:1629
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:3851
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
Definition: rna_define.c:1892
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
Definition: rna_define.c:1067
void RNA_def_property_array(PropertyRNA *prop, int length)
Definition: rna_define.c:1568
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
Definition: rna_define.c:1757
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
Definition: rna_define.c:1792
void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, const char *propname, const char *lengthpropname)
Definition: rna_define.c:2791
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
Definition: rna_define.c:4337
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
Definition: rna_define.c:2927
void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char *set, const char *item)
Definition: rna_define.c:3251
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
Definition: rna_define.c:1279
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:3611
void RNA_enum_item_end(EnumPropertyItem **items, int *totitem)
Definition: rna_define.c:4470
void RNA_def_struct_name_property(struct StructRNA *srna, struct PropertyRNA *prop)
Definition: rna_define.c:1122
void RNA_def_function_flag(FunctionRNA *func, int flag)
Definition: rna_define.c:4332
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1517
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:3373
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
Definition: rna_define.c:1047
void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2623
void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
Definition: rna_define.c:3055
void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
Definition: rna_define.c:1267
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:3675
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1512
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:3585
void RNA_def_property_subtype(PropertyRNA *prop, PropertySubType subtype)
Definition: rna_define.c:1563
void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2515
void RNA_enum_items_add_value(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item, int value)
Definition: rna_define.c:4455
void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision)
Definition: rna_define.c:1706
void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2364
void RNA_def_property_boolean_negative_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
Definition: rna_define.c:2348
void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
Definition: rna_define.c:1525
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
Definition: rna_define.c:1547
void RNA_def_image(BlenderRNA *brna)
Definition: rna_image.c:1173
static void rna_def_image(BlenderRNA *brna)
Definition: rna_image.c:884
static void rna_def_render_slot(BlenderRNA *brna)
Definition: rna_image.c:755
static void rna_def_render_slots(BlenderRNA *brna, PropertyRNA *cprop)
Definition: rna_image.c:776
static const EnumPropertyItem image_source_items[]
Definition: rna_image.c:54
static void rna_def_image_packed_files(BlenderRNA *brna)
Definition: rna_image.c:735
static void rna_def_udim_tile(BlenderRNA *brna)
Definition: rna_image.c:811
static void rna_def_udim_tiles(BlenderRNA *brna, PropertyRNA *cprop)
Definition: rna_image.c:833
static void rna_def_imageuser(BlenderRNA *brna)
Definition: rna_image.c:659
const EnumPropertyItem rna_enum_image_generated_type_items[]
Definition: rna_image.c:43
void RNA_api_image(StructRNA *srna)
void RNA_api_image_packed_file(StructRNA *srna)
char * rna_Node_ImageUser_path(struct PointerRNA *ptr)
const EnumPropertyItem rna_enum_image_type_items[]
Definition: rna_scene.c:366
const EnumPropertyItem rna_enum_views_format_items[]
Definition: rna_scene.c:471
#define min(a, b)
Definition: sort.c:51
Definition: DNA_ID.h:273
char name[66]
Definition: DNA_ID.h:283
int channels
unsigned char planes
float * rect_float
double ppm[2]
struct PackedFile * packedfile
char label[64]
struct Scene * scene
void * first
Definition: DNA_listBase.h:47
Definition: BKE_main.h:116
void * data
Definition: RNA_types.h:52
struct ID * owner_id
Definition: RNA_types.h:50
struct RenderData r
Definition: IMB_anim.h:87
float max
#define G(x, y, z)
void WM_main_add_notifier(unsigned int type, void *reference)
PointerRNA * ptr
Definition: wm_files.c:3157