Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import bpy
- from mathutils import Vector, Matrix, Quaternion, Euler, Color
- context = bpy.context
- #start list with first item as 'Basis'
- poseList = ['Basis']
- #Get list of names from pose library
- rig = bpy.data.objects.get("Face_Armature")
- pl = rig.pose_library
- i = 1
- if pl != None:
- for item in pl.pose_markers:
- poseList.append(item.name)
- print("Pose " + poseList[i] + " appended to list successfully")
- i+=1
- #prepare variables for next step
- i = 0
- #suffix for names
- suffix = ""
- #prefix for names
- prefix = ""
- #set prefix and suffix based on object's name
- for dest in bpy.context.selected_objects:
- if "head" in dest.name:
- prefix = "bs00_eye."
- suffix = ""
- elif "brows" in dest.name:
- prefix = "bs02_mayuge."
- suffix = "_mu"
- elif "lashes" in dest.name:
- prefix = "bs01_matuge."
- suffix = "_m"
- elif "tongue" in dest.name:
- prefix = "bs07_sita."
- suffix = "_sita"
- elif "teeth" in dest.name:
- prefix = "bs06_ha."
- suffix = "_ha"
- elif "t1" in dest.name:
- prefix = "bs03_namida01."
- suffix = "_n01"
- elif "t2" in dest.name:
- prefix = "bs04_namida02."
- suffix = "_n02"
- #get shape keys
- sks = dest.data.shape_keys
- #get shape keys names
- skNames = sks.key_blocks
- #cycle through destination's shapekeys and rename based on all previous rules
- for sk in skNames:
- if sk.name != "Basis":
- sk.name = prefix + poseList[i] + suffix + "_0"
- i +=1
- i = 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement