Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2013-06-16 17:13:42 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2013-06-16 17:13:42 +0400
commita691487ed42796d48892a7a3be072a16bfc7d185 (patch)
tree5e069b80349066b71f30915e7693e9ebc9e85542
parent29be97975876a1f298f4e6dab14c75aa9956f96a (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...
-rw-r--r--source/blender/editors/space_buttons/buttons_header.c49
-rw-r--r--source/blender/editors/space_buttons/buttons_intern.h1
-rw-r--r--source/blender/editors/space_buttons/buttons_texture.c31
3 files changed, 23 insertions, 58 deletions
diff --git a/source/blender/editors/space_buttons/buttons_header.c b/source/blender/editors/space_buttons/buttons_header.c
index f9742121e99..44c76d7a9a2 100644
--- a/source/blender/editors/space_buttons/buttons_header.c
+++ b/source/blender/editors/space_buttons/buttons_header.c
@@ -59,53 +59,6 @@
#define B_CONTEXT_SWITCH 101
-static void set_texture_context(const bContext *C, SpaceButs *sbuts)
-{
- Scene *scene = CTX_data_scene(C);
-
- if (BKE_scene_use_new_shading_nodes(scene)) {
- return; /* No texture context in new shading mode */
- }
-
- if ((sbuts->mainb == BCONTEXT_WORLD) && ED_texture_context_check_world(C)) {
- sbuts->texture_context = SB_TEXC_WORLD;
- }
- else if ((sbuts->mainb == BCONTEXT_MATERIAL) && ED_texture_context_check_material(C)) {
- sbuts->texture_context = SB_TEXC_MATERIAL;
- }
- else if ((sbuts->mainb == BCONTEXT_DATA) && ED_texture_context_check_lamp(C)) {
- sbuts->texture_context = SB_TEXC_LAMP;
- }
- 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);
- }
-}
-
static void do_buttons_buttons(bContext *C, void *UNUSED(arg), int event)
{
SpaceButs *sbuts = CTX_wm_space_buts(C);
@@ -117,8 +70,6 @@ static void do_buttons_buttons(bContext *C, void *UNUSED(arg), int event)
case B_CONTEXT_SWITCH:
ED_area_tag_redraw(CTX_wm_area(C));
- set_texture_context(C, sbuts);
-
sbuts->preview = 1;
break;
}
diff --git a/source/blender/editors/space_buttons/buttons_intern.h b/source/blender/editors/space_buttons/buttons_intern.h
index 55c9bf0dffd..5700d361e15 100644
--- a/source/blender/editors/space_buttons/buttons_intern.h
+++ b/source/blender/editors/space_buttons/buttons_intern.h
@@ -111,7 +111,6 @@ extern const char *buttons_context_dir[]; /* doc access */
/* buttons_texture.c */
void buttons_texture_context_compute(const struct bContext *C, struct SpaceButs *sbuts);
-void buttons_check_texture_context(const struct bContext *C, struct SpaceButs *sbuts);
/* buttons_ops.c */
void BUTTONS_OT_file_browse(struct wmOperatorType *ot);
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) {