Python maya.cmds.undoInfo() Examples
The following are 27
code examples of maya.cmds.undoInfo().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
maya.cmds
, or try the search function
.
Example #1
Source File: mlSSDS.py From ssds with MIT License | 6 votes |
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)
Example #2
Source File: uExport.py From uExport with zlib License | 6 votes |
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)
Example #3
Source File: uExport.py From uExport with zlib License | 6 votes |
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)
Example #4
Source File: spore_context.py From spore with MIT License | 6 votes |
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)
Example #5
Source File: utils.py From mgear_core with MIT License | 6 votes |
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
Example #6
Source File: sisidebar_sub.py From SISideBar with MIT License | 6 votes |
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()
Example #7
Source File: ml_utilities.py From ml_tools with MIT License | 5 votes |
def __exit__(self,*args): ''' Turn on undo ''' mc.undoInfo(stateWithoutFlush=True)
Example #8
Source File: ml_utilities.py From ml_tools with MIT License | 5 votes |
def press(self, *args): ''' Be careful overwriting the press method in child classes, because of the undoInfo openChunk ''' self.anchorPoint = mc.draggerContext(self.draggerContext, query=True, anchorPoint=True) self.button = mc.draggerContext(self.draggerContext, query=True, button=True) # This turns off the undo queue until we're done dragging, so we can undo it. mc.undoInfo(openChunk=True)
Example #9
Source File: ml_utilities.py From ml_tools with MIT License | 5 votes |
def release(self, *args): ''' Be careful overwriting the release method in child classes. Not closing the undo chunk leaves maya in a sorry state. ''' # close undo chunk and turn cycle check back on mc.undoInfo(closeChunk=True) #mc.cycleCheck(evaluation=self.cycleCheck) mm.eval('SelectTool')
Example #10
Source File: ml_utilities.py From ml_tools with MIT License | 5 votes |
def __enter__(self): ''' Turn off undo ''' mc.undoInfo(stateWithoutFlush=False)
Example #11
Source File: undo.py From maya-skinning-tools with GNU General Public License v3.0 | 5 votes |
def __exit__(self, *exc_info): cmds.undoInfo(closeChunk=True)
Example #12
Source File: ml_utilities.py From ml_tools with MIT License | 5 votes |
def __enter__(self): '''open the undo chunk''' if self.force or MAYA_VERSION < 2011: self.force = True mc.undoInfo(openChunk=True)
Example #13
Source File: lib.py From maya-capture-gui with MIT License | 5 votes |
def no_undo(): """Disable undo during the context""" try: cmds.undoInfo(stateWithoutFlush=False) yield finally: cmds.undoInfo(stateWithoutFlush=True)
Example #14
Source File: qt.py From SIWeightEditor with MIT License | 5 votes |
def __call__(self, *args, **kwargs): cmds.undoInfo(openChunk=True) try: return self.__func(*self.__args, **self.__kwargs) except: raise finally: cmds.undoInfo(closeChunk=True) #右クリックボタンクラスの作成
Example #15
Source File: utils.py From maya-keyframe-reduction with MIT License | 5 votes |
def __enter__(self): cmds.undoInfo(openChunk=True)
Example #16
Source File: utils.py From maya-keyframe-reduction with MIT License | 5 votes |
def __exit__(self, *exc_info): cmds.undoInfo(closeChunk=True) # ----------------------------------------------------------------------------
Example #17
Source File: __init__.py From fossil with BSD 3-Clause "New" or "Revised" License | 5 votes |
def undoBlock(name=''): if name: cmds.undoInfo(openChunk=True, chunkName=name) else: cmds.undoInfo(openChunk=True) yield cmds.undoInfo(closeChunk=True)
Example #18
Source File: lib.py From core with MIT License | 5 votes |
def undo_chunk(): """Open a undo chunk during context.""" try: cmds.undoInfo(openChunk=True) yield finally: cmds.undoInfo(closeChunk=True)
Example #19
Source File: undo.py From maya-skinning-tools with GNU General Public License v3.0 | 5 votes |
def __enter__(self): cmds.undoInfo(openChunk=True)
Example #20
Source File: qt.py From SISideBar with MIT License | 5 votes |
def __call__(self, *args, **kwargs): cmds.undoInfo(openChunk=True) try: return self.__func(*self.__args, **self.__kwargs) except: raise finally: cmds.undoInfo(closeChunk=True) #ウィジェットカラーを変更する関数
Example #21
Source File: sisidebar_sub.py From SISideBar with MIT License | 5 votes |
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() #コンテキストを切り替えてリアルタイム検出を有効にする。軸選択状態をサイドバーに復元する。 #選択タイプ検出時に直接実行するようになったので不要。
Example #22
Source File: extrude_edge.py From SISideBar with MIT License | 5 votes |
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
Example #23
Source File: transform.py From SISideBar with MIT License | 5 votes |
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)) #マッチトランスフォームオブジェクト情報を格納しておく
Example #24
Source File: transform.py From SISideBar with MIT License | 5 votes |
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()
Example #25
Source File: undo.py From maya-spline-ik with GNU General Public License v3.0 | 5 votes |
def __exit__(self, *exc_info): cmds.undoInfo(closeChunk=True)
Example #26
Source File: undo.py From maya-spline-ik with GNU General Public License v3.0 | 5 votes |
def __enter__(self): cmds.undoInfo(openChunk=True)
Example #27
Source File: sqCopyPasteShapes.py From dpAutoRigSystem with GNU General Public License v2.0 | 5 votes |
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