lib.py 文件源码

python
阅读 35 收藏 0 点赞 0 评论 0

项目:config 作者: mindbender-studio 项目源码 文件源码
def _maintained_selection_decorator(func):
    """Function decorator to maintain the selection once called

    Example:
        >>> @_maintained_selection
        ... def my_function():
        ...    # Modify selection
        ...    cmds.select(clear=True)
        ...
        >>> # Selection restored

    """

    def wrapper(*args, **kwargs):
        previous_selection = cmds.ls(selection=True)
        try:
            return func(*args, **kwargs)
        finally:
            if previous_selection:
                cmds.select(previous_selection,
                            replace=True,
                            noExpand=True)
            else:
                cmds.select(deselect=True,
                            noExpand=True)

    return wrapper
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号