Exemplo n.º 1
0
def applyPosesFromLibrary(path, n=0, meshName = None, onlyRot = False):

    mainDir = os.path.dirname(path)
    poseFiles = os.listdir(mainDir)
    homedir = os.path.expanduser('~')

    saveDir = os.path.join(homedir, "poseLibBlender")
    if not os.path.isdir(saveDir):
        os.mkdir(saveDir)

    for poseFile in poseFiles:

        blendFile = os.path.join(saveDir,poseFile+".blend")

        startEditing()
        vertices = getVertices(n, name = meshName)
        pPath = os.path.join(mainDir,poseFile)
        maketargetlib.loadPoseFromFile(vertices,pPath,1.00,onlyRot)
        updateVertices(vertices, n, name = meshName)
        endEditing()

        Blender.Save(blendFile)

        startEditing()
        vertices = getVertices(n, name = meshName)
        pPath = os.path.join(mainDir,poseFile)
        maketargetlib.loadPoseFromFile(vertices,pPath,-1.00,onlyRot)
        updateVertices(vertices, n, name = meshName)
        endEditing()
Exemplo n.º 2
0
def applyPosesFromLibrary(path, n=0, meshName=None, onlyRot=False):

    mainDir = os.path.dirname(path)
    poseFiles = os.listdir(mainDir)
    homedir = os.path.expanduser('~')

    saveDir = os.path.join(homedir, "poseLibBlender")
    if not os.path.isdir(saveDir):
        os.mkdir(saveDir)

    for poseFile in poseFiles:

        blendFile = os.path.join(saveDir, poseFile + ".blend")

        startEditing()
        vertices = getVertices(n, name=meshName)
        pPath = os.path.join(mainDir, poseFile)
        maketargetlib.loadPoseFromFile(vertices, pPath, 1.00, onlyRot)
        updateVertices(vertices, n, name=meshName)
        endEditing()

        Blender.Save(blendFile)

        startEditing()
        vertices = getVertices(n, name=meshName)
        pPath = os.path.join(mainDir, poseFile)
        maketargetlib.loadPoseFromFile(vertices, pPath, -1.00, onlyRot)
        updateVertices(vertices, n, name=meshName)
        endEditing()
Exemplo n.º 3
0
def applyTarget(mFactor, n=0, meshName = None):
    global loadedTraslTarget,rotationMode,loadedRotTarget,loadedPoseTarget
    startEditing()
    vertices = getVertices(n, name = meshName)
    if rotationMode.val and not poseMode:
        maketargetlib.loadRotTarget(vertices,loadedRotTarget,mFactor)
    if not rotationMode.val and not poseMode:
        maketargetlib.loadTraslTarget(vertices,loadedTraslTarget,mFactor)
    if not rotationMode.val and poseMode:
        maketargetlib.loadPoseFromFile(vertices,loadedPoseTarget,mFactor)
    if rotationMode.val and poseMode:
        maketargetlib.loadPoseFromFile(vertices,loadedPoseTarget,mFactor,onlyRot = True)
    updateVertices(vertices, n, name = meshName)
    endEditing()
Exemplo n.º 4
0
def applyTarget(mFactor, n=0, meshName=None):
    global loadedTraslTarget, rotationMode, loadedRotTarget, loadedPoseTarget
    startEditing()
    vertices = getVertices(n, name=meshName)
    if rotationMode.val and not poseMode:
        maketargetlib.loadRotTarget(vertices, loadedRotTarget, mFactor)
    if not rotationMode.val and not poseMode:
        maketargetlib.loadTraslTarget(vertices, loadedTraslTarget, mFactor)
    if not rotationMode.val and poseMode:
        maketargetlib.loadPoseFromFile(vertices, loadedPoseTarget, mFactor)
    if rotationMode.val and poseMode:
        maketargetlib.loadPoseFromFile(vertices,
                                       loadedPoseTarget,
                                       mFactor,
                                       onlyRot=True)
    updateVertices(vertices, n, name=meshName)
    endEditing()