当前位置: 首页>>代码示例>>Python>>正文


Python Surface.deserialise方法代码示例

本文整理汇总了Python中surface.Surface.deserialise方法的典型用法代码示例。如果您正苦于以下问题:Python Surface.deserialise方法的具体用法?Python Surface.deserialise怎么用?Python Surface.deserialise使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在surface.Surface的用法示例。


在下文中一共展示了Surface.deserialise方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Application

# 需要导入模块: from surface import Surface [as 别名]
# 或者: from surface.Surface import deserialise [as 别名]

#.........这里部分代码省略.........
        # If HEAD
        else:
            self._positioner = self._positioner_on_head
            self._selector   = self._select_right_hand_on_head

        # Last time saved
        self._auto_save_time = self._origo[PROP_TEXT_TIMER]


    #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
    def reset_view(self):
        orientation = Matrix(((1.0, 0.0, 0.0),
                              (0.0, 1.0, 0.0),
                              (0.0, 0.0, 1.0)))
        self._armature_control.worldOrientation = orientation
        self._armature.worldOrientation = orientation
        self._vertex_origo.worldScale = 1, 1, 1
        self._surface.update()


    #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
    def save(self):
        # Save created mesh
        file_path = INT_TEMP_SAVE_FILE.format(datetime.now())
        save_to_file(path=file_path, data=self._surface.serialise())
        print('[OKAY] file has been saved to:', file_path)


    #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
    def load(self):
        try:
            file_path = join(INT_TEMP_SAVE_FOLDER,
                             next(reversed(sorted(listdir(INT_TEMP_SAVE_FOLDER)))))
            self._surface.deserialise(load_from_file(file_path))
            print('[OKAY] file has been loaded from:', file_path)
        except StopIteration:
            print('[FAIL] there is no file in:', INT_TEMP_SAVE_FOLDER)


    #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
    def auto_save(self):
        current_time = self._origo[PROP_TEXT_TIMER]
        if self._auto_save_time + INT_AUTO_SAVE_INTERVAL <= current_time:
            # Update last-time checked value
            self._auto_save_time = current_time
            # Save created mesh
            save_to_file(path=INT_AUTO_SAVE_FILE,
                         data=self._surface.serialise())
            print('[OKAY] file has been auto-saved to:', INT_AUTO_SAVE_FILE)


    #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
    def recover_from_auto_save(self):
        self._auto_save_time = self._origo[PROP_TEXT_TIMER]
        self._surface.deserialise(load_from_file(INT_AUTO_SAVE_FILE))
        print('[OKAY] file has been recovered from:', INT_AUTO_SAVE_FILE)


    #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
    def __call__(self):
        # HACK: The ugliest hack I've ever done...
        if self._preprocess:
            try:
                # Set HUD scene
                self._blender_overlay_scene = bge.logic.getSceneList()[1]
                # Stop preprocessing loops
开发者ID:kitchenbudapest,项目名称:vr,代码行数:70,代码来源:app.py


注:本文中的surface.Surface.deserialise方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。