Community
Maya Forum
Welcome to Autodesk’s Maya Forums. Share your knowledge, ask questions, and explore popular Maya topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

formLayout's attachOppositeForm seems not to be working

0 REPLIES 0
Reply
Message 1 of 1
gfixler2JPHF
220 Views, 0 Replies

formLayout's attachOppositeForm seems not to be working

It's probably the least used of the 6 types, second only to attachNone, but I've tested it now in Maya 2018.6, and 2022, and it does the same thing, or rather, doesn't do what it should in the same way, in both. The attachOppositeForm is the only way to attach the right and bottom edges of controls and layouts at absolute positions from the same relative point as the top and left edges.

The attachPosition flag uses a 0-100 int percentage, which means the attached thing moves along with the scaling of the layout, which is often exactly what's needed. Using attachPosition means you can position the top and left edges at absolute positions, relative to the top-left edge of the layout, positions which don't move with the scaling thereof, but trying to attach the bottom and right edges in kind attaches them relative to the opposite corner of the layout. This is where attachOppositeForm comes in, allowing you to, e.g., attachForm btn "left" 50 and attachOppositeForm btn "right" 100 to plant the button's edges between pixels 50 and 100, relative to the left edge, where they'll stay.

This doesn't seem to be working, however.

Here's a simple example. We stick b2 under b1 with attachControl. Then we bump b1 and b2 out 50 and 100 from the left edge with attachForm. Then we try to move b1's right edge out to 100 from the left edge with attachOppositeForm, which would put it in line with b2's left edge, but nothing happens. You can change the number to anything, and nothing changes in the UI.

 

cmds.window()
cmds.showWindow()
fl = cmds.formLayout()
b1 = cmds.button(label="b1")
b2 = cmds.button(label="b2")
cmds.formLayout(fl, edit=True, attachControl=[ (b2, "top", 0, b1) ]
                             , attachForm=[ (b1, "left", 50), (b2, "left", 100) ]
                             , attachOppositeForm=[ (b1, "right", 100) ])

 

 

Result, regardless of int value put in for attachOppositeForm above:

 2021-04-29_14-44-16.png

 

Note that I'm not trying to use this to connect b1's right edge to b2's left - I'd just use attachControl for that - I'm trying to absolutely position b1's right edge relative to the left edge of the form (using b2's left edge to show when/if it works), which is what attachOppositeForm is designed to do. I've also tried attachOppositeForm from the other edges, again, to no avail. It just seems to be a broken flag.

Labels (1)
  • UI
0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report