Пример #1
0
    def write_windowInfo():

        exportPath = cmds.textField(WinA_Global.exportPath_txf, q=1, tx=1)
        exportType = WinA_Cmd.getExportType()
        searchFor = cmds.textField(WinA_Global.searchFor_txf, q=1, tx=1)
        searchForType = WinA_Cmd.getSearchForType()
        splitStringAndSearchCheck = cmds.checkBox(
            WinA_Global.searchForType_check, q=1, v=1)
        splitStringAndSearchString = cmds.textField(
            WinA_Global.searchForType_txf, q=1, tx=1)

        data = [
            exportPath, exportType, searchFor, searchForType,
            splitStringAndSearchCheck, splitStringAndSearchString
        ]

        import cPickle
        import sgBFunction_fileAndPath
        sgBFunction_fileAndPath.makeFile(WinA_Global.pathInfo, False)

        f = open(WinA_Global.uiInfo, 'w')
        cPickle.dump(data, f)
        f.close()

        f = open(WinA_Global.pathInfo, 'w')
        cPickle.dump(exportPath, f)
        f.close()
Пример #2
0
def exportTransformData( targets, folderPath ):
    
    import cPickle
    
    import sgBFunction_fileAndPath
    
    sgBFunction_fileAndPath.makeFolder( folderPath )
    
    for target in targets:

        filePath = folderPath + '/' + target.split( '|' )[-1].replace( ':', '_' )+'.transformData'
        sgBFunction_fileAndPath.makeFile( filePath )
        
        tx = cmds.getAttr( target+'.tx' )
        ty = cmds.getAttr( target+'.ty' )
        tz = cmds.getAttr( target+'.tz' )
        
        rx = cmds.getAttr( target+'.rx' )
        ry = cmds.getAttr( target+'.ry' )
        rz = cmds.getAttr( target+'.rz' )
        
        sx = cmds.getAttr( target+'.sx' )
        sy = cmds.getAttr( target+'.sy' )
        sz = cmds.getAttr( target+'.sz' )
        
        values = [target, tx, ty, tz, rx, ry, rz, sx, sy, sz]
        
        f = open( filePath, 'w' )
        cPickle.dump( values, f )
        f.close()
 def read_windowInfo():
     
     import cPickle
     import sgBFunction_fileAndPath
     
     if not os.path.exists( WinA_Global.infoPath ):
         sgBFunction_fileAndPath.makeFile( WinA_Global.infoPath )
         sgBFunction_fileAndPath.makeFile( WinA_Global.infoPathPath )
     try:
         f = open( WinA_Global.infoPath, 'r' )
         data = cPickle.load( f )
         f.close()
     except: return None
     
     if not data: return None
     
     try:exportPath, exportType, searchFor, searchForType, splitStringAndSerchCheck, splitStringAndSearchString = data
     except: return None
     
     cmds.textField( WinA_Global.exportPath_txf, e=1, tx= exportPath )
     items = cmds.radioCollection( WinA_Global.exportType_radio, q=1, cia=1 )
     cmds.radioButton( items[ exportType ], e=1, sl=1 )
     cmds.textField( WinA_Global.searchFor_txf, e=1, tx=searchFor )
     items = cmds.radioCollection( WinA_Global.searchForType_radio, q=1, cia=1 )
     cmds.radioButton( items[ searchForType ], e=1, sl=1 )
     cmds.checkBox( WinA_Global.searchForType_check, e=1, v=splitStringAndSerchCheck )
     cmds.textField( WinA_Global.searchForType_txf, e=1, tx=splitStringAndSearchString )
 def loadInfo( *args ):
     import sgBFunction_fileAndPath
     
     sceneBakeInfoPath = sgBFunction_fileAndPath.getSceneBakeInfoPath()
     
     sgBFunction_fileAndPath.makeFile( WinA_Global.filePathInfo, False )
     cmds.textField( WinA_Global.exportPath_txf, e=1, tx= sceneBakeInfoPath )
    def cmdConstraint():

        import sgBFunction_connection
        
        sgBFunction_fileAndPath.makeFile( WinA_Global.infoPath, False )
        f = open( WinA_Global.infoPath, 'r' )
        data = cPickle.load( f )
        f.close()
        
        if not data:
            autoAxis = True
            axisIndex = 0
            createUp = False
            editUp = True
            maintainOffset = False
        else:
            try:
                autoAxis, axisIndex, createUp, editUp, maintainOffset = data
            except: 
                autoAxis = True
                axisIndex = 0
                createUp = False
                editUp = True
                maintainOffset = False
        
        sels = cmds.ls( sl=1 )

        aimTarget = sels[0]
        constTarget = sels[1]
        sgBFunction_connection.aimConstraintByAimObjectMatrix( aimTarget, constTarget, autoAxis, maintainOffset, createUp, editUp, axisIndex-1 )
        WinA_Cmd.updateInfoFromWindow()
