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


Python cmds.undoInfo方法代码示例

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


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

示例1: undoIt

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import undoInfo [as 别名]
def undoIt(self):

        undo_command = self.last_undo_journal.split(' ')[2:]
        self.logger.info('Undo: {}'.format(undo_command))
        if not undo_command:
            self.logger.warn('No more steps to undo')
            return

        undo_mode = undo_command.pop(0)
        if undo_mode == 'place' or undo_mode == 'spray':
            self.undo_place_action(int(undo_command[0]), int(undo_command[1]))
        elif undo_mode == 'scale':
            self.undo_vector_action('scale', undo_command)
        elif undo_mode == 'align':
            self.undo_vector_action('rotation', undo_command)
        elif undo_mode == 'move':
            self.undo_vector_action('position', undo_command)
        elif undo_mode == 'id':
            self.undo_int_action('instance_id', undo_command)
        elif undo_mode == 'remove':
            self.undo_remove_action(undo_command)

        self.last_undo_journal = cmds.undoInfo(q=True, un=True) 
开发者ID:wiremas,项目名称:spore,代码行数:25,代码来源:spore_context.py

示例2: current_handle_getter

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import undoInfo [as 别名]
def current_handle_getter():
    undo_info = cmds.undoInfo(q=True, un=True)
    info_list = undo_info.split(' ')
    srt_mode = info_list[0]
    
    if srt_mode == 'scale':
        srt_mode = 'Scale'
        def_val = 1.0
    elif srt_mode == 'rotate':
        srt_mode = 'Rotate'
        def_val = 0.0
    elif srt_mode == 'move':
        srt_mode = 'Move'
        def_val = 0.0
    else:
        return
    
    axis_val_list = [float(i) for i in info_list[-4:-1]]
    check_val_list = [v != def_val for v  in axis_val_list]
    if all(check_val_list):
        handle_id = 3
    else:
        handle_id = check_val_list.index(True)
    sb.window.select_xyz_from_manip(handle_id=handle_id, keep=False)
    #sb.window.reload.emit() 
开发者ID:ShikouYamaue,项目名称:SISideBar,代码行数:27,代码来源:sisidebar_sub.py

示例3: one_undo

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import undoInfo [as 别名]
def one_undo(func):
    """Decorator - guarantee close chunk.

    type: (function) -> function

    """
    @wraps(func)
    def wrap(*args, **kwargs):
        # type: (*str, **str) -> None

        try:
            cmds.undoInfo(openChunk=True)
            return func(*args, **kwargs)

        except Exception as e:
            raise e

        finally:
            cmds.undoInfo(closeChunk=True)

    return wrap 
开发者ID:mgear-dev,项目名称:mgear_core,代码行数:23,代码来源:utils.py

示例4: connectRenderMeshes

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import undoInfo [as 别名]
def connectRenderMeshes(self, renderMeshes, LOD=0):
        try:
            cmds.undoInfo(openChunk=True)
            lodAttr = None
            if LOD >=0 or LOD <=4:
                lodAttr = self.node + '.rendermeshes_LOD' + str(LOD)
                conns = cmds.listConnections(lodAttr, plugs=1, destination=1)
                if conns:
                    for conn in cmds.listConnections(lodAttr, plugs=1, destination=1):
                        cmds.disconnectAttr(lodAttr, conn)
            if lodAttr:
                for mesh in renderMeshes:
                    msgConnect(lodAttr, mesh + '.uExport')
            else:
                cmds.error('connectRenderMeshes>>> please specify a LOD integer (0-4) for your meshes')

        except Exception as e:
            print e
        finally:
            cmds.undoInfo(closeChunk=True) 
开发者ID:chrisevans3d,项目名称:uExport,代码行数:22,代码来源:uExport.py

示例5: connectRoot

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import undoInfo [as 别名]
def connectRoot(self, uNode, root, rewire=1):
        try:
            cmds.undoInfo(openChunk=True)
            if rewire:
                conns = cmds.listConnections(uNode + '.export_root', plugs=1, source=1)
                if conns:
                    for conn in conns:
                        cmds.disconnectAttr(conn, uNode + '.export_root')

            if not attrExists(root+'.export'):
                cmds.addAttr(root, longName='export', attributeType='message')
            cmds.connectAttr(root + '.export', uNode + '.export_root' )
        except Exception as e:
            print e
        finally:
            cmds.undoInfo(closeChunk=True) 
