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


Python Surface.update方法代码示例

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


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

示例1: Application

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

#.........这里部分代码省略.........
        #       https://www.youtube.com/watch?v=iJUlqwKEdVQ

        # HACK: yuck.. this is getting out of hands now :(:(:(
        self._vertex_origo = blender_scene.objects[OBJ_PROTOTYPE_VERTEX_ALL]

        # EXPERIMENTAL
        self._armature_control = blender_scene.objects[OBJ_ARMATURE_CONTROL]
        self._armature         = blender_scene.objects[OBJ_ARMATURE]
        self._geometry         = blender_scene.objects[OBJ_GEOMETRY]
        # EXPERIMENTAL

        # Set position setter
        # If DESK
        if mounted_on_desk:
            self._positioner = self._positioner_on_desk
            self._selector   = self._select_right_hand_on_desk
        # 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)
开发者ID:kitchenbudapest,项目名称:vr,代码行数:69,代码来源:app.py


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