Пример #6
0
    def write_windowInfo():

        exportPath = cmds.textField(WinA_Global.exportPath_txf, q=1, tx=1)
        exportType = WinA_Cmd.getExportType()
        searchFor = cmds.textField(WinA_Global.searchFor_txf, q=1, tx=1)
        searchForType = WinA_Cmd.getSearchForType()
        splitStringAndSearchCheck = cmds.checkBox(
            WinA_Global.searchForType_check, q=1, v=1)
        splitStringAndSearchString = cmds.textField(
            WinA_Global.searchForType_txf, q=1, tx=1)
        cacheType = cmds.optionMenu(WinA_Global.om_cacheType, q=1, sl=1)
        pointsSpace = cmds.optionMenu(WinA_Global.om_pointsSpace, q=1, sl=1)

        data = [
            exportPath, exportType, searchFor, searchForType,
            splitStringAndSearchCheck, splitStringAndSearchString, cacheType,
            pointsSpace
        ]

        import cPickle
        import sgBFunction_fileAndPath
        sgBFunction_fileAndPath.makeFolder(WinA_Global.infoFolderPath)
        sgBFunction_fileAndPath.makeFile(WinA_Global.infoPathPath, False)
        f = open(WinA_Global.infoPath, 'w')
        cPickle.dump(data, f)
        f.close()

        f = open(WinA_Global.infoPathPath, 'w')
        cPickle.dump(exportPath, f)
        f.close()
    def loadInfo(*args):
        import sgBFunction_fileAndPath

        sceneBakeInfoPath = sgBFunction_fileAndPath.getSceneBakeInfoPath()

        sgBFunction_fileAndPath.makeFile(WinA_Global.filePathInfo, False)
        cmds.textField(WinA_Global.exportPath_txf, e=1, tx=sceneBakeInfoPath)
    def saveInfo(*args):
        import sgBFunction_fileAndPath
        import cPickle
        exportPath = cmds.textField(WinA_Global.exportPath_txf, q=1, tx=1)

        sgBFunction_fileAndPath.makeFile(WinA_Global.filePathInfo, False)
        f = open(WinA_Global.filePathInfo, 'w')
        cPickle.dump(exportPath, f)
        f.close()
 def saveInfo( *args ):
     import sgBFunction_fileAndPath
     import cPickle
     exportPath = cmds.textField( WinA_Global.exportPath_txf, q=1, tx=1 )
     
     sgBFunction_fileAndPath.makeFile( WinA_Global.filePathInfo, False )
     f = open( WinA_Global.filePathInfo, 'w' )
     cPickle.dump( exportPath, f )
     f.close()
Пример #10
0
def buildShadingInfoData( filePaths ):
    
    import os
    import sgBFunction_shader
    import sgBFunction_fileAndPath
    
    reload( sgBFunction_shader )
    reload( sgBFunction_fileAndPath )
    
    cachebodyPaths = []
    for filePath in filePaths:
        filePath = filePath.replace( '\\', '/' )
        folderPath = '/'.join( filePath.split( '/' )[:-1] )
        
        fileName = filePath.split( '/' )[-1]
        onlyFileName = fileName.split( '.' )[0]
        
        for root, dirs, names in os.walk( folderPath ):
            for name in names:
                try:onlyName, extension = name.split( '.' )
                except: continue
                if onlyName[-10:] == '_cachebody' and onlyName.find( onlyFileName ) != -1:
                    cachebodyPaths.append( root+'/'+name )
                    break
            break
    
    if not cachebodyPaths: return None
    
    launchFolders  = sgBFunction_fileAndPath.getStandaloneLaunchFolders( len( cachebodyPaths ) )
    standaloneRemoveFiles = sgBFunction_fileAndPath.getStandaloneTempFiles( launchFolders ) 
    
    shadingInfoPaths = []
    for i in range( len( cachebodyPaths ) ):
        cachebodyPath = cachebodyPaths[i]
        cachebodyFolder = '/'.join( cachebodyPath.split( '/' )[:-1] )
        cachebodyFile   = cachebodyPath.split( '/' )[-1]
        cachebodyFileName = cachebodyFile.split( '.' )[0]
        shadingInfoPath = cachebodyFolder + '/' + cachebodyFileName + '.shadingInfo'
        shadingInfoPaths.append( shadingInfoPath )
        
        if os.path.exists( shadingInfoPath ):
            os.remove( standaloneRemoveFiles[i] )
            continue

        sgBFunction_fileAndPath.makeFile( shadingInfoPath, False )
        sgBFunction_shader.standalone_makeReferenceShaderInfoFile( cachebodyPath, shadingInfoPath, launchFolders[i] )
    
    while( True ):
        exists = False
        for tempFile in standaloneRemoveFiles:
            if os.path.exists( tempFile ):
                exists = True; break
        #cmds.refresh()
        if not exists: break
    
    return shadingInfoPaths
