Re: [Maya-Python] Re: Python API - How to extract all the infos from a MSelectionList() ?

2016-09-11 Thread Christopher Crouzet
I think that it might be useful to redefine the purpose of your ` isEdgesConnected` function by making it do only the work that it is supposed to: check if 2 edges are connected. Right now, it is also forcing an unrelated behaviour by retrieving the selection list every time. What if you need to c

Re: [Maya-Python] Re: Python API - How to extract all the infos from a MSelectionList() ?

2016-09-11 Thread Jean Noval
What I mean by more direct way, is to not have to select anything like a did in my script* -- 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

Re: [Maya-Python] Re: Python API - How to extract all the infos from a MSelectionList() ?

2016-09-11 Thread Jean Noval
I'm not sure if it's what you told me to do but I did it like this : def isEdgesConnected(e1Index=None, e2Index=None, objShape=None): if not objShape: # Get the object from selection sel = om.MSelectionList() om.MGlobal.getActiveSelectionList(sel) e

Re: [Maya-Python] Re: Python API - How to extract all the infos from a MSelectionList() ?

2016-09-11 Thread Christopher Crouzet
I think you'll have to explain me (us?) what you mean by “direct way”. In fact, what makes you think that this approach is not “direct”? What do you expect by making it more “direct”? If using a list/set as mentioned earlier, you'll simply retrieve some data from Maya and cache it in memory once f

[Maya-Python] Re: Python API - How to extract all the infos from a MSelectionList() ?

2016-09-11 Thread Jean Noval
Yes I could do that, select the edges in my functions. But there is no other direct way ? -- 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

Re: [Maya-Python] Re: Python API - How to extract all the infos from a MSelectionList() ?

2016-09-11 Thread Christopher Crouzet
Save the indices of the selected edges once for all in a list (or set ?), then pass it to your function. This way you'll easily be able to do any type of operation such as adding new elements or membership testing. On 11 September 2016 at 20:36, Jean Noval wrote: > Thank you for your response.

Re: [Maya-Python] Import Skin Weight maps without DialogBox

2016-09-11 Thread Christopher Crouzet
I wrote a really quick'n'dirty one to be used as part as of a rig builder, so maybe you can use it as a starting point. Here's the code: https://gist.github.com/christophercrouzet/2e74ca5b6f33500caf95b0c9244c27e6 I've just extracted it from a codebase and didn't really tested it after that, so may

[Maya-Python] Re: Python API - How to extract all the infos from a MSelectionList() ?

2016-09-11 Thread Jean Noval
Thank you for your response. *'First of all, you might be misunderstanding what `mDagPath.length()` returns.'*Sorry it's a mistake I wanted to write sel.length(). In fact what I want to do is a little fonction to know if to edges are connected: def isEdgesConnected(e1Index, e2Index, objShape=

Re: [Maya-Python] Python API - How to extract all the infos from a MSelectionList() ?

2016-09-11 Thread Christopher Crouzet
First of all, you might be misunderstanding what `mDagPath.length()` returns. As per the doc, it “*determines the number of DAG Nodes in the Path not including the root.*” So basically, it gives you the hierarchy depth of the DAG path, that is '|pSphere1' will return 1, and '|pSphere1|pSphereShape1

[Maya-Python] Python API - How to extract all the infos from a MSelectionList() ?

2016-09-11 Thread Jean Noval
Hello, I'm trying to get all the infos from an MSelectionList(). Example : If I select a transform in maya and then run this script : sel = om.MSelectionList() om.MGlobal.getActiveSelectionList(sel) mDagPath = om.MDagPath() sel.getDagPath(0, mDagPath) print(mDagPath.fullPathName()) print(mDag