Hey Serguei,

I'm good, thank you. :) I just moved to Maya a few months ago for a
new job and I'm adapting.

I just tried the fileDialog command and it works perfectly! It's just
what I needed.

I had done some googling and they were talking about fileBrowserDialog
so I didn't know "fileDialog" existed, thought the other one was the
main and only file prompt command.

Cheers,

   -- Alan


On Wed, Jul 21, 2010 at 3:06 PM, Serguei Kalentchouk
<[email protected]> wrote:
> Hey Alan,
> How's it going?
>
> Try using the fileDialog command instead, it's a modal dialog that will wait
> for the resulting output.
> If you are running 2011 you should use fileDialog2 command instead.
>
> If you are set on using the old fileBrowserDialog command with custom
> function call than you pretty much have to wrap it into a mel.eval call for
> it to work correctly.
>
> Example from some code:
> mel.eval ('global proc int getFolderPath (string $fileName, string
> $fileType) {python ("Usualy a call to a proper python function you want to
> execute!");return true;}')
> mel.eval ('fileBrowser "getFolderPath" "Select Path" "Caption" 4;')
>
> Cheers!
>
> On Wed, Jul 21, 2010 at 11:23 AM, Alan Fregtman <[email protected]>
> wrote:
>>
>> Did some searching of the archives, people say this is supposed to work:
>>
>> import maya.cmds as cmds
>> def importImage(fileName, fileType):
>>    print "I am here\n"
>>    print fileName
>>    return 1
>> cmds.fileBrowserDialog( m=0, fc=importImage, ft='image',
>> an='Import_Image', om='Import' )
>>
>> But I get the same syntax error. Looks like it's interpreting as if it
>> were MEL?
>>
>>
>> On Wed, Jul 21, 2010 at 1:18 PM, Alan Fregtman <[email protected]>
>> wrote:
>> > The provided example from the docs gives me an error:
>> > -----------------------
>> > import pymel.core as pm
>> >
>> > def importImage( fileName, fileType):
>> >   pm.file( fileName, i=True );
>> >   return 1
>> >
>> > pm.fileBrowserDialog( m=0, fc=importImage, ft='image',
>> > an='Import_Image', om='Import' )
>> >
>> > # Error: <function callback at 0x00000000468F9898> "D:/test.tga"
>> > "image"; #
>> > # Error: Line 1.1: Syntax error #
>> > -----------------------
>> >
>> > Also, what's the difference between the fileCommand (fc) and the
>> > actionName (an)?
>> > (fc) is "script to run on command action" and (an) is "script to be
>> > called when the file is validated."
>> >
>> > Sounds like almost the same thing to me. Is one of them optional?
>> >
>> > Any help appreciated.
>> > Cheers,
>> >
>> >   -- Alan
>> >
>>
>> --
>> http://groups.google.com/group/python_inside_maya
>
>
> --
> Technical Director @ Digital Domain
>
> --
> http://groups.google.com/group/python_inside_maya

-- 
http://groups.google.com/group/python_inside_maya

Reply via email to