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-08 17:29:48 +0300
committerJanne Karhu <jhkarh@gmail.com>2011-02-08 17:29:48 +0300
commit811a1b910ca8f699ce499645ab99552fc2c83937 (patch)
tree9086296cbb58a943b9a95b6ed9f4aef9ecfe5194 /source
parent9e73ac2b9f6ba34c95e7146f346009363eb46a4d (diff)
Texture context selector for texture panel:
* Texture context was previously determined by going to the appropriate panel, for example "world panel -> texture panel" to access world textures. Additionally there was a separate button to access brush textures. * Now the texture context can be selected directly through an expanded icon menu, which shows the available context options. * This context selector is now at the top of the texture panel, but this could later be perhaps integrated to the context path somehow to be more intuitive.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/space_buttons/buttons_context.c9
-rw-r--r--source/blender/editors/space_buttons/buttons_header.c6
-rw-r--r--source/blender/makesdna/DNA_space_types.h12
-rw-r--r--source/blender/makesrna/intern/rna_space.c56
4 files changed, 67 insertions, 16 deletions
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c
index b0b1c23cbc0..d075958ffef 100644
--- a/source/blender/editors/space_buttons/buttons_context.c
+++ b/source/blender/editors/space_buttons/buttons_context.c
@@ -66,6 +66,7 @@ typedef struct ButsContextPath {
PointerRNA ptr[8];
int len;
int flag;
+ int tex_ctx;
} ButsContextPath;
static int set_pointer_type(ButsContextPath *path, bContextDataResult *result, StructRNA *type)
@@ -368,7 +369,7 @@ static int buttons_context_path_texture(ButsContextPath *path)
return 1;
}
/* try brush */
- if((path->flag & SB_BRUSH_TEX) && buttons_context_path_brush(path)) {
+ if((path->tex_ctx == SB_TEXC_BRUSH) && buttons_context_path_brush(path)) {
br= path->ptr[path->len-1].data;
if(br) {
@@ -380,7 +381,7 @@ static int buttons_context_path_texture(ButsContextPath *path)
}
}
/* try world */
- if((path->flag & SB_WORLD_TEX) && buttons_context_path_world(path)) {
+ if((path->tex_ctx == SB_TEXC_WORLD) && buttons_context_path_world(path)) {
wo= path->ptr[path->len-1].data;
if(wo && GS(wo->id.name)==ID_WO) {
@@ -442,6 +443,7 @@ static int buttons_context_path(const bContext *C, ButsContextPath *path, int ma
memset(path, 0, sizeof(*path));
path->flag= flag;
+ path->tex_ctx = sbuts->texture_context;
/* if some ID datablock is pinned, set the root pointer */
if(sbuts->pinid) {
@@ -534,13 +536,12 @@ void buttons_context_compute(const bContext *C, SpaceButs *sbuts)
{
ButsContextPath *path;
PointerRNA *ptr;
- int a, pflag, flag= 0;
+ int a, pflag= 0, flag= 0;
if(!sbuts->path)
sbuts->path= MEM_callocN(sizeof(ButsContextPath), "ButsContextPath");
path= sbuts->path;
- pflag= (sbuts->flag & (SB_WORLD_TEX|SB_BRUSH_TEX));
/* for each context, see if we can compute a valid path to it, if
* this is the case, we know we have to display the button */
diff --git a/source/blender/editors/space_buttons/buttons_header.c b/source/blender/editors/space_buttons/buttons_header.c
index bd1674aa307..0fbf7f51b70 100644
--- a/source/blender/editors/space_buttons/buttons_header.c
+++ b/source/blender/editors/space_buttons/buttons_header.c
@@ -62,12 +62,6 @@ static void do_buttons_buttons(bContext *C, void *UNUSED(arg), int event)
case B_BUTSPREVIEW:
ED_area_tag_redraw(CTX_wm_area(C));
- /* silly exception */
- if(sbuts->mainb == BCONTEXT_WORLD)
- sbuts->flag |= SB_WORLD_TEX;
- else if(sbuts->mainb != BCONTEXT_TEXTURE)
- sbuts->flag &= ~SB_WORLD_TEX;
-
sbuts->preview= 1;
break;
}
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index 90961a5cc15..43bda96baad 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -135,7 +135,8 @@ typedef struct SpaceButs {
short mainb, mainbo, mainbuser; /* context tabs */
short re_align, align; /* align for panels */
short preview; /* preview is signal to refresh */
- char flag, pad[3];
+ short texture_context; /* texture context selector (material, world, brush)*/
+ char flag, pad;
void *path; /* runtime */
int pathflag, dataicon; /* runtime */
@@ -627,10 +628,15 @@ typedef struct SpaceSound {
/* sbuts->flag */
#define SB_PRV_OSA 1
#define SB_PIN_CONTEXT 2
-#define SB_WORLD_TEX 4
-#define SB_BRUSH_TEX 8
+//#define SB_WORLD_TEX 4 //not used anymore
+//#define SB_BRUSH_TEX 8 //not used anymore
#define SB_SHADING_CONTEXT 16
+/* sbuts->texture_context */
+#define SB_TEXC_MAT_OR_LAMP 0
+#define SB_TEXC_WORLD 1
+#define SB_TEXC_BRUSH 2
+
/* sbuts->align */
#define BUT_FREE 0
#define BUT_HORIZONTAL 1
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index afb0b82b8a5..0a1ae8fdc5f 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -742,6 +742,51 @@ static void rna_BackgroundImage_opacity_set(PointerRNA *ptr, float value)
bgpic->blend = 1.0f - value;
}
+static EnumPropertyItem *rna_SpaceProperties_texture_context_itemf(bContext *C, PointerRNA *ptr, int *free)
+{
+ Scene *scene = CTX_data_scene(C);
+ Object *ob = CTX_data_active_object(C);
+ EnumPropertyItem *item= NULL;
+ EnumPropertyItem tmp= {0, "", 0, "", ""};
+ int totitem= 0;
+
+ if(ob) {
+ if(ob->type == OB_LAMP) {
+ tmp.value = SB_TEXC_MAT_OR_LAMP;
+ tmp.description = "Show Lamp Textures";
+ tmp.identifier = "LAMP";
+ tmp.icon = ICON_LAMP_POINT;
+ RNA_enum_item_add(&item, &totitem, &tmp);
+ }
+ else if(ob->totcol) {
+ tmp.value = SB_TEXC_MAT_OR_LAMP;
+ tmp.description = "Show Material Textures";
+ tmp.identifier = "MATERIAL";
+ tmp.icon = ICON_MATERIAL;
+ RNA_enum_item_add(&item, &totitem, &tmp);
+ }
+ }
+
+ if(scene && scene->world) {
+ tmp.value = SB_TEXC_WORLD;
+ tmp.description = "Show World Textures";
+ tmp.identifier = "WORLD";
+ tmp.icon = ICON_WORLD;
+ RNA_enum_item_add(&item, &totitem, &tmp);
+ }
+
+ tmp.value = SB_TEXC_BRUSH;
+ tmp.description = "Show Brush Textures";
+ tmp.identifier = "BRUSH";
+ tmp.icon = ICON_BRUSH_DATA;
+ RNA_enum_item_add(&item, &totitem, &tmp);
+
+ RNA_enum_item_end(&item, &totitem);
+ *free = 1;
+
+ return item;
+}
+
#else
static void rna_def_space(BlenderRNA *brna)
@@ -1323,6 +1368,10 @@ static void rna_def_space_buttons(BlenderRNA *brna)
{BUT_HORIZONTAL, "HORIZONTAL", 0, "Horizontal", ""},
{BUT_VERTICAL, "VERTICAL", 0, "Vertical", ""},
{0, NULL, 0, NULL, NULL}};
+
+ static EnumPropertyItem buttons_texture_context_items[] = {
+ {SB_TEXC_MAT_OR_LAMP, "MATERIAL", ICON_MATERIAL, "Material", "Material"},
+ {0, NULL, 0, NULL, NULL}}; //actually populated dynamically trough a function
srna= RNA_def_struct(brna, "SpaceProperties", "Space");
RNA_def_struct_sdna(srna, "SpaceButs");
@@ -1342,9 +1391,10 @@ static void rna_def_space_buttons(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Align", "Arrangement of the panels");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_PROPERTIES, NULL);
- prop= RNA_def_property(srna, "show_brush_texture", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SB_BRUSH_TEX);
- RNA_def_property_ui_text(prop, "Brush Texture", "Show brush textures");
+ prop= RNA_def_property(srna, "texture_context", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, buttons_texture_context_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_SpaceProperties_texture_context_itemf");
+ RNA_def_property_ui_text(prop, "Texture Context", "Type of texture data to display and edit");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_PROPERTIES, NULL);
/* pinned data */