52static void rna_Image_save_render(
Image *image,
61 if (scene ==
nullptr) {
76 reports,
RPT_ERROR,
"Image '%s' could not be saved to '%s'", image->id.name + 2, path);
88static void rna_Image_save(
Image *image,
99 if (path && path[0]) {
108 "Image '%s' could not be saved to '%s'",
122static void rna_Image_pack(
128 char *data_dup =
static_cast<char *
>(
129 MEM_mallocN(
sizeof(*data_dup) * (
size_t)data_len, __func__));
130 memcpy(data_dup, data,
size_t(data_len));
164static void rna_Image_reload(
Image *image,
Main *bmain)
174 if (ibuf ==
nullptr) {
189static void rna_Image_scale(
194 iuser.framenr = frame;
197 if (
tile !=
nullptr) {
198 iuser.tile =
tile->tile_number;
210static int rna_Image_gl_load(
211 Image *image,
ReportList *reports,
int frame,
int layer_index,
int pass_index)
216 iuser.
layer = layer_index;
217 iuser.
pass = pass_index;
218 if (image->rr !=
nullptr) {
224 if (
tex ==
nullptr) {
233static int rna_Image_gl_touch(
234 Image *image,
ReportList *reports,
int frame,
int layer_index,
int pass_index)
241 error = rna_Image_gl_load(image, reports, frame, layer_index, pass_index);
247static void rna_Image_gl_free(
Image *image)
252 image->flag &= ~IMA_NOCOLLECT;
255static void rna_Image_filepath_from_user(
Image *image,
ImageUser *image_user,
char *filepath)
260static void rna_Image_buffers_free(
Image *image)
283 "Save image to a specific path using a scenes render settings");
287 RNA_def_pointer(func,
"scene",
"Scene",
"",
"Scene to take image parameters from");
294 "Quality for image formats that support lossy compression, uses default quality if "
307 "Output path, uses image data-block filepath if not specified");
314 "Quality for image formats that support lossy compression, uses default quality if "
330 "length of given data (mandatory if data is provided)",
351 parm =
RNA_def_int(func,
"width", 1, 1, INT_MAX,
"",
"Width", 1, INT_MAX);
353 parm =
RNA_def_int(func,
"height", 1, 1, INT_MAX,
"",
"Height", 1, INT_MAX);
355 RNA_def_int(func,
"frame", 0, 0, INT_MAX,
"Frame",
"Frame (for image sequences)", 0, INT_MAX);
357 func,
"tile_index", 0, 0, INT_MAX,
"Tile",
"Tile index (for tiled images)", 0, INT_MAX);
361 func,
"Delay the image from being cleaned from the cache due inactivity");
364 func,
"frame", 0, 0, INT_MAX,
"Frame",
"Frame of image sequence or movie", 0, INT_MAX);
371 "Index of layer that should be loaded",
380 "Index of pass that should be loaded",
385 func,
"error", 0, -INT_MAX, INT_MAX,
"Error",
"OpenGL error value", -INT_MAX, INT_MAX);
391 "Load the image into an OpenGL texture. On success, image.bindcode will contain the "
392 "OpenGL texture bindcode. Colors read from the texture will be in scene linear color space "
393 "and have premultiplied or straight alpha matching the image alpha mode.");
396 func,
"frame", 0, 0, INT_MAX,
"Frame",
"Frame of image sequence or movie", 0, INT_MAX);
403 "Index of layer that should be loaded",
412 "Index of pass that should be loaded",
417 func,
"error", 0, -INT_MAX, INT_MAX,
"Error",
"OpenGL error value", -INT_MAX, INT_MAX);
424 func =
RNA_def_function(srna,
"filepath_from_user",
"rna_Image_filepath_from_user");
427 "Return the absolute path to the filepath of an image frame specified by the image user");
429 func,
"image_user",
"ImageUser",
"",
"Image user of the image to get filepath for");
435 "The resulting filepath from the image and its user");
Scene * CTX_data_scene(const bContext *C)
Main * CTX_data_main(const bContext *C)
ImBuf * BKE_image_acquire_ibuf(Image *ima, ImageUser *iuser, void **r_lock)
bool BKE_image_scale(Image *image, int width, int height, ImageUser *iuser)
RenderPass * BKE_image_multilayer_index(RenderResult *rr, ImageUser *iuser)
void BKE_image_release_ibuf(Image *ima, ImBuf *ibuf, void *lock)
void BKE_image_user_file_path(const ImageUser *iuser, const Image *ima, char *filepath)
void BKE_image_tag_time(Image *ima)
bool BKE_image_memorypack(Image *ima)
void BKE_image_packfiles(ReportList *reports, Image *ima, const char *basepath)
void BKE_image_free_buffers_ex(Image *image, bool do_lock)
bool BKE_image_is_dirty(Image *image)
void BKE_imageuser_default(ImageUser *iuser)
void BKE_image_free_gputextures(Image *ima)
#define IMA_SIGNAL_RELOAD
bool BKE_image_has_packedfile(const Image *image)
GPUTexture * BKE_image_get_gpu_texture(Image *image, ImageUser *iuser)
void BKE_image_signal(Main *bmain, Image *ima, ImageUser *iuser, int signal)
void BKE_image_packfiles_from_mem(ReportList *reports, Image *ima, char *data, size_t data_len)
void BKE_image_partial_update_mark_full_update(Image *image)
Mark the whole image to be updated.
void BKE_image_free_packedfiles(Image *image)
bool BKE_image_save(ReportList *reports, Main *bmain, Image *ima, ImageUser *iuser, const ImageSaveOptions *opts)
bool BKE_image_save_options_init(ImageSaveOptions *opts, Main *bmain, Scene *scene, Image *ima, ImageUser *iuser, const bool guess_path, const bool save_as_render)
void BKE_image_save_options_free(ImageSaveOptions *opts)
const char * BKE_main_blendfile_path(const Main *bmain) ATTR_NONNULL()
int BKE_packedfile_unpack_image(Main *bmain, ReportList *reports, Image *ima, enum ePF_FileStatus how)
int BKE_packedfile_write_to_file(ReportList *reports, const char *ref_file_name, const char *filepath_rel, PackedFile *pf)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BKE_report(ReportList *reports, eReportType type, const char *message)
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE int clamp_i(int value, int min, int max)
#define STRNCPY(dst, src)
#define ID_BLEND_PATH(_bmain, _id)
#define ID_IS_EDITABLE(_id)
void IMB_rect_from_float(ImBuf *ibuf)
@ IB_DISPLAY_BUFFER_INVALID
Read Guarded memory(de)allocation.
ccl_global const KernelWorkTile * tile
void *(* MEM_mallocN)(size_t len, const char *str)
static void error(const char *str)
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier, const char *call)
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
void RNA_def_function_flag(FunctionRNA *func, int flag)
PropertyRNA * RNA_def_string_file_path(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, const int maxlen, const char *ui_name, const char *ui_description)
void RNA_def_function_output(FunctionRNA *, PropertyRNA *ret)
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)
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
void RNA_api_image(StructRNA *srna)
void RNA_api_image_packed_file(StructRNA *srna)
const EnumPropertyItem rna_enum_unpack_method_items[]
ImBufByteBuffer byte_buffer
struct PackedFile * packedfile
ImageFormatData im_format
void WM_main_add_notifier(uint type, void *reference)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)