开发者ID:chrisevans3d,项目名称:uExport,代码行数:18,代码来源:uExport.py

示例6: invokeBuild

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import undoInfo [as 别名]
def invokeBuild(arg):
    maxInfluence = cmds.intField(uiMaxInfluenceName[1], query = True, value = True)
    numJoints = cmds.intField(uiNumJointsName[1], query = True, value = True)
    numIterations = cmds.intField(uiNumIterationsName[1], query = True, value = True)
    transformStr = cmds.radioCollection(uiTransformRadioCollectionName, query = True, select = True)
    transformType = uiTransformNames.index(transformStr)
    concentrate = cmds.floatField(uiConcentrateName[1], query = True, value = True)

    cmds.undoInfo(openChunk = True)
    try:
        ssds.build(numJoints = numJoints,
                    transformType = transformType,
                    numMaxInfluences = maxInfluence,
                    numIterations = numIterations,
                    concentrate = concentrate)
    except Exception as e:
        raise e
    finally:
        cmds.undoInfo(closeChunk = True) 
开发者ID:TomohikoMukai,项目名称:ssds,代码行数:21,代码来源:mlSSDS.py

示例7: undo_chunk

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import undoInfo [as 别名]
def undo_chunk():
    """Open a undo chunk during context."""

    try:
        cmds.undoInfo(openChunk=True)
        yield
    finally:
        cmds.undoInfo(closeChunk=True) 
开发者ID:getavalon,项目名称:core,代码行数:10,代码来源:lib.py

示例8: save_all_ctrls_shapes

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import undoInfo [as 别名]
def save_all_ctrls_shapes(path=None, **kwargs):
    # Resolve current path
    current_path = cmds.file(q=True, sceneName=True)
    if not current_path:
        pymel.warning("Please save your scene!")
        return

    # Resolve path
    if path is None:
        path = get_default_path_snapshot(current_path)

    cmds.undoInfo(openChunk=True)

    snapshots = hold_all_ctrls_shapes(**kwargs)
    if snapshots:
        pymel.select(snapshots)
        cmds.file(rename=path)
        cmds.file(exportSelected=True, type='mayaAscii', prompt=False, force=True)
        cmds.file(rename=current_path)
        pymel.delete(snapshots)
        print('Exported shapes to: {0}'.format(path))
        return True

    cmds.undoInfo(closeChunk=True)

    return False 
开发者ID:nilouco,项目名称:dpAutoRigSystem,代码行数:28,代码来源:sqCopyPasteShapes.py

示例9: __enter__

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import undoInfo [as 别名]
def __enter__(self):
        cmds.undoInfo(openChunk=True) 
开发者ID:robertjoosten,项目名称:maya-spline-ik,代码行数:4,代码来源:undo.py

示例10: __exit__

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import undoInfo [as 别名]
def __exit__(self, *exc_info):
        cmds.undoInfo(closeChunk=True) 
开发者ID:robertjoosten,项目名称:maya-spline-ik,代码行数:4,代码来源:undo.py

示例11: match_transform

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import undoInfo [as 别名]
def match_transform(mode='', child_comp=False):
    from . import sisidebar_sub
    pre_sel = cmds.ls(sl=True, l=True)
    selection = cmds.ls(sl=True, l=True, type='transform')
    if not selection:
        return
    cmds.undoInfo(openChunk=True)
    set_maching(nodes=selection, mode=mode ,pre_sel=pre_sel, child_comp=child_comp)
    
    msg = lang.Lang(en=u"<hl>Select Matching Object</hl>",
                            ja=u"<hl>一致対象オブジェクトを選択してください</hl>")
    cmds.inViewMessage( amg=msg.output(), pos='midCenterTop', fade=True )
    #cmds.select(cl=True)
    maching_tool = cmds.scriptCtx( title='Much Transform',
                        totalSelectionSets=3,
                        cumulativeLists=True,
                        expandSelectionList=True,
                        toolCursorType="edit",
                        setNoSelectionPrompt='Select the object you want to matching transform.'
                        )
    #カスタムカーソルを設定
    image_path = os.path.join(os.path.dirname(__file__), 'icon/')
    my_cursor = QCursor(QPixmap(image_path+'picker.png'))
    QApplication.setOverrideCursor(my_cursor)
    #cmds.hudButton('HUDHelloButton', e=True, s=7, b=5, vis=1, l='Button', bw=80, bsh='roundRectangle', rc=match_cancel )
    global hud_but
    if maya_ver != 2017:
        try:
            hud_but = cmds.hudButton('HUD_match_cancel', s=7, b=5, vis=1, l='Cancel', bw=80, bsh='roundRectangle', rc=finish_matching)
            #print 'create'
        except:
            #print 'change'
            hud_but = cmds.hudButton('HUD_match_cancel',e=True, s=7, b=5, vis=1, l='Cancel', bw=80, bsh='roundRectangle', rc=finish_matching)
    jobNum = cmds.scriptJob(ro=True, e=('SelectionChanged', qt.Callback(trs_matching)), protected=True)
    sisidebar_sub.get_matrix() 
