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 <montagne29@wanadoo.fr>2014-05-28 10:19:41 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2014-05-28 10:19:41 +0400
commit4b15a54eded7724af3341f4d3fd5a61b3009a209 (patch)
treec9aac251d0c1e0b734d76a1b4afeb7c3a4bc3e17 /source/blender
parenta6005319a7f5fdd317132ea9ce4256f63d60e1f8 (diff)
Fix T40388: 2.70a - Blender Render - Texture Stack - persistent checkbox state.
Reset 'use_texture' flag of a material tex slot when creating/assigning a texture to an empty slot.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/intern/texture.c9
-rw-r--r--source/blender/editors/render/render_shading.c7
2 files changed, 15 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index 4fff50153ef..bb956cb085c 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -705,6 +705,10 @@ MTex *add_mtex_id(ID *id, int slot)
MEM_freeN(mtex_ar[slot]);
mtex_ar[slot] = NULL;
}
+ else if (GS(id->name) == ID_MA) {
+ /* Reset this slot's ON/OFF toggle, for materials, when slot was empty. */
+ ((Material *)id)->septex &= ~(1 << slot);
+ }
mtex_ar[slot] = add_mtex();
@@ -1174,8 +1178,11 @@ void set_current_material_texture(Material *ma, Tex *newtex)
id_us_min(&tex->id);
if (newtex) {
- if (!ma->mtex[act])
+ if (!ma->mtex[act]) {
ma->mtex[act] = add_mtex();
+ /* Reset this slot's ON/OFF toggle, for materials, when slot was empty. */
+ ma->septex &= ~(1 << act);
+ }
ma->mtex[act]->tex = newtex;
id_us_plus(&newtex->id);
diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c
index 4166a52691f..79ab300fa7f 100644
--- a/source/blender/editors/render/render_shading.c
+++ b/source/blender/editors/render/render_shading.c
@@ -449,6 +449,13 @@ static int new_texture_exec(bContext *C, wmOperator *UNUSED(op))
* pointer se also increases user, so this compensates it */
tex->id.us--;
+ if (ptr.id.data && GS(((ID *)ptr.id.data)->name) == ID_MA &&
+ RNA_property_pointer_get(&ptr, prop).id.data == NULL) {
+ /* In case we are assigning new texture to a material, and active slot was empty, reset 'use' flag. */
+ Material *ma = (Material *)ptr.id.data;
+ ma->septex &= ~(1 << ma->texact);
+ }
+
RNA_id_pointer_create(&tex->id, &idptr);
RNA_property_pointer_set(&ptr, prop, idptr);
RNA_property_update(C, &ptr, prop);