Hey guys,
So i want this piece of code to work within my ui that i have created but i just cant get it to work.
This works on its own..
import maya.cmds as cmds
faceSel = cmds.ls(sl=True)
cmds.polyProjection( faceSel, type='Planar', md='x' )
As you can see i have had a crack at it but of course it doesnt work.
faceSel = cmds.ls(sl=True)
def planarxcommand(*args):
cmds.polyProjection( faceSel, type='Planar', md='x' )
bt8 = cmds.checkBox( label='X', command=planarxcommand )
faceSel = cmds.ls(sl=True)
def planarycommand(*args):
cmds.polyProjection( faceSel, type='Planar', md='y' )
bt9 = cmds.checkBox( label='Y', command=planarycommand )
faceSel = cmds.ls(sl=True)
def planarzcommand(*args):
cmds.polyProjection( faceSel, type='Planar', md='z' )
bt10 = cmds.checkBox( label='Z', command=planarycommand )
bt11 = cmds.checkBox( label='Camera')
What i really want is a unwrap tool that works like a checkbox command. The choices you have are:
1.planar button
2. 4 checkboxes, x,y,z and camera
3. You pick what axis you want to do a planar map on (only able to have one checkbox selected)
4. hit planar button to execute the unwrap depending on what checkbox you selected
This is the ui that works:
bt7 = cmds.button( label='Planar', width=55, command=cmds.polyAutoProjection )
bt8 = cmds.checkBox( label='X',)
bt9 = cmds.checkBox( label='Y',)
bt10 = cmds.checkBox( label='Z',)
bt11 = cmds.checkBox( label='Camera',)
which displays this:
Is there anyone out there that can save me from going mad? will love you forever!
Replies
Just need the hard bit to work and thats the code
I had a look at your script.
Your check to see if the UI existed in order to delete it didn't work properly. I fixed it for you.
I added a function to make sure that only one checkbox can be checked at any one time by adding a 'onCommand'(onc) to the checkboxes. Also added a function for the Planar button which checks which checkbox is checked and acts on that data.
Hope it helps.
EDIT: Optimized the checked() function a whole lot.