diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2013-06-16 13:44:17 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2013-06-16 13:44:17 +0400 |
commit | 556c47faa6af5e8f4ed81043c714b9fe5a12a49c (patch) | |
tree | 0eb253aafcf0dd6b6645f4750d929392477483e9 | |
parent | 4e23e9cab167aa3e29b41911615a7939a0ccc852 (diff) |
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 “show texture in texture tab” 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]...).
-rw-r--r-- | source/blender/editors/space_buttons/buttons_header.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/source/blender/editors/space_buttons/buttons_header.c b/source/blender/editors/space_buttons/buttons_header.c index 1d8d2136181..f9742121e99 100644 --- a/source/blender/editors/space_buttons/buttons_header.c +++ b/source/blender/editors/space_buttons/buttons_header.c @@ -79,6 +79,27 @@ static void set_texture_context(const bContext *C, SpaceButs *sbuts) 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); |