Maya and STL – Connected vertices done right

Intro For the third and last part1)I do have an idea for an optimization related addendum to this though, so I might be lying here, there might be a part 3.5 of the whole STL thing, of which you can find the previous part here, we’re going to finally look at actually using STL instead of Maya arrays, why, and what the benefits will be. This is probably the most practically useful part, and ironically also the shortest. The whole point being made is, after all, that using STL will save you time. Enough time that there won’t be much code to it2)fluff will therefore be added freely to inspire further reading on your side!.   Neighborhood cache The first thing to look at is multi-dimensional containers. Maya does have some containers that are actually 2D containers. MPointArray, MVectorArray and so on are actually 2D Arrays of a fixed width under the hood. What Maya doesn’t provide that STL does however is arbitrary containers of anything of arbitrary dimensions3)you can work around this by using plain arrays of pointers to Maya arrays that are manually allocated on the free store, but then you also have to take care of manually … Continue Reading →

Maya and STL – Deep Connected Vertices

Part 2, something practical Given the previous post might have been informative, but somewhat inconclusive in showing why you would care about STL1)the containers part of the Standard Library is referred to as simply STL this time around we move right away to a practical example of how you could do things without STL, and in a follow up we’ll look at the STL alternative.   Vertex Neighborhood problems Maya offers a single straightforward way to get the neighborhood of an arbitrary point: the getConnectedVertices() method in the mesh vertex iterator. It’s a suitable place and a reasonable layout, but it has one issue, the degree of topological connection is limited to 1; only the immediately connected points are available, if you want the points connected to the connected points you’re on your own. Sampling data around a vertex, with around being the topological geography of it, is an incredibly common operation that a lot of important algorithms use2)I’d say Laplacian based operations like Smoothing/Relaxing geometry or vertex attributes are the most common and the most intuitive; a lot of the time the immediate neighborhood is all you need, but not infrequently you need a deeper neighborhood. Smoothing skinning weights … Continue Reading →

Bridging The Gap, Standard Library and Maya

Over the years I’ve found myself needing large enough, or better served, containers than what Maya provides out of the box. After years of ad hoc hacks or local, thin wrappers I decided to start cooking a more extensive and reliable wrapper/bridge between Maya’s somewhat aging facilities and some of the Standard Library facilities1)C++’s Standard Library. Having had the capital idea of leaving the Australian summer to spend time home when the weather is finger blackening cold I thought I might as well kill some time, and write about a few bits of interest as I go. The following is just about equal parts ramblings and some notions and explanations of fundamentals of C++ and how they apply, with a handful of listings to exemplify things. Maybe they’ll be of use to someone, maybe not. If you know enough Maya and enough C++ to cobble together a plugin, but not quite enough to risk tossing around raw pointers and pointer arithmetic, and intend to use the Standard Library containers, this could be for you. If you are an intermediate programmer with enough knowledge of C++ and the Standard Library, then this might all be obvious and trivial. If you are … Continue Reading →