Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_image_api.c
| Show All 31 Lines | |||||
| #include <stdlib.h> | #include <stdlib.h> | ||||
| #include <stdio.h> | #include <stdio.h> | ||||
| #include <string.h> | #include <string.h> | ||||
| #include <time.h> | #include <time.h> | ||||
| #include "DNA_packedFile_types.h" | #include "DNA_packedFile_types.h" | ||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "BLI_path_util.h" | |||||
| #include "BIF_gl.h" | #include "BIF_gl.h" | ||||
| #include "RNA_define.h" | #include "RNA_define.h" | ||||
| #include "RNA_enum_types.h" | #include "RNA_enum_types.h" | ||||
| #include "rna_internal.h" /* own include */ | #include "rna_internal.h" /* own include */ | ||||
| ▲ Show 20 Lines • Show All 224 Lines • ▼ Show 20 Lines | |||||
| static void rna_Image_gl_free(Image *image) | static void rna_Image_gl_free(Image *image) | ||||
| { | { | ||||
| GPU_free_image(image); | GPU_free_image(image); | ||||
| /* remove the nocollect flag, image is available for garbage collection again */ | /* remove the nocollect flag, image is available for garbage collection again */ | ||||
| image->flag &= ~IMA_NOCOLLECT; | image->flag &= ~IMA_NOCOLLECT; | ||||
| } | } | ||||
| static void rna_Image_get_path_for_user(Image *image, ImageUser *image_user, char *filepath) | |||||
| { | |||||
| BKE_image_user_file_path(image_user, image, filepath); | |||||
| } | |||||
| #else | #else | ||||
| void RNA_api_image(StructRNA *srna) | void RNA_api_image(StructRNA *srna) | ||||
| { | { | ||||
| FunctionRNA *func; | FunctionRNA *func; | ||||
| PropertyRNA *parm; | PropertyRNA *parm; | ||||
| func = RNA_def_function(srna, "save_render", "rna_Image_save_render"); | func = RNA_def_function(srna, "save_render", "rna_Image_save_render"); | ||||
| ▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | void RNA_api_image(StructRNA *srna) | ||||
| /* return value */ | /* return value */ | ||||
| parm = RNA_def_int(func, "error", 0, -INT_MAX, INT_MAX, "Error", "OpenGL error value", -INT_MAX, INT_MAX); | parm = RNA_def_int(func, "error", 0, -INT_MAX, INT_MAX, "Error", "OpenGL error value", -INT_MAX, INT_MAX); | ||||
| RNA_def_function_return(func, parm); | RNA_def_function_return(func, parm); | ||||
| func = RNA_def_function(srna, "gl_free", "rna_Image_gl_free"); | func = RNA_def_function(srna, "gl_free", "rna_Image_gl_free"); | ||||
| RNA_def_function_ui_description(func, "Free the image from OpenGL graphics memory"); | RNA_def_function_ui_description(func, "Free the image from OpenGL graphics memory"); | ||||
| /* path to an frame specified by image user */ | |||||
| func = RNA_def_function(srna, "path_for_user", "rna_Image_get_path_for_user"); | |||||
| RNA_def_function_ui_description(func, "Return the absolute path to the filepath of an image frame specified by the image user"); | |||||
| RNA_def_pointer(func, "image_user", "ImageUser", "", "Image user of the image to get filepath for"); | |||||
| parm = RNA_def_string_file_path(func, "filepath", NULL, FILE_MAX, "File Path", | |||||
| "The resulting filepath from the image and it's user"); | |||||
| RNA_def_property_flag(parm, PROP_THICK_WRAP); /* needed for string return value */ | |||||
| RNA_def_function_output(func, parm); | |||||
| /* TODO, pack/unpack, maybe should be generic functions? */ | /* TODO, pack/unpack, maybe should be generic functions? */ | ||||
| } | } | ||||
| #endif | #endif | ||||