diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-07-03 21:47:06 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-07-03 21:47:06 +0400 |
commit | 80f6102629b746ea520d3ec54aaa6414c669a998 (patch) | |
tree | 8d254cc92120eca8be6ef5b92af7be3c3626f202 /source/blender/editors/space_node | |
parent | 9a85435e96af9933b282594b6ad8b23ca598d8bc (diff) |
better reporting for file i/o failier, use system error message in more places: Permission Denied, No space left, File not found etc.
- blend load/save uses os message.
- image load gives os message. (remove check for slash at end of line, just let the os report an error)
- python api load image/font/text raise errors with message (was just retuning None for image and font)
- minor edits to py api errors.
Diffstat (limited to 'source/blender/editors/space_node')
-rw-r--r-- | source/blender/editors/space_node/node_edit.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index b5ed2f4d8a7..222504179cb 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -31,6 +31,7 @@ #include <stdlib.h> #include <math.h> #include <string.h> +#include <errno.h> #include "MEM_guardedalloc.h" @@ -2248,21 +2249,28 @@ static int node_add_file_exec(bContext *C, wmOperator *op) { char path[FILE_MAX]; RNA_string_get(op->ptr, "filepath", path); + + errno= 0; + ima= BKE_add_image_file(path, scene ? scene->r.cfra : 1); + + if(!ima) { + BKE_reportf(op->reports, RPT_ERROR, "Can't read: \"%s\", %s.", path, errno ? strerror(errno) : "Unsupported image format"); + return OPERATOR_CANCELLED; + } } else if(RNA_property_is_set(op->ptr, "name")) { char name[32]; RNA_string_get(op->ptr, "name", name); ima= (Image *)find_id("IM", name); + + if(!ima) { + BKE_reportf(op->reports, RPT_ERROR, "Image named \"%s\", not found.", name); + return OPERATOR_CANCELLED; + } } - if(!ima) { - BKE_report(op->reports, RPT_ERROR, "Not an Image."); - return OPERATOR_CANCELLED; - } - - node_deselectall(snode); if (snode->nodetree->type==NTREE_COMPOSIT) |