[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [57497] trunk/blender/source/blender/ editors/space_buttons/buttons_header.c: Fix [#35741] Material shows WORLD texture_context by default.

Bastien Montagne montagne29 at wanadoo.fr
Sun Jun 16 11:44:18 CEST 2013


Revision: 57497
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=57497
Author:   mont29
Date:     2013-06-16 09:44:17 +0000 (Sun, 16 Jun 2013)
Log Message:
-----------
Fix [#35741] Material shows WORLD texture_context by default.

Now also check previous button context, when switching. This way, if the previous one was a texture one, and become valid after the last switch (e.g. a material added to a new object), relevant texture context can still be set.

Note this commit also partially fixes [#35769] The ?\226?\128?\156show texture in texture tab?\226?\128?\157 button in a modifier does not show up until the user manually shows the texture in the Texture tab (full fix of this one will probably implies to always have a valid ButsContextTexture [sbuts->texuser]...).

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_buttons/buttons_header.c

Modified: trunk/blender/source/blender/editors/space_buttons/buttons_header.c
===================================================================
--- trunk/blender/source/blender/editors/space_buttons/buttons_header.c	2013-06-16 09:14:24 UTC (rev 57496)
+++ trunk/blender/source/blender/editors/space_buttons/buttons_header.c	2013-06-16 09:44:17 UTC (rev 57497)
@@ -79,6 +79,27 @@
 	else if ((sbuts->mainb == BCONTEXT_PARTICLE) && ED_texture_context_check_particles(C)) {
 		sbuts->texture_context = SB_TEXC_PARTICLES;
 	}
+	else if ((ELEM(sbuts->mainb, BCONTEXT_MODIFIER, BCONTEXT_PHYSICS)) && ED_texture_context_check_others(C)) {
+		sbuts->texture_context = SB_TEXC_OTHER;
+	}
+	/* Second pass: sbuts->mainbuser still contains the previous button context.
+	 * Useful e.g. when we switch to material, no material present, add a material, switch to texture.
+	 * See #35741. */
+	else if ((sbuts->mainbuser == BCONTEXT_WORLD) && ED_texture_context_check_world(C)) {
+		sbuts->texture_context = SB_TEXC_WORLD;
+	}
+	else if ((sbuts->mainbuser == BCONTEXT_MATERIAL) && ED_texture_context_check_material(C)) {
+		sbuts->texture_context = SB_TEXC_MATERIAL;
+	}
+	else if ((sbuts->mainbuser == BCONTEXT_DATA) && ED_texture_context_check_lamp(C)) {
+		sbuts->texture_context = SB_TEXC_LAMP;
+	}
+	else if ((sbuts->mainbuser == BCONTEXT_PARTICLE) && ED_texture_context_check_particles(C)) {
+		sbuts->texture_context = SB_TEXC_PARTICLES;
+	}
+	else if ((ELEM(sbuts->mainbuser, BCONTEXT_MODIFIER, BCONTEXT_PHYSICS)) && ED_texture_context_check_others(C)) {
+		sbuts->texture_context = SB_TEXC_OTHER;
+	}
 	/* Else, just be sure that current context is valid! */
 	else {
 		buttons_check_texture_context(C, sbuts);




More information about the Bf-blender-cvs mailing list