New uialign code, based on 2D positions of widgets.
This new code fixes a tons of issues with previous one, which basically was epic-failing in many non-basic cases (especially mixed columns and rows with column-dominant layout). It basically no more relies over order of buttons declaration in the uiBlock, instead it finds and stores spatial neighbors and uses that data to compute needed stitching. See code comments for details. New code seems to be roughly ten times slower than old one (for complex grouped layouts), that is, about a few microsecconds per alignment group - this remains reasonable. Also, ui-align code becomming rather big in itself, it was separated in own new `interface_align.c` file. Reviewers: campbellbarton, severin Reviewed By: campbellbarton, severin Differential Revision: https://developer.blender.org/D1573
This commit is contained in:
		@@ -203,6 +203,12 @@ enum {
 | 
			
		||||
	UI_BUT_ALIGN_RIGHT       = (1 << 16),
 | 
			
		||||
	UI_BUT_ALIGN_DOWN        = (1 << 17),
 | 
			
		||||
	UI_BUT_ALIGN             = (UI_BUT_ALIGN_TOP | UI_BUT_ALIGN_LEFT | UI_BUT_ALIGN_RIGHT | UI_BUT_ALIGN_DOWN),
 | 
			
		||||
 | 
			
		||||
	/* Warning - HACK! Needed for buttons which are not TOP/LEFT aligned, but have some top/left corner stitched to some
 | 
			
		||||
	 *                 other TOP/LEFT-aligned button, because of 'corrective' hack in widget_roundbox_set()... */
 | 
			
		||||
	UI_BUT_ALIGN_STITCH_TOP  = (1 << 18),
 | 
			
		||||
	UI_BUT_ALIGN_STITCH_LEFT = (1 << 19),
 | 
			
		||||
	UI_BUT_ALIGN_ALL         = (UI_BUT_ALIGN | UI_BUT_ALIGN_STITCH_TOP | UI_BUT_ALIGN_STITCH_LEFT),
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/* scale fixed button widths by this to account for DPI */
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user