[Bf-blender-cvs] [ebd55b4acdc] master: T90372: Assets: When dropping material use active material slot.

Jeroen Bakker noreply at git.blender.org
Tue Aug 3 08:08:37 CEST 2021


Commit: ebd55b4acdc47ba2a412fd769aa6ab657abe97ca
Author: Jeroen Bakker
Date:   Tue Aug 3 08:06:26 2021 +0200
Branches: master
https://developer.blender.org/rBebd55b4acdc47ba2a412fd769aa6ab657abe97ca

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

===================================================================

M	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);



More information about the Bf-blender-cvs mailing list