Ejemplo n.º 1
0
    def parse(cls, version_name: str):
        parser = argparse.ArgumentParser()
        parser.add_argument('--motion_path',
                            dest='motion_path',
                            help='input vmd',
                            type=str)
        parser.add_argument('--model_path',
                            dest='model_path',
                            help='model_path',
                            type=str)
        parser.add_argument('--loop_cnt',
                            dest='loop_cnt',
                            help='loop_cnt',
                            type=int)
        parser.add_argument('--interpolation',
                            dest='interpolation',
                            help='interpolation',
                            type=int)
        parser.add_argument("--verbose", type=int, default=20)

        args = parser.parse_args()

        # ログディレクトリ作成
        os.makedirs("log", exist_ok=True)

        MLogger.initialize(level=args.verbose, is_file=True)

        try:
            motion = VmdReader(args.motion_path).read_data()
            model = PmxReader(args.model_path).read_data()

            # 出力ファイルパス
            output_vmd_path = MFileUtils.get_output_smooth_vmd_path(
                motion.path, model.path, "", args.interpolation, args.loop_cnt,
                True)

            options = MSmoothOptions(\
                version_name=version_name, \
                logging_level=args.verbose, \
                motion=motion, \
                model=model, \
                output_path=output_vmd_path, \
                loop_cnt=args.loop_cnt, \
                interpolation=args.interpolation, \
                monitor=sys.stdout, \
                is_file=True, \
                outout_datetime=logger.outout_datetime, \
                max_workers=1)

            return options
        except SizingException as se:
            logger.error("スムージング処理が処理できないデータで終了しました。\n\n%s",
                         se.message,
                         decoration=MLogger.DECORATION_BOX)
        except Exception as e:
            logger.critical("スムージング処理が意図せぬエラーで終了しました。",
                            e,
                            decoration=MLogger.DECORATION_BOX)
Ejemplo n.º 2
0
    def set_output_vmd_path(self, event, is_force=False):
        output_smooth_vmd_path = MFileUtils.get_output_smooth_vmd_path(
            self.smooth_vmd_file_ctrl.file_ctrl.GetPath(),
            self.smooth_model_file_ctrl.file_ctrl.GetPath(),
            self.output_smooth_vmd_file_ctrl.file_ctrl.GetPath(),
            self.interpolation_ctrl.GetSelection(),
            self.loop_cnt_ctrl.GetValue(), is_force)

        self.output_smooth_vmd_file_ctrl.file_ctrl.SetPath(
            output_smooth_vmd_path)

        if len(output_smooth_vmd_path) >= 255 and os.name == "nt":
            logger.error("生成予定のファイルパスがWindowsの制限を超えています。\n生成予定パス: {0}".format(
                output_smooth_vmd_path),
                         decoration=MLogger.DECORATION_BOX)