How to upgrade the Rig to the merged Deformers:
The SkinWeightsLayerPainter node is kept for rig upgrade only.
To upgrade a previous rig, here are the steps that are needed:
- For skinners (body, facial, attach, eyes…), import new ones then:
use the script below with weights_layers as both DEFORMER_ATTRIBUTE and PAINTER_ATTRIBUTE to copy the skin layers;
use the script below with as activation_mask as DEFORMER_ATTRIBUTE and mask as PAINTER_ATTRIBUTE to copy the activation mask;
Note
The new name (“activation_mask”) of the buffer storing the mask weights may not match the one from the painter. If this is the case use the second part of the script to rename the mask with activation_mask as MASK and “activation_mask” as NEW_MASK_NAME.**
reconnect the input, skeleton and output plugs to replace the former skinner. The external RestValue node for the skeleton is now internal to the skinner (still overridable if suited);
for the Attach skinners, connect the flatten_weights plug of the mimicked skinner into the weights_override plug;
- For blendshapes deformers:
use the script below with activation_mask as DEFORMER_ATTRIBUTE and mask as PAINTER_ATTRIBUTE to copy the activation mask;
Note
The new name (“activation_mask”) of the buffer storing the mask weights may not match the one from the painter. If this is the case use the second part of the script to rename the mask with activation_mask as MASK and “activation_mask” as NEW_MASK_NAME.**
- For wrappers, import new ones then:
use the script below with mask_to_wrap as DEFORMER_ATTRIBUTE and mask as PAINTER_ATTRIBUTE to copy the input weights;
Note
The new name (“mask_to_wrap”) of the buffer storing the mask weights may not match the one from the painter. If this is the case use the second part of the script to rename the mask with mask_to_wrap as MASK and “mask_to_wrap” as NEW_MASK_NAME.**
reconnect the input and driver to replace the former wrapper. The rest values for the input and target scenes are now given by internal RestValue nodes (still overridable if suited);
- For UVN skinners (lids), import new ones then:
use the script below with weights as DEFORMER_ATTRIBUTE and mask as PAINTER_ATTRIBUTE to copy the weights.
Note
The new name (“weights”) of the buffer storing the weights may not match the one from the painter. If this is the case use the second part of the script to rename the mask with weights as MASK and “weights” as NEW_MASK_NAME.**
The external RestValue node for the curve is now internal to the skinner (still overridable if suited);
- For cluster deformers:
use the script below with weights as DEFORMER_ATTRIBUTE and mask as PAINTER_ATTRIBUTE to copy the weights;
Note
The new name (“weights”) of the buffer storing the weights may not match the one from the painter. If this is the case use the second part of the script to rename the weights with weights as MASK and “weights” as NEW_MASK_NAME.**
import rumba
doc = rumba.workspace().child("documents/Document_0")
# Replace PATH_TO_PAINTER and PATH_TO_DEFORMER with the paths to the painter and deformer nodes
painter = doc.child(PATH_TO_PAINTER)
deformer = doc.child(PATH_TO_DEFORMER)
# Replace DEFORMER_ATTRIBUTE and PAINTER_ATTRIBUTE with the corresponding plugs
deformer.DEFORMER_ATTRIBUTE.set_value(painter.PAINTER_ATTRIBUTE.value())
# Below: only if the attribute name needs to be updated.
# Replace MASK and NEW_MASK_NAME with the corresponding plug and name of the attribute
old_mask_name = painter.attribute.as_string()
mask = rumba.SceneConst(deformer.DEFORMER_ATTRIBUTE.value())
new_mask = rumba.duplicate(mask, True)
for scene in new_mask.write_children(False, True):
shape = scene.geometry()
if shape.has_attribute(old_mask_name, rumba.Shape.Topology.vertex):
attr = shape.read_attribute(old_mask_name, rumba.Shape.Topology.vertex)
shape.set_attribute(NEW_MASK_NAME, rumba.Shape.Topology.vertex, attr)
shape.remove_attribute(old_mask_name, rumba.Shape.Topology.vertex)
deformer.DEFORMER_ATTRIBUTE.set_value(new_mask)