Weight Maps - API

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

  • PraxisPraxis Posts: 252
    edited September 2021

    Faux2D said:

    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.

    This post  has some relevant info: https://www.daz3d.com/forums/discussion/comment/4346826/#Comment_4346826

    Example:

    var obj = Scene.getPrimarySelection().getSkeleton().getWeightMapHandler().getSkinBinding().findBoneBinding('lPectoral').getWeights();print( obj.className() );        // DzWeightMapprint( Object.keys( obj ) );// e.g.://   getNumWeights()//   getFloatWeight(int)

    DzBoneBinding has a setWeights(WeightMap) function.

     

    Post edited by Praxis on
  • Faux2DFaux2D Posts: 452

    Praxis said:

    Faux2D said:

    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.

    This post  has some relevant info: https://www.daz3d.com/forums/discussion/comment/4346826/#Comment_4346826

    Example:

    var obj = Scene.getPrimarySelection().getSkeleton().getWeightMapHandler().getSkinBinding().findBoneBinding('lPectoral').getWeights();print( obj.className() );        // DzWeightMapprint( Object.keys( obj ) );// e.g.://   getNumWeights()//   getFloatWeight(int)

    DzBoneBinding has a setWeights(WeightMap) function.

     

    Thanks both of you, this has been immensely helpful. getFloatWeight(int) does the trick, with "int" being the vertex index.

  • Faux2DFaux2D Posts: 452

    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.

  • PraxisPraxis Posts: 252

    Faux2D said:

    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

  • Praxis said:

    Faux2D said:

    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.

  • PraxisPraxis Posts: 252
    edited October 2021

    Faux2D said:

    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.

    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:

    Since:

    • 4.15.0.4

     

     

    Post edited by Praxis on
  • 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.

  • PraxisPraxis Posts: 252

    Richard Haseltine said:

    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.

Sign In or Register to comment.