how to pass a list of floats to a scripted command?

28 views
Skip to first unread message

ynedelin

unread,
Nov 25, 2013, 8:41:04 PM11/25/13
to python_in...@googlegroups.com
hey guys
how to pass a list of floats to a scripted command?
first of all can it be done?

Let say I want to have this

myCommand(‘pCube1’, [list of skin weights])


thank you

yury




Justin Israel

unread,
Nov 26, 2013, 5:45:57 AM11/26/13
to python_in...@googlegroups.com
Something like this?

    def doIt(self, args):
        util = OpenMaya.MScriptUtil()

        name = args.asString(0)

        util.createFromInt(1)
        ptr = util.asUintPtr()
        weights = args.asDoubleArray(ptr)

        print "Name:", name, "; Weights:", weights

cmds.myCommand("pCube1", [1.0, 2.2, 3.3])
# Name: pCube1 ; Weights: [1.0, 2.2, 3.3]


--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/130d1de1-2a56-4efa-9b18-c8f49fb81572%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

yury nedelin

unread,
Nov 26, 2013, 3:33:40 PM11/26/13
to python_in...@googlegroups.com
Thank you Justin,

it works great,





Reply all
Reply to author
Forward
0 new messages