Introduction to Maya - Modeling Fundamentals Vol 2
This course will look in the fundamentals of modeling in Maya with an emphasis on creating good topology. It's aimed at people that have some modeling experience in Maya but are having trouble with complex objects.
# 1 06-09-2012 , 07:14 AM
sanfx's Avatar
Registered User
Join Date: May 2009
Location: Vancouver
Posts: 4

set text of the textfield from filedialog2 selected file path

I have a function[scnFileOpen()] that opens the dialog box and returns the string
Code:
import maya.mel as mel
import maya.cmds as cmds
scnFilter ="All Scene files (*.ma *.mb);;Ascii Files (*.ma );;Binary Image Files (*.mb);;All Files (*.*)"
chosenFile = cmds.fileDialog2(fm=1, ds=0, cap="Open", ff=scnFilter ,okc="Select scene file", hfe=0)
but i want the string returned should also set the text of the textfield
user added image

the main() function that has GUI to display and recieve and set info
Code:
import maya.cmds as cmds

def main():
window = cmds.window(title='open file')
    cmds.rowColumnLayout( numberOfColumns=3, columnAttach=(1, 'left', 0), columnWidth=[(1, 100), (2, 250)] )
    cmds.text( label='Maya Scene' )
    front = cmds.textField()
    cmds.iconTextButton( style='iconAndTextVertical',align='right',command='scnFileOpen()', image1='fileOpen.xpm', height=8 )
cmds.showWindow( window )
can anyone help me out in this ?

# 2 06-11-2012 , 04:35 AM
NextDesign's Avatar
Technical Director
Join Date: Feb 2004
Posts: 2,988
You need to have scnOpenFile return the chosenFile. Once that's done, save it to a variable in main, then set the text box's label to it.


Imagination is more important than knowledge.
# 3 06-11-2012 , 04:53 AM
sanfx's Avatar
Registered User
Join Date: May 2009
Location: Vancouver
Posts: 4

need to know this urgently

i got that working a while ago, I also wanted to know how can I have filedialog2 act like fileBrowserDialog with mode 4, (deprected in 2012 onwards)....

# 4 06-11-2012 , 01:45 PM
NextDesign's Avatar
Technical Director
Join Date: Feb 2004
Posts: 2,988
See global proc int fileBrowser in fileBrowser.mel in Maya's scripts/others directory.


Imagination is more important than knowledge.
# 5 06-11-2012 , 05:43 PM
sanfx's Avatar
Registered User
Join Date: May 2009
Location: Vancouver
Posts: 4

See global proc int fileBrowser in fileBrowser.mel in Maya's scripts/others directory.

thanks that all i need to know...

Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads