diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-11-24 00:48:48 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-11-24 00:48:48 +0300 |
commit | 929dbc66445ba2004be52bd29f5bd06bcd1f8a26 (patch) | |
tree | 8631422ffb9b089abbbdae5bc187df6d5b71dae7 /source/blender/editors/mesh/mesh_data.c | |
parent | 888ab78edfad4f9c2bdd31764eb95eb347a8c2d8 (diff) |
Cleanup: de-duplicate image drag & drop logic
also don't make library paths relative on image load.
Diffstat (limited to 'source/blender/editors/mesh/mesh_data.c')
-rw-r--r-- | source/blender/editors/mesh/mesh_data.c | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index e2ce97a3bdf..4bffb491581 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -571,24 +571,13 @@ static int drop_named_image_invoke(bContext *C, wmOperator *op, const wmEvent *e return OPERATOR_CANCELLED; } - /* check input variables */ - if (RNA_struct_property_is_set(op->ptr, "filepath")) { - char path[FILE_MAX]; - - RNA_string_get(op->ptr, "filepath", path); - ima = BKE_image_load_exists(path); - } - else { - char name[MAX_ID_NAME - 2]; - RNA_string_get(op->ptr, "name", name); - ima = (Image *)BKE_libblock_find_name(ID_IM, name); - } - + ima = (Image *)WM_operator_drop_load_path(C, op, ID_IM); if (!ima) { - BKE_report(op->reports, RPT_ERROR, "Not an image"); return OPERATOR_CANCELLED; } - + /* handled below */ + id_us_min((ID *)ima); + /* put mesh in editmode */ obedit = base->object; |