Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- all this dose is create blenshapes with the appropritae name for there situation
- iPhone Ar Face Motion capture Blendshapes
- # Predefined list of shape key names
- names = [
- "Basis", "browOuterUp_L", "browOuterUp_R", "eyeSquint_L", "eyeSquint_R",
- "eyeLookIn_L", "eyeLookOut_L", "eyeLookIn_R", "eyeLookOut_R", "eyeLookUp_L",
- "eyeLookUp_R", "eyeLookDown_L", "eyeLookDown_R", "cheekPuff", "cheekSquint_L",
- "cheekSquint_R", "noseSneer_L", "noseSneer_R", "mouthLeft", "mouthRight",
- "mouthPucker", "mouthFunnel", "mouthSmile_L", "mouthSmile_R", "mouthFrown_L",
- "mouthFrown_R", "mouthDimple_L", "mouthDimple_R", "mouthPress_L", "mouthPress_R",
- "mouthShrugLower", "mouthShrugUpper", "mouthStretch_L", "mouthStretch_R",
- "mouthUpperUp_L", "mouthUpperUp_R", "mouthLowerDown_L", "mouthLowerDown_R",
- "mouthRollUpper", "mouthRollLower", "mouthClosed", "jawForward", "jawOpen",
- "jawLeft", "jawRight", "browInnerUp", "eyeBlinking_Right", "eyeBlinking_Left",
- "browDown_Left", "browDown_Right", "eyeWide_Right", "eyeWide_Left",
- "tongue_jawOpen", "tongue_jawForward", "tongue_jawLeft", "tongue_jawRight",
- "tongue_tongueOut"
- ]
- Vrchat Defult Facial Bland shapes
- # Predefined list of shape key names
- names = [
- "Basis", "blink_both", "blink_left", "blink_righ", "lowerlid_left", "lowerlid_tight",
- "v_th", "v_ss", "v_sil", "v_rr", "v_pp", "v_ou", "v_oh", "v_nn", "v_kk", "v_ih", "v_ff", "v_ee", "v_dd", "v_ch", "v_aa",
- "button-out", "mouth-open", "mouth-smile"
- ]
- """
- import bpy
- def apply_shape_keys_from_list():
- # Get the active object
- active_object = bpy.context.active_object
- # Check if an object is selected and is in Object mode
- if active_object and active_object.type == 'MESH' and bpy.context.mode == 'OBJECT':
- # Ensure the mesh has an armature modifier
- armature_modifier = active_object.modifiers.get("Armature")
- if not armature_modifier:
- print("Error: Please select a mesh with an Armature modifier.")
- return
- # Predefined list of shape key names
- names = [
- "Basis", "browOuterUp_L", "browOuterUp_R", "eyeSquint_L", "eyeSquint_R",
- "eyeLookIn_L", "eyeLookOut_L", "eyeLookIn_R", "eyeLookOut_R", "eyeLookUp_L",
- "eyeLookUp_R", "eyeLookDown_L", "eyeLookDown_R", "cheekPuff", "cheekSquint_L",
- "cheekSquint_R", "noseSneer_L", "noseSneer_R", "mouthLeft", "mouthRight",
- "mouthPucker", "mouthFunnel", "mouthSmile_L", "mouthSmile_R", "mouthFrown_L",
- "mouthFrown_R", "mouthDimple_L", "mouthDimple_R", "mouthPress_L", "mouthPress_R",
- "mouthShrugLower", "mouthShrugUpper", "mouthStretch_L", "mouthStretch_R",
- "mouthUpperUp_L", "mouthUpperUp_R", "mouthLowerDown_L", "mouthLowerDown_R",
- "mouthRollUpper", "mouthRollLower", "mouthClosed", "jawForward", "jawOpen",
- "jawLeft", "jawRight", "browInnerUp", "eyeBlinking_Right", "eyeBlinking_Left",
- "browDown_Left", "browDown_Right", "eyeWide_Right", "eyeWide_Left",
- "tongue_jawOpen", "tongue_jawForward", "tongue_jawLeft", "tongue_jawRight",
- "tongue_tongueOut"
- ]
- # Set the frame range based on your animation
- start_frame = bpy.context.scene.frame_start
- end_frame = bpy.context.scene.frame_end
- # Iterate over each frame
- for frame in range(start_frame, end_frame + 1):
- # Set the current frame
- bpy.context.scene.frame_set(frame)
- # Apply the armature modifier as a shape key
- bpy.ops.object.modifier_apply_as_shapekey(keep_modifier=True, modifier="Armature")
- # Assign a name from the list to the new shape key
- shape_key_name = names[frame % len(names)]
- active_object.data.shape_keys.key_blocks[-1].name = shape_key_name
- print("Shape keys applied and named from the list.")
- else:
- print("Error: Please select a mesh object in Object mode.")
- # Call the function to apply shape keys and assign names
- apply_shape_keys_from_list()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement