What is a "Sequence of Ints" in Maya Python API 2.0 ?

39 views
Skip to first unread message

brand

unread,
Feb 16, 2019, 5:39:45 AM2/16/19
to Python Programming for Autodesk Maya
I'm having trouble understanding what is defined as a sequence of Ints.

The 2.0 documentation is pretty straight forward to me since most parameters have a link to what is needed, and I can dig deeper. When I came across MFnMesh.collapseFaces(), there was no link for the parameter, so I didn't know what it meant by sequence of ints.

I am new to python, so I maybe overlooking this. I searched on GitHub and blogs and saw some people use MIntArray, but not sure if that is what a sequence actually is in this context.

The code I got right now gives no errors, and I managed to make the face collapse one time, followed by 10 crashes.

https://pastebin.com/0nnD76DM

Thanks !!

Justin Israel

unread,
Feb 16, 2019, 1:20:07 PM2/16/19
to python_in...@googlegroups.com


On Sat, Feb 16, 2019, 11:39 PM brand <branc...@gmail.com wrote:
I'm having trouble understanding what is defined as a sequence of Ints.

The 2.0 documentation is pretty straight forward to me since most parameters have a link to what is needed, and I can dig deeper. When I came across MFnMesh.collapseFaces(), there was no link for the parameter, so I didn't know what it meant by sequence of ints.

I am new to python, so I maybe overlooking this. I searched on GitHub and blogs and saw some people use MIntArray, but not sure if that is what a sequence actually is in this context.

Have you tried just passing a list or a tuple? 

mesh.collapseFaces([id1, id2, ...])

Sequence types:



The code I got right now gives no errors, and I managed to make the face collapse one time, followed by 10 crashes.

https://pastebin.com/0nnD76DM

Thanks !!

--
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/8f5637a2-6fd4-4db3-b73c-52a32968c41f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

brand

unread,
Feb 16, 2019, 2:08:53 PM2/16/19
to Python Programming for Autodesk Maya
Hey Justin,

I tried hard coding a list and tuple just for a test, and it just gives me a fatal error every time.

list_test = [1]
mesh.collapseFaces(list_test)

After reading the docs, it does say a list is a sequence type so that makes it clear, but just not sure why I am getting crashes.

Michael Boon

unread,
Feb 18, 2019, 8:37:19 PM2/18/19
to Python Programming for Autodesk Maya
I just tried that function on a test sphere, using a list of integers. It works for me but it doesn't redraw in the viewport; I had to call updateSurface() afterwards to see the changes.

I wasn't able to get it to crash on my sphere. Eventually, it would either do nothing, or give an error "# RuntimeError: (kInvalidParameter): Index not in valid range #" depending on the index or indices I was trying to collapse.

The numPolygons attribute and getVertices() method don't return updated numbers though, even after updateSurface. I suspect it would be easy to get a crash in other code after using collapseFaces.

brand

unread,
Feb 19, 2019, 10:59:09 PM2/19/19
to Python Programming for Autodesk Maya
Thanks for testing it out. Something weird does happens after collapsing faces using the list of ints, but calling updateSurface() fixes it. Not sure what exactly is going on here, but I am glad this works at least. Thanks!
Reply all
Reply to author
Forward
0 new messages