Пример #11
0
    def saveInfo(*args):
        import sgBFunction_fileAndPath
        import cPickle
        importPath = cmds.textField(WinA_Global.importPath_txf, q=1, tx=1)
        importByMatrix = cmds.checkBox(WinA_Global.checkBox, q=1, v=1)
        data = [importPath, importByMatrix]

        sgBFunction_fileAndPath.makeFile(WinA_Global.uiInfo, False)
        f = open(WinA_Global.uiInfo, 'w')
        cPickle.dump(data, f)
        f.close()
 def saveInfo( *args ):
     import sgBFunction_fileAndPath
     import cPickle
     importPath = cmds.textField( WinA_Global.importPath_txf, q=1, tx=1 )
     importByMatrix = cmds.checkBox( WinA_Global.checkBox, q=1, v=1 )
     data = [ importPath, importByMatrix ]
     
     sgBFunction_fileAndPath.makeFile( WinA_Global.uiInfo, False )
     f = open( WinA_Global.uiInfo, 'w' )
     cPickle.dump( data, f )
     f.close()
 def loadInfo( *args ):
     import cPickle
     import sgBFunction_fileAndPath
     
     sgBFunction_fileAndPath.makeFile( WinA_Global.pathInfo, False )
     
     try:
         f = open( WinA_Global.pathInfo, 'r' )
         importPath = cPickle.load( f )
         f.close()
         
         cmds.textField( WinA_Global.importPath_txf, e=1, tx= importPath )
     except: return None
 def write_windowInfo():
     
     exportPath = cmds.textField( WinA_Global.txf_export, q=1, tx=1 )
     
     data = exportPath
     
     import cPickle
     import sgBFunction_fileAndPath
     sgBFunction_fileAndPath.makeFile( WinA_Global.infoFilePath, False )
     
     f = open( WinA_Global.infoFilePath, 'w' )
     cPickle.dump( data, f )
     f.close()
    def write_windowInfo():

        exportPath = cmds.textField(WinA_Global.txf_export, q=1, tx=1)

        data = exportPath

        import cPickle
        import sgBFunction_fileAndPath
        sgBFunction_fileAndPath.makeFile(WinA_Global.infoFilePath, False)

        f = open(WinA_Global.infoFilePath, 'w')
        cPickle.dump(data, f)
        f.close()
