def asset_group_builder(*args): mc.SelectAll() sel = mc.ls(sl=True) bad_name = mc.ls('group*', transforms=True) if bad_name: sys.exit('Some groups have a bad name (' + str(len(bad_name)) + ' groups). AutoTag Aborted.') etg.asset_group_builder(sel)
def _exportVray(self, filePath, exportSettings, exportSelected=True, timeRange=[0, 10]): # TODO: // export vray core function for Maya # cmds.confirmDialog(title='Ongoing development', message="Vray Proxy Export for Maya is under development") # mayaExp_vrayProxy = exportSettings["vrayProxyExportMaya"] # export settings / Choices / Default Value: # exportType / 1 2 / 1 # velocityOn / True False / True # velocityIntervalStart / 0.0 1.0 /0.0 # velocityIntervalEnd / 0.0 1.0 /0.050 # pointSize / 0.0 1.0 / 0.0 # previewFaces / Integer / 10000 # previewType / "clustering" "edge_collapse" "face_sampling" "combined" / "clustering" # vertexColorsOn / True False / False # ignoreHiddenObjects / True False / True # oneVoxelPerMesh / True False / False # facesPerVoxel / Integer / 20000 # createProxyNode / True False / False # makeBackup / True False / False if not cmds.pluginInfo('vrayformaya.mll', l=True, q=True): try: cmds.loadPlugin('vrayformaya.mll') except: msg = "Vray cannot be initialized. Skipping Vray Proxy export" cmds.confirmDialog(title='Plugin Error', message=msg) return False originalSelection = cmds.ls(sl=True) if not exportSelected: cmds.SelectAll() # OVERRIDE ANIMATION SETTINGS if timeRange[0] != timeRange[1]: animOn = True else: animOn = False directory, name = os.path.split(filePath) proxyNode = "%s_proxy" % name cmds.vrayCreateProxy(dir=directory, fname=name, overwrite=True, animOn=animOn, animType=3, startFrame=timeRange[0], endFrame=timeRange[1], node=proxyNode, exportType=1, makeBackup=False, velocityOn=True, velocityIntervalStart=0.0, velocityIntervalEnd=0.050, pointSize=0.0, previewFaces=10000, previewType="clustering", vertexColorsOn=False, ignoreHiddenObjects=True, oneVoxelPerMesh=False, facesPerVoxel=20000, createProxyNode=False) # re-select original selection cmds.select(originalSelection) return False
def select_all(): cmds.SelectAll()
def group(): cmds.SelectAll() selection = cmds.ls(sl=True) cmds.group(selection)
def g_abc_export(mode='currentframe', qst=0, qend=0): filename = mc.file(q=True, sn=True) charvalue = filename.split('/') # Verifier que l'on est dans le projet if not project_name in charvalue: sys.exit('You are not working in the Project !!') # Verifier asset/sequence # Definir options pour asset sequence if 'seq' in charvalue: # sequences options/variables check_name = ['chars', 'props', 'sets', 'cams', 'building'] else: # asset options/variables check_name = charvalue[-4] # Sortir l'emplacement du fichier seulement file_path = charvalue[:-1] filevalue = charvalue[-1] print('filevalue => ' + filevalue) filevalue, extension = ext.get_ext(filevalue) filevalue = charvalue[-4] file_path.pop(-1) file_path.pop(-1) print(charvalue) file_path = '/'.join(file_path) print('file_path => ' + file_path) print(filevalue) extension = '.abc' charvalue = file_path + '/' + 'export/' + filevalue + extension print(charvalue) mc.SelectAll() sel = mc.ls(sl=True) check.transforms(sel) sel = pmc.ls(sl=True) mc.select(cl=True) print(sel) # check export asset / sequence if not len(sel) == 1: print('sel > 1') # asset export checks if not 'seq' in charvalue: print('asset type') sys.exit( 'One group only must be selected, with the asset name. Use the Asset Group Builder command to do that.' ) #sequence export checks else: print('seq type') if not sel == check_name: sys.exit( 'You need to select the 5 groups that are in the asset => chars, props, sets, cams and building. Nothing else should be present.' ) # asset export checks elif not sel[0] == check_name: sys.exit( 'One group only must be selected, with the asset name. Use the Asset Group Builder command to do that.' ) if os.path.exists(charvalue): go_on = mc.confirmDialog(title='Exporting Alembic !!', message='An ABC already exists for : ' + filevalue + ', do you want to overwrite it ?', button=['Yes', 'No'], defaultButton='Yes', cancelButton='No', dismissString='No') if go_on == 'No': sys.exit('Alembic Export Aborted') abc_custom_export(framemode=mode, qstart=qst, qend=qend, preroll=False, path=charvalue, preframe=0, nodes=sel) print('Alembic : ' + filevalue + ' successfully created !')
import maya.cmds as cmds # display all commands as a list ls = cmds.ls() # deselect all cmds.select(clear=True) # display all cameras in the viewport as a list cmds.ls(cameras=True) # select all polys in the viewport as a list allselect = cmds.SelectAll() # dispaly selected items in viewport as a list cmds.ls(sl=True) # display transforme items as a list cmds.ls(tr=True) # To Hide selected selection_list = cmds.ls(sl=True) for selected in selection_list: cmds.setAttr('{}.v'.format(selected), False) # To Show selected for selected in selection_list: cmds.setAttr('{}.v'.format(selected), True) # filter what to see in ls list cmds.ls(type="transform") # filter by type cmds.ls("p*", transforms=True) cmds.ls("*Cube*", transforms=True) # cubes only cmds.ls("*Plane*", transforms=True) # planes only