From db15df0baaad0d7ddedbae86b76ebcb342b14616 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Sun, 24 Jan 2021 16:39:50 +0100 Subject: 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. --- source/blender/editors/space_node/space_node.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c index 2722b2a8c17..5999a6488c5 100644 --- a/source/blender/editors/space_node/space_node.c +++ b/source/blender/editors/space_node/space_node.c @@ -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); -- cgit v1.2.3