Пример #16
0
    def export(*args):

        import sgBExcute_data
        import sgBFunction_fileAndPath
        import sgBFunction_scene
        import sgBFunction_base
        import cPickle

        sgBFunction_base.autoLoadPlugin('AbcExport')
        sgBFunction_base.autoLoadPlugin('AbcImport')

        path = cmds.textField(WinA_Global.exportPath_txf, q=1, tx=1)

        sgBFunction_fileAndPath.makeFile(WinA_Global.pathInfo, False)
        f = open(WinA_Global.pathInfo, 'w')
        cPickle.dump(path, f)
        f.close()

        if not os.path.exists(path):
            try:
                sgBFunction_fileAndPath.makeFolder(path)
            except:
                cmds.error('"%s" is not exist path' % path)
                return None

        if not os.path.isdir(path):
            cmds.error('"%s" is not Directory' % path)
            return None

        path = cmds.textField(WinA_Global.exportPath_txf, q=1, tx=1)
        startFrame = cmds.floatField(WinA_Global.fld_startFrame, q=1, v=1)
        endFrame = cmds.floatField(WinA_Global.fld_endFrame, q=1, v=1)
        step = cmds.floatField(WinA_Global.fld_step, q=1, v=1)
        exportType = WinA_Cmd.getExportType()
        if exportType == 0: exportTargets = cmds.ls(sl=1)
        elif exportType == 1:
            exportTargets = []
            for tr in cmds.ls(tr=1):
                if cmds.listRelatives(tr, p=1): continue
                exportTargets.append(tr)

        if not exportTargets:
            cmds.error('Target is not exists')
        else:
            sgBExcute_data.exportAlembicData(sgBFunction_scene.getCutNumber(),
                                             exportTargets, startFrame,
                                             endFrame, step, path)
    def export( *args ):

        import sgBExcute_data
        import sgBFunction_fileAndPath
        import sgBFunction_scene
        import sgBFunction_base
        import cPickle
        
        sgBFunction_base.autoLoadPlugin( 'AbcExport' )
        sgBFunction_base.autoLoadPlugin( 'AbcImport' )
        
        path = cmds.textField( WinA_Global.exportPath_txf, q=1, tx=1 )
        
        sgBFunction_fileAndPath.makeFile( WinA_Global.pathInfo, False )
        f = open( WinA_Global.pathInfo, 'w' )
        cPickle.dump( path, f )
        f.close()
        
        if not os.path.exists( path ):
            try:
                sgBFunction_fileAndPath.makeFolder( path ) 
            except:
                cmds.error( '"%s" is not exist path' % path )
                return None
        
        if not os.path.isdir( path ):
            cmds.error( '"%s" is not Directory' % path )
            return None

        path = cmds.textField( WinA_Global.exportPath_txf, q=1, tx=1 )
        startFrame = cmds.floatField( WinA_Global.fld_startFrame, q=1, v=1 )
        endFrame   = cmds.floatField( WinA_Global.fld_endFrame, q=1, v=1 )
        step       = cmds.floatField( WinA_Global.fld_step, q=1, v=1 )
        exportType = WinA_Cmd.getExportType()
        if exportType == 0: exportTargets = cmds.ls( sl=1 )
        elif exportType == 1:
            exportTargets = []
            for tr in cmds.ls( tr=1 ):
                if cmds.listRelatives( tr, p=1 ): continue
                exportTargets.append( tr )
        
        if not exportTargets:
            cmds.error( 'Target is not exists' )
        else:
            sgBExcute_data.exportAlembicData( sgBFunction_scene.getCutNumber(), exportTargets, startFrame, endFrame, step, path )
 def updateWindowFromInfo():
     
     sgBFunction_fileAndPath.makeFile( WinA_Global.infoPath, False )
     f = open( WinA_Global.infoPath, 'r' )
     data = cPickle.load( f )
     f.close()
     if not data: return None
     
     try:
         autoAxis, aimIndex, createUp, editUpObject, maintainOffset = data
     except: return None
     
     cmds.checkBox(      WinA_Global.chk_autoAxis, e=1, v=autoAxis )
     cmds.optionMenuGrp( WinA_Global.omg_aimAxis,  e=1, sl=aimIndex )
     cmds.checkBox(      WinA_Global.chk_createUp, e=1, v=createUp )
     cmds.checkBox(      WinA_Global.chk_editUp,   e=1, v=editUpObject )
     cmds.checkBox(      WinA_Global.chk_mo,       e=1, v=maintainOffset )
     WinA_Cmd.updateUICondition()
    def read_windowInfo():

        import cPickle
        import sgBFunction_fileAndPath

        if not os.path.exists(WinA_Global.uiInfo):
            sgBFunction_fileAndPath.makeFile(WinA_Global.uiInfo, False)
        try:
            f = open(WinA_Global.uiInfo, 'r')
            data = cPickle.load(f)
            f.close()

            exportPath, exportType, searchFor, searchForType, splitStringAndSerchCheck, splitStringAndSearchString, cacheType, pointsSpace = data
        except:
            sgBFunction_fileAndPath.makeFile(WinA_Global.uiInfo, False)

            exportPath = ''
            exportType = 'Export By Selection'
            searchFor = ''
            searchForType = 'Ani position'
            splitStringAndSerchCheck = False
            splitStringAndSearchString = ''
            cacheType = 1
            pointsSpace = 1

        import sgBModel_aniScene

        upFolderNum, addPath = sgBModel_aniScene.exportCachePathFromAni
        sceneName = cmds.file(q=1, sceneName=1)
        sceneFolder = '/'.join(sceneName.split('/')[:-1 + upFolderNum])
        exportPath = sceneFolder + addPath

        cmds.textField(WinA_Global.exportPath_txf, e=1, tx=exportPath)
        cmds.textField(WinA_Global.searchFor_txf, e=1, tx=searchFor)
        cmds.checkBox(WinA_Global.searchForType_check,
                      e=1,
                      v=splitStringAndSerchCheck)
        cmds.textField(WinA_Global.searchForType_txf,
                       e=1,
                       tx=splitStringAndSearchString)
        cmds.optionMenu(WinA_Global.om_cacheType, e=1, sl=cacheType)
        cmds.optionMenu(WinA_Global.om_pointsSpace, e=1, sl=pointsSpace)
 def read_windowInfo():
     
     import cPickle
     import sgBFunction_fileAndPath
     
     sgBFunction_fileAndPath.makeFile( WinA_Global.keyExportInfoFile, False )
     sgBFunction_fileAndPath.makeFile( WinA_Global.cacheExportInfoFile, False )
     sgBFunction_fileAndPath.makeFile( WinA_Global.infoPath, False )
     
     import sgBModel_aniScene
     
     upFolderNum, addPath = sgBModel_aniScene.exportCachePathFromAni
     sceneName = cmds.file( q=1, sceneName=1 )
     sceneFolder = '/'.join( sceneName.split( '/' )[:-1+upFolderNum] )
     cacheExportPath = sceneFolder + addPath
     
     upFolderNum, addPath = sgBModel_aniScene.exportKeyPathFromAni
     sceneName = cmds.file( q=1, sceneName=1 )
     sceneFolder = '/'.join( sceneName.split( '/' )[:-1+upFolderNum] )
     keyExportPath = sceneFolder + addPath
     
     cmds.textField( WinA_Global.exportKeyPath_txf, e=1, tx=keyExportPath )
     cmds.textField( WinA_Global.exportCachePath_txf, e=1, tx=cacheExportPath )
     
     try:
         f = open( WinA_Global.infoPath, 'r' )
         data = cPickle.load( f )
         f.close()
         
         cacheTypeIndex = data[0]
         exportByMatrix = data[1]
         
         cmds.optionMenu( WinA_Global.optionMenu, e=1, sl=cacheTypeIndex )
         cmds.checkBox( WinA_Global.chk_exportByMatrix , e=1, v=exportByMatrix )
     except: return None
 def read_windowInfo():
     
     import cPickle
     import sgBFunction_fileAndPath
     
     if not os.path.exists( WinA_Global.uiInfo ):
         sgBFunction_fileAndPath.makeFile( WinA_Global.uiInfo, False )
         sgBFunction_fileAndPath.makeFile( WinA_Global.pathInfo, False )
     try:
         f = open( WinA_Global.uiInfo, 'r' )
         data = cPickle.load( f )
         f.close()
         
         exportPath, exportType, searchFor, searchForType, splitStringAndSerchCheck, splitStringAndSearchString = data
     except:
         sgBFunction_fileAndPath.makeFile( WinA_Global.uiInfo, False )
     
         exportPath = ''
         exportType = 'Export By Selection'
         searchFor  = ''
         searchForType = 'Ani position'
         splitStringAndSerchCheck = False
         splitStringAndSearchString = ''
     
     import sgBModel_aniScene
     
     upFolderNum, addPath = sgBModel_aniScene.exportMeshPathFromAni
     sceneName = cmds.file( q=1, sceneName=1 )
     sceneFolder = '/'.join( sceneName.split( '/' )[:-1+upFolderNum] )
     exportPath = sceneFolder + addPath
     
     cmds.textField( WinA_Global.exportPath_txf, e=1, tx= exportPath )
     cmds.textField( WinA_Global.searchFor_txf, e=1, tx=searchFor )
     cmds.checkBox( WinA_Global.searchForType_check, e=1, v=splitStringAndSerchCheck )
     cmds.textField( WinA_Global.searchForType_txf, e=1, tx=splitStringAndSearchString )
