Open2

PyMEL

shibeshibe

blendシェイプ名がFBXASC みたいに文字化けしてる場合
↓のスクリプトをMAYA上で実行して、文字化けした文字列を関数にかけていけばいい
https://qiita.com/it_ks/items/c2a076d26dc8b75ac141

from binascii import a2b_hex as a2b

def fbxasc_to_chr( target_str ):
    return_list = []

    stock = ''
    for var in target_str.split( 'FBXASC' ):
        # 空だったら無視する
        if not var:
            continue
        # 1文字目がアルファベットだったら対象外 return_listに足して次へ。
        if var[0].isalpha():
            return_list.append(var)
            continue

        # 字数が3より多ければ、3文字目までをint変換
        ex_digit = ''
        if len(var)>3:
            ex_digit = var[3:]
            code_int = int(var[:3])
        else:
            code_int = int(var)

        stock +=hex( code_int )
        try:
            return_list.append( a2b(stock.replace('0x','')).decode('utf8') )
        except UnicodeDecodeError:
            continue

        # decode、appendができたらリセット
        stock = ''

        if ex_digit:
            return_list.append(ex_digit)

    return ''.join(return_list)
shibeshibe

選択したオブジェクトのblendShapeのターゲット名をすべて取得
https://help.autodesk.com/cloudhelp/2022/ENU/Maya-Tech-Docs/PyMel/generated/classes/pymel.core.nodetypes/pymel.core.nodetypes.BlendShape.html

import pymel.core as pm

def get_blendshapes():
    # 選択されたオブジェクトを取得
    selected_objects = pm.ls(selection=True, dag=True, type='transform')

    # 選択されたオブジェクトごとにブレンドシェイプを取得
    for obj in selected_objects:
        history = pm.listHistory(obj)
        blendshapes = pm.ls( history, type = 'blendShape')
        print(blendshapes[0])

        targets = blendshapes[0].getTarget()
        
    for target in targets:
        print(target)

# プラグインのメイン関数
def main():
    get_blendshapes()

# メイン関数を実行
main()