Skip to content

Instantly share code, notes, and snippets.

@nabesakarenders
Created November 6, 2023 13:01
Show Gist options
  • Save nabesakarenders/391d9af5efb90998dc84a4a8a0b1b420 to your computer and use it in GitHub Desktop.
Save nabesakarenders/391d9af5efb90998dc84a4a8a0b1b420 to your computer and use it in GitHub Desktop.
Convert DAZ vertex groups to Auto Rig Pro
import bpy
# This is your dictionary of vertex groups to be renamed.
vertex_groups = {
"lHand": "hand.l",
"rHand": "hand.r",
"BelowJaw": "BelowJaw",
"lForearmTwist": "c_forearm_stretch.l",
"rForearmTwist": "c_forearm_stretch.r",
"lForearmBend": "c_forearm_twist.l",
"rForearmBend": "c_forearm_twist.r",
"lowerJaw": "jawbone.x",
"lShldrTwist": "c_arm_stretch.l",
"rShldrTwist": "c_arm_stretch.r",
"head": "head.x",
"lMetatarsals": "lMetatarsals",
"rMetatarsals": "rMetatarsals",
"lShldrBend": "c_arm_twist.l",
"rShldrBend": "c_arm_twist.r",
"neckUpper": "neck.x",
"lFoot": "foot.l",
"rFoot": "foot.r",
"lCollar": "shoulder.l",
"rCollar": "shoulder.r",
"neckLower": "c_subneck_1.x",
"lShin": "c_leg_stretch.l",
"rShin": "c_leg_stretch.r",
"chestUpper": "spine_04.x",
"lPectoral": "c_breast_01.l",
"rPectoral": "c_breast_01.r",
"lThighTwist": "c_thigh_stretch.l",
"rThighTwist": "c_thigh_stretch.r",
"chestLower": "spine_03.x",
"lThighBend": "c_thigh_twist.l",
"rThighBend": "c_thigh_twist.r",
"abdomenUpper": "spine_02.x",
"pelvis": "root.x",
"abdomenLower": "spine_01.x",
}
# Assuming you have an active object that has vertex groups.
obj = bpy.context.active_object
# Check if the active object is a mesh and has vertex groups.
if obj and obj.type == 'MESH' and obj.vertex_groups:
for old_name, new_name in vertex_groups.items():
# Check if the vertex group exists in the object.
if old_name in obj.vertex_groups:
# Rename the vertex group.
obj.vertex_groups[old_name].name = new_name
else:
print(f"Vertex group '{old_name}' not found in the active object.")
else:
print("No active mesh object with vertex groups found.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment