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:23:17 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-01-03 04:25:37 +0300
commitba9e10fd6a5b7052d25f34343b7b723d25a94490 (patch)
treef9b45841dbbcc40c9c2e0b40f9d69d572589adc5 /source/blender/editors/render/render_shading.c
parent11f2c65128dc9bdead56003df7c282b6e091cbd1 (diff)
parent847b21ee08e5a30a2fe35ede4c5b3a73af404af7 (diff)
Merge branch 'blender2.7'
Diffstat (limited to 'source/blender/editors/render/render_shading.c')
-rw-r--r--source/blender/editors/render/render_shading.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c
index c4effd3a523..6875c803c33 100644
--- a/source/blender/editors/render/render_shading.c
+++ b/source/blender/editors/render/render_shading.c
@@ -523,7 +523,6 @@ static int new_material_exec(bContext *C, wmOperator *UNUSED(op))
{
Material *ma = CTX_data_pointer_get_type(C, "material", &RNA_Material).data;
Main *bmain = CTX_data_main(C);
- Object *ob = CTX_data_active_object(C);
PointerRNA ptr, idptr;
PropertyRNA *prop;
@@ -532,6 +531,7 @@ static int new_material_exec(bContext *C, wmOperator *UNUSED(op))
ma = BKE_material_copy(bmain, ma);
}
else {
+ Object *ob = CTX_data_active_object(C);
if ((!ob) || (ob->type != OB_GPENCIL)) {
ma = BKE_material_add(bmain, DATA_("Material"));
}
@@ -546,6 +546,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);