コード例 #1
0
def transferRigifyToIk(rig, context, delim):
    from rig_ui import ik2fk_arm, ik2fk_leg

    scn = context.scene
    frames = getActiveFramesBetweenMarkers(rig, scn)
    nFrames = len(frames)
    for n, frame in enumerate(frames):
        showProgress(n, frame, nFrames)
        scn.frame_set(frame)
        updateScene()

        if scn.McpFkIkArms:
            for suffix in [".L", ".R"]:
                # @ssq NOT_CHANGED
                uarm = "upper_arm" + delim + "fk" + suffix
                farm = "forearm" + delim + "fk" + suffix
                hand = "hand" + delim + "fk" + suffix
                uarmi = "MCH-upper_arm" + delim + "ik" + suffix
                farmi = "MCH-forearm" + delim + "ik" + suffix
                handi = "hand" + delim + "ik" + suffix
                pole = "elbow_target" + delim + "ik" + suffix

                fk = [uarm, farm, hand]
                ik = [uarmi, farmi, handi, pole]
                ik2fk_arm(rig, fk, ik)

                setLocation(pole, rig)
                setLocRot(handi, rig)

        if scn.McpFkIkLegs:
            for suffix in [".L", ".R"]:
                # @ssq NOT_CHANGED
                thigh = "thigh" + delim + "fk" + suffix
                shin = "shin" + delim + "fk" + suffix
                foot = "foot" + delim + "fk" + suffix
                mfoot = "MCH-foot" + suffix
                thighi = "MCH-thigh" + delim + "ik" + suffix
                shini = "MCH-shin" + delim + "ik" + suffix
                footi = "foot" + delim + "ik" + suffix
                footroll = "foot_roll" + delim + "ik" + suffix
                pole = "knee_target" + delim + "ik" + suffix
                mfooti = "MCH-foot" + suffix + ".001"

                fk = [thigh, shin, foot, mfoot]
                ik = [thighi, shini, footi, footroll, pole, mfooti]
                ik2fk_leg(rig, fk, ik)

                setLocation(pole, rig)
                setLocRot(footi, rig)
                setRotation(footroll, rig)

    setInterpolation(rig)
    for suffix in [".L", ".R"]:
        if scn.McpFkIkArms:
            rig.pose.bones["hand.ik" + suffix]["ikfk_switch"] = 1.0
        if scn.McpFkIkLegs:
            rig.pose.bones["foot.ik" + suffix]["ikfk_switch"] = 1.0
コード例 #2
0
ファイル: fkik.py プロジェクト: jultrunb/ass
def transferRigifyToIk(rig, scn):
    from rig_ui import ik2fk_arm, ik2fk_leg

    frames = getActiveFramesBetweenMarkers(rig, scn)
    nFrames = len(frames)
    for n,frame in enumerate(frames):
        showProgress(n, frame, nFrames)
        scn.frame_set(frame)
        updateScene()

        if scn.McpFkIkArms:
            for suffix in [".L", ".R"]:
                uarm  = "upper_arm.fk"+suffix
                farm  = "forearm.fk"+suffix
                hand  = "hand.fk"+suffix
                uarmi = "MCH-upper_arm.ik"+suffix
                farmi = "MCH-forearm.ik"+suffix
                handi = "hand.ik"+suffix
                pole  = "elbow_target.ik"+suffix

                fk = [uarm,farm,hand]
                ik = [uarmi,farmi,handi,pole]
                ik2fk_arm(rig, fk, ik)

                setLocation(pole, rig)
                setLocRot(handi, rig)

        if scn.McpFkIkLegs:
            for suffix in [".L", ".R"]:
                thigh  = "thigh.fk"+suffix
                shin   = "shin.fk"+suffix
                foot   = "foot.fk"+suffix
                mfoot  = "MCH-foot"+suffix
                thighi = "MCH-thigh.ik"+suffix
                shini  = "MCH-shin.ik"+suffix
                footi  = "foot.ik"+suffix
                footroll = "foot_roll.ik"+suffix
                pole   = "knee_target.ik"+suffix
                mfooti = "MCH-foot"+suffix+".001"

                fk = [thigh,shin,foot,mfoot]
                ik = [thighi,shini,footi,footroll,pole,mfooti]
                ik2fk_leg(rig, fk, ik)

                setLocation(pole, rig)
                setLocRot(footi, rig)
                setRotation(footroll, rig)

    setInterpolation(rig)
    for suffix in [".L", ".R"]:
        if scn.McpFkIkArms:
            rig.pose.bones["hand.ik"+suffix]["ikfk_switch"] = 1.0
        if scn.McpFkIkLegs:
            rig.pose.bones["foot.ik"+suffix]["ikfk_switch"] = 1.0