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:
Diffstat (limited to 'source/blender/editors/space_node/node_edit.c')
-rw-r--r--source/blender/editors/space_node/node_edit.c20
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)