UILayout.box does not align correctly #28391

Closed
opened 2011-08-28 05:27:59 +02:00 by Dany Lebel · 14 comments
Member

%%%In the python api it is possible to create boxes in which other properties or operators may be put. The elements of a panel can generally be aligned. But the boxes have some problems dealing with alignment. A simple script is attached with this issue to demonstrate the problem.

  1. Open box_align_issue.py and run it.
  2. Look at the "Hello World Panel" in the properties window in the "Object" tab.
  3. Note the issues with the box alignment.%%%
%%%In the python api it is possible to create boxes in which other properties or operators may be put. The elements of a panel can generally be aligned. But the boxes have some problems dealing with alignment. A simple script is attached with this issue to demonstrate the problem. 1. Open box_align_issue.py and run it. 2. Look at the "Hello World Panel" in the properties window in the "Object" tab. 3. Note the issues with the box alignment.%%%
Author
Member

Changed status to: 'Open'

Changed status to: 'Open'

blender/blender#43286 was marked as duplicate of this issue

blender/blender#43286 was marked as duplicate of this issue

%%%looks like you used API not very correct -- i can't see where you're placing properties in the box. They're adding to layout or column in attached script. If you want property be added to box you should do the following:

box = layout.box() # create box
box.prop(...) # add property to box (place valid arguments here)

Attaching modified script which works.

All works fine with api usage i showed, so closing report. Feel free to poke me here if there'll be more issues noticed.%%%

%%%looks like you used API not very correct -- i can't see where you're placing properties in the box. They're adding to layout or column in attached script. If you want property be added to box you should do the following: box = layout.box() # create box box.prop(...) # add property to box (place valid arguments here) Attaching modified script which works. All works fine with api usage i showed, so closing report. Feel free to poke me here if there'll be more issues noticed.%%%
Author
Member

%%%Hi Sergey,
yes, I know how to use the box() object and put some properties or other things in it, I use it often. I wrote this script as simple as it can be to demonstrate the issue. I was not talking about aligning properties inside a box. The bug I am describing is not present in your script.

My issue:
In fact, I was talking about aligning the box ITSELF to another object (property, operator...). If you look carefully to my example, you'll see that there is three boxes which are aligned with other properties inside a column(align=True).

The first has nothing inside of it and alignes correctly. The lower corners of the box are smoothed with the upper corners of the x location property. This is working correctly but is useless since there is nothing inside the box.

The second one does not align correctly. And the only difference between the first one is that the box is placed under the properties. The box does align with the properties, but the corners are not smoothed. Why does it smooth when it is above and not when it is under.

The third one is the same as the first one except that there is a label in it. But the simple fact to put something in the box breaks the smoothed corners.

I develped an addon where I expected a box to align smoothly with other properties. The addon is paint_palette.py it is on projects.blender.org and it is now also in the trunk. You can look at it to see an example of a situation using what I am talking about.

UIlayout.box, as an ui object, has the possibility to align itself with other ui objects inside a column or a row. It would be inconsistent to not allow it to smooth correctly as the other objects do.
Thank you for your time and considering my issue.%%%

%%%Hi Sergey, yes, I know how to use the box() object and put some properties or other things in it, I use it often. I wrote this script as simple as it can be to demonstrate the issue. I was not talking about aligning properties inside a box. The bug I am describing is not present in your script. My issue: In fact, I was talking about aligning the box ITSELF to another object (property, operator...). If you look carefully to my example, you'll see that there is three boxes which are aligned with other properties inside a column(align=True). The first has nothing inside of it and alignes correctly. The lower corners of the box are smoothed with the upper corners of the x location property. This is working correctly but is useless since there is nothing inside the box. The second one does not align correctly. And the only difference between the first one is that the box is placed under the properties. The box does align with the properties, but the corners are not smoothed. Why does it smooth when it is above and not when it is under. The third one is the same as the first one except that there is a label in it. But the simple fact to put something in the box breaks the smoothed corners. I develped an addon where I expected a box to align smoothly with other properties. The addon is paint_palette.py it is on projects.blender.org and it is now also in the trunk. You can look at it to see an example of a situation using what I am talking about. UIlayout.box, as an ui object, has the possibility to align itself with other ui objects inside a column or a row. It would be inconsistent to not allow it to smooth correctly as the other objects do. Thank you for your time and considering my issue.%%%

%%%Pardon, nisunderstand initial issue, re-opening.%%%

%%%Pardon, nisunderstand initial issue, re-opening.%%%

%%%Old 2011 reports gets a bit dusty. :)

I attached "box_align_2013.py" which shows the issue. Open the script in text editor and check the panel in the scene tab.
Comment the one prop line (line 20) and the box looks fine. But in the current config it fails. %%%

%%%Old 2011 reports gets a bit dusty. :) I attached "box_align_2013.py" which shows the issue. Open the script in text editor and check the panel in the scene tab. Comment the one prop line (line 20) and the box looks fine. But in the current config it fails. %%%

%%%Note: the error is caused by ui_item_align() adding the buttons to the head of the list. Attempted to fix by changing the order but this just gives other similar problems.

Looks like we should really have ui_block_do_align() be able to check for adjacent boxes without them being together in the button list.%%%

%%%Note: the error is caused by ui_item_align() adding the buttons to the head of the list. Attempted to fix by changing the order but this just gives other similar problems. Looks like we should really have ui_block_do_align() be able to check for adjacent boxes without them being together in the button list.%%%

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'

There're quite enough osf things related on widgets alignment.. Perhaps at some point we'll need to revisit interface engine. For now moving to TODO http://wiki.blender.org/index.php/Dev:2.5/Source/Development/Todo/UserInterface#UI_Widgets

There're quite enough osf things related on widgets alignment.. Perhaps at some point we'll need to revisit interface engine. For now moving to TODO http://wiki.blender.org/index.php/Dev:2.5/Source/Development/Todo/UserInterface#UI_Widgets

Added subscribers: @Leon95, @JulianEisel

Added subscribers: @Leon95, @JulianEisel

Changed status from 'Archived' to: 'Open'

Changed status from 'Archived' to: 'Open'

Merged in blender/blender#43286, another example of alignment failing (though not box)

Merged in blender/blender#43286, another example of alignment failing (though not `box`)
Brecht Van Lommel removed their assignment 2015-10-05 02:17:28 +02:00

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Leon Eckardt self-assigned this 2015-11-20 22:37:43 +01:00

Solved with {D1573}/rB3d39b98f94a6cd3d4445226dd04d5ba3261bf10b

Solved with {[D1573](https://archive.blender.org/developer/D1573)}/rB3d39b98f94a6cd3d4445226dd04d5ba3261bf10b
Sign in to join this conversation.
No Milestone
No project
No Assignees
6 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#28391
No description provided.