Weight Maps - API
Faux2D
Posts: 452
I've searched the documentation, samples, and forum but I couldn't find a method of modifying the weightmaps through Script IDE. Are there any scripts or documentation which deal with weightmaps? I want to know the steps to get a weightmap, read its values, and change its values.
Comments
This post has some relevant info: https://www.daz3d.com/forums/discussion/comment/4346826/#Comment_4346826
Example:
DzBoneBinding has a setWeights(WeightMap) function.
But also see https://www.daz3d.com/forums/discussion/comment/4347541/#Comment_4347541, especially with DS 5 in the offing
Thanks both of you, this has been immensely helpful. getFloatWeight(int) does the trick, with "int" being the vertex index.
I have another question.
How do you modify the weightmap values? It would be easy if something like "setFloatWeights(Idx,value)" worked but I see no function to change anything within a weightmap.
I have not found anything either.
All I can suggest is to edit a .duf or .dsf file - e.g. search for binding in data/DAZ 3D/Genesis 8/Female/Genesis8Female.dsf
I've found that quite a few things are not available through the scripting API, fewer not even through the C++ API, but the data is in the DSON nevertheless and is there for the parsing and so it's worthwhile to learn one's way around in DSON. I'm curious how much this will change with the scripting and C++ SDKs for 5.0 when they are released.
Looks like the next Beta version will have what you want:
http://docs.daz3d.com/doku.php/public/software/dazstudio/4/change_log
Extended DzWeightMap public API; added getStrengthControl()
Modified DzWeightMap public API; deprecated getStrengthController()
Extended DzProperty public API; added buildIdUriToRoot()
Updated public API documentation; DzWeightMap, DzMap, DzProperty
DAZ Studio : Incremented build number to 4.15.1.76
http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/object_index/weightmap_dz#a_1a8cc7a3d2f1fd37050a8729403c4bfb9e
void : setFloatWeight( Number idx, Number weight )
Parameter(s):
idx - The index of the vertex to set the weight for.
weight - The floating point equivalent (0.0 - 1.0) of the weight at the given index in the map.
See Also:
setNumWeights()
weightValuesChanged()
DzElement::beginEdit()
DzElement::finishEdit()
DzElement::cancelEdit()
getFloatWeight()
Since:
4.15.0.4
Sorry, I missed the vital bit here earlier - the change log entry for the unreleased 4.15.1.76 is about documentation, the actual change was made in 4.15.0.4 as noted in the quote from the scripting documentation. It is therefore already in the current General release, no need to wait.
Thanks - I missed that too.