开发者ID:ShikouYamaue,项目名称:SISideBar,代码行数:37,代码来源:transform.py

示例12: finish_matching

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import undoInfo [as 别名]
def finish_matching():
    global hud_but
    global matching_obj
    cmds.select(cl=True)
    cmds.select(matching_obj, r=True)
    #print hud_but
    #キャンセルボタン削除
    if maya_ver != 2017:
        cmds.headsUpDisplay(removeID=int(hud_but))
    
    QApplication.restoreOverrideCursor()
    cmds.undoInfo(closeChunk=True)
    cmds.headsUpDisplay(removeID=int(hud_but))
    
#マッチトランスフォームオブジェクト情報を格納しておく 
开发者ID:ShikouYamaue,项目名称:SISideBar,代码行数:17,代码来源:transform.py

示例13: eventFilter

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import undoInfo [as 别名]
def eventFilter(self, obj, event):
        if event.type() == QEvent.MouseButtonPress:
            #print 'in'
            cmds.undoInfo(openChunk=True)
        if event.type() == QEvent.MouseButtonRelease:
            #print 'out'
            cmds.undoInfo(closeChunk=True)
        return False 
开发者ID:ShikouYamaue,项目名称:SISideBar,代码行数:10,代码来源:extrude_edge.py

示例14: change_selection

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import undoInfo [as 别名]
def change_selection():
    #print '*+*+*+*+*+*+*+selection changed+*+*+*+*+*+*+* :', cmds.ls(sl=True)
    global bake_mode
    if bake_mode:
        return
    #return
    if group_mode:
        group_selection()
    #コンポーネント選択の時はアンドゥできなくなるのでヒストリ取得を無効にしてからマトリックス取得実行
    cmds.undoInfo(swf=False)
    get_matrix()
    cmds.undoInfo(swf=True)
    
    #コンテキストを切り替えてリアルタイム検出を有効にする。
    #restore_context_and_axis()
    #コンテキストのpodモードを選択タイプによって切り替える
    sb.chenge_manip_type()
    sb.change_selection_display()
    #オブジェクト変更があった場合はセンターをベイクして再度センターモードに入りなおす
    #print 'check center mode in culc :', center_mode
    if cmds.selectMode(q=True, o=True):
        if center_mode:
            #cmds.undoInfo(cn='cng_center', ock=True)
            sb.toggle_center_mode(mode=False, change=True)
            sb.toggle_center_mode(mode=True, change=True)
            #qt.Callback(sb.transform_center()
            sb.transform_center()
            #cmds.undoInfo(cn='cng_center', cck=True)
            return
    #COGモードチェックしておく
    sb.window.setup_object_center()
    #UIの変更を反映する
    sb.check_option_parm()
    
#コンテキストを切り替えてリアルタイム検出を有効にする。軸選択状態をサイドバーに復元する。
#選択タイプ検出時に直接実行するようになったので不要。 
开发者ID:ShikouYamaue,项目名称:SISideBar,代码行数:38,代码来源:sisidebar_sub.py

示例15: __call__

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import undoInfo [as 别名]
def __call__(self, *args, **kwargs):
        cmds.undoInfo(openChunk=True)
        try:
            return self.__func(*self.__args, **self.__kwargs)
            
        except:
            raise
            
        finally:
            cmds.undoInfo(closeChunk=True)
            
#ウィジェットカラーを変更する関数 
开发者ID:ShikouYamaue,项目名称:SISideBar,代码行数:14,代码来源:qt.py


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