diff options
-rw-r--r-- | release/scripts/modules/bpy/path.py | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_image_api.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_main_api.c | 8 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene_api.c | 3 | ||||
-rw-r--r-- | source/blender/python/generic/py_capi_utils.c | 4 |
5 files changed, 11 insertions, 8 deletions
diff --git a/release/scripts/modules/bpy/path.py b/release/scripts/modules/bpy/path.py index e131be648ce..9a29b713882 100644 --- a/release/scripts/modules/bpy/path.py +++ b/release/scripts/modules/bpy/path.py @@ -129,7 +129,7 @@ def resolve_ncase(path): import os def _ncase_path_found(path): - if path == "" or os.path.exists(path): + if not path or os.path.exists(path): return path, True filename = os.path.basename(path) # filename may be a directory or a file diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c index 97da3ab4ad9..836faf1e9a9 100644 --- a/source/blender/makesrna/intern/rna_image_api.c +++ b/source/blender/makesrna/intern/rna_image_api.c @@ -198,7 +198,7 @@ void RNA_api_image(StructRNA *srna) func= RNA_def_function(srna, "save_render", "rna_Image_save_render"); RNA_def_function_ui_description(func, "Save image to a specific path using a scenes render settings"); RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS); - parm= RNA_def_string(func, "filepath", "", 0, "", "Save path."); + parm= RNA_def_string_file_path(func, "filepath", "", 0, "", "Save path."); RNA_def_property_flag(parm, PROP_REQUIRED); RNA_def_pointer(func, "scene", "Scene", "", "Scene to take image parameters from"); diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index 797baf07605..c13bfaca8bb 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -516,7 +516,7 @@ void RNA_api_main(StructRNA *srna) /* func= RNA_def_function(srna, "add_image", "rna_Main_add_image"); RNA_def_function_ui_description(func, "Add a new image."); - parm= RNA_def_string(func, "filepath", "", 0, "", "File path to load image from."); + parm= RNA_def_string_file_path(func, "filepath", "", 0, "", "File path to load image from."); RNA_def_property_flag(parm, PROP_REQUIRED); parm= RNA_def_pointer(func, "image", "Image", "", "New image."); RNA_def_function_return(func, parm); @@ -805,7 +805,7 @@ void RNA_def_main_images(BlenderRNA *brna, PropertyRNA *cprop) func= RNA_def_function(srna, "load", "rna_Main_images_load"); RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_function_ui_description(func, "Load a new image into the main database"); - parm= RNA_def_string(func, "filepath", "File Path", 0, "", "path of the file to load."); + parm= RNA_def_string_file_path(func, "filepath", "File Path", 0, "", "path of the file to load."); RNA_def_property_flag(parm, PROP_REQUIRED); /* return type */ parm= RNA_def_pointer(func, "image", "Image", "", "New image datablock."); @@ -921,7 +921,7 @@ void RNA_def_main_fonts(BlenderRNA *brna, PropertyRNA *cprop) func= RNA_def_function(srna, "load", "rna_Main_fonts_load"); RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_function_ui_description(func, "Load a new font into the main database"); - parm= RNA_def_string(func, "filepath", "File Path", 0, "", "path of the font to load."); + parm= RNA_def_string_file_path(func, "filepath", "File Path", 0, "", "path of the font to load."); RNA_def_property_flag(parm, PROP_REQUIRED); /* return type */ parm= RNA_def_pointer(func, "vfont", "VectorFont", "", "New font datablock."); @@ -1081,7 +1081,7 @@ void RNA_def_main_texts(BlenderRNA *brna, PropertyRNA *cprop) func= RNA_def_function(srna, "load", "rna_Main_texts_load"); RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_function_ui_description(func, "Add a new text to the main database from a file"); - parm= RNA_def_string(func, "filepath", "Path", FILE_MAXDIR + FILE_MAXFILE, "", "path for the datablock."); + parm= RNA_def_string_file_path(func, "filepath", "Path", FILE_MAXDIR + FILE_MAXFILE, "", "path for the datablock."); RNA_def_property_flag(parm, PROP_REQUIRED); /* return type */ parm= RNA_def_pointer(func, "text", "Text", "", "New text datablock."); diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c index fbba43e5932..31297d8a478 100644 --- a/source/blender/makesrna/intern/rna_scene_api.c +++ b/source/blender/makesrna/intern/rna_scene_api.c @@ -101,9 +101,8 @@ void RNA_api_scene_render(StructRNA *srna) func= RNA_def_function(srna, "frame_path", "rna_SceneRender_get_frame_path"); RNA_def_function_ui_description(func, "Return the absolute path to the filename to be written for a given frame."); RNA_def_int(func, "frame", INT_MIN, INT_MIN, INT_MAX, "", "Frame number to use, if unset the current frame will be used.", MINAFRAME, MAXFRAME); - parm= RNA_def_string(func, "filepath", "", FILE_MAX, "File Path", "the resulting filepath from the scenes render settings."); + parm= RNA_def_string_file_path(func, "filepath", "", FILE_MAX, "File Path", "the resulting filepath from the scenes render settings."); RNA_def_property_flag(parm, PROP_THICK_WRAP); /* needed for string return value */ - RNA_def_property_subtype(parm, PROP_FILEPATH); /* allow non utf8 */ RNA_def_function_output(func, parm); } diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c index 3fc1ec140c6..d29587a084b 100644 --- a/source/blender/python/generic/py_capi_utils.c +++ b/source/blender/python/generic/py_capi_utils.c @@ -228,6 +228,10 @@ const char *PyC_UnicodeAsByte(PyObject *py_str, PyObject **coerce) * chars since blender doesnt limit this */ return result; } + else if(PyBytes_Check(py_str)) { + PyErr_Clear(); + return PyBytes_AS_STRING(py_str); + } else { /* mostly copied from fileio.c's, fileio_init */ PyObject *stringobj; |