Ejemplo n.º 1
0
    def export(self, human, filename):
        if not human.getSkeleton():
            gui3d.app.prompt(
                'Error', 'You did not select a skeleton from the library.',
                'OK')
            return

        skel = human.getSkeleton()
        cfg = BvhConfig(self)

        if self.exportAnimations and len(human.animated.getAnimations()) > 0:
            baseFilename = os.path.splitext(filename("bvh"))[0]
            for animName in human.animated.getAnimations():
                fn = baseFilename + "_%s.bvh" % animName
                log.message("Exporting file %s.", fn)
                bvhData = bvh.createFromSkeleton(
                    skel, human.animated.getAnimation(animName))
                if cfg.scale != 1:
                    bvhData.scale(cfg.scale)
                bvhData.writeToFile(fn)
        else:
            fn = filename("bvh")
            log.message("Exporting file %s.", fn)
            bvhData = bvh.createFromSkeleton(skel)
            if cfg.scale != 1:
                bvhData.scale(cfg.scale)
            bvhData.writeToFile(fn)
Ejemplo n.º 2
0
    def export(self, human, filename):
        if not human.getSkeleton():
            G.app.prompt('Error', 'You did not select a skeleton from the library.', 'OK')
            return

        skel = human.getSkeleton()
        cfg = self.getConfig()
        cfg.setHuman(human)

        if cfg.exportAnimations and len(human.getAnimations()) > 0:
            baseFilename = os.path.splitext(filename("bvh"))[0]
            for animName in human.getAnimations():
                fn = baseFilename + "_%s.bvh" % animName
                log.message("Exporting file %s.", fn)
                bvhData = bvh.createFromSkeleton(skel, human.getAnimation(animName))
                if cfg.scale != 1:
                    bvhData.scale(cfg.scale)
                if cfg.feetOnGround:
                    bvhData.offset(cfg.offset)
                bvhData.writeToFile(fn)
        else:
            fn = filename("bvh")
            log.message("Exporting file %s.", fn)
            if human.isPosed():
                bvhData = bvh.createFromSkeleton(skel, human.getActiveAnimation())
            else:
                bvhData = bvh.createFromSkeleton(skel)
            if cfg.scale != 1:
                bvhData.scale(cfg.scale)
            if cfg.feetOnGround:
                bvhData.offset(cfg.offset)
            bvhData.writeToFile(fn)
Ejemplo n.º 3
0
    def export(self, human, filename):
        if not human.getSkeleton():
            G.app.prompt('Error', 'You did not select a skeleton from the library.', 'OK')
            return

        skel = human.getSkeleton()
        cfg = self.getConfig()
        cfg.setHuman(human)

        if self.exportAnimations and len(human.animated.getAnimations()) > 0:
            baseFilename = os.path.splitext(filename("bvh"))[0]
            for animName in human.animated.getAnimations():
                fn = baseFilename + "_%s.bvh" % animName
                log.message("Exporting file %s.", fn)
                bvhData = bvh.createFromSkeleton(skel, human.animated.getAnimation(animName))
                if cfg.scale != 1:
                    bvhData.scale(cfg.scale)
                bvhData.writeToFile(fn)
        else:
            fn = filename("bvh")
            log.message("Exporting file %s.", fn)
            bvhData = bvh.createFromSkeleton(skel)
            if cfg.scale != 1:
                bvhData.scale(cfg.scale)
            bvhData.writeToFile(fn)