Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArystanbek Dyussenov <arystan.d@gmail.com>2009-08-03 16:02:40 +0400
committerArystanbek Dyussenov <arystan.d@gmail.com>2009-08-03 16:02:40 +0400
commit4086ca58e275816a49950f6ac0cbffa6cb36a8ad (patch)
tree2fec7b9f9aba7fac9ab95e43de28c48c812e2ace /source/blender/makesrna/intern/rna_image_api.c
parentd1e42cc5f85a6665e85a388763696fd291b86db8 (diff)
- re-wrote image exporting function renaming it from BKE_export_image to BKE_get_image_export_path because now it doesn't copy
files but only manipulates paths. It produces both ablsolute and relative paths. COLLADA exporter can now use it. - re-wrote unit test for it, this is now more compact and readable - RNA API Image.get_export_path takes a boolean arg to indicate whether a relative or absolute path should be returned. Python scripts can now use it.
Diffstat (limited to 'source/blender/makesrna/intern/rna_image_api.c')
-rw-r--r--source/blender/makesrna/intern/rna_image_api.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c
index 42ee2b64c7a..20770ef2957 100644
--- a/source/blender/makesrna/intern/rna_image_api.c
+++ b/source/blender/makesrna/intern/rna_image_api.c
@@ -41,12 +41,12 @@
#include "BKE_utildefines.h"
#include "BKE_image.h"
-static char *rna_Image_export(Image *image, char *dest_dir)
+static char *rna_Image_get_export_path(Image *image, char *dest_dir, int rel)
{
int length = FILE_MAX;
char *path= MEM_callocN(length, "image file path");
- if (!BKE_export_image(image, dest_dir, path, length)) {
+ if (!BKE_get_image_export_path(image, dest_dir, rel ? NULL : path, length, rel ? path : NULL, length )) {
MEM_freeN(path);
return NULL;
}
@@ -61,11 +61,13 @@ void RNA_api_image(StructRNA *srna)
FunctionRNA *func;
PropertyRNA *parm;
- func= RNA_def_function(srna, "export", "rna_Image_export");
- RNA_def_function_ui_description(func, "Copy image file to a directory rebuilding subdirectory structure.");
+ func= RNA_def_function(srna, "export", "rna_Image_get_export_path");
+ RNA_def_function_ui_description(func, "Produce image export path.");
parm= RNA_def_string(func, "dest_dir", "", 0, "", "Destination directory.");
RNA_def_property_flag(parm, PROP_REQUIRED);
- parm= RNA_def_string(func, "path", "", 0, "", "Absolute file path of copied image.");
+ parm= RNA_def_boolean(func, "get_rel_path", 1, "", "Return relative path if True.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ parm= RNA_def_string(func, "path", "", 0, "", "Absolute export path.");
RNA_def_function_return(func, parm);
}