Page MenuHome

Correct outliner width computation

Authored by Jacques Lucke (JacquesLucke) on May 17 2019, 4:20 PM.



Problem: Currently it is not possible to see everything in the
outliner when there are e.g. long icon rows. This is because Blender
does not allow panning the view to the right, since it does not
know the actual width.

Most of the code to compute the width correctly was there already,
but there were a couple of issues that made it not work.

  • The tree width was computed before the tree was drawn. This does not work, since the width is only known, after it is drawn.
  • Every TreeElement stores its right-most position in xend. However, in the current code, the xend of e.g. an object is the position where the text ends. The xend of the icons is stored in the sub-tree-elements. Therefore, to compute the maximum width, you may not skip the closed tree elements.
  • The current drawing code had an early exit when the icon row would not be visible anymore. This also skipped the calculation of xend. So it would work correctly, when the icon was visible a little bit, but not when it was not visible at all.

This patch fixes these issues. So even in more complex files, the
width is computed correcly. At least I haven't found a case, where
it does not.

Unfortunately, it does so, by potentionally adding quite a bit of
overhead, since I had to disable some optimizations. I haven't
measured if this has a noticable effect yet.

In general we should decide whether it is really worth the effort
to compute the exact width. We could just use a high fixed width.
Since we scroll almost exclusively vertically, the impact on the
user is negilible. One downside is that the horizontal scrollbar
does not make any sense anymore then.

The when the outliner mode is set to Data API, we could just
align the second column to the right, so that we don't need the
tree width there.

Diff Detail

rB Blender

Event Timeline

Brecht Van Lommel (brecht) requested changes to this revision.May 29 2019, 1:59 PM

Could we compute the width and the height in the same function?

Outliner drawing is already rather slow, looping over all tree elements is not always cheap. Would be good if it didn't get slower for this.

This revision now requires changes to proceed.May 29 2019, 1:59 PM
  • new outliner_tree_dimensions function wrapping width and height computation
  • compute outliner tree dimensions in one go
This revision is now accepted and ready to land.May 29 2019, 3:48 PM
This revision was automatically updated to reflect the committed changes.