From ebd55b4acdc47ba2a412fd769aa6ab657abe97ca Mon Sep 17 00:00:00 2001 From: Jeroen Bakker Date: Tue, 3 Aug 2021 08:06:26 +0200 Subject: T90372: Assets: When dropping material use active material slot. Currently when dropping an asset the first material slot is always updated. This patch changes that logic to update the active material slot. In future the behavior will be updated to use the material slot of the face under the cursor. That requires better feedback tot he user. Reviewed By: Severin Maniphest Tasks: T90372 Differential Revision: https://developer.blender.org/D12056 --- source/blender/editors/object/object_relations.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'source/blender/editors/object/object_relations.c') diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index c61965b3e23..f576c0c8517 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -2736,7 +2736,11 @@ static int drop_named_material_invoke(bContext *C, wmOperator *op, const wmEvent return OPERATOR_CANCELLED; } - BKE_object_material_assign(CTX_data_main(C), base->object, ma, 1, BKE_MAT_ASSIGN_USERPREF); + Object *ob = base->object; + const short active_mat_slot = ob->actcol; + + BKE_object_material_assign( + CTX_data_main(C), base->object, ma, active_mat_slot, BKE_MAT_ASSIGN_USERPREF); DEG_id_tag_update(&base->object->id, ID_RECALC_TRANSFORM); -- cgit v1.2.3