Python script doesn't work with Unfold command
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
with the below code there is no error but it doesn't work, in this, I am creating GUI in which two inputs density and regulation when I click on apply button it doesn't work and it gives me no error if anyone has an idea to solve please guide or help me, Thanks.
Code-:
import maya.cmds as cmds
def applyScale(*args):
sel = cmds.ls(sl=True, flatten=True)
txDensity = cmds.floatField("density",q=True,value=0)
txSize = cmds.floatField("resolution",q=True,value=0)
scalar = txDensity/txSize
for i in sel:
cmds.unfold(i,i=0,ss=0.001,gb=0,gmb=1,pub=0,ps=0,oa=0,us=1,s=scalar)
''' UNIQUE WINDOW NAME '''
winId="layoutDesign"
''' CONDITION WHICH CHECK EXISTENCE OF WINDOW'''
if cmds.window(winId,exists=True):
cmds.deleteUI(winId)
''' CREATES NEW WINDOW WITH SPECIFIED WIDTH AND HEIGHT'''
window_demo = cmds.window(winId,t="Layout Design",w=500,h=500,menuBar=True)
''' INITIALIZE FRAME LAYOUT AND FORM LAYOUT'''
cmds.frameLayout("FBX_Exporter_UI_animationFrameLayout", collapsable=False,label="",borderVisible=False)
cmds.formLayout("FBX_Exporter_UI_animationFormLayout",numberOfDivisions=100,parent="FBX_Exporter_UI_animationFrameLayout")
cmds.text("texelDensity",l="Texel \n Density",parent="FBX_Exporter_UI_animationFormLayout")
cmds.floatField("density",minValue=0, precision=1, step=1,w=100,h=30)
cmds.text("textureResolution",l="Texture \n Resolution",parent="FBX_Exporter_UI_animationFormLayout")
cmds.floatField("resolution",minValue=0, precision=1, step=1,w=100,h=30)
cmds.button("apply",l="Apply",h=30,w=70,c=applyScale)
cmds.formLayout("FBX_Exporter_UI_animationFormLayout",edit=True,attachForm=[("texelDensity",'top',30),("density",'left',60),("density",'top',30),("resolution",'top',50),("textureResolution",'top',30),("textureResolution",'left',190),("resolution",'top',30),("resolution",'left',270),("apply",'top',30),("apply",'left',390)])
''' AT LAST COMMAND FOR SHOW WINDOW'''
cmds.showWindow(winId)