本文整理汇总了Python中maya.cmds.undoInfo函数的典型用法代码示例。如果您正苦于以下问题:Python undoInfo函数的具体用法?Python undoInfo怎么用?Python undoInfo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了undoInfo函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: copyWorld
def copyWorld(self, *args):
#print "copyworld"
self.selection = cmds.ls(selection=True)
if len(self.selection) < 1: return
if len(self.selection) > 20:
message = "Too many objects selected, continue?"
confirm = cmds.confirmDialog( title='Confirm', message=message, button=['Yes','No'], defaultButton='Yes', cancelButton='No', dismissString='No' )
if confirm != 'Yes': return
cmds.refresh(suspend=True)
cmds.undoInfo(stateWithoutFlush=False)
self.flushCopyCache(force=True)
self.scriptJob()
self.sourceObjs = self.selection
self.targetObj = "world"
for loopObj in self.sourceObjs:
matrix = cmds.xform(loopObj, query=True, ws=True, matrix=True)
self.copyCache.append(matrix)
cmds.iconTextButton("fakeConstrainBtn", edit=True, image= uiMod.getImagePath("specialTools_fake_constrain_active"), highlightImage= uiMod.getImagePath("specialTools_fake_constrain_active copy"))
cmds.refresh(suspend=False)
cmds.undoInfo(stateWithoutFlush=True)
开发者ID:Italic-,项目名称:maya-prefs,代码行数:30,代码来源:fakeConstrain.py
示例2: offsetCurveDragCmd
def offsetCurveDragCmd(self, *args ):
if not self._dragStart:
selCurves = cmds.ls( sl=1 )
self._targetCurves = []
self._keepTargetCurveValues = []
for curve in selCurves:
if cmds.attributeQuery( 'centerRate' , node = curve, ex=1 ):
self._targetCurves.append( curve )
self._keepTargetCurveValues.append( cmds.getAttr( curve+'.centerRate' ) )
if not self._targetCurves:
cmds.warning( "Select VolumeCurves" )
return None
self._dragStart = True
cmds.undoInfo( swf=0 )
multRate = cmds.floatSliderGrp( self._offsetCurve, q=1, v=1 )
for i in range( len( self._targetCurves ) ):
targetCurve = self._targetCurves[i]
value = self._keepTargetCurveValues[i]
cmds.setAttr( targetCurve+'.centerRate', value*multRate )
开发者ID:jonntd,项目名称:mayadev-1,代码行数:27,代码来源:volume.py
示例3: orientJoints
def orientJoints(s):
"""
Face joints in the correct direction.
"""
sel = cmds.ls(sl=True)
err = cmds.undoInfo(openChunk=True)
try:
markers = s.markers
joints = markers.keys()
with ReSeat(joints):
for j in joints:
m = markers[j]
if cmds.objExists(m.marker) and cmds.objExists(j):
with Isolate(j):
m.setJoint()
try:
cmds.makeIdentity(
j,
apply=True,
r=True) # Freeze Rotations
except RuntimeError:
pass
else: # User deleted marker / joint. Stop tracking.
m.removeMarker()
del markers[j]
cmds.select(sel, r=True)
except Exception as err:
raise
finally:
cmds.undoInfo(closeChunk=True)
if err: cmds.undo()
开发者ID:internetimagery,项目名称:twinSkeleton,代码行数:31,代码来源:fixorient.py
示例4: processItems
def processItems(self, sender = None, all = False, case = ''):
cmds.undoInfo(openChunk = True)
cmds.select(clear = True)
if not all:
for eachItem in self._getSelItems():
itemName = eachItem.text().replace(SEP, "|")
if not cmds.objExists(itemName):
itemName = itemName.split("|")[-1] or None
if itemName:
if case == 'select':
cmds.select(itemName, add = True, ne = True)
elif case == 'delete':
cmds.delete(itemName)
elif case == 'deleteCH':
cmds.delete(itemName, ch = True)
else:
count = self.reportTree.count()
items = []
for x in range(count):
if "-----" not in self.reportTree.item(x).text():
itemName = self.reportTree.item(x).text().replace(SEP, "|")
if not cmds.objExists(itemName):
itemName = itemName.split("|")[-1] or None
if itemName:
items.extend([itemName])
if case == 'select':
cmds.select(items, r = True, ne = True)
elif case == 'delete':
cmds.delete(items)
elif case == 'deleteCH':
cmds.delete(items, ch = True)
cmds.undoInfo(closeChunk = True)
开发者ID:yes7rose,项目名称:jbd_sanityCheckUI,代码行数:35,代码来源:reportWindow.py
示例5: stopRecording
def stopRecording(self):
"""Stop recording of undoable comamnds and restore the previous command stack.
The instance is now ready to undo and redo the recorded commands
:note: this method may only be called once, subsequent calls have no effect"""
if self._recorded_commands is not None:
return
try:
if not self._is_recording:
raise AssertionError("startRecording was not called")
if self._orig_stack is None:
raise AssertionError("startRecording was not called on this instance, but on another one")
self.__class__._is_recording = False
self._recorded_commands = sys._maya_stack
sys._maya_stack = self._orig_stack
# restore previous undo queue state
if self._disable_undo:
self.__class__._disable_undo = False
cmds.undoInfo(swf=0)
# END handle undo
finally:
# tigger deletion
self._undoable_helper = None
开发者ID:mrv-developers,项目名称:mrv,代码行数:27,代码来源:undo.py
示例6: setAttrCommand
def setAttrCommand():
import pymel.core
cmds.undoInfo( ock=1 )
sels = pymel.core.ls( sl=1 )
numItems = self.layout.count()
for i in range( 1, numItems-1 ):
targetWidget = self.layout.itemAt( i ).widget()
attrName = targetWidget.lineEdit_srcAttr.text()
attrValue = targetWidget.lineEdit_dstAttr.text()
if not attrName or not attrValue: continue
for sel in sels:
attrType = sel.attr( attrName ).type()
if attrType == 'string':
sel.attr( attrName ).set( attrValue )
else:
print "attr value : ", attrValue
if attrValue.find( ',' ) != -1:
values = [ float( value ) for value in attrValue.split( ',' ) ]
sel.attr( attrName ).set( values )
else:
sel.attr( attrName ).set( float( attrValue ) )
cmds.undoInfo( cck=1 )
开发者ID:jonntd,项目名称:mayadev-1,代码行数:28,代码来源:setAttr.py
示例7: load
def load():
'''loads animation environment'''
print "loading animation environment presets..."
#set autoKey
cmds.autoKeyframe( state=True )
#set 24fps and playback on all viewports
cmds.playbackOptions(ps=1.0, v='all')
#set unlimited undo's
cmds.undoInfo( state=True, infinity=True )
#set manipulator sizes
if lib.checkAboveVersion(2014):
cmds.manipOptions( r=False, hs=55, ls=4, sph=1 )
else:
cmds.manipOptions( r=False, hs=55, ls=4 )
#set framerate visibility
mel.eval("setFrameRateVisibility(1);")
#gimbal rotation
cmds.manipRotateContext('Rotate', e=True, mode=2)
#world translation
cmds.manipMoveContext('Move', e=True, mode=2)
#time slider height
aPlayBackSliderPython = mel.eval('$tmpVar=$gPlayBackSlider')
cmds.timeControl(aPlayBackSliderPython, h=45, e=True);
#special tick color
cmds.displayRGBColor("timeSliderTickDrawSpecial", 1,0.5,0)
#check if hotkeys have been set
if (cmds.hotkey( 't', ctl=True, query=True, name = True)== 'CharacterAnimationEditorNameCommand'):
print "Hotkeys have been previously loaded"
else:
setHotkeys('default')
print "ENVIRONMENT SET\n", #the comma forces output on the status line
开发者ID:studiocoop,项目名称:maya-coop,代码行数:33,代码来源:animEnvironment.py
示例8: run
def run():
#get selected edgeloop
edgeLoop = cmds.ls(selection=True)
#get verticles in the edge loop
vertLoop = cmds.polyListComponentConversion(edgeLoop, fromEdge=True, toVertex=True)
#sort individual verticles into a list
vertLoop = cmds.ls(vertLoop, flatten=True)
#open undo chunk so entire operation is a single action
cmds.undoInfo(openChunk = True)
#soften the mesh normals
mesh = cmds.listRelatives(parent=1)
cmds.polySoftEdge(mesh, angle=180)
#run on each vertex on the edgeloop
for vert in vertLoop:
#unlock the normal of the vertex
cmds.polyNormalPerVertex(vert, unFreezeNormal=True)
#get the normals of the vertex on the loop
vertNormals = list(cmds.polyNormalPerVertex(vert, query=True, xyz=True))
#get only the first three vectors
vertNormals = vertNormals[:3]
# select the neighboring verticles using the declared function below
vertNeighbors(vert, vertLoop)
#set their normal angle to match the vertex on the loop
cmds.polyNormalPerVertex(xyz=vertNormals)
#reselect the edge loops
cmds.select(edgeLoop)
#close undo chunk, operation is done
cmds.undoInfo(closeChunk = True)
开发者ID:echofourpapa,项目名称:edgeLord.py,代码行数:35,代码来源:edgeLord.py
示例9: combineShader
def combineShader( shaderList ):
cmds.undoInfo( ock=1 )
targetObjs = []
for shader in shaderList:
cmds.hyperShade( objects = shader )
targetObjs += cmds.ls( sl=1 )
shadingEngines = cmds.listConnections( shaderList, s=0, d=1, type='shadingEngine' )
if not shadingEngines: return None
shadingEngines = list( set( shadingEngines ) )
targetShadingEngine = shadingEngines[0]
cmds.sets( targetObjs, e=1, forceElement = targetShadingEngine )
cmds.delete( shadingEngines[1:] )
for shader in shaderList:
shadingEngines = cmds.listConnections( shader, s=0, d=1, type='shadingEngine' )
if not shadingEngines:
cmds.delete( shader )
elif not targetShadingEngine in shadingEngines:
cmds.delete( shader, shadingEngines )
Window_global.nodeInfomation = {}
cmds.undoInfo( cck=1 )
开发者ID:jonntd,项目名称:mayadev-1,代码行数:26,代码来源:__init__.py
示例10: sliderA
def sliderA(prefix):
cmds.undoInfo(openChunk=True)
#create nodes
grp=cmds.group(empty=True,n=(prefix+'_grp'))
cnt=cmds.circle(r=0.1,ch=False,n=(prefix+'_cnt'))
shp=cmds.circle(o=True,r=1,ch=False,d=1,s=4,n=(prefix+'_shp'))
#setup shp
cmds.move(-1,0,0,'%s.cv[0]' % shp[0],r=True,os=True)
cmds.move(-1,0,0,'%s.cv[4]' % shp[0],r=True,os=True)
cmds.move(0,-1,0,'%s.cv[1]' % shp[0],r=True,os=True)
cmds.move(1,0,0,'%s.cv[2]' % shp[0],r=True,os=True)
cmds.move(0,1,0,'%s.cv[3]' % shp[0],r=True,os=True)
cmds.parent(shp,grp)
cmds.setAttr('%s.overrideEnabled' % shp[0],1)
cmds.setAttr('%s.overrideDisplayType' % shp[0],2)
#setup cnt
cmds.parent(cnt,shp)
cmds.setAttr('%s.overrideEnabled' % cnt[0],1)
cmds.transformLimits(cnt,tx=(-1,1),etx=(1,1))
cmds.transformLimits(cnt,ty=(-1,1),ety=(1,1))
setupAttrs(prefix,cnt[0])
return grp
cmds.undoInfo(closeChunk=True)
开发者ID:Bumpybox,项目名称:Tapp,代码行数:33,代码来源:utils.py
示例11: componentSelectionInOrder
def componentSelectionInOrder():
'''
Returns a list of the selected components in the order they were selected.
'''
# Get selection
selection = []
selectionAll = mc.ls(sl=1)
lastCommand = mc.undoInfo(q=True,un=True)
counter = 0
# Traverse undo list
while lastCommand.count('select'):
lastCommand = mc.undoInfo(q=True,un=True)
if lastCommand.count('select'):
selectElem = lastCommand.split(' ')
selection.append(selectElem[2])
mc.undo()
# Sort selection
selection.reverse()
realSelection = []
[realSelection.append(i) for i in selection if not realSelection.count(i)]
# Return result
return realSelection
开发者ID:auqeyjf,项目名称:glTools,代码行数:25,代码来源:selection.py
示例12: latticeRemove
def latticeRemove():
#undo enable
cmds.undoInfo(openChunk=True)
#getting nodes
sel = cmds.ls(selection=True)
if not sel:
cmds.warning('No nodes selected!')
return
lat = sel[-1]
objs = sel[0:-1]
if cmds.nodeType(cmds.listRelatives(lat, shapes=True)[0]) != 'lattice':
cmds.warning('Last selected is NOT a lattice!')
return
#removing from lattice
for obj in objs:
try:
cmds.lattice(lat, e=True, remove=True, geometry=obj)
#disconnecting shapes
shapes = cmds.listRelatives(obj, shapes=True)
for shp in shapes:
source = cmds.listConnections(shp + '.inMesh', source=True)
if cmds.nodeType(source) == 'ffd':
attr = cmds.listConnections(shp + '.inMesh', plugs=True)[0]
cmds.disconnectAttr(attr, shp + '.inMesh')
except:
pass
cmds.undoInfo(closeChunk=True)
开发者ID:Bumpybox,项目名称:Tapp,代码行数:34,代码来源:lattice.py
示例13: mirror_objs
def mirror_objs(objs):
# Only work on transforms
objs = filter(
lambda obj: isinstance(obj, pymel.nodetypes.Transform) and not isinstance(obj, pymel.nodetypes.Constraint),
objs)
# Resolve desired poses without affecting anything
tms_by_objs = {}
for obj_dst in objs:
# Resolve source object
obj_src = get_ctrl_friend(obj_dst)
if obj_src is None:
obj_src = obj_dst
# Resolve mirror definition
# If we didn't find any friend, we'll use a default mirror definition.
data = get_obj_mirror_def(obj_dst)
if data is None:
continue
m = obj_dst.__apimfn__().transformation().asMatrix()
m = mirror_matrix(m, *data)
tms_by_objs[obj_src] = OpenMaya.MTransformationMatrix(m)
# Apply desired poses
cmds.undoInfo(openChunk=True)
for mfn_transform_src in tms_by_objs.keys():
tm = tms_by_objs[mfn_transform_src]
# HACK: Use cmds so undoes are working
# mfn_transform_src.set(tm)
cmds.xform(mfn_transform_src.__melobject__(), matrix=list_from_MMatrix(tm.asMatrix()))
cmds.undoInfo(closeChunk=True)
开发者ID:renaudll,项目名称:omtk,代码行数:35,代码来源:mirrorPose.py
示例14: exportBake
def exportBake( self, ctls, timeRange ):
cmds.undoInfo( swf=0 )
time = ( timeRange[0], timeRange[1] )
sampleValue = timeRange[2]
cmds.bakeResults( ctls, simulation=True, t=time, sampleBy=sampleValue, disableImplicitControl=True, preserveOutsideKeys=False,
sparseAnimCurveBake=False, removeBakedAttributeFromLayer=False, bakeOnOverrideLayer=False, minimizeRotation=False,
controlPoints=False, shape=False )
timeControl = cmds.createNode( 'timeControl', n='timeControl' )
dgtrAnimCurves = cmds.ls( 'DGTR_*', type='animCurve' )
for anim in dgtrAnimCurves:
cmds.connectAttr( timeControl+'.outTime', anim+'.input' )
for ctl in ctls:
animNodeRx = cmds.listConnections( ctl+'.rx', s=1, d=0, type='animCurve' )[0]
animNodeRy = cmds.listConnections( ctl+'.ry', s=1, d=0, type='animCurve' )[0]
animNodeRz = cmds.listConnections( ctl+'.rz', s=1, d=0, type='animCurve' )[0]
animNodeIrx = cmds.listConnections( ctl+'.irx', s=1, d=0, type='animCurve' )[0]
animNodeIry = cmds.listConnections( ctl+'.iry', s=1, d=0, type='animCurve' )[0]
animNodeIrz = cmds.listConnections( ctl+'.irz', s=1, d=0, type='animCurve' )[0]
self.eulerFilter( [animNodeRx, animNodeRy, animNodeRz] )
self.eulerFilter( [animNodeIrx, animNodeIry, animNodeIrz] )
cmds.undoInfo( swf=1 )
开发者ID:jonntd,项目名称:mayadev-1,代码行数:29,代码来源:bake.py
示例15: loadData
def loadData(self, onlySelectedNodes=False, crashFolder=None, *args):
cmds.waitCursor(state=True)
cmds.refresh(suspend=True)
cmds.undoInfo(openChunk=True)
utilMod.startProgressBar("aTools Animation Crash Recovery - Loading data...")
self.pause = True
savedData = self.getSavedData(crashFolder, onlySelectedNodes)
if savedData:
animData = savedData["animData"]["data"]
attrData = savedData["attrData"]["data"]
self.applyAttrData(attrData)
self.applyAnimData(animData)
if not crashFolder: self.loadInfoData()
utilMod.setProgressBar(endProgress=True)
self.pause = False
cmds.undoInfo(closeChunk=True)
cmds.refresh(suspend=False)
cmds.waitCursor(state=False)
开发者ID:Italic-,项目名称:maya-prefs,代码行数:26,代码来源:animationCrashRecovery.py
示例16: connectCommand
def connectCommand():
cmds.undoInfo( ock=1 )
sels = cmds.ls( sl=1 )
numItems = self.layout.count()
optionWidget = self.layout.itemAt( numItems-2 ).widget()
for i in range( 1, numItems-2 ):
targetWidget = self.layout.itemAt( i ).widget()
srcAttr = targetWidget.lineEdit_srcAttr.text()
dstAttr = targetWidget.lineEdit_dstAttr.text()
if not srcAttr or not dstAttr: continue
try:
for sel in sels[1:]:
target = sel
if optionWidget.checkBox.isChecked():
selParents = cmds.listRelatives( sel, p=1, f=1 )
if selParents:
target = selParents[0]
cmds.connectAttr( sels[0] + '.' + srcAttr, target + '.' + dstAttr )
except: pass
cmds.undoInfo( cck=1 )
开发者ID:jonntd,项目名称:mayadev-1,代码行数:26,代码来源:connectAttr.py
示例17: cacheVP
def cacheVP():
"""
//Cache viewport geometry for playback
undoInfo -stateWithoutFlush off;
string $activePanel = `getPanel -wf`;
modelEditor -e -grid false $activePanel;
modelEditor -e -allObjects 0 $activePanel;
modelEditor -e -polymeshes 1 $activePanel;
int $rangeStartFrame = `playbackOptions -q -min`;
currentTime -e $rangeStartFrame;
playbackOptions -playbackSpeed 0 -loop "once" -by 1;
playButtonForward;
playbackOptions -playbackSpeed 1 -loop "continuous";
undoInfo -stateWithoutFlush on;
"""
cmds.undoInfo(swf=False)
panType = cmds.getPanel(wf=True)
cmds.modelEditor(panType, e=True, gr=False)
cmds.modelEditor(panType, e=True, alo=False)
cmds.modelEditor(panType, e=True, pm=True)
rangeStartFrame = cmds.playbackOptions(q=True, min=True)
cmds.currentTime = int(rangeStartFrame)
cmds.playbackOptions(ps=0, l="once", by=1)
cmds.play(f=True, ps=True)
cmds.playbackOptions(ps=1, l="continuous")
cmds.undoInfo(swf=True)
开发者ID:Italic-,项目名称:maya-scripts,代码行数:34,代码来源:ita_snippet_collection.py
示例18: doPress
def doPress( self, event ):
if event.mouseButton() == OpenMayaUI.MEvent.kMiddleMouse:
cmds.select( d=1 )
self.beforeJoint = None
return None
self.transform = None
mouseX, mouseY = self.getMouseXY( event )
intersectPoint = Functions.getIntersectPoint( self.dagPath, mouseX, mouseY )
if not intersectPoint:
return None
if not self.beforeJoint:
cmds.select( d=1 )
self.transform = cmds.joint()
cmds.select( self.transform )
self.beforePosition = cmds.xform( self.transform, q=1, ws=1, t=1 )[:3]
cmds.undoInfo( swf=0 )
cmds.move( intersectPoint.x, intersectPoint.y, intersectPoint.z, self.transform, ws=1 )
self.currentPosition = [intersectPoint.x, intersectPoint.y, intersectPoint.z]
if self.beforeJoint:
Functions.setOrientByChild( self.beforeJoint )
cmds.setAttr( self.transform + '.r', 0,0,0 )
cmds.refresh()
开发者ID:jonntd,项目名称:mayadev-1,代码行数:28,代码来源:sgPutJointLineContext.py
示例19: updateSelection
def updateSelection(undoState):
global sel
global selCmp
global win
if undoState:
mc.select( cl=1)
for obj in sel: obj.getSavedSelection()
for cmp in selCmp: cmp.getSavedSelection()
mc.undoInfo( stateWithoutFlush=undoState)
ratio = mc.floatSliderGrp( win.selection, q=1, v=1)
mc.select( cl=1)
#if len( sel) : random.seed( sel[0].tx)
#elif len( selCmp): random.seed( selCmp[0].tx)
for obj in sel:
if obj.tx < ratio:
mc.select( obj.name, add=1)
for cmp in selCmp:
if cmp.tx < ratio:
mc.select( cmp.name, add=1)
if undoState:
for obj in sel: obj.saveSelection( ratio)
for cmp in selCmp: cmp.saveSelection( ratio)
开发者ID:cyrillef,项目名称:apps.exchange.packager,代码行数:27,代码来源:bt_randomizer.py
示例20: doRelease
def doRelease(self, event ):
cmds.move( self.beforePosition[0], self.beforePosition[1], self.beforePosition[2], self.transform, ws=1 )
cmds.undoInfo( swf=1 )
cmds.move( self.currentPosition[0], self.currentPosition[1], self.currentPosition[2], self.transform, ws=1 )
self.beforeJoint = self.transform
pass
开发者ID:jonntd,项目名称:mayadev-1,代码行数:7,代码来源:sgPutJointLineContext.py
注:本文中的maya.cmds.undoInfo函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论