It works fine on the Mac with Maya 2009 and 2008.

Maya 8.5 SP1P08 on the Mac does not play well with this. I also just
noticed an errant semicolon which doesn't break my code, but really
should not be there.

#####
import maya.cmds as cmds

def printPath( filePath, fileType ):
   cmds.file( filePath, q=True, ex=True)
   print filePath
   return 1

cmds.fileBrowserDialog( m=4, fc=printPath , ft='image',
an='Import_Image', om='Import' )
#####

Chris

Lizard Lounge Graphics, LTD.
Wellington, NZ
http://lizardlounge.com

Int'l:  +644-977-5400 / +642-174-8770
NZ local: 04-977-5400 /   021-748-770



Chris Mills wrote:
> fileBrowserDialog needs special care - you have to supply it with
> exactly the right number of arguments and of a particular type. That
> having been said you can trick it into doing what you want pretty
> easily. See below:
> 
> #####
> import maya.cmds as cmds
> 
> def printPath( filePath, fileType ):
>    cmds.file( filePath, q=True, ex=True);
>    print filePath
>    return 1
> 
> cmds.fileBrowserDialog( m=4, fc=printPath , ft='image',
> an='Import_Image', om='Import' )
> #####
> 
> As long as you supply the function call with the needed arguments that
> *look* correct you can get it to return what you are looking for without
> issue. I'll eat my hat if this does not work on the Mac (and will verify
> shortly for you). This is the first time I've tried it with Python, but
> I have never had any issues with this using MEL - other than the weird
> structuring of the function call.
> 
> Chris
> 
> Lizard Lounge Graphics, LTD.
> Wellington, NZ
> http://lizardlounge.com
> 
> VHF: ZL4CDM
> Int'l:  +644-977-5400 / +642-174-8770
> NZ local: 04-977-5400 /   021-748-770
> 
> 
> 
> meljunky wrote:
>> Need a way for fileDialog() to look for a folder then; needed for the
>> cross platform support. All it seems to do is default to a file.
>>
>> -meljunky
>>
>> On Jan 21, 2:21 pm, Chris Mills <c...@lizardlounge.com> wrote:
>>> fileDialog() on the Mac is the same thing as on Windows.
>>>
>>> It returns a string and only needs the one function to work.
>>>
>>> fileDialogBrowser() on the other hand is a different animal which needs
>>> more specific handling.
>>>
>>> Chris
>>>
>>> Lizard Lounge Graphics, LTD.
>>> Wellington, NZhttp://lizardlounge.com
>>>
>>> VHF: ZL4CDM
>>> Int'l:  +644-977-5400 / +642-174-8770
>>> NZ local: 04-977-5400 /   021-748-770
>>>
>>> meljunky wrote:
>>>> Under the python command states fileBrowserDialog's docs states "See
>>>> the fileDialog command for cross platform file dialog support".  In
>>>> two different locations the user will be prompted for a folder and an
>>>> Maya scene file. I can get the results easy with fileBrowserDialog,
>>>> but I need cross platform support. Since I don't have access to Linux
>>>> or a Mac, its hard to test out solutions. Can't use pymel due to
>>>> distribution constraints.  Any ideas?
>>>> Thanks,
>>>> meljunky
> 
> 
> 

--~--~---------~--~----~------------~-------~--~----~
Yours,
Maya-Python Club Team.
-~----------~----~----~----~------~----~------~--~---

Reply via email to