28 {
IMA_GENTYPE_GRID,
"UV_GRID", 0,
"UV Grid",
"Generated grid to test UV mappings"},
33 "Generated improved UV grid to test UV mappings"},
34 {0,
nullptr, 0,
nullptr,
nullptr},
38 {
IMA_SRC_FILE,
"FILE", 0,
"Single Image",
"Single image file"},
39 {
IMA_SRC_SEQUENCE,
"SEQUENCE", 0,
"Image Sequence",
"Multiple image files, as a sequence"},
42 {
IMA_SRC_VIEWER,
"VIEWER", 0,
"Viewer",
"Compositing node viewer"},
43 {
IMA_SRC_TILED,
"TILED", 0,
"UDIM Tiles",
"Tiled UDIM image texture"},
44 {0,
nullptr, 0,
nullptr,
nullptr},
52# include <fmt/format.h>
88 Image *
image = id_cast<Image *>(value.owner_id);
92static bool rna_Image_is_stereo_3d_get(
PointerRNA *ptr)
97static bool rna_Image_is_multiview_get(
PointerRNA *ptr)
102static bool rna_Image_dirty_get(
PointerRNA *ptr)
107static void rna_Image_source_set(
PointerRNA *ptr,
int value)
109 Image *ima = id_cast<Image *>(ptr->owner_id);
111 if (value != ima->source) {
127 Image *ima = id_cast<Image *>(ptr->owner_id);
134static int rna_Image_generated_type_get(
PointerRNA *ptr)
138 return base_tile->gen_type;
141static void rna_Image_generated_type_set(
PointerRNA *ptr,
int value)
148static int rna_Image_generated_width_get(
PointerRNA *ptr)
152 return base_tile->gen_x;
155static void rna_Image_generated_width_set(
PointerRNA *ptr,
int value)
159 base_tile->gen_x = std::clamp(value, 1, 65536);
162static int rna_Image_generated_height_get(
PointerRNA *ptr)
166 return base_tile->gen_y;
169static void rna_Image_generated_height_set(
PointerRNA *ptr,
int value)
173 base_tile->gen_y = std::clamp(value, 1, 65536);
176static bool rna_Image_generated_float_get(
PointerRNA *ptr)
183static void rna_Image_generated_float_set(
PointerRNA *ptr,
bool value)
195void rna_Image_generated_color_get(
PointerRNA *ptr,
float values[4])
202void rna_Image_generated_color_set(
PointerRNA *ptr,
const float values[4])
206 for (
uint i = 0; i < 4; i++) {
207 base_tile->gen_color[i] = std::clamp(values[i], 0.0f,
FLT_MAX);
213 Image *ima = id_cast<Image *>(ptr->owner_id);
220 Image *ima = id_cast<Image *>(ptr->owner_id);
230 Image *ima = id_cast<Image *>(ptr->owner_id);
236 rna_Image_colormanage_update(bmain, scene, ptr);
241 Image *ima = id_cast<Image *>(ptr->owner_id);
260 ID *
id = ptr->owner_id;
262 if (scene !=
nullptr) {
282 rna_ImageUser_update(bmain, scene, ptr);
286static std::optional<std::string> rna_ImageUser_path(
const PointerRNA *ptr)
289 switch (
GS(ptr->owner_id->name)) {
298 const bScreen *screen =
reinterpret_cast<bScreen *
>(ptr->owner_id);
301 for (
const auto [area_index, area] : screen->areabase.enumerate()) {
302 for (
const auto [space_index, sl] : area.spacedata.enumerate()) {
305 if (&sima->iuser == iuser) {
306 return fmt::format(
"areas[{}].spaces[{}].image_user", area_index, space_index);
311 return " ... image_user";
323 Image *ima = id_cast<Image *>(ptr->owner_id);
356static int rna_Image_file_format_get(
PointerRNA *ptr)
361 ibuf ? &ibuf->foptions :
nullptr);
368static void rna_Image_file_format_set(
PointerRNA *ptr,
int value)
378static void rna_UDIMTile_size_get(
PointerRNA *ptr,
int *values)
381 Image *
image = id_cast<Image *>(ptr->owner_id);
385 image_user.tile =
tile->tile_number;
401static int rna_UDIMTile_channels_get(
PointerRNA *ptr)
404 Image *
image = id_cast<Image *>(ptr->owner_id);
408 image_user.tile =
tile->tile_number;
415 channels = ibuf->channels;
423static void rna_UDIMTile_label_get(
PointerRNA *ptr,
char *value)
426 const Image *
image = id_cast<Image *>(ptr->owner_id);
429 char value_buf[
sizeof(
tile->label)];
431 memcpy(value, value_buf,
len + 1);
434static int rna_UDIMTile_label_length(
PointerRNA *ptr)
437 const Image *
image = id_cast<Image *>(ptr->owner_id);
439 char label[
sizeof(
tile->label)];
443static void rna_UDIMTile_tile_number_set(
PointerRNA *ptr,
int value)
446 Image *
image = id_cast<Image *>(ptr->owner_id);
450 if (cur_tile ==
nullptr) {
457 Image *ima = id_cast<Image *>(ptr->owner_id);
466static int rna_Image_active_tile_index_get(
PointerRNA *ptr)
469 return image->active_tile_index;
472static void rna_Image_active_tile_index_set(
PointerRNA *ptr,
int value)
480static void rna_Image_active_tile_index_range(
509static bool rna_Image_has_data_get(
PointerRNA *ptr)
516static void rna_Image_size_get(
PointerRNA *ptr,
int *values)
535static void rna_Image_resolution_get(
PointerRNA *ptr,
float *values)
543 values[0] = ibuf->ppm[0];
544 values[1] = ibuf->ppm[1];
554static void rna_Image_resolution_set(
PointerRNA *ptr,
const float *values)
562 ibuf->ppm[0] = values[0];
563 ibuf->ppm[1] = values[1];
569static int rna_Image_depth_get(
PointerRNA *ptr)
579 else if (ibuf->float_data()) {
580 depth = ibuf->color_mode_channels_get() * 8 * 4;
583 depth = ibuf->color_mode_channels_get() * 8;
591static int rna_Image_frame_duration_get(
PointerRNA *ptr)
593 Image *ima = id_cast<Image *>(ptr->owner_id);
615 Image *ima = id_cast<Image *>(ptr->owner_id);
633static void rna_Image_pixels_get(
PointerRNA *ptr,
float *values)
635 Image *ima = id_cast<Image *>(ptr->owner_id);
644 if (ibuf->float_data()) {
645 memcpy(values, ibuf->float_data(),
sizeof(
float) * size);
648 const uchar *byte_data = ibuf->byte_data();
649 for (
size_t i = 0; i <
size; i++) {
650 values[i] = byte_data[i] * (1.0f / 255.0f);
658static void rna_Image_pixels_set(
PointerRNA *ptr,
const float *values)
660 Image *ima = id_cast<Image *>(ptr->owner_id);
669 if (
float *float_data = ibuf->float_data_for_write()) {
670 memcpy(float_data, values,
sizeof(
float) * size);
673 uchar *byte_data = ibuf->byte_data_for_write();
674 for (
size_t i = 0; i <
size; i++) {
690static int rna_Image_channels_get(
PointerRNA *ptr)
699 channels = ibuf->channels;
707static bool rna_Image_is_float_get(
PointerRNA *ptr)
712 bool is_float =
false;
716 is_float = ibuf->float_data() !=
nullptr;
726 Image *ima = id_cast<Image *>(ptr->owner_id);
746 Image *
image = id_cast<Image *>(ptr->owner_id);
752static void rna_render_slots_active_set(
PointerRNA *ptr,
756 Image *
image = id_cast<Image *>(ptr->owner_id);
757 if (value.owner_id == &
image->id) {
766static int rna_render_slots_active_index_get(
PointerRNA *ptr)
768 Image *
image = id_cast<Image *>(ptr->owner_id);
769 return image->render_slot;
772static void rna_render_slots_active_index_set(
PointerRNA *ptr,
int value)
774 Image *
image = id_cast<Image *>(ptr->owner_id);
775 int num_slots =
image->renderslots.count();
776 image->render_slot = value;
780static void rna_render_slots_active_index_range(
783 Image *
image = id_cast<Image *>(ptr->owner_id);
820 "Parameters defining how an Image data-block is used by another data-block");
835 prop,
"Current Frame",
"Current frame number in image sequence or movie");
854 prop,
"Offset",
"Offset the number of the frame to use in the animation");
863 "Global starting frame of the movie/sequence, assuming first picture has a #1");
957 "rna_render_slots_active_index_get",
958 "rna_render_slots_active_index_set",
959 "rna_render_slots_active_index_range");
966 prop,
"rna_render_slots_active_get",
"rna_render_slots_active_set",
nullptr,
nullptr);
973 parm =
RNA_def_string(func,
"name",
nullptr, 0,
"Name",
"New name for the render slot");
974 parm =
RNA_def_pointer(func,
"result",
"RenderSlot",
"",
"Newly created render layer");
992 prop,
"rna_UDIMTile_label_get",
"rna_UDIMTile_label_length",
nullptr);
1009 "Width and height of the tile buffer in pixels, zero when image data cannot be loaded",
1080 "rna_Image_active_tile_index_get",
1081 "rna_Image_active_tile_index_set",
1082 "rna_Image_active_tile_index_range");
1088 prop,
"rna_Image_active_tile_get",
"rna_Image_active_tile_set",
nullptr,
nullptr);
1095 func,
"tile_number", 1, 1,
INT_MAX,
"",
"Number of the newly created tile", 1, 100);
1097 parm =
RNA_def_string(func,
"label",
nullptr, 0,
"",
"Optional label for the tile");
1098 parm =
RNA_def_pointer(func,
"result",
"UDIMTile",
"",
"Newly created image tile");
1103 parm =
RNA_def_int(func,
"tile_number", 0, 0,
INT_MAX,
"",
"Number of the tile", 0, 100);
1110 parm =
RNA_def_pointer(func,
"tile",
"UDIMTile",
"",
"Image tile to remove");
1125 {0,
nullptr, 0,
nullptr,
nullptr},
1132 "Store RGB and alpha channels separately with alpha acting as a mask, also known as "
1133 "unassociated alpha. Commonly used by image editing applications and file formats like "
1139 "Store RGB channels with alpha multiplied in, also known as associated alpha. The natural "
1140 "format for renders and used by file formats like OpenEXR."},
1145 "Different images are packed in the RGB and alpha channels, and they should not "
1146 "affect each other. Channel packing is commonly used by game engines to save memory."},
1151 "Ignore alpha channel from the file and make image fully opaque"},
1152 {0,
nullptr, 0,
nullptr,
nullptr},
1157 srna,
"Image",
"Image data-block referencing an external or packed image");
1176 prop,
"rna_Image_file_format_get",
"rna_Image_file_format_set",
nullptr);
1210 "Apply render part of display transformation when displaying this image on the screen");
1249 prop,
"rna_Image_generated_type_get",
"rna_Image_generated_type_set",
nullptr);
1259 prop,
"rna_Image_generated_width_get",
"rna_Image_generated_width_set",
nullptr);
1269 prop,
"rna_Image_generated_height_get",
"rna_Image_generated_height_set",
nullptr);
1277 prop,
"rna_Image_generated_float_get",
"rna_Image_generated_float_set");
1286 prop,
"rna_Image_generated_color_get",
"rna_Image_generated_color_set",
nullptr);
1297 prop,
"Display Aspect",
"Display Aspect for this image, does not affect rendering");
1330 "Width and height of the image buffer in pixels, zero when image data cannot be loaded",
1344 "X/Y pixels per meter, for the image buffer",
1349 prop,
"rna_Image_resolution_get",
"rna_Image_resolution_set",
nullptr);
1354 prop,
"Duration",
"Duration (in frames) of the image (1 when not a video/sequence)");
1377 prop,
"Is Float",
"True if this image is stored in floating-point buffer");
1389 "Representation of alpha in the image file, to convert to and from "
1390 "when saving and loading the image");
1396 "Half Float Precision",
1397 "Use 16 bits per channel to lower the memory usage during rendering."
1398 "\nNote: Not supported by Cycles");
1405 "Margin to take into account when fixing UV seams during painting. Higher "
1406 "number would improve seam-fixes for mipmaps, but decreases performance.");
#define IMA_SIGNAL_COLORMANAGE
#define IMA_SIGNAL_SRC_CHANGE
#define IMA_SIGNAL_RELOAD
#define BLT_I18NCONTEXT_ID_IMAGE
#define RNA_MAX_ARRAY_DIMENSION
SIMD_FORCE_INLINE btScalar length() const
Return the length of the vector.
CCL_NAMESPACE_BEGIN struct Options options
ccl_gpu_kernel_postfix ccl_global KernelWorkTile const int num_tiles
const ccl_global KernelWorkTile * tile
ccl_device_inline dual1 len(const ccl_private dual< T > &a)
int size(const AssetLibraryReference *library_reference)
bool BKE_image_is_multiview(const Image *ima)
void WM_main_add_notifier(uint type, void *reference)
void BKE_image_user_frame_calc(Image *ima, ImageUser *iuser, int cfra)
void RNA_def_property_srna(PropertyRNA *prop, const char *type)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
void RNA_def_property_dynamic_array_funcs(PropertyRNA *prop, const char *getlength)
void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, const char *propname)
MINLINE unsigned char unit_float_to_uchar_clamp(float val)
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, const int maxlen, const char *ui_name, const char *ui_description)
@ IMA_ALPHA_CHANNEL_PACKED
void RNA_def_property_boolean_negative_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
bool BKE_image_is_dirty(Image *image)
bool BKE_image_clear_renderslot(Image *ima, ImageUser *iuser, int slot)
void RNA_api_image_packed_file(StructRNA *srna)
void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set, const char *type_fn, const char *poll)
void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, const char *propname, const char *lengthpropname)
void BKE_image_signal(Main *bmain, Image *ima, ImageUser *iuser, int signal)
size_t IMB_get_pixel_count(const ImBuf *ibuf)
Get the length of the data of the given image buffer in pixels.
bool BKE_image_has_loaded_ibuf(Image *image)
void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const char *set)
void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, const int length[])
void BKE_image_free_gpu_texture_caches(Image *ima)
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
void IMB_mark_dirty(ImBuf *ibuf)
bool BKE_image_fill_tile(Image *ima, ImageTile *tile)
void RNA_define_lib_overridable(const bool make_overridable)
ImageTile * BKE_image_get_tile(Image *ima, int tile_number)
PropertyRNA * RNA_def_int_vector(StructOrFunctionRNA *cont_, const char *identifier, const int len, const int *default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
eImbFileType BKE_imtype_to_ftype(char imtype, ImbFormatOptions *r_options)
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
static void rna_def_image_packed_files(BlenderRNA *brna)
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
static const EnumPropertyItem image_source_items[]
MINLINE int max_ii(int a, int b)
static void rna_def_render_slots(BlenderRNA *brna, PropertyRNA *cprop)
ImageTile * BKE_image_add_tile(Image *ima, int tile_number, const char *label)
void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision)
void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
PropertyRNA * RNA_def_float_vector(StructOrFunctionRNA *cont_, const char *identifier, const int len, const float *default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier_c_str, int type, int subtype)
void * BLI_findlink(const ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
void RNA_def_parameter_clear_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
bool BKE_image_remove_tile(Image *ima, ImageTile *tile)
const EnumPropertyItem rna_enum_image_type_all_items[]
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
bool BKE_image_is_stereo(const Image *ima)
void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void DEG_id_tag_update(ID *id, unsigned int flags)
void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
void BKE_main_ensure_invariants(Main &bmain, std::optional< Span< ID * > > modified_ids=std::nullopt)
void BKE_ntree_update_tag_image_user_changed(bNodeTree *ntree, ImageUser *iuser)
void RNA_def_struct_path_func(StructRNA *srna, const char *path)
bool rna_Image_no_renderresult_or_viewer_poll(PointerRNA *ptr, const PointerRNA value)
RenderSlot * BKE_image_get_renderslot(Image *ima, int index)
void RNA_def_property_subtype(PropertyRNA *prop, PropertySubType subtype)
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
const EnumPropertyItem rna_enum_views_format_items[]
bool BKE_image_has_anim(Image *image)
static void rna_def_udim_tile(BlenderRNA *brna)
void RNA_enum_items_add_value(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item, int value)
void IMB_partial_update_mark_full(ImBuf *ibuf)
void RNA_enum_item_end(EnumPropertyItem **items, int *totitem)
void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char *set, const char *item)
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier_c_str, const char *call)
void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
bool BKE_imtype_is_movie(char imtype)
static void rna_def_imageuser(BlenderRNA *brna)
ImBuf * BKE_image_acquire_ibuf(Image *ima, ImageUser *iuser, void **r_lock)
void RNA_def_function_flag(FunctionRNA *func, FunctionFlag flag)
char BKE_ftype_to_imtype(eImbFileType ftype, const ImbFormatOptions *options)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, const int default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
static void rna_def_udim_tiles(BlenderRNA *brna, PropertyRNA *cprop)
void RNA_def_image(BlenderRNA *brna)
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
int BKE_image_get_tile_label(const Image *ima, const ImageTile *tile, char *label, int label_maxncpy)
ID_Type GS(const char *name)
@ PROP_PATH_SUPPORTS_BLEND_RELATIVE
void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
PointerRNA RNA_pointer_create_with_parent(const PointerRNA &parent, StructRNA *type, void *data)
void DEG_relations_tag_update(Main *bmain)
static void rna_def_render_slot(BlenderRNA *brna)
MINLINE void copy_v4_v4(float r[4], const float a[4])
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
void BKE_image_reassign_tile(Image *ima, ImageTile *tile, int new_tile_number)
bool BKE_image_has_packedfile(const Image *image)
std::optional< std::string > rna_CameraBackgroundImage_image_or_movieclip_user_path(const PointerRNA *ptr)
int MOV_get_duration_frames(const MovieReader *anim)
const EnumPropertyItem rna_enum_image_generated_type_items[]
void RNA_api_image(StructRNA *srna)
void BKE_image_file_format_set(Image *image, eImbFileType ftype, const ImbFormatOptions *options)
void RNA_def_struct_name_property(StructRNA *srna, PropertyRNA *prop, const bool allow_replace)
void BKE_imageuser_default(ImageUser *iuser)
MINLINE int min_ii(int a, int b)
bool BKE_id_is_in_global_main(ID *id)
void RNA_def_property_array(PropertyRNA *prop, int length)
static void rna_def_image(BlenderRNA *brna)
std::optional< std::string > rna_Node_ImageUser_path(const PointerRNA *ptr)
void BKE_image_release_ibuf(Image *ima, ImBuf *ibuf, void *lock)