[Bf-blender-cvs] [f11bcbed9d0] master: Fix T51913: Context tab for textures issue

Dalai Felinto noreply at git.blender.org
Tue Jun 27 16:59:07 CEST 2017


Commit: f11bcbed9d0402db271bc610eaec156583e746fa
Author: Dalai Felinto
Date:   Tue Jun 27 16:53:43 2017 +0200
Branches: master
https://developer.blender.org/rBf11bcbed9d0402db271bc610eaec156583e746fa

Fix T51913: Context tab for textures issue

The original code was doing a sanity check to see if existing index was
out of range. However the comparison was wrong.

So if the previous ct->user (active index of texture node) was larger
than then number of available texture nodes + 1 in the other material,
we would never re-set the index to 0.

Bug introduced on c31f74de6bb7.

There was an early attempt of fixing this (2b2ac5d3cc) but it was just working
by pure, luck. And failing in cases like the one from this bug report.

===================================================================

M	source/blender/editors/space_buttons/buttons_texture.c

===================================================================

diff --git a/source/blender/editors/space_buttons/buttons_texture.c b/source/blender/editors/space_buttons/buttons_texture.c
index 72de7e5c81c..1d67ac620b0 100644
--- a/source/blender/editors/space_buttons/buttons_texture.c
+++ b/source/blender/editors/space_buttons/buttons_texture.c
@@ -470,7 +470,7 @@ void buttons_texture_context_compute(const bContext *C, SpaceButs *sbuts)
 	}
 	else {
 		/* set one user as active based on active index */
-		if (ct->index == BLI_listbase_count_ex(&ct->users, ct->index + 1))
+		if (ct->index >= BLI_listbase_count_ex(&ct->users, ct->index + 1))
 			ct->index = 0;
 
 		ct->user = BLI_findlink(&ct->users, ct->index);




More information about the Bf-blender-cvs mailing list