[Bf-blender-cvs] [4b15a54] master: Fix T40388: 2.70a - Blender Render - Texture Stack - persistent checkbox state.
Bastien Montagne
noreply at git.blender.org
Wed May 28 08:22:38 CEST 2014
Commit: 4b15a54eded7724af3341f4d3fd5a61b3009a209
Author: Bastien Montagne
Date: Wed May 28 08:19:41 2014 +0200
https://developer.blender.org/rB4b15a54eded7724af3341f4d3fd5a61b3009a209
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.
===================================================================
M source/blender/blenkernel/intern/texture.c
M source/blender/editors/render/render_shading.c
===================================================================
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index 4fff501..bb956cb 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 4166a52..79ab300 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);
More information about the Bf-blender-cvs
mailing list