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:
authorCampbell Barton <ideasman42@gmail.com>2019-01-03 04:15:03 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-01-03 04:20:08 +0300
commit847b21ee08e5a30a2fe35ede4c5b3a73af404af7 (patch)
tree9fb9ecf0ca14d0d25485ad090012efae81158a27 /source/blender/editors/render
parentf7e9642da9c9a56a435c2a7f1e506245700a72b0 (diff)
Fix T60014: material link pref ignored
The PreferencesEdit.material_link only worked for adding slots, adding an initial new material didn't respect the preference.
Diffstat (limited to 'source/blender/editors/render')
-rw-r--r--source/blender/editors/render/render_shading.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c
index 5b198774b71..8aa345dfa10 100644
--- a/source/blender/editors/render/render_shading.c
+++ b/source/blender/editors/render/render_shading.c
@@ -483,6 +483,15 @@ static int new_material_exec(bContext *C, wmOperator *UNUSED(op))
UI_context_active_but_prop_get_templateID(C, &ptr, &prop);
if (prop) {
+ if (RNA_struct_is_a(ptr.type, &RNA_Object)) {
+ /* Add slot follows user-preferences for creating new slots,
+ * RNA pointer assignment doesn't, see: T60014. */
+ Object *ob = ptr.data;
+ if (give_current_material_p(ob, ob->actcol) == NULL) {
+ BKE_object_material_slot_add(bmain, ob);
+ }
+ }
+
/* when creating new ID blocks, use is already 1, but RNA
* pointer use also increases user, so this compensates it */
id_us_min(&ma->id);