[Maya-Python] Re: MArrays and undoing in Python API 2.0

2018-10-10 Thread dur
I am not entirely sure whether I'm using the MObjectHandle correctly, but I added 'self.vertsHandle = om.MObjectHandle(vertices)' to the doIt() function. Where 'vertices' is from the 'sel.getComponent(0)'. In the undoIt() function, I put the condition of 'self.vertsHandle.isAlive()'. It still

[Maya-Python] Re: MArrays and undoing in Python API 2.0

2018-10-10 Thread dur
I won't directly say that I solved this, but I implemented it with using 'setColors' and 'assignColors', taking advatange of the 'colorset' system. This works. I tried an implementation with faceVerts which also resulted in crashing. Where I assigned all faceVerts instead of individually. Using

[Maya-Python] Re: Checking order of list items in 2 lists

2018-10-10 Thread davidlatwe
Hi Kiteh, Why not use `OrderedDict` in the first place ? Seems like `list01` and `list02` both from the same scene, if you are able to use `OrderedDict` instead of `dict`, you can save the order. Or, just iterating `list01` and use as key to access the `dict` value, isn't that also guaranty the

Re: [Maya-Python] Checking order of list items in 2 lists

2018-10-10 Thread Kurian O.S
Sort can do that In [2]: list01=['cleve', 'adam', 'yuno', 'pete'] In [3]: list02 = ['pete', 'yuno', 'cleve', 'adam'] In [4]: list02 = sorted(list2, key=list01.index) In [5]: list02 Out[5]: ['cleve', 'adam', 'yuno', 'pete'] On Wed, Oct 10, 2018 at 2:31 PM kiteh wrote: > Hi Justin, sorry

Re: [Maya-Python] Custom Maya node, with iconName like dagContainer

2018-10-10 Thread davidlatwe
Hi Marcus, I was looking for this, too. Have you got any result ? While I was googling, I found this page https://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2018/ENU/Maya-SDK/cpp-ref/node-icon-cmd-2node-icon-cmd-8cpp-example-html.html And that inspired me to use

Re: [Maya-Python] Checking order of list items in 2 lists

2018-10-10 Thread Justin Israel
On Thu, Oct 11, 2018 at 8:32 AM kiteh wrote: > Hi everyone, > > I have 2 list items which contains the same amount of items, and I am > trying to check the order of one list to another. > > Eg. > # This is derived from maya.cmds > list01 = ['cleve', 'adam', 'yuno', 'pete'] > > # This is derived

Re: [Maya-Python] Checking order of list items in 2 lists

2018-10-10 Thread kiteh
Hi Justin, sorry that I may have made my question confusing/ I was babbling, typing away of the way I am trying to phrase my question. Let me try again :) 1. Deriving the hierarchy from Outliner Eg. This is the hierarchical level as seen in my Outliner |-- base |--|-- names |--|--|-- cleve

[Maya-Python] Sub menus in shelf button

2018-10-10 Thread likage
Hello, I need some help with Mel in which I am trying to attach a sub-menu onto a shelf button. If the shelf button is toggled by left-mouse click (also the default), a menu will be shown. And if it is toggled with a right-mouse click, a different menu will be shown. This is my code:

Re: [Maya-Python] Checking order of list items in 2 lists

2018-10-10 Thread Justin Israel
On Thu, Oct 11, 2018 at 10:44 AM Kurian O.S wrote: > Sort can do that > > > In [2]: list01=['cleve', 'adam', 'yuno', 'pete'] > > In [3]: list02 = ['pete', 'yuno', 'cleve', 'adam'] > > In [4]: list02 = sorted(list2, key=list01.index) > > In [5]: list02 > Out[5]: ['cleve', 'adam', 'yuno', 'pete']