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:
authorBastien Montagne <bastien@blender.org>2020-07-28 19:32:11 +0300
committerBastien Montagne <bastien@blender.org>2020-07-28 19:32:11 +0300
commitfcf91bbf0daefa8ffdcbae7ce707115ec4fd5eb0 (patch)
treeab156987676f3b1f9730636eba0962d6b58fdfd9 /source/blender/blenkernel
parentcf243e09809fbe593cf6f01f7a66693251e32475 (diff)
parent9c1da81a4c173437c1e556afde7b32eef4b0a47d (diff)
Merge branch 'blender-v2.90-release'
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_material.h3
-rw-r--r--source/blender/blenkernel/intern/material.c13
2 files changed, 13 insertions, 3 deletions
diff --git a/source/blender/blenkernel/BKE_material.h b/source/blender/blenkernel/BKE_material.h
index 225d966a51a..cae79326dda 100644
--- a/source/blender/blenkernel/BKE_material.h
+++ b/source/blender/blenkernel/BKE_material.h
@@ -84,7 +84,8 @@ void BKE_object_material_assign(
void BKE_object_material_array_assign(struct Main *bmain,
struct Object *ob,
struct Material ***matar,
- short totcol);
+ int totcol,
+ const bool to_object_only);
short BKE_object_material_slot_find_index(struct Object *ob, struct Material *ma);
bool BKE_object_material_slot_add(struct Main *bmain, struct Object *ob);
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 0e2d8fcf4c7..34835fd1e35 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -955,7 +955,8 @@ void BKE_object_material_remap_calc(Object *ob_dst, Object *ob_src, short *remap
void BKE_object_material_array_assign(Main *bmain,
struct Object *ob,
struct Material ***matar,
- short totcol)
+ int totcol,
+ const bool to_object_only)
{
int actcol_orig = ob->actcol;
short i;
@@ -966,7 +967,15 @@ void BKE_object_material_array_assign(Main *bmain,
/* now we have the right number of slots */
for (i = 0; i < totcol; i++) {
- BKE_object_material_assign(bmain, ob, (*matar)[i], i + 1, BKE_MAT_ASSIGN_USERPREF);
+ if (to_object_only && ob->matbits[i] == 0) {
+ /* If we only assign to object, and that slot uses obdata material, do nothing. */
+ continue;
+ }
+ BKE_object_material_assign(bmain,
+ ob,
+ (*matar)[i],
+ i + 1,
+ to_object_only ? BKE_MAT_ASSIGN_OBJECT : BKE_MAT_ASSIGN_USERPREF);
}
if (actcol_orig > ob->totcol) {