[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34739] trunk/blender/source/blender/ editors/space_buttons/buttons_header.c: Restoring the old behavior of switching texture context based on active tab :
Janne Karhu
jhkarh at gmail.com
Wed Feb 9 12:03:13 CET 2011
Revision: 34739
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=34739
Author: jhk
Date: 2011-02-09 11:03:11 +0000 (Wed, 09 Feb 2011)
Log Message:
-----------
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".
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 2011-02-09 10:02:36 UTC (rev 34738)
+++ trunk/blender/source/blender/editors/space_buttons/buttons_header.c 2011-02-09 11:03:11 UTC (rev 34739)
@@ -38,8 +38,8 @@
#include "ED_screen.h"
#include "ED_types.h"
+#include "DNA_object_types.h"
-
#include "UI_interface.h"
#include "UI_resources.h"
#include "UI_view2d.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 @@
case B_BUTSPREVIEW:
ED_area_tag_redraw(CTX_wm_area(C));
+ set_texture_context(C, sbuts);
+
sbuts->preview= 1;
break;
}
More information about the Bf-blender-cvs
mailing list