Fix #138511: support dropping material asset into Set Material node

The `Drop Name` operator previously only worked for local data-blocks and not for assets.
This makes it possible to drop assets with this operator too.

Pull Request: https://projects.blender.org/blender/blender/pulls/140053
This commit is contained in:
Jacques Lucke
2025-06-10 12:10:15 +02:00
parent a14a844a99
commit 2e44db85d2

View File

@@ -73,12 +73,12 @@ static std::string ui_view_drop_tooltip(bContext *C,
static bool ui_drop_name_poll(bContext *C, wmDrag *drag, const wmEvent * /*event*/)
{
return UI_but_active_drop_name(C) && (drag->type == WM_DRAG_ID);
return UI_but_active_drop_name(C) && ELEM(drag->type, WM_DRAG_ID, WM_DRAG_ASSET);
}
static void ui_drop_name_copy(bContext * /*C*/, wmDrag *drag, wmDropBox *drop)
static void ui_drop_name_copy(bContext *C, wmDrag *drag, wmDropBox *drop)
{
const ID *id = WM_drag_get_local_ID(drag, 0);
const ID *id = WM_drag_get_local_ID_or_import_from_asset(C, drag, 0);
RNA_string_set(drop->ptr, "string", id->name + 2);
}