UI: disable broken horizontal properties editor alignment.
This commit is contained in:
		@@ -1033,7 +1033,6 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
 | 
				
			|||||||
						SpaceButs *sbuts = (SpaceButs *) sl;
 | 
											SpaceButs *sbuts = (SpaceButs *) sl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
						sbuts->v2d.maxzoom = 1.2f;
 | 
											sbuts->v2d.maxzoom = 1.2f;
 | 
				
			||||||
						sbuts->align = 1;	/* horizontal default */
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
						if (sbuts->mainb == BUTS_LAMP) {
 | 
											if (sbuts->mainb == BUTS_LAMP) {
 | 
				
			||||||
							sbuts->mainb = CONTEXT_SHADING;
 | 
												sbuts->mainb = CONTEXT_SHADING;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -117,12 +117,17 @@ static void panel_activate_state(const bContext *C, Panel *pa, uiHandlePanelStat
 | 
				
			|||||||
/*********************** space specific code ************************/
 | 
					/*********************** space specific code ************************/
 | 
				
			||||||
/* temporary code to remove all sbuts stuff from panel 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)
 | 
					static int panel_aligned(ScrArea *sa, ARegion *ar)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if (sa->spacetype == SPACE_BUTS && ar->regiontype == RGN_TYPE_WINDOW) {
 | 
						if (sa->spacetype == SPACE_BUTS && ar->regiontype == RGN_TYPE_WINDOW)
 | 
				
			||||||
		SpaceButs *sbuts = sa->spacedata.first;
 | 
							return BUT_VERTICAL;
 | 
				
			||||||
		return sbuts->align;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	else if (sa->spacetype == SPACE_USERPREF && ar->regiontype == RGN_TYPE_WINDOW)
 | 
						else if (sa->spacetype == SPACE_USERPREF && ar->regiontype == RGN_TYPE_WINDOW)
 | 
				
			||||||
		return BUT_VERTICAL;
 | 
							return BUT_VERTICAL;
 | 
				
			||||||
	else if (sa->spacetype == SPACE_FILE && ar->regiontype == RGN_TYPE_CHANNELS)
 | 
						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) {
 | 
						if (sa->spacetype == SPACE_BUTS && ar->regiontype == RGN_TYPE_WINDOW) {
 | 
				
			||||||
		SpaceButs *sbuts = sa->spacedata.first;
 | 
							SpaceButs *sbuts = sa->spacedata.first;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (sbuts->align) {
 | 
							if (sbuts->mainbo != sbuts->mainb) {
 | 
				
			||||||
			if (sbuts->re_align || sbuts->mainbo != sbuts->mainb) {
 | 
								return true;
 | 
				
			||||||
				return true;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	else if (sa->spacetype == SPACE_IMAGE && ar->regiontype == RGN_TYPE_PREVIEW) {
 | 
						else if (sa->spacetype == SPACE_IMAGE && ar->regiontype == RGN_TYPE_PREVIEW) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -65,7 +65,6 @@ static SpaceLink *buttons_new(const ScrArea *UNUSED(area), const Scene *UNUSED(s
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	sbuts = MEM_callocN(sizeof(SpaceButs), "initbuts");
 | 
						sbuts = MEM_callocN(sizeof(SpaceButs), "initbuts");
 | 
				
			||||||
	sbuts->spacetype = SPACE_BUTS;
 | 
						sbuts->spacetype = SPACE_BUTS;
 | 
				
			||||||
	sbuts->align = BUT_VERTICAL;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	sbuts->mainb = sbuts->mainbuser = BCONTEXT_OBJECT;
 | 
						sbuts->mainb = sbuts->mainbuser = BCONTEXT_OBJECT;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -109,17 +108,8 @@ static void buttons_free(SpaceLink *sl)
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* spacetype; init callback */
 | 
					/* 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)
 | 
					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)
 | 
					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);
 | 
						buttons_context_compute(C, sbuts);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	const char *contexts[2] = {NULL, NULL};
 | 
						const char *contexts[2] = {NULL, NULL};
 | 
				
			||||||
@@ -203,12 +191,12 @@ static void buttons_main_region_layout_properties(const bContext *C, SpaceButs *
 | 
				
			|||||||
			break;
 | 
								break;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						const bool vertical = true;
 | 
				
			||||||
	ED_region_panels_layout_ex(C, ar, contexts, sbuts->mainb, vertical);
 | 
						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 char *contexts[3] = {NULL};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	const WorkSpace *workspace = CTX_wm_workspace(C);
 | 
						const WorkSpace *workspace = CTX_wm_workspace(C);
 | 
				
			||||||
@@ -263,6 +251,7 @@ static void buttons_main_region_layout_tool(const bContext *C, SpaceButs *sbuts,
 | 
				
			|||||||
		/* TODO */
 | 
							/* TODO */
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						const bool vertical = true;
 | 
				
			||||||
	ED_region_panels_layout_ex(C, ar, contexts, -1, vertical);
 | 
						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);
 | 
						SpaceButs *sbuts = CTX_wm_space_buts(C);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (sbuts->mainb == BCONTEXT_TOOL) {
 | 
						if (sbuts->mainb == BCONTEXT_TOOL) {
 | 
				
			||||||
		buttons_main_region_layout_tool(C, sbuts, ar);
 | 
							buttons_main_region_layout_tool(C, ar);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	else {
 | 
						else {
 | 
				
			||||||
		buttons_main_region_layout_properties(C, sbuts, ar);
 | 
							buttons_main_region_layout_properties(C, sbuts, ar);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	sbuts->re_align = 0;
 | 
					 | 
				
			||||||
	sbuts->mainbo = sbuts->mainb;
 | 
						sbuts->mainbo = sbuts->mainb;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -138,8 +138,8 @@ typedef struct SpaceButs {
 | 
				
			|||||||
	short space_subtype;
 | 
						short space_subtype;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	short mainb, mainbo, mainbuser; /* context tabs */
 | 
						short mainb, mainbo, mainbuser; /* context tabs */
 | 
				
			||||||
	short re_align, align;          /* align for panels */
 | 
					 | 
				
			||||||
	short preview;                  /* preview is signal to refresh */
 | 
						short preview;                  /* preview is signal to refresh */
 | 
				
			||||||
 | 
						short pad[2];
 | 
				
			||||||
	char flag;
 | 
						char flag;
 | 
				
			||||||
	char collection_context;
 | 
						char collection_context;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -213,14 +213,6 @@ typedef enum eSpaceButtons_Flag {
 | 
				
			|||||||
	SB_SHADING_CONTEXT = (1 << 4),
 | 
						SB_SHADING_CONTEXT = (1 << 4),
 | 
				
			||||||
} eSpaceButtons_Flag;
 | 
					} eSpaceButtons_Flag;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* SpaceButs.align */
 | 
					 | 
				
			||||||
typedef enum eSpaceButtons_Align {
 | 
					 | 
				
			||||||
	BUT_FREE = 0,
 | 
					 | 
				
			||||||
	BUT_HORIZONTAL = 1,
 | 
					 | 
				
			||||||
	BUT_VERTICAL = 2,
 | 
					 | 
				
			||||||
	BUT_AUTO = 3,
 | 
					 | 
				
			||||||
} eSpaceButtons_Align;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/** \} */
 | 
					/** \} */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* -------------------------------------------------------------------- */
 | 
					/* -------------------------------------------------------------------- */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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 */
 | 
					/* Space Console */
 | 
				
			||||||
static void rna_ConsoleLine_body_get(PointerRNA *ptr, char *value)
 | 
					static void rna_ConsoleLine_body_get(PointerRNA *ptr, char *value)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@@ -3161,12 +3153,6 @@ static void rna_def_space_buttons(BlenderRNA *brna)
 | 
				
			|||||||
	StructRNA *srna;
 | 
						StructRNA *srna;
 | 
				
			||||||
	PropertyRNA *prop;
 | 
						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");
 | 
						srna = RNA_def_struct(brna, "SpaceProperties", "Space");
 | 
				
			||||||
	RNA_def_struct_sdna(srna, "SpaceButs");
 | 
						RNA_def_struct_sdna(srna, "SpaceButs");
 | 
				
			||||||
	RNA_def_struct_ui_text(srna, "Properties Space", "Properties space data");
 | 
						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_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");
 | 
						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 */
 | 
						/* pinned data */
 | 
				
			||||||
	prop = RNA_def_property(srna, "pin_id", PROP_POINTER, PROP_NONE);
 | 
						prop = RNA_def_property(srna, "pin_id", PROP_POINTER, PROP_NONE);
 | 
				
			||||||
	RNA_def_property_pointer_sdna(prop, NULL, "pinid");
 | 
						RNA_def_property_pointer_sdna(prop, NULL, "pinid");
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user