Пример #22
0
def export_transformsBake(targets, fileName=None):

    import sgBFunction_fileAndPath
    import sgBFunction_dag
    import cPickle

    if not fileName:
        scenePath = cmds.file(q=1, sceneName=1)
        if scenePath:
            sceneFolder = '/'.join(scenePath.split('/')[:-1])
            fileName = sceneFolder + '/transformsBake/bakeFile.txt'
        else:
            fileName = sgBFunction_fileAndPath.getMayaDocPath(
            ) + '/transformsBake/bakeFile.txt'
    defaultExportTransformBakePath = sgBFunction_fileAndPath.getMayaDocPath(
    ) + '/defaultExportTransformsBake.txt'

    exTargets = []
    for target in targets:
        if cmds.nodeType(target) != 'transform': continue
        cloneH = sgBFunction_dag.getParents(target)
        cloneH.append(cmds.ls(target, l=1)[0])
        exTargets += cloneH

    exTargets = list(set(exTargets))
    exTargets.sort()
    exTargetMtxs = [[] for i in range(len(exTargets))]

    minFrame = cmds.playbackOptions(q=1, min=1)
    maxFrame = cmds.playbackOptions(q=1, max=1)
    unit = cmds.currentUnit(q=1, time=1)

    for t in range(int(minFrame), int(maxFrame + 1)):
        cmds.currentTime(t)
        for i in range(len(exTargets)):
            exTargetMtx = cmds.getAttr(exTargets[i] + '.m')
            exTargetMtxs[i].append(exTargetMtx)

    fileName = sgBFunction_fileAndPath.makeFile(fileName)
    f = open(fileName, 'w')
    datas = [unit, minFrame, maxFrame]
    for i in range(len(exTargets)):
        extargetName = exTargets[i].replace(':', '_')
        datas.append([extargetName, exTargetMtxs[i]])
    cPickle.dump(datas, f)
    f.close()

    f = open(defaultExportTransformBakePath, 'w')
    cPickle.dump(fileName, f)
    f.close()

    print "Export Path : ", fileName
 def loadInfo( *args ):
     import cPickle
     import sgBFunction_fileAndPath
     
     sgBFunction_fileAndPath.makeFile( WinA_Global.uiInfo, False )
     
     importPath = ''
     importByMatrix = 0
     
     try:
         f = open( WinA_Global.uiInfo, 'r' )
         importPath, importByMatrix = cPickle.load( f )
         f.close()
     except:pass
     try:
         f = open( WinA_Global.pathInfo, 'r' )
         importPath = cPickle.load( f )
         f.close()
     except: pass
     
     cmds.textField( WinA_Global.importPath_txf, e=1, tx= importPath )
     cmds.checkBox( WinA_Global.checkBox, e=1, v=importByMatrix )
 def write_windowInfo():
     
     exportPath = cmds.textField( WinA_Global.exportPath_txf, q=1, tx=1 )
     exportType = WinA_Cmd.getExportType()
     searchFor = cmds.textField( WinA_Global.searchFor_txf, q=1, tx=1 )
     searchForType = WinA_Cmd.getSearchForType()
     splitStringAndSearchCheck = cmds.checkBox( WinA_Global.searchForType_check, q=1, v=1 )
     splitStringAndSearchString = cmds.textField( WinA_Global.searchForType_txf, q=1, tx=1 )
     
     data = [ exportPath, exportType, searchFor, searchForType, splitStringAndSearchCheck, splitStringAndSearchString ]
     
     import cPickle
     import sgBFunction_fileAndPath
     sgBFunction_fileAndPath.makeFile( WinA_Global.pathInfo, False )
     
     f = open( WinA_Global.uiInfo, 'w' )
     cPickle.dump( data, f )
     f.close()
     
     f = open( WinA_Global.pathInfo, 'w' )
     cPickle.dump( exportPath, f )
     f.close()
