[Closed] C++ ReplaceVertexWeight
^^^^^ just means up there you know the code you posted up there ^^^^^ is useless to anyone else as it’s non compilable nonsense.
Ok, but my assumption was someone that has build environment (like you!) Can compile the code easily. Also I’m sure for someone that has expreince in this field (again like you! Or Denis) makes sense even just by looking at the code.
Anyway, my goal is to translate some parts of my maxscript code to cpp. And I started from skin functions which I’m sure can be faster.
I want to share my opinion on why we need the mechanism “mxs function publishing”.
At a certain point, many tools developers (3DS MAX in particular) are wondering whether to stay with the scripts or switch to c ++ sdk.
So, if you have started to actively use “function publishing”, it just says that you stay with the scripts. And this, in my opinion, is the most effective and productive method of 3ds max tools development.
In your code, I see that you include c++ methods that do not give you any advantages over mxs (for example, creating nodes and objects).
Yes, Exactly! Thank You!
Actually I wanted to explore the SDK world a little bit more to know how the mechanism works. For example what is the node, object, drived object, modcontext and relationship between them. That’s why I created all in C++. But You right, I should skip the unnecessary parts.
here is how your task with skinned plane might look in my framework with my mxs extension:
(
node = plane width:x length:y widthsegs:xs lengthsegs:ys
node = converttopoly n
sk = skin()
addmodifier node sk
pp = getpointpositions node
bones = for p in pp collect (sphere radius:r pos:p)
addskinbone sk bones
sk_data = getskindata sk
normalizeSkinWeights sk_data verts:#all neighbors:2 type:#linear
setskindata sk sk_data update:on
)
published functions are:
getPointPositions – get point positions of any deformable object in a specified coordinate system
addSkinBone – adds bone(s) without node and/or modifier selection
getSkinData – collect both skin and mesh data with information about skin and mesh geometry(topology)
normalizeSkinWeights – smooth and normalize skin data based on mesh(neighbors) or geometry distance
setSkinData – sets skin data to the skin (like a replace weights)
everything else can be simply done with mxs
Nice!, So you completely get the skin data and set it back after modification right? what is the data type of skin data? c++ class or max’s structure or just some arrays?
Another side question is why you converted the mesh to poly? where it might help?
very clever questions. I will be happy to answer them …
let’s start with the second.
poly vs mesh is a more organized system, it gives an advantage in finding vertex neighbors, edge rings / loops, in-between face, edge, vertex conversions. it helps a lot during advanced skin weights operations (smooth, blend, average, contrast, etc.) and advanced selection.
the skin modifier itself uses mesh local data which is more close to poly structures
i store skin data in my mxs published class which doesn’t use script memory and provides quick (c++) methods to work with.