[Maya-Python] Pass in List/Array to Command Flag?

498 views
Skip to first unread message

NPuetz

unread,
Apr 23, 2010, 3:26:02 PM4/23/10
to python_inside_maya
Hey Guys! I'm having a little trouble accompanied by frustration
trying to figure out how to pass in a list/array to a custom command
im writing similar to the -transformValue flag in skinPercent. I've
done endless searches on google and within the devkit/plugins, but
failed to find a working solution.

In case there is any confusion as to what im looking for.....
cmds.customCommand( values=[ .8, .6, .8, .7 ] )

... just wanting to be able to provide a list as an argument for a flag

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

Chris G

unread,
Apr 23, 2010, 4:34:09 PM4/23/10
to python_in...@googlegroups.com
Don't you just need to make your flag 'values' multi-use ? (MSyntax::makeFlagMultiUse)

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

NPuetz

unread,
Apr 23, 2010, 6:24:47 PM4/23/10
to python_inside_maya
Hey Chris, thanks for the reply. I tried makeFlagMultiUse at one point
and came across some errors.


Here's the stripped down code i had using makeFlagMultiUse()...
http://pastebin.com/TA34Md6x


if i run in python "cmds.customCommand( v=[.2, .3, .4] )" it prints
out that there is indeed 3 values given in the list but once i try and
print that value it errors out with "Unexpected Internal Error".

And in MEL it doesnt work at all with "customCommand -v {.2, .3, .4}".
It errors out when it creates the MArgDatabase call in doIt(). Only
way i got it to work in MEL was by using multiple instance of the flag
i.e. "customCommand -v .2 -v .3 -v .4". But I need to pass in an
Array, not the latter. :(


On Apr 23, 1:34 pm, Chris G <cgreb...@gmail.com> wrote:
> Don't you just need to make your flag 'values' multi-use ?
> (MSyntax::makeFlagMultiUse)
>
> - chris
>
> On Fri, Apr 23, 2010 at 3:26 PM, NPuetz <puetznick...@gmail.com> wrote:
> > Hey Guys! I'm having a little trouble accompanied by frustration
> > trying to figure out how to pass in a list/array to a custom command
> > im writing similar to the -transformValue flag in skinPercent. I've
> > done endless searches on google and within the devkit/plugins, but
> > failed to find a working solution.
>
> > In case there is any confusion as to what im looking for.....
> > cmds.customCommand( values=[ .8, .6, .8, .7 ] )
>
> > ... just wanting to be able to provide a list as an argument for a flag
>
> > --
> >http://groups.google.com/group/python_inside_maya
>
> --http://groups.google.com/group/python_inside_maya

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

Carlo Giesa

unread,
Apr 27, 2010, 11:31:13 AM4/27/10
to python_inside_maya
Hi there!

We had same experiences with this error under Python. And it seams
that this is a Maya bug that should be fixed in 2011:

http://images.autodesk.com/adsk/files/maya2011fixedcustomerissues.pdf

Look at number 348522.

We could not check out until now because we're still working on 2010.

But there's always hope ;).

For your problem under MEL I guess you should use the eval and build
your command string and append for each value a new flag.

Regards,
Carlo

On Apr 24, 12:24 am, NPuetz <puetznick...@gmail.com> wrote:
> Hey Chris, thanks for the reply. I tried makeFlagMultiUse at one point
> and came across some errors.
>
> Here's the stripped down code i had using makeFlagMultiUse()...http://pastebin.com/TA34Md6x

Amorano

unread,
Apr 28, 2010, 5:19:17 AM4/28/10
to python_inside_maya
*cough* HI!

Just wondering, you try passing the values as a tuple and not a list ?

Got another idea for you to try, but it would require the init code.




On Apr 23, 3:24 pm, NPuetz <puetznick...@gmail.com> wrote:
> Hey Chris, thanks for the reply. I tried makeFlagMultiUse at one point
> and came across some errors.
>
> Here's the stripped down code i had using makeFlagMultiUse()...http://pastebin.com/TA34Md6x
>
> if i run in python "cmds.customCommand( v=[.2, .3, .4] )" it prints
> out that there is indeed 3 values given in the list but once i try and
> print that value it errors out with "Unexpected Internal Error".
>
> And in MEL it doesnt work at all with "customCommand -v {.2, .3, .4}".
> It errors out when it creates the MArgDatabase call in doIt(). Only
> way i got it to work in MEL was by using multiple instance of the flag
> i.e. "customCommand -v .2 -v .3 -v .4". But I need to pass in an
> Array, not the latter. :(
>
> On Apr 23, 1:34 pm, Chris G <cgreb...@gmail.com> wrote:
>
>
>
>
>
> > Don't you just need to make your flag 'values' multi-use ?
> > (MSyntax::makeFlagMultiUse)
>
> > - chris
>
> > On Fri, Apr 23, 2010 at 3:26 PM, NPuetz <puetznick...@gmail.com> wrote:
> > > Hey Guys! I'm having a little trouble accompanied by frustration
> > > trying to figure out how to pass in a list/array to a custom command
> > > im writing similar to the -transformValue flag in skinPercent. I've
> > > done endless searches on google and within the devkit/plugins, but
> > > failed to find a working solution.
>
> > > In case there is any confusion as to what im looking for.....
> > > cmds.customCommand( values=[ .8, .6, .8, .7 ] )
>
> > > ... just wanting to be able to provide a list as an argument for a flag
>
> > > --
> > >http://groups.google.com/group/python_inside_maya
>
> > --http://groups.google.com/group/python_inside_maya
>
> --http://groups.google.com/group/python_inside_maya- Hide quoted text -
>
> - Show quoted text -

--
http://groups.google.com/group/python_inside_maya
Reply all
Reply to author
Forward
0 new messages