Home Website Youtube GitHub

ngSkinTool 2.0 mirror set mirror distance threshold value

config : maya 2022.4 / ngSkinTools 2.1.3

Hello guys !

I need to change InfluenceMappingConfig().distance_threshold value with python and reevaluate the mirroring.

image

Thank’s for your help !

1 Like

This is an mGear forum, so I moved this to “Rigging General”.

Where are you stuck on this? What have you tried so far?

Hello Chris,

I build mgear rig in batch, I’m stuck just after imported ngSkinTool .json weight file. I need to set in script the mirroring position Tolerance to avoid wrong skin behaviours with support joints for example.

This the part of script :

from ngSkinTools2.api import InfluenceMappingConfig, InfluenceMapping, VertexTransferMode, import_export

# - import weights and layers from ngSkinTools.
import_export.import_json(sknClusterName, 
					      self.skinPresetFilePath,
					      vertex_transfer_mode=VertexTransferMode.vertexId
					      )

# - set ngSkinTools mirror distance threshold.
InfluenceMappingConfig().distance_threshold = 0.055 # -  > distance_threshold attribute can't be setted it return always 0.001
InfluenceMapping().calculate()


# - import RBF datas.
rbf_io.importRBFs(self.rbfPresetFilePath)

In the module …/scripts/ngSkinTools2/api/influenceMapping.py

the attribute distance_threshold is not editable.

Just after that, I import RBF .json and make so many actions on mgear rig.

1 Like

It seems you are trying to edit the class property on an instance call.

When you call InfluenceMappingConfig() it is going to make an instance of the InfluenceMappingConfig class. However, you haven’t stored it anywhere. So the next time you call InfluenceMappingConfig() you will end up with a brand new instance with the default values.

You then call .calculate() on another brand new instance, with default values.

Try this instead:

myMap = InfluenceMappingConfig()
print(myMap.distance_threshold)
# RESULT: 0.001
myMap.distance_threshold = 0.055
print(myMap.distance_threshold)
# RESULT: 0.055
myMap.calculate()
2 Likes

Hi Chris,

thanks for you’re reply. Of course, I have to instance my class, my bad …

Now it works, but calculate() do nothing because no source and destination influences are given in input.

I’m going to check this !

Thank you !