Пример #25
0
    def read_windowInfo():

        import cPickle
        import sgBFunction_fileAndPath

        if not os.path.exists(WinA_Global.infoPath):
            sgBFunction_fileAndPath.makeFile(WinA_Global.infoPath)

        try:
            f = open(WinA_Global.infoPath, 'r')
            data = cPickle.load(f)
            f.close()
        except:
            return None

        if not data: return None

        try:
            exportPath, exportType, searchFor, searchForType, splitStringAndSerchCheck, splitStringAndSearchString, cacheType, pointsSpace = data
        except:
            return None

        cmds.textField(WinA_Global.exportPath_txf, e=1, tx=exportPath)
        items = cmds.radioCollection(WinA_Global.exportType_radio, q=1, cia=1)
        cmds.radioButton(items[exportType], e=1, sl=1)
        cmds.textField(WinA_Global.searchFor_txf, e=1, tx=searchFor)
        items = cmds.radioCollection(WinA_Global.searchForType_radio,
                                     q=1,
                                     cia=1)
        cmds.radioButton(items[searchForType], e=1, sl=1)
        cmds.checkBox(WinA_Global.searchForType_check,
                      e=1,
                      v=splitStringAndSerchCheck)
        cmds.textField(WinA_Global.searchForType_txf,
                       e=1,
                       tx=splitStringAndSearchString)
        cmds.optionMenu(WinA_Global.om_cacheType, e=1, sl=cacheType)
        cmds.optionMenu(WinA_Global.om_pointsSpace, e=1, sl=pointsSpace)
