Exemple #1
0
def saveBvhFile(context, filepath):
    ob = context.object
    rig = ob.parent
    scn = context.scene
    if rig and rig.type == "ARMATURE":
        roots = rigRoots(rig)
        if len(roots) > 1:
            raise MHError("Armature %s has multiple roots: %s" % (rig.name, roots))
        scn.objects.active = rig
        (pname, ext) = os.path.splitext(filepath)
        bvhpath = pname + ".bvh"

        export_bvh.write_armature(
            context,
            bvhpath,
            frame_start=scn.frame_current,
            frame_end=scn.frame_current,
            global_scale=1.0,
            rotate_mode=scn.MhExportRotateMode,
            root_transform_only=True,
        )
        scn.objects.active = ob
        print("Saved %s" % bvhpath)
        return True
    else:
        return False
Exemple #2
0
def saveBvhFile(context, filepath):
    ob = context.object
    rig = ob.parent
    scn = context.scene
    if rig and rig.type == 'ARMATURE':
        roots = rigRoots(rig)
        if len(roots) > 1:
            raise MHError("Armature %s has multiple roots: %s" %
                          (rig.name, roots))
        scn.objects.active = rig
        (pname, ext) = os.path.splitext(filepath)
        bvhpath = pname + ".bvh"

        export_bvh.write_armature(context,
                                  bvhpath,
                                  frame_start=scn.frame_current,
                                  frame_end=scn.frame_current,
                                  global_scale=1.0,
                                  rotate_mode=scn.MhExportRotateMode,
                                  root_transform_only=True)
        scn.objects.active = ob
        print("Saved %s" % bvhpath)
        return True
    else:
        return False