Implimenting an array of weight lists.

Implimenting an array of weight lists.

jmreinhart
Advisor Advisor
367 Views
0 Replies
Message 1 of 1

Implimenting an array of weight lists.

jmreinhart
Advisor
Advisor

microWeights_screenShot_mayaForum.png

I am testing out a deformer that has an array of weightLists. I am not trying to make them paintable. I am going to do is turn the  parameterU attribute into an array.  I want the node to multiply each of the weightLists by the parameterU value with the same index, and then add them together, so that the deformation is based on a weighted average of the weight lists. 

 

I'm new to writing deformers and even more new to c++, and I curious to know what would be the most efficient way to do this in the code.

 

1:

I was planning on using MArrayDataHandles inside of the geometryIterator for the deformer to get the weights from each weightList for each component. That seems like it would be quite slow because we are jumping from weightlist to weight list.

 

2:

I thought it would be more efficient to create a C++ array of all 0's, and then go through each weight list and multiply the weights by the parameterU value and then add them to the value at the right index in the list. And then get the values out of that list during the geometryIterator part of the deform method. But C++ doesn't seem to like arrays whose size is not constant (but it's very possible I was doing something wrong)

 

3:

I saw some code examples that used the MPlug.selectAncestorLogicalIndex() to iterate through similar attribute hierarchies, so that's another technique I am looking into.

 

I just want to know which of these techniques would be the best in terms of performance and readability, and why.

My apologies for such a wordy  post, if anything isn't clear I will do my best to explain, thanks.

 

0 Likes
368 Views
0 Replies
Replies (0)