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
path: root/source
diff options
context:
space:
mode:
authorJanne Karhu <jhkarh@gmail.com>2011-02-09 14:03:11 +0300
committerJanne Karhu <jhkarh@gmail.com>2011-02-09 14:03:11 +0300
commit38e5081839c9b68622a02e707780cf906e92fec1 (patch)
tree94dd66e859ad75fe626613b6835d69af26165b85 /source
parent81a00cf2eb1984787e175bcd254bee8a149fc7d5 (diff)
Restoring the old behavior of switching texture context based on active tab:
* Once again switching to texture panel from material, world or lamp data tab sets the texture context automatically to the "parent context".
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/space_buttons/buttons_header.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/source/blender/editors/space_buttons/buttons_header.c b/source/blender/editors/space_buttons/buttons_header.c
index 0fbf7f51b70..18882a68e52 100644
--- a/source/blender/editors/space_buttons/buttons_header.c
+++ b/source/blender/editors/space_buttons/buttons_header.c
@@ -38,7 +38,7 @@
#include "ED_screen.h"
#include "ED_types.h"
-
+#include "DNA_object_types.h"
#include "UI_interface.h"
#include "UI_resources.h"
@@ -50,6 +50,25 @@
#define B_CONTEXT_SWITCH 101
#define B_BUTSPREVIEW 102
+static void set_texture_context(bContext *C, SpaceButs *sbuts)
+{
+ switch(sbuts->mainb) {
+ case BCONTEXT_MATERIAL:
+ sbuts->texture_context = SB_TEXC_MAT_OR_LAMP;
+ break;
+ case BCONTEXT_DATA:
+ {
+ Object *ob = CTX_data_active_object(C);
+ if(ob && ob->type==OB_LAMP)
+ sbuts->texture_context = SB_TEXC_MAT_OR_LAMP;
+ break;
+ }
+ case BCONTEXT_WORLD:
+ sbuts->texture_context = SB_TEXC_WORLD;
+ break;
+ }
+}
+
static void do_buttons_buttons(bContext *C, void *UNUSED(arg), int event)
{
SpaceButs *sbuts= CTX_wm_space_buts(C);
@@ -62,6 +81,8 @@ static void do_buttons_buttons(bContext *C, void *UNUSED(arg), int event)
case B_BUTSPREVIEW:
ED_area_tag_redraw(CTX_wm_area(C));
+ set_texture_context(C, sbuts);
+
sbuts->preview= 1;
break;
}