Пример #26
0
def export_transformsBake( targets, fileName=None ):
    
    import sgBFunction_fileAndPath
    import sgBFunction_dag
    import cPickle

    if not fileName:
        scenePath = cmds.file( q=1, sceneName=1 )
        if scenePath:
            sceneFolder = '/'.join( scenePath.split( '/' )[:-1] )
            fileName = sceneFolder + '/transformsBake/bakeFile.txt'
        else:
            fileName = sgBFunction_fileAndPath.getMayaDocPath()+ '/transformsBake/bakeFile.txt'
    defaultExportTransformBakePath = sgBFunction_fileAndPath.getMayaDocPath() + '/defaultExportTransformsBake.txt'
    
    exTargets = []
    for target in targets:
        if cmds.nodeType( target ) != 'transform': continue
        cloneH = sgBFunction_dag.getParents( target )
        cloneH.append( cmds.ls( target, l=1 )[0] )
        exTargets += cloneH

    exTargets = list( set( exTargets ) )
    exTargets.sort()
    exTargetMtxs = [ [] for i in range( len( exTargets ) ) ]
    
    minFrame = cmds.playbackOptions( q=1, min=1 )
    maxFrame = cmds.playbackOptions( q=1, max=1 )
    unit     = cmds.currentUnit( q=1, time=1 )
    
    for t in range( int( minFrame ), int( maxFrame+1 ) ):
        cmds.currentTime( t )
        for i in range( len( exTargets ) ):
            exTargetMtx = cmds.getAttr( exTargets[i] + '.m' )
            exTargetMtxs[i].append( exTargetMtx )
    
    fileName = sgBFunction_fileAndPath.makeFile( fileName )
    f = open( fileName, 'w' )
    datas = [ unit, minFrame, maxFrame ]
    for i in range( len( exTargets ) ):
        extargetName = exTargets[i].replace( ':', '_' )
        datas.append( [ extargetName, exTargetMtxs[i] ] )
    cPickle.dump( datas, f )
    f.close()
    
    f = open( defaultExportTransformBakePath, 'w' )
    cPickle.dump( fileName, f )
    f.close()
    
    print "Export Path : ", fileName
 def write_windowInfo():
     
     exportPath = cmds.textField( WinA_Global.exportPath_txf, q=1, tx=1 )
     exportType = WinA_Cmd.getExportType()
     searchFor = cmds.textField( WinA_Global.searchFor_txf, q=1, tx=1 )
     searchForType = WinA_Cmd.getSearchForType()
     splitStringAndSearchCheck = cmds.checkBox( WinA_Global.searchForType_check, q=1, v=1 )
     splitStringAndSearchString = cmds.textField( WinA_Global.searchForType_txf, q=1, tx=1 )
     cacheType   = cmds.optionMenu( WinA_Global.om_cacheType, q=1, sl=1 )
     pointsSpace = cmds.optionMenu( WinA_Global.om_pointsSpace, q=1, sl=1 )
     
     data = [ exportPath, exportType, searchFor, searchForType, splitStringAndSearchCheck, splitStringAndSearchString, cacheType, pointsSpace ]
     
     import cPickle
     import sgBFunction_fileAndPath
     sgBFunction_fileAndPath.makeFolder( WinA_Global.infoFolderPath )
     sgBFunction_fileAndPath.makeFile( WinA_Global.infoPathPath, False )
     f = open( WinA_Global.infoPath, 'w' )
     cPickle.dump( data, f )
     f.close()
     
     f = open( WinA_Global.infoPathPath, 'w' )
     cPickle.dump( exportPath, f )
     f.close()
