diff options
Diffstat (limited to 'source/blender/windowmanager/intern/wm_operators.c')
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index f46358f83cf..5c500cf04c1 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1306,6 +1306,7 @@ wmOperator *WM_operator_last_redo(const bContext *C) */ ID *WM_operator_drop_load_path(struct bContext *C, wmOperator *op, const short idcode) { + Main *bmain = CTX_data_main(C); ID *id = NULL; /* check input variables */ if (RNA_struct_property_is_set(op->ptr, "filepath")) { @@ -1333,8 +1334,6 @@ ID *WM_operator_drop_load_path(struct bContext *C, wmOperator *op, const short i if (is_relative_path ) { if (exists == false) { - Main *bmain = CTX_data_main(C); - if (idcode == ID_IM) { BLI_path_rel(((Image *)id)->name, bmain->name); } @@ -1347,7 +1346,7 @@ ID *WM_operator_drop_load_path(struct bContext *C, wmOperator *op, const short i else if (RNA_struct_property_is_set(op->ptr, "name")) { char name[MAX_ID_NAME - 2]; RNA_string_get(op->ptr, "name", name); - id = BKE_libblock_find_name(idcode, name); + id = BKE_libblock_find_name(bmain, idcode, name); if (!id) { BKE_reportf(op->reports, RPT_ERROR, "%s '%s' not found", BKE_idcode_to_name(idcode), name); |