Page MenuHome

UI: Center align Menu Buttons without text
Needs ReviewPublic

Authored by Luis de Bethencourt Guimera (luisbg) on Wed, Aug 14, 5:18 PM.

Details

Summary

Menu Buttons with icons should only be aligned left if they have text since the breathing room for text and icons is different.

Only align a button to the left when it has text.

This can be visible in the Add a texture paint slot drop down menu button.


Notice that the cross icon is mis-aligned.

Diff Detail

Repository
rB Blender

Event Timeline

This also affects the snapping popover and object types visibility in a way that looks a little bit worse to me.

Hi Brecht, I did this approach because I thought it didn't affect adversely other menu buttons.

I have a different approach in mind in that case but I will investigate further before sending a new version.

Thanks for reviewing.

I'm no help here at the moment, despite pointing you at this. Looking around I can't find where that ICON_ADD button is actually added for that PAINT_OT_add_texture_paint_slot operator menu.

Luis de Bethencourt Guimera (luisbg) edited the summary of this revision. (Show Details)EditedWed, Aug 14, 8:27 PM

My other approach is to make sure a uiBut has text before aligning it left. If it doesn't have text it should use the default center align.

That said, I can't reproduce your problem Brecht. This is how the snapping popover looks to me after applying either the original or new patches. So I'm not 100% confident it will solve it. Sorry.

Also, I didn't check if but is a valid pointer before destructuring because the code after it UI_but_drawflag_enable assumes the pointer isn't NULL. It should be safe.

This is how the snapping popover looks to me in git master. It is the same as with my patch. Not sure this is the place you are alluding to @Brecht Van Lommel (brecht)
My patch doesn't affect it but I want to make sure I'm looking at the right place.

Did not test the patch, but I meant the button that opens these popovers, not the contents.

When making these kinds of changing, copy a Blender build from before the changes and alt+tab between the two builds to see exactly what was affected.