def importSgUVData(targetMesh, filePath=None, *args): sgBFunction_base.autoLoadPlugin("sgBDataCmd") if not filePath: filePath = sgBFunction_fileAndPath.getDefaultSgUVDataPath() targetMesh = sgBFunction_dag.getShape(targetMesh) targetMeshOrig = sgBFunction_dag.getOrigShape(targetMesh) targetMeshOrigSrcCon = cmds.listConnections(targetMeshOrig + '.inMesh', p=1, c=1, s=1, d=0) if targetMeshOrigSrcCon: cmds.disconnectAttr(targetMeshOrigSrcCon[1], targetMeshOrigSrcCon[0]) cmds.warning('"%s" to "%s" are disconnected.' % (targetMeshOrigSrcCon[1], targetMeshOrigSrcCon[0])) cmds.sgBDataCmd_mesh(targetMeshOrig, iuv=1, fp=filePath) print targetMeshOrig cons = cmds.listConnections(targetMesh + '.inMesh', s=1, d=0, p=1, c=1) if not cons: return targetMeshOrig cmds.disconnectAttr(cons[1], cons[0]) cmds.refresh() cmds.connectAttr(cons[1], cons[0]) return targetMeshOrig
def exportSgMeshData( targetMesh, filePath=None, *args ): sgBFunction_base.autoLoadPlugin( "sgBDataCmd" ) if not filePath: filePath = sgBFunction_fileAndPath.getDefaultSgMeshDataPath() filePath = filePath.replace( '\\', '/' ) folderPath = '/'.join( filePath.split( '/' )[:-1] ) sgBFunction_fileAndPath.makeFolder( folderPath ) cmds.sgBDataCmd_mesh( targetMesh, em=1, fp=filePath ) print '"%s" export to "%s"' %( targetMesh, filePath )
def exportSgMeshData(targetMesh, filePath=None, *args): sgBFunction_base.autoLoadPlugin("sgBDataCmd") if not filePath: filePath = sgBFunction_fileAndPath.getDefaultSgMeshDataPath() filePath = filePath.replace('\\', '/') folderPath = '/'.join(filePath.split('/')[:-1]) sgBFunction_fileAndPath.makeFolder(folderPath) cmds.sgBDataCmd_mesh(targetMesh, em=1, fp=filePath) print '"%s" export to "%s"' % (targetMesh, filePath)
def importSgMeshDatas( folderPath=None, importByMatrix = True, typ='old', *args ): sgBFunction_base.autoLoadPlugin( "sgBDataCmd" ) if not folderPath: folderPath = sgBFunction_fileAndPath.getDefaultSgMeshDataPath() if typ == 'old': import os for root, dirs, names in os.walk( folderPath ): for name in names: extension = name.split( '.' )[-1] if extension != 'sgBData_mesh': continue cmds.sgBDataCmd_mesh( im=1, ibm=importByMatrix, fp=root + '/' + name ) else: cmds.sgBDataCmd_mesh( im=1, ibm=importByMatrix, fdp=folderPath )
def exportSgMeshDatas( targetMeshs, folderPath = None, typ='old', *args ): sgBFunction_base.autoLoadPlugin( "sgBDataCmd" ) if not folderPath: folderPath = sgBFunction_fileAndPath.getDefaultSgMeshDataFolder() sgBFunction_fileAndPath.makeFolder( folderPath ) if typ == 'old': print len( targetMeshs ) for targetMesh in targetMeshs: targetMeshName = cmds.ls( targetMesh ) if not targetMeshName: continue filePath = folderPath + '/' + targetMeshName[0].replace( ':', '_' ).replace( '|', '_' ) + '.sgBData_mesh' cmds.sgBDataCmd_mesh( targetMeshName[0], em=1, fp= filePath ) else: cmds.sgBDataCmd_mesh( targetMeshs, em=1, fdp= folderPath )
def importSgMeshDatas(folderPath=None, importByMatrix=True, typ='old', *args): sgBFunction_base.autoLoadPlugin("sgBDataCmd") if not folderPath: folderPath = sgBFunction_fileAndPath.getDefaultSgMeshDataPath() if typ == 'old': import os for root, dirs, names in os.walk(folderPath): for name in names: extension = name.split('.')[-1] if extension != 'sgBData_mesh': continue cmds.sgBDataCmd_mesh(im=1, ibm=importByMatrix, fp=root + '/' + name) else: cmds.sgBDataCmd_mesh(im=1, ibm=importByMatrix, fdp=folderPath)
def exportSgMeshDatas(targetMeshs, folderPath=None, typ='old', *args): sgBFunction_base.autoLoadPlugin("sgBDataCmd") if not folderPath: folderPath = sgBFunction_fileAndPath.getDefaultSgMeshDataFolder() sgBFunction_fileAndPath.makeFolder(folderPath) if typ == 'old': print len(targetMeshs) for targetMesh in targetMeshs: targetMeshName = cmds.ls(targetMesh) if not targetMeshName: continue filePath = folderPath + '/' + targetMeshName[0].replace( ':', '_').replace('|', '_') + '.sgBData_mesh' cmds.sgBDataCmd_mesh(targetMeshName[0], em=1, fp=filePath) else: cmds.sgBDataCmd_mesh(targetMeshs, em=1, fdp=folderPath)
def importSgUVData( targetMesh, filePath=None, *args ): sgBFunction_base.autoLoadPlugin( "sgBDataCmd" ) if not filePath: filePath = sgBFunction_fileAndPath.getDefaultSgUVDataPath() targetMesh = sgBFunction_dag.getShape( targetMesh ) targetMeshOrig = sgBFunction_dag.getOrigShape( targetMesh ) targetMeshOrigSrcCon = cmds.listConnections( targetMeshOrig+'.inMesh', p=1, c=1, s=1, d=0 ) if targetMeshOrigSrcCon: cmds.disconnectAttr( targetMeshOrigSrcCon[1], targetMeshOrigSrcCon[0] ) cmds.warning( '"%s" to "%s" are disconnected.' %( targetMeshOrigSrcCon[1], targetMeshOrigSrcCon[0] ) ) cmds.sgBDataCmd_mesh( targetMeshOrig, iuv=1, fp=filePath ) print targetMeshOrig cons = cmds.listConnections( targetMesh+'.inMesh', s=1, d=0, p=1, c=1 ) if not cons: return targetMeshOrig cmds.disconnectAttr( cons[1], cons[0] ) cmds.refresh() cmds.connectAttr( cons[1], cons[0] ) return targetMeshOrig
def makeUvFiles(): import sgBFunction_base sgBFunction_base.autoLoadPlugin( 'sgBDataCmd' ) import sgBModel_fileAndPath import sgBFunction_fileAndPath scenePath = cmds.file( q=1, sceneName=1 ) cmds.file( scenePath, f=1, options="v=0;", ignoreVersion=True ) folderPath = '/'.join( scenePath.split( '/' )[:-1] ) uvPath = folderPath + '/' + sgBModel_fileAndPath.cacheBodyUvFolderName sgBFunction_fileAndPath.makeFolder( uvPath ) meshs = cmds.ls( type='mesh' ) for mesh in meshs: if cmds.getAttr( mesh+'.io' ): continue meshName = mesh.replace( '|', '_' ).replace( ':', '_' ) uvFilePath = uvPath + '/' + meshName + '.sgBData_uvs' cmds.sgBDataCmd_mesh( mesh, euv=1, filePath = uvFilePath )
def importSgMeshData( filePath=None, skipByName = False, *args ): sgBFunction_base.autoLoadPlugin( "sgBDataCmd" ) if not filePath: filePath = sgBFunction_fileAndPath.getDefaultSgMeshDataPath() cmds.sgBDataCmd_mesh( im=1, fp=filePath )
def importSgMeshData(filePath=None, skipByName=False, *args): sgBFunction_base.autoLoadPlugin("sgBDataCmd") if not filePath: filePath = sgBFunction_fileAndPath.getDefaultSgMeshDataPath() cmds.sgBDataCmd_mesh(im=1, fp=filePath)