So I’m working on an interface for something, and am having an issue I’m kind of hitting a wall on. In essence, what I’m trying to do is replicate the behavior similar to the top-right pane in hypershade. A variable length list of controls in a scroll area that interactively go down to new rows when the layout gets too narrow to accommodate the width. Another requirement is that it has to all be happening within a collapsible frame.
The really big problem I’m running in to is that the flowLayout doesn’t appear to be capable of interactively changing in height according to how many rows there are as far as I know. It just kind of just wraps in to nothing if the height of the layout isn’t there to support it.
What I ideally would actually have (just to throw it out there just in case anyone’s achieved it) is actually just to have the frameLayout shrink and grow in height according to the height of the flowLayout because in the actual window, I’m having all of those collapsible frames within a scrollLayout anyways. but I see that just having a box with a scrollLayout within has been done in the case of hypershade. Problem I’m running in to though is attaching the bottom of the parent formLayout to the bottom of the scrollLayout, since it doesn’t really have a bottom.
Here’s a little snippet of what I currently have that I grabbed from the script and re-formatted to work on its own. Just in case anyone’s unfamiliar with working with PyMEL, I tried to comment on the pymel specific things that are there.
import pymel.core as pm
pm.window()
pm.frameLayout('Some Folder (10 Entries)', cll=True, cl=True)
scr = pm.scrollLayout(cr=True)
formLwt = pm.horizontalLayout() # a special pymel formlayout class that can distribute all children horizontally
flowLwt = pm.flowLayout(cs=5, wr=True, p=formLwt)
pm.button()
pm.button()
pm.button()
pm.button()
pm.button()
pm.button()
pm.button()
pm.button()
pm.button()
formLwt.redistribute() # since there's only one child, it's just the same as attaching position to either edge
formLwt.attachPosition(flowLwt, 'bottom', 0, 100) #same as pm.formLayout(formLwt, e=True, ap=[flowLwt, 'bottom', 0, 100])
pm.showWindow()