Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen Bakker <jbakker>2021-08-03 09:06:26 +0300
committerJeroen Bakker <jeroen@blender.org>2021-08-03 09:08:20 +0300
commitebd55b4acdc47ba2a412fd769aa6ab657abe97ca (patch)
tree141771aa0960b7586f9865c693b99c0d94b4eb81 /source/blender/editors/object/object_relations.c
parenta53feb0aff5227fe0728275285ad35b6eba57508 (diff)
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
Diffstat (limited to 'source/blender/editors/object/object_relations.c')
-rw-r--r--source/blender/editors/object/object_relations.c6
1 files changed, 5 insertions, 1 deletions
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);