Asset Browser: Support dragging image assets into node editors

The normal drag & drop support was already there, just needed minor tweaks to
respect asset importing. The dragged in image will create a image/texture node
for the internally known node-tree types (shader, texture and compositing
nodes).

Part of T82661.
This commit is contained in:
Julian Eisel 2021-01-24 16:39:50 +01:00
parent aa065a2951
commit db15df0baa
1 changed files with 2 additions and 2 deletions

View File

@ -664,7 +664,7 @@ static bool node_ima_drop_poll(bContext *UNUSED(C),
/* rule might not work? */
return (ELEM(drag->icon, 0, ICON_FILE_IMAGE, ICON_FILE_MOVIE));
}
return WM_drag_get_local_ID(drag, ID_IM) != NULL;
return WM_drag_get_local_ID(drag, ID_IM) || WM_drag_get_asset_data(drag, ID_IM);
}
static bool node_mask_drop_poll(bContext *UNUSED(C),
@ -684,7 +684,7 @@ static void node_id_drop_copy(wmDrag *drag, wmDropBox *drop)
static void node_id_path_drop_copy(wmDrag *drag, wmDropBox *drop)
{
ID *id = WM_drag_get_local_ID(drag, 0);
ID *id = WM_drag_get_local_ID_or_import_from_asset(drag, 0);
if (id) {
RNA_string_set(drop->ptr, "name", id->name + 2);