motiondsl.motiondsl

The actual implementation of the MotionDSL (motiondsl), using textX.

The module-level member dsl is the default instance of the MotionDSL class. Normally, you will only need this preallocated instance to load a document in the MotionDSL format.

For example:

import os, sys
import motiondsl.motiondsl as motdsl

def main():
    if len(sys.argv) > 1 :
        ifile = sys.argv[1]
    else :
        ifile = os.path.join( os.path.dirname(__file__), 'sample.motdsl')

    # Load the motions-model from the input file
    motionsModel = motdsl.dsl.modelFromFile(ifile)

    print("Motions (poses) model name: ", motionsModel.name)

    # Convert the motions-model to a pose-specification model
    posesModel = motdsl.toPosesSpecification(motionsModel)

See also the files in the sample/motiondsl folder.

class MotionDSL:
mm
def modelFromFile(self, file):

The MotionDSL model represented by the given conforming document.

Arguments:

  • file: path of a MotionDSL document (i.e. a text file)
def modelFromText(self, text):
dsl = <MotionDSL object>
def toPosesSpecification(dslmodel):

Convert a MotionDSL model into a kgprim.motions.PosesSpec instance.

One typically gets a MotionDSL model by loading it from an input document; see MotionDSL.modelFromFile()

def expressionToMotionDSLSnippet(expr):
def poseSpecToMotionDSLSnippet(poseSpec):
def snippetToPoseSpec(text):