Пример #28
0
    def loadInfo(*args):
        import cPickle
        import sgBFunction_fileAndPath

        sgBFunction_fileAndPath.makeFile(WinA_Global.uiInfo, False)

        importPath = ''
        importByMatrix = 0

        try:
            f = open(WinA_Global.uiInfo, 'r')
            importPath, importByMatrix = cPickle.load(f)
            f.close()
        except:
            pass
        try:
            f = open(WinA_Global.pathInfo, 'r')
            importPath = cPickle.load(f)
            f.close()
        except:
            pass

        cmds.textField(WinA_Global.importPath_txf, e=1, tx=importPath)
        cmds.checkBox(WinA_Global.checkBox, e=1, v=importByMatrix)
    def read_windowInfo():

        import cPickle
        import sgBFunction_fileAndPath

        sgBFunction_fileAndPath.makeFile(WinA_Global.keyExportInfoFile, False)
        sgBFunction_fileAndPath.makeFile(WinA_Global.cacheExportInfoFile,
                                         False)
        sgBFunction_fileAndPath.makeFile(WinA_Global.infoPath, False)

        try:
            f = open(WinA_Global.keyExportInfoFile, 'r')
            keyExportInfoPath = cPickle.load(f)
            f.close()

            cmds.textField(WinA_Global.exportKeyPath_txf,
                           e=1,
                           tx=keyExportInfoPath)
        except:
            pass

        try:
            f = open(WinA_Global.cacheExportInfoFile, 'r')
            cacheExportInfoPath = cPickle.load(f)
            f.close()

            cmds.textField(WinA_Global.exportCachePath_txf,
                           e=1,
                           tx=cacheExportInfoPath)
        except:
            pass

        try:
            f = open(WinA_Global.infoPath, 'r')
            data = cPickle.load(f)
            f.close()

            cacheTypeIndex = data[0]
            exportByMatrix = data[1]

            cmds.optionMenu(WinA_Global.optionMenu, e=1, sl=cacheTypeIndex)
            cmds.checkBox(WinA_Global.chk_exportByMatrix,
                          e=1,
                          v=exportByMatrix)
        except:
            return None
    def read_windowInfo():

        import cPickle
        import sgBFunction_fileAndPath

        sgBFunction_fileAndPath.makeFile(WinA_Global.keyExportInfoFile, False)
        sgBFunction_fileAndPath.makeFile(WinA_Global.cacheExportInfoFile,
                                         False)
        sgBFunction_fileAndPath.makeFile(WinA_Global.infoPath, False)

        import sgBModel_aniScene

        upFolderNum, addPath = sgBModel_aniScene.exportCachePathFromAni
        sceneName = cmds.file(q=1, sceneName=1)
        sceneFolder = '/'.join(sceneName.split('/')[:-1 + upFolderNum])
        cacheExportPath = sceneFolder + addPath

        upFolderNum, addPath = sgBModel_aniScene.exportKeyPathFromAni
        sceneName = cmds.file(q=1, sceneName=1)
        sceneFolder = '/'.join(sceneName.split('/')[:-1 + upFolderNum])
        keyExportPath = sceneFolder + addPath

        cmds.textField(WinA_Global.exportKeyPath_txf, e=1, tx=keyExportPath)
        cmds.textField(WinA_Global.exportCachePath_txf,
                       e=1,
                       tx=cacheExportPath)

        try:
            f = open(WinA_Global.infoPath, 'r')
            data = cPickle.load(f)
            f.close()

            cacheTypeIndex = data[0]
            exportByMatrix = data[1]

            cmds.optionMenu(WinA_Global.optionMenu, e=1, sl=cacheTypeIndex)
            cmds.checkBox(WinA_Global.chk_exportByMatrix,
                          e=1,
                          v=exportByMatrix)
        except:
            return None
 def read_windowInfo():
     
     import cPickle
     import sgBFunction_fileAndPath
     
     sgBFunction_fileAndPath.makeFile( WinA_Global.keyExportInfoFile, False )
     sgBFunction_fileAndPath.makeFile( WinA_Global.cacheExportInfoFile, False )
     sgBFunction_fileAndPath.makeFile( WinA_Global.infoPath, False )
     
     try:
         f = open( WinA_Global.keyExportInfoFile, 'r' )
         keyExportInfoPath = cPickle.load( f )
         f.close()
         
         cmds.textField( WinA_Global.exportKeyPath_txf, e=1, tx=keyExportInfoPath )
     except:pass
     
     try:
         f = open( WinA_Global.cacheExportInfoFile, 'r' )
         cacheExportInfoPath = cPickle.load( f )
         f.close()
         
         cmds.textField( WinA_Global.exportCachePath_txf, e=1, tx=cacheExportInfoPath )
     except:pass
     
     try:
         f = open( WinA_Global.infoPath, 'r' )
         data = cPickle.load( f )
         f.close()
         
         cacheTypeIndex = data[0]
         exportByMatrix = data[1]
         
         cmds.optionMenu( WinA_Global.optionMenu, e=1, sl=cacheTypeIndex )
         cmds.checkBox( WinA_Global.chk_exportByMatrix , e=1, v=exportByMatrix )
     except: return None
Пример #32
0
import maya.cmds as cmds
import sgModelUI
import cPickle, shutil

import sgBFunction_fileAndPath
        
settingInfoPath = sgBFunction_fileAndPath.getLocusCommPackagePrefsPath() + "/reloadPluginInfo.txt"
tempPluginTestPath = sgBFunction_fileAndPath.getDefaultScenePath()
sgBFunction_fileAndPath.makeFile( settingInfoPath, False )
sgBFunction_fileAndPath.makeFile( tempPluginTestPath, False )


class TwoTextFiels:
    
    def __init__(self, firstString, secondString, w=120, h=22 ):
        
        self.firstString = firstString
        self.secondString = secondString
        self.width = w
        self.height = h
    
    
    def create(self):
        
        form = cmds.formLayout()
        
        txt_first  = cmds.text( l=self.firstString, al='right', w= self.width, h=self.height )
        txt_second = cmds.text( l=self.secondString, al='right', w= self.width, h=self.height )
        fld_first  = cmds.textField( h=self.height )
        fld_second = cmds.textField( h=self.height )
        
Пример #33
0
import maya.cmds as cmds
import sgModelUI
import cPickle, shutil

import sgBFunction_fileAndPath

settingInfoPath = sgBFunction_fileAndPath.getLocusCommPackagePrefsPath(
) + "/reloadPluginInfo.txt"
tempPluginTestPath = sgBFunction_fileAndPath.getDefaultScenePath()
sgBFunction_fileAndPath.makeFile(settingInfoPath, False)
sgBFunction_fileAndPath.makeFile(tempPluginTestPath, False)


class TwoTextFiels:
    def __init__(self, firstString, secondString, w=120, h=22):

        self.firstString = firstString
        self.secondString = secondString
        self.width = w
        self.height = h

    def create(self):

        form = cmds.formLayout()

        txt_first = cmds.text(l=self.firstString,
                              al='right',
                              w=self.width,
                              h=self.height)
        txt_second = cmds.text(l=self.secondString,
                               al='right',