UI: disable broken horizontal properties editor alignment.

This commit is contained in:
2018-07-06 13:46:26 +02:00
parent 3da1207b48
commit 9fc79a4033
5 changed files with 17 additions and 56 deletions

View File

@@ -1033,7 +1033,6 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
SpaceButs *sbuts = (SpaceButs *) sl;
sbuts->v2d.maxzoom = 1.2f;
sbuts->align = 1; /* horizontal default */
if (sbuts->mainb == BUTS_LAMP) {
sbuts->mainb = CONTEXT_SHADING;

View File

@@ -117,12 +117,17 @@ static void panel_activate_state(const bContext *C, Panel *pa, uiHandlePanelStat
/*********************** space specific code ************************/
/* temporary code to remove all sbuts stuff from panel code */
/* SpaceButs.align */
typedef enum eSpaceButtons_Align {
BUT_HORIZONTAL = 0,
BUT_VERTICAL = 1,
BUT_AUTO = 2,
} eSpaceButtons_Align;
static int panel_aligned(ScrArea *sa, ARegion *ar)
{
if (sa->spacetype == SPACE_BUTS && ar->regiontype == RGN_TYPE_WINDOW) {
SpaceButs *sbuts = sa->spacedata.first;
return sbuts->align;
}
if (sa->spacetype == SPACE_BUTS && ar->regiontype == RGN_TYPE_WINDOW)
return BUT_VERTICAL;
else if (sa->spacetype == SPACE_USERPREF && ar->regiontype == RGN_TYPE_WINDOW)
return BUT_VERTICAL;
else if (sa->spacetype == SPACE_FILE && ar->regiontype == RGN_TYPE_CHANNELS)
@@ -180,10 +185,8 @@ static bool panels_need_realign(ScrArea *sa, ARegion *ar, Panel **pa_animate)
if (sa->spacetype == SPACE_BUTS && ar->regiontype == RGN_TYPE_WINDOW) {
SpaceButs *sbuts = sa->spacedata.first;
if (sbuts->align) {
if (sbuts->re_align || sbuts->mainbo != sbuts->mainb) {
return true;
}
if (sbuts->mainbo != sbuts->mainb) {
return true;
}
}
else if (sa->spacetype == SPACE_IMAGE && ar->regiontype == RGN_TYPE_PREVIEW) {

View File

@@ -65,7 +65,6 @@ static SpaceLink *buttons_new(const ScrArea *UNUSED(area), const Scene *UNUSED(s
sbuts = MEM_callocN(sizeof(SpaceButs), "initbuts");
sbuts->spacetype = SPACE_BUTS;
sbuts->align = BUT_VERTICAL;
sbuts->mainb = sbuts->mainbuser = BCONTEXT_OBJECT;
@@ -109,17 +108,8 @@ static void buttons_free(SpaceLink *sl)
}
/* spacetype; init callback */
static void buttons_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa)
static void buttons_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa))
{
SpaceButs *sbuts = sa->spacedata.first;
/* auto-align based on size */
if (sbuts->align == BUT_AUTO || !sbuts->align) {
if (sa->winx > sa->winy)
sbuts->align = BUT_HORIZONTAL;
else
sbuts->align = BUT_VERTICAL;
}
}
static SpaceLink *buttons_duplicate(SpaceLink *sl)
@@ -146,8 +136,6 @@ static void buttons_main_region_init(wmWindowManager *wm, ARegion *ar)
static void buttons_main_region_layout_properties(const bContext *C, SpaceButs *sbuts, ARegion *ar)
{
const bool vertical = (sbuts->align == BUT_VERTICAL);
buttons_context_compute(C, sbuts);
const char *contexts[2] = {NULL, NULL};
@@ -203,12 +191,12 @@ static void buttons_main_region_layout_properties(const bContext *C, SpaceButs *
break;
}
const bool vertical = true;
ED_region_panels_layout_ex(C, ar, contexts, sbuts->mainb, vertical);
}
static void buttons_main_region_layout_tool(const bContext *C, SpaceButs *sbuts, ARegion *ar)
static void buttons_main_region_layout_tool(const bContext *C, ARegion *ar)
{
const bool vertical = (sbuts->align == BUT_VERTICAL);
const char *contexts[3] = {NULL};
const WorkSpace *workspace = CTX_wm_workspace(C);
@@ -263,6 +251,7 @@ static void buttons_main_region_layout_tool(const bContext *C, SpaceButs *sbuts,
/* TODO */
}
const bool vertical = true;
ED_region_panels_layout_ex(C, ar, contexts, -1, vertical);
}
@@ -272,13 +261,12 @@ static void buttons_main_region_layout(const bContext *C, ARegion *ar)
SpaceButs *sbuts = CTX_wm_space_buts(C);
if (sbuts->mainb == BCONTEXT_TOOL) {
buttons_main_region_layout_tool(C, sbuts, ar);
buttons_main_region_layout_tool(C, ar);
}
else {
buttons_main_region_layout_properties(C, sbuts, ar);
}
sbuts->re_align = 0;
sbuts->mainbo = sbuts->mainb;
}

View File

@@ -138,8 +138,8 @@ typedef struct SpaceButs {
short space_subtype;
short mainb, mainbo, mainbuser; /* context tabs */
short re_align, align; /* align for panels */
short preview; /* preview is signal to refresh */
short pad[2];
char flag;
char collection_context;
@@ -213,14 +213,6 @@ typedef enum eSpaceButtons_Flag {
SB_SHADING_CONTEXT = (1 << 4),
} eSpaceButtons_Flag;
/* SpaceButs.align */
typedef enum eSpaceButtons_Align {
BUT_FREE = 0,
BUT_HORIZONTAL = 1,
BUT_VERTICAL = 2,
BUT_AUTO = 3,
} eSpaceButtons_Align;
/** \} */
/* -------------------------------------------------------------------- */

View File

@@ -1326,14 +1326,6 @@ static void rna_SpaceProperties_context_update(Main *UNUSED(bmain), Scene *UNUSE
}
}
static void rna_SpaceProperties_align_set(PointerRNA *ptr, int value)
{
SpaceButs *sbuts = (SpaceButs *)(ptr->data);
sbuts->align = value;
sbuts->re_align = 1;
}
/* Space Console */
static void rna_ConsoleLine_body_get(PointerRNA *ptr, char *value)
{
@@ -3161,12 +3153,6 @@ static void rna_def_space_buttons(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
static const EnumPropertyItem align_items[] = {
{BUT_HORIZONTAL, "HORIZONTAL", 0, "Horizontal", ""},
{BUT_VERTICAL, "VERTICAL", 0, "Vertical", ""},
{0, NULL, 0, NULL, NULL}
};
srna = RNA_def_struct(brna, "SpaceProperties", "Space");
RNA_def_struct_sdna(srna, "SpaceButs");
RNA_def_struct_ui_text(srna, "Properties Space", "Properties space data");
@@ -3178,13 +3164,6 @@ static void rna_def_space_buttons(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Context", "Type of active data to display and edit");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_PROPERTIES, "rna_SpaceProperties_context_update");
prop = RNA_def_property(srna, "align", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "align");
RNA_def_property_enum_items(prop, align_items);
RNA_def_property_enum_funcs(prop, NULL, "rna_SpaceProperties_align_set", NULL);
RNA_def_property_ui_text(prop, "Align", "Arrangement of the panels");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_PROPERTIES, NULL);
/* pinned data */
prop = RNA_def_property(srna, "pin_id", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "pinid");