本文整理汇总了Python中maya.cmds.workspace函数的典型用法代码示例。如果您正苦于以下问题:Python workspace函数的具体用法?Python workspace怎么用?Python workspace使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了workspace函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: projSetAndOpenFile
def projSetAndOpenFile(self, projName, *args):
global projRoot
global workTypeId
projPath = projRoot + '/' + projName + '/03-cg'
workPath = projPath + '/' + ['1-scenes', '1-shots'][workTypeId - 1]
if cmds.file(workPath, q= 1, ex= 1):
hasMayaScene = 0
setProject = 0
for root, dirs, files in os.walk(workPath):
for file in files:
if file.endswith(".ma") or file.endswith(".mb"):
hasMayaScene = 1
if hasMayaScene:
fileName = cmds.fileDialog2(dir= (workPath), dialogStyle=2, fm=1)
if fileName:
setProject = 1
cmds.file(mf= 0)
cmds.file(fileName[0], open= 1)
print 'file opened.'
cmds.deleteUI('ProjectLoader') if cmds.window('ProjectLoader', ex= 1) else None
else:
setProject = 1
if setProject:
mel.eval('setProject \"' + projPath + '\"')
cmds.workspace(fr= ['images', projPath.replace('1-project', '2-Render')])
cmds.workspace(fr= ['movie', projPath.replace('1-project', '2-Render')])
mel.eval('projectWindow;') # create project folders
mel.eval('np_editCurrentProjectCallback;') # create project folders
print 'project setted.'
cmds.deleteUI('ProjectLoader') if cmds.window('ProjectLoader', ex= 1) else None
else:
sorryStr = 'Dose not exist \n' + workPath
cmds.confirmDialog( title='Sorry', message=sorryStr, button=['Confirm'], defaultButton='Confirm', icon= 'information')
开发者ID:davidpower,项目名称:MS_Research,代码行数:34,代码来源:dp_pxflyProjectLoader.py
示例2: __init__
def __init__(self, intWinName, visWinName, buttonLabel):
super(Key_RenderLauncher, self).__init__(intWinName, visWinName, buttonLabel)
self.renderPathWin = 'key_SetRenderPath'
self.rlPathTxtFld = self.intWinName + '_rlPathTxtFld'
self.rlPathForm = self.intWinName + '_rlForm'
self.rlBrwsPathBut = self.intWinName + '_rlBrwsPathBut'
self.rlRenderBut = self.intWinName + '_rlRenderBut'
self.advXfld = self.intWinName + 'rlAdvXFld'
self.advYfld = self.intWinName + 'rlAdvYFld'
self.advEndSubDCb = self.intWinName + '_advEndSubDCb'
self.cpuIntFld = self.intWinName + '_cpuIntFld'
self.subRndrLyrCB = self.intWinName + '_subRndrLyrCB'
self.xDivisions = 2
self.yDivisions = 2
self.subdivide = False
self.outputname = None
self.outputpath = None
# get the current working images directory
self.currentWorkspace = os.path.realpath(cmds.workspace(query=True, rd=True))
self.currentImagePath = cmds.workspace(rte='images')
self.imageFilePrefix = cmds.getAttr('defaultRenderGlobals.imageFilePrefix')
self.uncompressedTifCb = self.intWinName + '_rl_uncompTifCb'
self.render_exrCB = None
version = mm.eval('getApplicationVersionAsFloat()')
if version == 2011.0:
self.renderer = 'maya2011'
elif version == 2012.0:
self.renderer = 'maya2012'
else:
self.renderer = 'maya2009'
self.renderers = ['maya2009', 'maya2011', 'maya2012']
开发者ID:boochos,项目名称:work,代码行数:35,代码来源:key_ui.py
示例3: get_texture_source_folder
def get_texture_source_folder(alt_path=None):
""" Return texture source folder
:param alt_path:
"""
texture_source_folder = MTTSettings.TEXTURE_SOURCE_FOLDER
if WS_KEY in MTTSettings.TEXTURE_SOURCE_FOLDER:
ws = cmds.workspace(query=True, rootDirectory=True)
texture_source_folder = MTTSettings.TEXTURE_SOURCE_FOLDER.replace(WS_KEY, ws)
texture_source_folder = os.path.normpath(texture_source_folder)
if not os.path.isdir(texture_source_folder):
# if default folder not found, try in sourceimages folder
if WS_KEY in MTTSettings.TEXTURE_SOURCE_FOLDER and alt_path:
texture_source_folder = MTTSettings.TEXTURE_SOURCE_FOLDER.replace(WS_KEY, alt_path)
texture_source_folder = os.path.normpath(texture_source_folder)
if not os.path.isdir(texture_source_folder):
# if another location doesn't exists, return workspace root
texture_source_folder = cmds.workspace(q=1, rootDirectory=True)
msg = (
'You should change "textureSourceFolder" folder '
'in mtt.json file')
mtt_log(msg, msg_type='warning', verbose=False)
return os.path.normpath(texture_source_folder)
开发者ID:Bioeden,项目名称:dbMayaTextureToolkit,代码行数:26,代码来源:mttCmd.py
示例4: collect_playblasts
def collect_playblasts(self, parent_item, project_root):
"""
Creates items for quicktime playblasts.
Looks for a 'project_root' property on the parent item, and if such
exists, look for movie files in a 'movies' subfolder.
:param parent_item: Parent Item instance
:param str project_root: The maya project root to search for playblasts
"""
movie_dir_name = None
# try to query the file rule folder name for movies. This will give
# us the directory name set for the project where movies will be
# written
if "movie" in cmds.workspace(fileRuleList=True):
# this could return an empty string
movie_dir_name = cmds.workspace(fileRuleEntry='movie')
if not movie_dir_name:
# fall back to the default
movie_dir_name = "movies"
# ensure the movies dir exists
movies_dir = os.path.join(project_root, movie_dir_name)
if not os.path.exists(movies_dir):
return
self.logger.info(
"Processing movies folder: %s" % (movies_dir,),
extra={
"action_show_folder": {
"path": movies_dir
}
}
)
# look for movie files in the movies folder
for filename in os.listdir(movies_dir):
# do some early pre-processing to ensure the file is of the right
# type. use the base class item info method to see what the item
# type would be.
item_info = self._get_item_info(filename)
if item_info["item_type"] != "file.video":
continue
movie_path = os.path.join(movies_dir, filename)
# allow the base class to collect and create the item. it knows how
# to handle movie files
item = super(MayaSessionCollector, self)._collect_file(
parent_item,
movie_path
)
# the item has been created. update the display name to include
# the an indication of what it is and why it was collected
item.name = "%s (%s)" % (item.name, "playblast")
开发者ID:jamesbdunlop,项目名称:tk-jbd-baseconfig,代码行数:60,代码来源:collector.py
示例5: _export_ass
def _export_ass(self):
import mtoa.cmds.arnoldRender as ar
filePath=cmds.file(q=True,sn=True)
#getting fields for version
shot_temp=self.parent.sgtk.templates["maya_shot_work"]
shotgunFields=shot_temp.get_fields(filePath)
#getting output path
area_temp=self.parent.sgtk.templates['maya_ass_export_area']
path=area_temp.apply_fields(shotgunFields).replace('\\','/')
#setting ass export path
cmds.workspace(fileRule = ['ASS', path])
#account for renderlayers
for layer in cmds.ls(type='renderLayer'):
#discarding referenced layers
if ':' not in layer:
#checking whether layer needs to be rendered
if cmds.getAttr(layer+'.renderable')==1:
cmds.editRenderLayerGlobals( currentRenderLayer=layer )
try:
ar.arnoldBatchRender('')
except Exception, e:
raise TankError("Failed to export Ass files: %s" % e)
开发者ID:baitstudio,项目名称:00719_grandpa,代码行数:32,代码来源:shot_post_submit_tk_maya.py
示例6: _getFile
def _getFile(self,index):
if self.__mode == 'save':
file = QtGui.QFileDialog.getSaveFileName(self, 'save', str(cmds.workspace(q = True, dir = True)), self.__filter)
else:
file = QtGui.QFileDialog.getSaveFileName(self, 'save', str(cmds.workspace(q = True, dir = True)), self.__filter)
self.setText(str(file))
开发者ID:jonntd,项目名称:japeto,代码行数:7,代码来源:fields.py
示例7: imgpath
def imgpath(img):
imgfile = img.split("/")[-1]
workspacepath = cmds.workspace(q=True,dir=True)
imgfolder = cmds.workspace("images",q=True,fre=True)
imgfullpath = os.path.join(workspacepath,imgfolder,imgfile)
imgfullpath = fixpath(imgfullpath)
return imgfullpath
开发者ID:jaforsgren,项目名称:Pipetools,代码行数:7,代码来源:collectTextures.py
示例8: win
def win(*args):
'''Window used to update the mesh
'''
#if any windows are open that deal with updating the mesh, close them
winList=['atom_meshUpdateWin', 'keyMeshdirDialogWin']
for win in winList:
if cmds.window(win, ex=True):
cmds.deleteUI(win)
#create the window
cmds.window('atom_meshUpdateWin', title = 'Atom Mesh Update')
cmds.columnLayout(co=['both',5],adj=True, rs=5)
path = os.path.join(cmds.workspace(query=True, o=True), 'scenes/anim/template_rig/CharactersWork/SantaPup/RIG/mesh_update_info')
button_state = True
#Test if the mesh_update_folder is the current path, this will usually be false
if os.path.exists(path) != True:
print path
path = cmds.workspace(query=True, o=True)
button_state=False
print 'mesh_update_info folder not found. Browse to folder to continue.'
cmds.textFieldButtonGrp('atom_meshUpdatePath_tfbg', label='Path:', tx=path, buttonLabel='Set Path', ct3=['left','both','left'],
co3=[0,0,5],cl3=['left', 'center', 'center'], ad3=2, cw3=[35,100,80], bc='from atom import atom_updateMesh_lib\natom_updateMesh_lib.dirDialog()')
cmds.button('atom_meshUpdate_button',l='Update Mesh', c ='from atom import atom_updateMesh_lib\natom_updateMesh_lib.updateMeshCMD()', en=button_state )
cmds.scriptJob(runOnce=True,uid=['atom_meshUpdateWin', 'from atom import atom_updateMesh_lib\natom_updateMesh_lib.deleteDirDialog()'])
cmds.showWindow('atom_meshUpdateWin')
开发者ID:boochos,项目名称:work,代码行数:25,代码来源:atom_updateMesh_lib.py
示例9: blastDir
def blastDir(forceTemp=False, brackets=False):
'''
forceTemp = use get default function to force a specified location, otherwise standard maya locations are used
'''
if not forceTemp:
if os.name == 'nt':
project = cmds.workspace(q=True, rd=True)
scene = sceneName(full=True)
if project in scene:
if brackets:
if '(' in project or ')' in project:
project = project.replace('(', '__')
project = project.replace(')', '__')
# print project
return project + 'movies/'
else:
message('Project likely not set', maya=True)
return None
# print project
# print scene
elif os.name == 'posix':
project = cmds.workspace(q=True, rd=True).split('scenes/')[0]
scene = sceneName(full=True)
if project in scene:
return project + 'movies/'
else:
message('Project likely not set', maya=True)
# print None, '____'
return None
# print project, 'here'
# print scene, 'here'
else:
return getPath()
else:
return getPath()
开发者ID:boochos,项目名称:work,代码行数:35,代码来源:playblast_lib.py
示例10: browse
def browse(folder,*args):
if folder=='renderFolder':
mc.textField(str(folder),edit=1,text=mc.fileDialog2(ds=2,dir=os.path.join(mc.workspace(q=1,rd=1),'scenes'),fm=3,okc="Set",cc="Cancel")[0].split('/')[-1])
else:
mc.textField(str(folder),edit=1,text=mc.fileDialog2(ds=2,dir=os.path.join(mc.workspace(q=1,rd=1),'scenes'),fm=3,okc="Set",cc="Cancel")[0])
commitUI()
UI()
开发者ID:RobRuckus,项目名称:rcTools,代码行数:7,代码来源:rcFileManager.py
示例11: hw
def hw(*args, **kwargs):
t0 = float(time.time())
try:
verbose = kwargs["verbose"]
except KeyError:
verbose = False
if cmds.optionVar(exists="checkmateVerbosity"):
verbose = cmds.optionVar(query="checkmateVerbosity")
else:
pass
scenefilename = cmds.file(query=True, sn=True, shn=True)
root, ext = os.path.splitext(scenefilename)
fullscenepath = cmds.file(query=True, sn=True, shn=False)
fullscenedirname = os.path.dirname(fullscenepath)
reportname = "".join([root, ext.replace(".", "_")])
img_dir = os.path.join(fullscenedirname, reportname)
print "save HW rendered images to : %s" % img_dir
# before we render, save render globals presets
cmds.nodePreset(save=("defaultRenderQuality", "ttRestorePreviousDefaultRenderViewPreset"))
cmds.nodePreset(save=("defaultRenderGlobals", "ttRestorePreviousDefaultRenderViewPreset"))
cmds.nodePreset(save=("defaultResolution", "ttRestorePreviousDefaultRenderViewPreset"))
# override the user settings
cmds.setAttr("defaultRenderGlobals.imageFormat", 32)
ext = ".png"
# set resolution ot 320x240
cmds.setAttr("defaultResolution.width", 640)
cmds.setAttr("defaultResolution.height", 480)
cmds.setAttr("defaultResolution.deviceAspectRatio", (float(320) / float(240)))
# set file format to png
cmds.setAttr("defaultRenderGlobals.imageFormat", 32)
ext = ".png"
cmds.setAttr("defaultRenderGlobals.outFormatControl", 0) # default name.ext
cmds.setAttr("defaultRenderGlobals.animation", False)
# cmds.setAttr('defaultRenderGlobals.imageFilePrefix', "../<Camera>", type="string")
cmds.setAttr("defaultRenderGlobals.imageFilePrefix", "<Camera>", type="string")
cmds.workspace(fileRule=["images", img_dir])
print "save rendered images to : %s" % img_dir
cmds.hwRender(currentFrame=True, cam="top", edgeAntiAliasing=[2, 4], fullRenderSupport=True)
cmds.hwRender(currentFrame=True, cam="persp", edgeAntiAliasing=[2, 16], fullRenderSupport=True)
cmds.hwRender(currentFrame=True, cam="front", edgeAntiAliasing=[2, 16], fullRenderSupport=True)
cmds.hwRender(currentFrame=True, cam="side", edgeAntiAliasing=[2, 16], fullRenderSupport=True)
# move rendererd images from the default project images dir to the report dir
sourcedir = os.path.join(cmds.workspace(q=True, rd=True), cmds.workspace(fileRuleEntry="images"))
targetdir = img_dir
print "from : ", sourcedir
print "to : ", targetdir
# for img in ['side.png', 'front.png', 'persp.png', 'top.png'] :
# os.rename(os.path.join(sourcedir, img), os.path.join(targetdir, img))
print "%-24s : %.6f seconds" % ("render.hw()", (float(time.time()) - t0))
return img_dir
开发者ID:Kif11,项目名称:turbosquid_maya_publisher,代码行数:60,代码来源:render.py
示例12: select_file
def select_file(self):
""" Maya Open Dialog to select file texture """
self.open_dialog_visible = True
if MTTSettings.value('browserFirstStart'):
image_dir = cmds.optionVar(query='MTT_browserStartFolder')
else:
image_dir = cmds.workspace(query=True,
rootDirectory=True) + cmds.workspace(
fileRuleEntry='sourceImages')
MTTSettings.set_value('browserFirstStart', True)
file_path = cmds.fileDialog2(fileMode=1, startingDirectory=image_dir,
caption='Select a texture',
okCaption='Select')
if file_path:
new_path = file_path[0]
cmds.optionVar(
sv=['MTT_browserStartFolder', os.path.dirname(new_path)])
if MTTSettings.value('forceRelativePath'):
new_path = convert_to_relative_path(new_path)
# relative_path = workspace(projectPath=new_path)
# if relative_path != new_path:
# new_path = '/%s' % relative_path
self.line_edit.setText(new_path)
self.open_dialog_visible = False
self.close()
self.editingFinished.emit()
cmds.showWindow(WINDOW_NAME)
开发者ID:Bioeden,项目名称:dbMayaTextureToolkit,代码行数:30,代码来源:mttDelegate.py
示例13: setProject
def setProject(self):
""" Option: 'project' = Set maya project """
if self.options['project'] is None:
self.log("\tUse current project.")
else:
self.log("\tOption 'project' detected: %s" % self.options['project'])
mc.workspace(self.options['project'], o=True)
mc.workspace(dir=self.options['project'])
开发者ID:snaress,项目名称:bank,代码行数:8,代码来源:procRender.py
示例14: getDirRules
def getDirRules(self):
"""
"""
ruleDict = {}
for rule in cmds.workspace(q= 1, frl= 1):
ruleDict[rule] = cmds.workspace(rule, q= 1, fre= 1)
return ruleDict
开发者ID:davidpower,项目名称:MS_Research,代码行数:8,代码来源:moSceneInfo.py
示例15: getSourceImagesDir
def getSourceImagesDir():
sourceImagesRule = cmds.workspace('sourceImages', query=True, fileRuleEntry=True)
if sourceImagesRule != None:
sourceImagesRule = sourceImagesRule.split(';')
ret = []
for rule in sourceImagesRule:
ret.append(cmds.workspace(expandName=rule))
return ret
else:
return [cmds.workspace(expandName='sourceimages')]
开发者ID:Quazo,项目名称:breakingpoint,代码行数:10,代码来源:utils.py
示例16: findWorkSpace
def findWorkSpace(set=False):
ws=''
d=os.path.dirname(mc.file(q=True,loc=True))
while ws=='' and d!=os.path.dirname(d):
if 'workspace.mel' in iterable(os.listdir(d)):
ws=d
else:
d=os.path.dirname(d)
if set: mc.workspace(ws,o=True)
return ws
开发者ID:jonntd,项目名称:zentools,代码行数:10,代码来源:findWorkSpace.py
示例17: rlmAttrs
def rlmAttrs():#custom renderLayerManager Attributes for tools using customAttr class
rlm=customAttr('renderLayerManager')
rlm.define('project',mc.workspace(q=1,rd=1))
rlm.define('shotName','SH01')
rlm.define('enableAbsoluteRenderFolder',False)
rlm.define('absoluteRenderFolder',os.path.join(mc.workspace(q=1,rd=1),'scenes'))
rlm.define('enablePrefixRenderLayer',False)
rlm.define('prefixRenderLayer','L')
rlm.define('enableSingleFileName',False)
rlm.define('singleFileName','custom')
rlm.define('notes',' ')
开发者ID:RobRuckus,项目名称:rcTools,代码行数:11,代码来源:rcMaya.py
示例18: getProjectPath
def getProjectPath(self):
#----------------------------
self.project_name = mc.workspace(q=True, sn=True)
self.project_path = mc.workspace(q=True, fn=True)
#-
self.btn_getProject.setText(self.project_name)
#----------------------------
self.tableModel.clear()
for d in os.listdir(self.project_path):
self.tableModel.insertRow([d, ''])
self.tableView.openPersistentEditor(self.tableModel.index(self.tableModel.rowCount() - 1, 1))
self.tableView.setRowHeight(self.tableModel.rowCount() - 1, 25)
开发者ID:AtonLerin,项目名称:RiggingTeamTools,代码行数:12,代码来源:ProjectTool.py
示例19: quick_set_proj
def quick_set_proj():
'''
Sets the project to where the current file is located.
'''
scene_path = cmds.file(q=True, sn=True)
base_path = os.path.split(scene_path)
# Setting Project and workspace
# Find out how workspace and setting parent differ.
mel.eval('setProject("%s")' % base_path[0])
cmds.workspace(dir=base_path[0])
开发者ID:creuter23,项目名称:fs-tech-artist,代码行数:12,代码来源:mec_env.py
示例20: workspaceToDict
def workspaceToDict():
"""
Store workspace info to dict
:return: Workspace info
:rtype: dict
"""
wsDict = {'projectName': mc.workspace(q=True, fn=True).split('/')[-1],
'projectPath': mc.workspace(q=True, fn=True), 'fileRules': {}}
fr = mc.workspace(q=True, fr=True)
for n in range(0, len(fr), 2):
wsDict['fileRules'][fr[n]] = fr[n+1]
return wsDict
开发者ID:snaress,项目名称:studio_dev,代码行数:13,代码来源:pScene.py
注:本文中的maya.cmds.workspace函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论