diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2013-06-16 17:13:42 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2013-06-16 17:13:42 +0400 |
commit | a691487ed42796d48892a7a3be072a16bfc7d185 (patch) | |
tree | 5e069b80349066b71f30915e7693e9ebc9e85542 /source/blender/editors/space_buttons/buttons_texture.c | |
parent | 29be97975876a1f298f4e6dab14c75aa9956f96a (diff) |
Complete fix for [#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 (and better fix for [#35741] Material shows WORLD texture_context by default).
Simply recompute texture context on every redraw, like already done for sbuts->texuser (also called texture context :/ ).
Also allows simplification, buttons_check_texture_context can be merged back into set_texture_context...
Diffstat (limited to 'source/blender/editors/space_buttons/buttons_texture.c')
-rw-r--r-- | source/blender/editors/space_buttons/buttons_texture.c | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/source/blender/editors/space_buttons/buttons_texture.c b/source/blender/editors/space_buttons/buttons_texture.c index 0b1f244a1b5..51e740e539f 100644 --- a/source/blender/editors/space_buttons/buttons_texture.c +++ b/source/blender/editors/space_buttons/buttons_texture.c @@ -135,8 +135,7 @@ bool ED_texture_context_check_others(const bContext *C) return false; } -/* Only change texture context if current one is invalid! */ -void buttons_check_texture_context(const bContext *C, SpaceButs *sbuts) +static void set_texture_context(const bContext *C, SpaceButs *sbuts) { Scene *scene = CTX_data_scene(C); @@ -151,11 +150,27 @@ void buttons_check_texture_context(const bContext *C, SpaceButs *sbuts) bool valid_particles = ED_texture_context_check_particles(C); bool valid_others = ED_texture_context_check_others(C); - if (((sbuts->texture_context == SB_TEXC_WORLD) && !valid_world) || - ((sbuts->texture_context == SB_TEXC_MATERIAL) && !valid_material) || - ((sbuts->texture_context == SB_TEXC_LAMP) && !valid_lamp) || - ((sbuts->texture_context == SB_TEXC_PARTICLES) && !valid_particles) || - ((sbuts->texture_context == SB_TEXC_OTHER) && !valid_others)) + if ((sbuts->mainb == BCONTEXT_WORLD) && valid_world) { + sbuts->texture_context = SB_TEXC_WORLD; + } + else if ((sbuts->mainb == BCONTEXT_MATERIAL) && valid_material) { + sbuts->texture_context = SB_TEXC_MATERIAL; + } + else if ((sbuts->mainb == BCONTEXT_DATA) && valid_lamp) { + sbuts->texture_context = SB_TEXC_LAMP; + } + else if ((sbuts->mainb == BCONTEXT_PARTICLE) && valid_particles) { + sbuts->texture_context = SB_TEXC_PARTICLES; + } + else if ((ELEM(sbuts->mainb, BCONTEXT_MODIFIER, BCONTEXT_PHYSICS)) && valid_others) { + sbuts->texture_context = SB_TEXC_OTHER; + } + /* Else, just be sure that current context is valid! */ + else if (((sbuts->texture_context == SB_TEXC_WORLD) && !valid_world) || + ((sbuts->texture_context == SB_TEXC_MATERIAL) && !valid_material) || + ((sbuts->texture_context == SB_TEXC_LAMP) && !valid_lamp) || + ((sbuts->texture_context == SB_TEXC_PARTICLES) && !valid_particles) || + ((sbuts->texture_context == SB_TEXC_OTHER) && !valid_others)) { if (valid_others) { sbuts->texture_context = SB_TEXC_OTHER; @@ -368,7 +383,7 @@ void buttons_texture_context_compute(const bContext *C, SpaceButs *sbuts) Scene *scene = CTX_data_scene(C); ID *pinid = sbuts->pinid; - buttons_check_texture_context(C, sbuts); + set_texture_context(C, sbuts); if (!(BKE_scene_use_new_shading_nodes(scene) || (sbuts->texture_context == SB_TEXC_OTHER))) { if (ct) { |