本文整理匯總了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)
示例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()
示例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
示例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)
示例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)
示例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)
示例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)
示例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
示例9: __enter__
# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import undoInfo [as 別名]
def __enter__(self):
cmds.undoInfo(openChunk=True)
示例10: __exit__
# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import undoInfo [as 別名]
def __exit__(self, *exc_info):
cmds.undoInfo(closeChunk=True)
示例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()
示例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))
#マッチトランスフォームオブジェクト情報を格納しておく
示例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
示例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()
#コンテキストを切り替えてリアルタイム検出を有効にする。軸選択狀態をサイドバーに復元する。
#選択タイプ検出時に直接実行するようになったので不要。
示例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)
#ウィジェットカラーを変更する関數