From 54f5c174a8cf480d934f3be8ecc85c76537ad148 Mon Sep 17 00:00:00 2001 From: Jeroen Bakker Date: Wed, 8 Sep 2021 08:39:03 +0200 Subject: Asset: Dropping Material assets on material slot under mouse cursor. This patch allows dropping material assets from material slot under the mouse cursor. Before this change the material slot had to be hand-picked from the properties panel. For consistency it is chosen to do this in any shading mode as the tooltip shows what is exactly going to happen during release. The feature also works for other object types than Meshes as it uses the drawn surface on the GPU to detect the material slots. Performance of this patch has been tested with AMD GCN3.0 cards and are very responsive. Reviewed By: fclem, Severin Differential Revision: https://developer.blender.org/D12190 --- source/blender/blenkernel/intern/object.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source/blender/blenkernel/intern/object.c') diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 394245b3a2c..d0d1db9b4f8 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -5754,3 +5754,9 @@ void BKE_object_replace_data_on_shallow_copy(Object *ob, ID *new_data) } ob->id.py_instance = NULL; } + +bool BKE_object_supports_material_slots(struct Object *ob) +{ + return ELEM( + ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL, OB_HAIR, OB_POINTCLOUD, OB_VOLUME); +} -- cgit v1.2.3