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:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user