Re: [Maya-Python] Re: Converting list entries in nested dictionaries into dictionary type

2018-12-11 Thread yann19
My bad, had thought I had added in my dictionary example. Here you go - https://pastebin.com/raw/wb9gw3L9 And my actual codes: from datetime import datetime def sortedPage(d): return {k: {'elements': sorted([v1 for k1 ,v1 in v['elements'].items()], key=lambda el:

[Maya-Python] selecting objects inside an arbitrary frustum

2018-12-11 Thread Ravi Jagannadhan
Hi all, does anyone have a script they can share for selecting objects inside a given frustum? I am currently using the selectFromScreen(...) function in MGlobal, but that doesn't seem to pick up everything. I figured this is a common problem so rather than write my own, I'd take the lazy route :P

Re: [Maya-Python] Re: Converting list entries in nested dictionaries into dictionary type

2018-12-11 Thread Justin Israel
On Wed, Dec 12, 2018 at 10:57 AM yann19 wrote: > My bad, had thought I had added in my dictionary example. > Here you go - https://pastebin.com/raw/wb9gw3L9 > > And my actual codes: > from datetime import datetime > > def sortedPage(d): > return {k: {'elements': sorted([v1 for k1 ,v1 in >

[Maya-Python] Converting list entries in nested dictionaries into dictionary type

2018-12-11 Thread yann19
I apologize in advance as this is not much of a Maya question but I am trying to convert this 'list' within nested dictionaries into a dictionary type. I had a function where it ingests in a nested dictionary and allows me to sort the contents by a specified value eg. name. This is a portion

Re: [Maya-Python] Converting list entries in nested dictionaries into dictionary type

2018-12-11 Thread Justin Israel
On Wed, Dec 12, 2018 at 9:07 AM yann19 wrote: > I apologize in advance as this is not much of a Maya question but I am > trying to convert this 'list' within nested dictionaries into a dictionary > type. > > I had a function where it ingests in a nested dictionary and allows me to > sort the

[Maya-Python] Re: Converting list entries in nested dictionaries into dictionary type

2018-12-11 Thread Daniele Dolci
Dictionaries are basically hash maps and therefore are not ordered. You can't preserve the order of the entries in a dict, indeed when you use sort you are doing it on a list. There is something called ordered dictionary that you can check out, otherwise you could use a list of tuples. I hope

Re: [Maya-Python] Re: Converting list entries in nested dictionaries into dictionary type

2018-12-11 Thread Justin Israel
On Wed, Dec 12, 2018 at 9:32 AM Daniele Dolci wrote: > Dictionaries are basically hash maps and therefore are not ordered. You > can't preserve the order of the entries in a dict, indeed when you use sort > you are doing it on a list. There is something called ordered dictionary > that you can

[Maya-Python] Paint context and tool

2018-12-11 Thread Daniele Dolci
Hi Guys, I have created a custom blendshape with certain functionalities. It also, as a normal blendshape, takes as input multiple targets which I would like to paint the weights for. I watched the tutorial of Chad Vernon about doing it with a paintIndex attribute and callbacks but I would