本文整理汇总了Python中maya.cmds.currentUnit函数的典型用法代码示例。如果您正苦于以下问题:Python currentUnit函数的具体用法?Python currentUnit怎么用?Python currentUnit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了currentUnit函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_bwav_handler
def test_bwav_handler(self):
'''
test the bwav handler and formatting of the data
'''
assert self.audioNode.isBwav()
# print self.audioNode.bwav_timecodeFormatted()
cmds.currentUnit(time='ntscf')
assert r9General.getCurrentFPS() == 60
print 'ntscf' , self.audioNode.bwav_timecodeFormatted()
assert self.audioNode.bwav_timecodeFormatted() == '01:26:04:11'
cmds.currentUnit(time='pal')
assert r9General.getCurrentFPS() == 25
# print 'pal : ', self.audioNode.bwav_timecodeFormatted()
assert self.audioNode.bwav_timecodeFormatted() == '01:26:04:05'
# print self.audioNode.bwav_timecodeFormatted(smpte=False)
assert self.audioNode.bwav_timecodeFormatted(smpte=False) == '01:26:04:172'
assert self.audioNode.bwav_timecodeReference() == 227739993
assert self.audioNode.bwav_timecodeMS() == 5164172.1768707484
# need to get the bWav header to bind it to the var
self.audioNode.bwav_getHeader()
assert self.audioNode.bwav_HeaderData == {'AudioFormat': 0,
'BextVersion': 0,
'BitsPerSample': 0,
'ChunkSize': 732516,
'Description': 'This is a unitTest file for validating the Red9 broadcast wav extraction of metaData',
'Format': 'WAVE',
'InternalFormat': 'fmt ',
'OriginationDate': '2014-03-03',
'OriginationTime': '10:00:00',
'Originator': 'Pro Tools',
'OriginatorReference': 'ffgDDffdhgff',
'Subchunk1Size': 16,
'TimeReference': 227739993,
'TimeReferenceHigh': 0}
开发者ID:markj3d,项目名称:Red9_StudioPack,代码行数:35,代码来源:Red9_AudioTest.py
示例2: setAnimationFPS
def setAnimationFPS(self, fps, changeType=constants.FPSChangeType.Seconds, callback=None):
""" Updates the scene's fps to the provided value and scales existing keys as specified.
StudioMax Note: If you have any code that you need to run after changing the fps and plan to use it in
3dsMax you will need to pass that code into the callback argument.
Maya Note: Maya only supports specific fps settings. If you provide it with a value it doesn't understand,
it will be set to the closest matching value. See MayaScene._timeUnitToFPS for valid values.
:param fps: The FPS value to set.
:param changeType: <constants.FPSChangeType> Defaults to constants.FPSChangeType.Frames
:param callback: <funciton> Code called after the fps is changed.
:return: bool success
"""
# Maya doesn't appear to allow you to set the fps to a specific value,
# so we attempt to find a exact match in our _timeUnitToConst dictonary
name = self._timeUnitToConst.get(fps)
if not name:
# If there isn't a exact match, find the value closest to the requested fps.
closest = min(self._timeUnitToConst, key=lambda x: abs(x - fps))
name = self._timeUnitToConst[closest]
# Only update the fps if the value is different
if name != self._currentTimeUnit():
# Only update animation if Seconds is specified
updateAnimation = changeType == constants.FPSChangeType.Seconds
cmds.currentUnit(time=name, updateAnimation=updateAnimation)
if callback:
callback()
return True
开发者ID:blurstudio,项目名称:cross3d,代码行数:26,代码来源:mayascene.py
示例3: pressFunction
def pressFunction(self):
self.attribute = self.history[-1] + Cache.currentAttribute # re-init the attribute in case cached has been switched
self.modifier = cmds.draggerContext( 'dragTool', query=True, modifier=True)
self.button = cmds.draggerContext('dragTool', query = True, button=True)
self.attributeValue = cmds.getAttr( self.attribute )
if cmds.currentUnit( query=True, linear=True ) == 'cm':
self.speed = .01 # modifier for speed traveled through values while dragging
elif cmds.currentUnit( query=True, linear=True ) == 'm':
self.speed = .001 # modifier for speed traveled through values while dragging
else:
self.speed = .0001
self.space = 'screen' # initialize the variable
if isinstance(self.attributeValue, list): # only edit the space based on button if the attribute is a list value
# If left click is used, then the space is set to (X,Y,Z) world based
# If middle click is used, space is set to (X, Y) screen based
if self.button == 1: # left button
self.space = 'world' # tracking space used
cmds.draggerContext( 'dragTool', edit=True, space = 'world')
elif self.button == 2: # middle button
self.space = 'screen' # tracking space used
cmds.draggerContext( 'dragTool', edit=True, space = 'screen')
else: # set to 'screen' as default if the attr isn't a list value
cmds.draggerContext( 'dragTool', edit=True, space = 'screen')
if self.modifier == 'ctrl':
self.speed = self.speed * .01
if self.modifier == 'shift':
self.speed = self.speed * 10
if len(self.dragDirection) > 0:
self.dragDirection = []
开发者ID:jricker,项目名称:JR_Maya,代码行数:29,代码来源:JR_dragger_class.py
示例4: run
def run(*args, **kwargs):
""" prepare the scene for the tests
converts scene to use centimeters
set the grid to the default
"""
valid_kwargs = ['verbose']
for k, v in kwargs.iteritems():
if k not in valid_kwargs:
raise TypeError("Invalid keyword argument %s" % k)
# verbose defaults to False if verbose option not set in menu or set
# as cmdline argument
try:
verbose = kwargs['verbose']
except KeyError:
verbose = False
if cmds.optionVar(exists='checkmateVerbosity'):
verbose = cmds.optionVar(query='checkmateVerbosity')
else:
verbose = False
batch = cmds.about(batch=True)
# get the name of the script Editor's output control
from maya import mel as mel
# Turn off Echo All Commands in the Script Editor
# Disable Stack Tracevin the Script Editor
# Turn off Line Numbers in errors in the Script Editor
# Reset the grid
# Set the background color
# Turn off the heads-up displays
# Switch to wrireframe mode
# Close all windows (except main)
# Close ChannelBox, Attribute Editor and Outliner ()
if not batch:
try:
gCommandReporter = mel.eval("proc string f(string $g){return $g;}f($gCommandReporter);")
except RuntimeError:
gCommandReporter = ''
pass
try:
cmds.cmdScrollFieldReporter(gCommandReporter,
edit=True,
echoAllCommands=False,
lineNumbers=True,
stackTrace=True,
suppressResults=False,
suppressInfo=False,
suppressWarnings=False,
suppressErrors=False,
suppressStackTrace=False,
)
except RuntimeError:
if verbose:
print 'No Script Editor'
pass
# convert scene to cm to fix crashes in nearestnormal
cmds.currentUnit(linear='cm')
开发者ID:Kif11,项目名称:turbosquid_maya_publisher,代码行数:59,代码来源:setup.py
示例5: restoreSettings
def restoreSettings(self):
'''
restore all UI settings
'''
cmds.autoKeyframe(state=self.dataStore['autoKey'])
# timeline management
cmds.currentTime(self.dataStore['currentTime'])
cmds.playbackOptions(min=self.dataStore['minTime'])
cmds.playbackOptions(max=self.dataStore['maxTime'])
cmds.playbackOptions(ast=self.dataStore['startTime'])
cmds.playbackOptions(aet=self.dataStore['endTime'])
cmds.playbackOptions(ps=self.dataStore['playSpeed'])
cmds.playbackOptions(loop=self.dataStore['playLoop'])
# unit management
cmds.currentUnit(time=self.dataStore['timeUnit'])
cmds.currentUnit(linear=self.dataStore['sceneUnits'])
if not cmds.upAxis(axis=True, q=True) == self.dataStore['upAxis']:
cmds.upAxis(axis=self.dataStore['upAxis'])
log.debug('Restored PlayBack / Timeline setup')
# viewport colors
cmds.displayPref(displayGradient=self.dataStore['displayGradient'])
cmds.displayRGBColor(resetToSaved=True)
# objects colors
cmds.displayColor("curve", self.dataStore['curvecolor'], dormant=True)
# panel management
for panel, data in self.dataStore['panelStore'].items():
try:
cmdString = data['settings'].replace('$editorName', panel)
mel.eval(cmdString)
log.debug("Restored Panel Settings Data >> %s" % panel)
mel.eval('lookThroughModelPanel("%s","%s")' % (data['activeCam'], panel))
log.debug("Restored Panel Active Camera Data >> %s >> cam : %s" % (panel, data['activeCam']))
except:
log.debug("Failed to fully Restore ActiveCamera Data >> %s >> cam : %s" % (panel, data['activeCam']))
# camera management
for cam, settings in self.dataStore['cameraTransforms'].items():
try:
cmds.setAttr('%s.translate' % cam, settings[0][0][0], settings[0][0][1], settings[0][0][2])
cmds.setAttr('%s.rotate' % cam, settings[1][0][0], settings[1][0][1], settings[1][0][2])
cmds.setAttr('%s.scale' % cam, settings[2][0][0], settings[2][0][1], settings[2][0][2])
log.debug('Restored Default Camera Transform Data : % s' % cam)
except:
log.debug("Failed to fully Restore Default Camera Transform Data : % s" % cam)
# sound management
if self.dataStore['displaySound']:
cmds.timeControl(self.gPlayBackSlider, e=True, ds=1, sound=self.dataStore['activeSound'])
log.debug('Restored Audio setup')
else:
cmds.timeControl(self.gPlayBackSlider, e=True, ds=0)
log.debug('Scene Restored fully')
return True
开发者ID:markj3d,项目名称:Red9_StudioPack,代码行数:59,代码来源:Red9_General.py
示例6: currentUnits
def currentUnits():
# ex: {'angle': 'degree', 'linear': 'centimeter', 'time': 'pal'}
currentUnitsDict = {
'linear': MC.currentUnit(query=True, linear=True, fullName=True),
'angle': MC.currentUnit(query=True, angle=True, fullName=True),
'time': MC.currentUnit(query=True, time=True)
}
return currentUnitsDict
开发者ID:GuidoPollini,项目名称:MuTools,代码行数:8,代码来源:MuScene.py
示例7: importScene
def importScene( evt=0 ):
rootPath = cmds.textField( Window_global.txf_rootPath, q=1, tx=1 )
abcPath = rootPath + '/' + cmds.textField( Window_global.txf_abcPath, q=1, tx=1 )
sceneInfoPath = rootPath + '/' + cmds.textField( Window_global.txf_sceneInfoPath, q=1, tx=1 )
cmds.AbcImport( abcPath, mode='import' )
def getBBCenter( targetTransform ):
bbmin = cmds.getAttr( targetTransform + '.boundingBoxMin' )[0]
bbmax = cmds.getAttr( targetTransform + '.boundingBoxMax' )[0]
bbcenter = OpenMaya.MPoint( (bbmin[0] + bbmax[0])/2.0, (bbmin[1] + bbmax[1])/2.0, (bbmin[2] + bbmax[2])/2.0 )
pmtx = cmds.getAttr( targetTransform + '.parentMatrix' )
mtx = OpenMaya.MMatrix()
OpenMaya.MScriptUtil.createMatrixFromList( pmtx, mtx )
bbcenter *= mtx
return [bbcenter.x, bbcenter.y,bbcenter.z]
def addNamespaceToChildren( namespace, rootNode ):
import pymel.core
children = pymel.core.listRelatives( rootNode, c=1, ad=1, type='transform' )
if not children: children = []
for child in children:
child.rename( namespace + ':' + child.name().split( '|' )[-1] )
f = open( sceneInfoPath, 'r' )
data = json.load( f )
f.close()
cmds.currentUnit( time=data['timeUnit'] )
cmds.playbackOptions( min=data['minFrame'], max=data['maxFrame'] )
cmds.currentTime( data['exportFrame'] )
cmds.refresh()
namespaceRoots = data['namespaceRoots']
rootCenters = data['rootCenters']
for i in range( len( namespaceRoots ) ):
namespaceRoot = namespaceRoots[i]
localName = namespaceRoot.split( '|' )[-1]
namespace = ':'.join( localName.split( ':' )[:-1] )
try:cmds.namespace( add=namespace )
except:pass
target = '|'.join( namespaceRoot.split( '|' )[:-1] ) + '|' + localName.replace( namespace+':', '' ) + '*'
targets = cmds.ls( target, type='transform' )
if len( targets ) == 1:
target = targets[0]
addNamespaceToChildren( namespace, target )
cmds.rename( target, namespaceRoot.split( '|' )[-1] )
else:
for target in targets:
targetCenter = OpenMaya.MPoint( *getBBCenter( target ) )
rootCenter = OpenMaya.MPoint( *rootCenters[i] )
if targetCenter.distanceTo( rootCenter ) < 0.0001:
addNamespaceToChildren( namespace, target )
cmds.rename( target, namespaceRoot.split( '|' )[-1] )
开发者ID:jonntd,项目名称:mayadev-1,代码行数:58,代码来源:importScene.py
示例8: set_fps
def set_fps(fps = None):
fps_string = "pal"
if fps == 25:
fps_string = "pal"
if fps == 24:
fps_string = "film"
if fps == 30:
fps_string = "ntsc"
cmds.currentUnit(t=fps_string)
开发者ID:liorbenhorin,项目名称:pipeline,代码行数:9,代码来源:maya_warpper.py
示例9: setLinearUnit
def setLinearUnit(unit):
validUnits = ["mm", "millimeter", "cm", "centimeter", "m", "meter", "km", "kilometer", "in", "inch", "ft", "foot", "yd", "yard", "mi", "mile"]
if unit in validUnits:
cmds.optionVar(sv = ["workingUnitLinear", unit])
cmds.optionVar(sv = ["workingUnitLinearDefault", unit])
cmds.currentUnit(linear=unit)
else:
cmds.warning('Please specify a valid unit.')
开发者ID:jonntd,项目名称:dmptools,代码行数:9,代码来源:mayaSettings.py
示例10: __init__
def __init__( self):
self._saved = cmds.file( query = True, exists = True)
if self._saved:
self._modified = cmds.file( query = True, anyModified = True)
self._versionDigits = 3
self._fullName = cmds.file( query = True, expandName = True)
self._fileName = cmds.file( query = True, sceneName = True, shortName = True)
self._fileType = cmds.file( query = True, type = True)[0]
self._extension = '.' + mm.eval( 'fileExtension("' + self._fileName + '")')
self._path = self._fullName[:self._fullName.rfind(self._fileName)]
self._sceneName = self._fileName[:self._fileName.rfind(self._extension)]
self._shotName = self._sceneName[:-(self._versionDigits+2)]
self._sceneVersion = self._sceneName[-self._versionDigits:]
self._resolutionWidth = cmds.getAttr( 'defaultResolution.width')
self._resolutionHeight = cmds.getAttr( 'defaultResolution.height')
self._format = str( self._resolutionWidth) + ' x ' + str( self._resolutionHeight)
self._renderStartFrame = int( cmds.getAttr( 'defaultRenderGlobals.startFrame'))
self._renderEndFrame = int( cmds.getAttr( 'defaultRenderGlobals.endFrame'))
_rawDate = os.stat( self._fullName)
_rawDate = time.localtime( _rawDate[8])
self._lastModified = str( _rawDate[0]) + '. ' \
+ str( _rawDate[1]) + '. ' \
+ str( _rawDate[2]) + ' - ' \
+ str( _rawDate[3]) + ':' \
+ str( _rawDate[4]) + ':' \
+ str( _rawDate[5])
self._unitLinear = cmds.currentUnit( query = True, linear = True, fullName = True)
self._unitAngle = cmds.currentUnit( query = True, angle = True, fullName = True)
self._unitTime = cmds.currentUnit( query = True, time = True, fullName = True)
self._references = cmds.file (query = True, reference = True)
else:
_empty = 'scene not saved'
self._modified = _empty
self._versionDigits = _empty
self._fullName = _empty
self._fileName = _empty
self._fileType = _empty
self._extension = _empty
self._path = _empty
self._sceneName = _empty
self._shotName = _empty
self._sceneVersion = _empty
self._resolutionWidth = _empty
self._resolutionHeight = _empty
self._format = _empty
self._renderStartFrame = _empty
self._renderEndFrame = _empty
_rawDate = _empty
_rawDate = _empty
self._lastModified = _empty
self._unitLinear = _empty
self._unitAngle = _empty
self._unitTime = _empty
self._references = _empty
开发者ID:danielforgacs,项目名称:code-dump,代码行数:56,代码来源:ford_mayaSceneInfo_v001.py
示例11: setup
def setup(self):
cmds.file(os.path.join(r9Setup.red9ModulePath(), 'tests', 'testFiles', 'MetaRig_anim_jump.mb'), open=True, f=True)
self.mRig = r9Meta.getMetaNodes(mTypes=r9Meta.MetaRig)[0]
self.poseFolder = getPoseFolder()
# make our PoseData object with the unitTest config loaded
filterNode = r9Core.FilterNode_Settings()
filterNode.read(red9MetaRigConfig)
self.poseData = r9Pose.PoseData(filterNode)
cmds.currentUnit(time='ntscf')
开发者ID:markj3d,项目名称:Red9_StudioPack,代码行数:10,代码来源:Red9_PoseTests.py
示例12: import_transformsBake
def import_transformsBake( fileName=None ):
import sgBFunction_fileAndPath
import sgFunctionDag
import cPickle
if not fileName:
defaultExportTransformBakePath = sgBFunction_fileAndPath.getMayaDocPath() + '/defaultExportTransformsBake.txt'
f = open( defaultExportTransformBakePath, 'r' )
fileName = cPickle.load( f )
f = open( fileName, 'r' )
datas = cPickle.load( f )
f.close()
unit, minFrame, maxFrame = datas[:3]
imTargets = datas[3:]
cmds.currentUnit( time= unit )
for imTarget, targetMtxs in imTargets:
if not cmds.objExists( imTarget ):
sgFunctionDag.makeTransform( imTarget )
for imTarget, targetMtxs in imTargets:
attrs = cmds.listAttr( imTarget, k=1 )
animCurves = []
for k in range( len( attrs ) ):
targetAttr = imTarget + '.' + attrs[k]
at = cmds.attributeQuery( attrs[k], node=imTarget, at=1 )
animCurveType='animCurveTU'
if at == 'doubleLinear':
animCurveType = 'animCurveTL'
elif at == 'doubleAngle':
animCurveType = 'animCurveTA'
animCurve = cmds.createNode( animCurveType, n=targetAttr.split( '|' )[-1].replace( '.', '_' ) )
animCurves.append( animCurve )
for time in range( int( minFrame ), int( maxFrame+1 ) ):
i = time - int( minFrame )
cmds.xform( imTarget, os=1, matrix= targetMtxs[i] )
for k in range( len( attrs ) ):
targetAttr = imTarget + '.' + attrs[k]
targetAttrValue= cmds.getAttr( targetAttr )
animCurve = animCurves[k]
cmds.setKeyframe( animCurves[k], t=i, v=targetAttrValue )
for k in range( len( attrs ) ):
targetAttr = imTarget + '.' + attrs[k]
cmds.connectAttr( animCurves[k]+'.output', targetAttr )
cmds.select( imTargets[-1][0] )
开发者ID:jonntd,项目名称:mayadev-1,代码行数:54,代码来源:sgCFnc_import.py
示例13: copyTimeSettings
def copyTimeSettings(self):
"""copy time settings from selected scene"""
asset = self.getAssetFromTaks()
if not asset:
return
tim = asset.time
mc.currentUnit( time=tim['tim'], linear = tim['lin'], angle = tim[ 'angle' ] )
mc.playbackOptions( min = tim[ 'min' ],
ast = tim[ 'ast' ],
max = tim[ 'max' ],
aet = tim[ 'aet' ] )
开发者ID:skarone,项目名称:PipeL,代码行数:11,代码来源:taskUi.py
示例14: simpleEmitter
def simpleEmitter():
cmds.file (force=True, newFile=True)
cmds.currentUnit (linear='centimeter', angle='degree', time='film')
# Load the plug-in emitter and create an emitter node
cmds.loadPlugin ('simpleEmitter.py')
cmds.createNode ('spSimpleEmitter', name='simpleEmitter')
# Create particle object and connect to the plugin emitter node
cmds.particle (name='particles')
cmds.connectDynamic ('particles', em='simpleEmitter')
cmds.setAttr ('simpleEmitter.rate', 200 )
cmds.setAttr ('simpleEmitter.speed', 25 )
cmds.playbackOptions (minTime=0.00, maxTime=60.0)
cmds.currentTime (0)
cmds.play (wait=True, forward=True)
# make some keyframes on emitter
cmds.currentTime (0)
cmds.select ('simpleEmitter', replace=True)
cmds.setKeyframe ('simpleEmitter.tx')
cmds.setKeyframe ('simpleEmitter.ty')
cmds.setKeyframe ('simpleEmitter.tz')
cmds.setKeyframe ('simpleEmitter.rx')
cmds.setKeyframe ('simpleEmitter.ry')
cmds.setKeyframe ('simpleEmitter.rz')
cmds.currentTime (30)
cmds.move (-2.011944, 6.283524, -2.668834, relative=True)
cmds.move (0, 0, 12.97635, relative=True, localSpace=True, worldSpaceDistance=True)
cmds.rotate (0, -75.139762, 0, relative=True, objectSpace=True)
cmds.setKeyframe ('simpleEmitter.tx')
cmds.setKeyframe ('simpleEmitter.ty')
cmds.setKeyframe ('simpleEmitter.tz')
cmds.setKeyframe ('simpleEmitter.rx')
cmds.setKeyframe ('simpleEmitter.ry')
cmds.setKeyframe ('simpleEmitter.rz')
cmds.currentTime (60)
cmds.move (0, 0, -14.526107, relative=True)
cmds.move (0, -8.130523, 0, relative=True)
cmds.rotate (0, 0, 78.039751, relative=True, objectSpace=True)
cmds.rotate (0, 0, 53.86918, relative=True, objectSpace=True)
cmds.setKeyframe ('simpleEmitter.tx')
cmds.setKeyframe ('simpleEmitter.ty')
cmds.setKeyframe ('simpleEmitter.tz')
cmds.setKeyframe ('simpleEmitter.rx')
cmds.setKeyframe ('simpleEmitter.ry')
cmds.setKeyframe ('simpleEmitter.rz')
cmds.playbackOptions (minTime=0.00, maxTime=60.0)
cmds.currentTime (0)
cmds.play (wait=True, forward=True)
开发者ID:DimondTheCat,项目名称:xray,代码行数:53,代码来源:simpleEmitterTest.py
示例15: storeSettings
def storeSettings(self):
'''
main work function, store all UI settings
'''
self.dataStore['autoKey'] = cmds.autoKeyframe(query=True, state=True)
# timeline management
self.dataStore['currentTime'] = cmds.currentTime(q=True)
self.dataStore['minTime'] = cmds.playbackOptions(q=True, min=True)
self.dataStore['maxTime'] = cmds.playbackOptions(q=True, max=True)
self.dataStore['startTime'] = cmds.playbackOptions(q=True, ast=True)
self.dataStore['endTime'] = cmds.playbackOptions(q=True, aet=True)
self.dataStore['playSpeed'] = cmds.playbackOptions(query=True, playbackSpeed=True)
self.dataStore['playLoop'] = cmds.playbackOptions(query=True, loop=True)
# unit management
self.dataStore['timeUnit'] = cmds.currentUnit(q=True, fullName=True, time=True)
self.dataStore['sceneUnits'] = cmds.currentUnit(q=True, fullName=True, linear=True)
self.dataStore['upAxis'] = cmds.upAxis(q=True, axis=True)
# viewport colors
self.dataStore['displayGradient'] = cmds.displayPref(q=True, displayGradient=True)
# objects colors
self.dataStore['curvecolor'] = cmds.displayColor("curve", q=True, dormant=True)
# panel management
self.dataStore['panelStore'] = {}
for panel in ['modelPanel1', 'modelPanel2', 'modelPanel3', 'modelPanel4']:
if not cmds.modelPanel(panel, q=True, exists=True):
continue
self.dataStore['panelStore'][panel] = {}
self.dataStore['panelStore'][panel]['settings'] = cmds.modelEditor(panel, q=True, sts=True)
activeCam = cmds.modelPanel(panel, q=True, camera=True)
if not cmds.nodeType(activeCam) == 'camera':
activeCam = cmds.listRelatives(activeCam, f=True)[0]
self.dataStore['panelStore'][panel]['activeCam'] = activeCam
# camera management
# TODO : store the camera field of view etc also
self.dataStore['cameraTransforms'] = {}
for cam in ['persp', 'top', 'side', 'front']:
try:
self.dataStore['cameraTransforms'][cam] = [cmds.getAttr('%s.translate' % cam),
cmds.getAttr('%s.rotate' % cam),
cmds.getAttr('%s.scale' % cam)]
except:
log.debug("Camera doesn't exists : %s" % cam)
# sound management
self.dataStore['activeSound'] = cmds.timeControl(self.gPlayBackSlider, q=True, s=1)
self.dataStore['displaySound'] = cmds.timeControl(self.gPlayBackSlider, q=True, ds=1)
开发者ID:markj3d,项目名称:Red9_StudioPack,代码行数:52,代码来源:Red9_General.py
示例16: FrameratePrompt
def FrameratePrompt():
framerate = cmds.currentUnit(q=True, time=True)
if framerate != 'pal':
message = 'Maya session is not working with 25 fps.\n'
message += 'Do you want to switch to 25 fps?'
result = cmds.confirmDialog(title='FRAMERATE', message=message,
icon='warning', backgroundColor=(0.5, 0, 0))
if result == 'Confirm':
cmds.currentUnit(time='pal')
开发者ID:Bumpybox,项目名称:Tapp,代码行数:13,代码来源:framerate.py
示例17: checkUnit
def checkUnit(self , assetRoot, *args, **kws):
"""
# check maya working units:
# Linear: centimeter
# Angular: degrees
# Time: Film(24fps)
"""
if mc.currentUnit(q=True, l=True) != "cm" or mc.currentUnit(q=True, a=True) != "deg" or mc.currentUnit(q=True, t=True) != "film":
return self.checkResult(allowPublish=False, msg="Maya working unit should be: Linear: centimeter, Angular: degrees, Time: Film(24fps)", nodes=list())
else:
return self.checkResult(allowPublish=True, msg="Everything is OK")
开发者ID:wangqinghuaTudou,项目名称:test,代码行数:13,代码来源:Base.py
示例18: setupScene
def setupScene(*args):
cmds.currentUnit(time = 'ntsc')
cmds.playbackOptions(min = 0, max = 100, animationStartTime = 0, animationEndTime = 100)
cmds.currentTime(0)
#check for skeleton builder or animation UIs
if cmds.dockControl("skeletonBuilder_dock", exists = True):
print "Custom Maya Menu: SetupScene"
channelBox = cmds.formLayout("SkelBuilder_channelBoxFormLayout", q = True, childArray = True)
if channelBox != None:
channelBox = channelBox[0]
#reparent the channelBox Layout back to maya's window
cmds.control(channelBox, e = True, p = "MainChannelsLayersLayout")
channelBoxLayout = mel.eval('$temp1=$gChannelsLayersForm')
channelBoxForm = mel.eval('$temp1 = $gChannelButtonForm')
#edit the channel box pane's attachment to the formLayout
cmds.formLayout(channelBoxLayout, edit = True, af = [(channelBox, "left", 0),(channelBox, "right", 0), (channelBox, "bottom", 0)], attachControl = (channelBox, "top", 0, channelBoxForm))
#print "deleting dock and window and shit"
cmds.deleteUI("skeletonBuilder_dock")
if cmds.window("SkelBuilder_window", exists = True):
cmds.deleteUI("SkelBuilder_window")
if cmds.dockControl("artAnimUIDock", exists = True):
channelBox = cmds.formLayout("ART_cbFormLayout", q = True, childArray = True)
if channelBox != None:
channelBox = channelBox[0]
#reparent the channelBox Layout back to maya's window
cmds.control(channelBox, e = True, p = "MainChannelsLayersLayout")
channelBoxLayout = mel.eval('$temp1=$gChannelsLayersForm')
channelBoxForm = mel.eval('$temp1 = $gChannelButtonForm')
#edit the channel box pane's attachment to the formLayout
cmds.formLayout(channelBoxLayout, edit = True, af = [(channelBox, "left", 0),(channelBox, "right", 0), (channelBox, "bottom", 0)], attachControl = (channelBox, "top", 0, channelBoxForm))
#print "deleting dock and window and shit"
cmds.deleteUI("artAnimUIDock")
if cmds.window("artAnimUI", exists = True):
cmds.deleteUI("artAnimUI")
开发者ID:JustDo1989,项目名称:UnrealEngine4.11-HairWorks,代码行数:51,代码来源:customMayaMenu.py
示例19: mImportTimeInfo
def mImportTimeInfo(timeInfoFile):
"""
"""
with open(timeInfoFile, 'r') as timeInfoTxt:
timeInfo = timeInfoTxt.read().split('\n')
cmds.currentUnit(t= timeInfo[0])
logger.info('TimeInfo [Unit] ' + timeInfo[0])
cmds.playbackOptions(min= float(timeInfo[1].split(':')[0]))
cmds.playbackOptions(max= float(timeInfo[1].split(':')[1]))
logger.info('TimeInfo [Range] ' + timeInfo[1])
exec(timeInfo[2])
logger.info('TimeInfo [Static] ' + str(isStatic))
return [isStatic, float(timeInfo[1].split(':')[1])]
开发者ID:davidpower,项目名称:MS_GeoCache,代码行数:14,代码来源:moGeoCacheMethod.py
示例20: referenceCamera
def referenceCamera(self):
"""docstring for reference"""
sht = self._selectedShot
if INMAYA:
sht.poolCam.reference()
tim = self._selectedShot.animPath.time
mc.currentUnit( time=tim['tim'], linear = tim['lin'], angle = tim[ 'angle' ] )
mc.playbackOptions( min = tim[ 'min' ],
ast = tim[ 'ast' ],
max = tim[ 'max' ],
aet = tim[ 'aet' ] )
elif INHOU:
hu.loadCamera(sht.project.name, sht.sequence.name, sht.name, self.connectToGlobalScale_chb.isChecked() )
hu.copyTimeSettings( sht.project.name, sht.sequence.name, sht.name )
开发者ID:skarone,项目名称:PipeL,代码行数:14,代码来源:cacheManager.py
注:本文中的maya.cmds.currentUnit函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论