bgdev.utils.weightmap¶
Utility method to deal with weightmaps.
- created
13/12/2018
- author
Benoit GIELLY <benoit.gielly@gmail.com>
-
check_libraries
()[source]¶ Check if ngSkinTools package is available.
- Returns
A mapping dict with the required ngSkinTool modules.
- Return type
dict
- Raises
ImportError – If the package can’t be imported.
RuntimeError – If the package can’t be imported.
-
export_layer_data
(node, data, path)[source]¶ Export ngLayerData into JSON file.
- Parameters
node (str) – Name of the mesh. Used as filename.
data (dict) – The ngLayer dictionary to export.
path (str) – The parent folder where the file will be saved into.
-
export_multiple_skinweights
(nodes, path='weights')[source]¶ Export multiple skinweights into a single file.
- Parameters
nodes (str) – List of nodes to export their skinweights.
path (str) – File path to export weights.
-
export_skinweights
(node, path='weights', export=True)[source]¶ Export the weights of the given skincluster node.
- Parameters
node (str) – Name of the skinned node to export its weights.
path (str) – File path to export the weights.
export (bool) – Export weights into a file. Defaults to True. Use False when you only want the weights data.
- Returns
The weights data.
- Return type
dict
-
export_skinweights_callback
()[source]¶ Call back
export_skinweights()
.
-
import_layer_data
(node, path)[source]¶ Import ngLayerData from JSON file.
- Parameters
node (str) – Name of the mesh. Used to find the JSON file.
path (str) – The parent folder where the file is saved.
- Returns
The raw ngLayer data (somehow, this is a string!)
- Return type
str
-
import_multiple_skinweights
(path, layers=True)[source]¶ Import multiple skinweights into a single file.
- Parameters
path (str) – File path to export weights.
layers (bool) – Keep ngSkinTools layers or not.
-
import_skinweights
(node, path='weights', data=None, layers=True, mode='vertexID')[source]¶ Export the weights of the given skincluster node.
- Parameters
node (str) – Name of the skinned node to export its weights.
path (str) – File path to export the weights.
data (dict) – Use this data directly instead of reading if from file.
layers (bool) – Keep ngSkinTools layers or not.
mode (str) – Can be “vertexID”, “UV” or “closestPoint”. Defaults to “vertexID”.
-
import_skinweights_callback
()[source]¶ Call back
import_skinweights()
.