コード例 #1
0
def main():
    logger.info('Running asmShotExportCmd.py in batch mode ...')
    scenePath = sys.argv[1]
    logger.debug('Input argv[1], scenePath %s' % scenePath)
    # scenePath = 'P:/Lego_Pipeline/asset/3D/set/town/lpl_lab/setDress/dress/scenes/lpl_lab_dress_v025_TA.ma'

    logger.debug('Loading pipeline module ...')
    from tool.utils import entityInfo, fileUtils
    from tool.sceneAssembly import asm_utils as asmUtils
    from tool.setDress.utils import sd_utils
    reload(asmUtils)
    reload(sd_utils)
    reload(entityInfo)
    logger.debug('Loaded')

    mc.file(scenePath, f=True, ignoreVersion=True, o=True)

    logger.debug('setting all active representation ...')
    adRoots = sd_utils.findAssemblyRoot()
    for adRoot in adRoots:
        asmUtils.setAllActiveRep(adRoot)
    logger.debug('set complete')

    logger.info('Exporting abc locator')
    sd_utils.exportShotAsmLocator()
    logger.debug('Export abc locator finish')
コード例 #2
0
    def createAsmLocator(self, bake=False):
        # find root
        adRoots = findAssemblyRoot()
        currentTime = mc.currentTime(q=True)
        start = currentTime
        end = currentTime + 1
        roots = []

        if adRoots:
            for adRoot in adRoots:
                ad = adRoot
                self.assetRoot = ad
                asm_utils.setAllActiveRep(ad)
                # cleanNamespace(ad)
                root = self.createAsmLocatorCmd(ad)
                childs = [
                    a for a in mc.listRelatives(root, ad=True, f=True)
                    if mc.objectType(a, isType='transform')
                ]

                if bake:
                    start = mc.playbackOptions(q=True, min=True)
                    end = mc.playbackOptions(q=True, max=True)

                logger.info('------ bake animation --------')
                logger.info('%s-%s' % (start, end))
                bakeAnimation(childs, start, end)
                roots.append(root)
                removeConstraint(root)

            # mc.delete(tmpConstraint)

            return roots
コード例 #3
0
def createLocAbc():

    scenePath = sys.argv[1]
    assetPath = sys.argv[2]
    assetName = sys.argv[3]
    # openFile = sys.argv[4]

    from tool.utils import pipelineTools, fileUtils
    from tool.sceneAssembly import asm_utils as asmUtils

    reload(pipelineTools)
    reload(asmUtils)

    mc.file(f=True, new=True)

    adName = assetName + '_AD'
    adPath = assetPath + '/ref/' + adName + '.ma'
    locPath = adPath.replace('_AD.ma', '_Loc.abc')

    arName = asmUtils.createARNode(adName)
    asmUtils.setARDefinitionPath(arName, adPath)
    asmUtils.setARNamespace(arName, adName)
    # asmUtils.setActiveRep(arName,'AR')
    asmUtils.setAllActiveRep(arName)

    locAD = os.path.split(scenePath)[0] + '/_buildLoc.ma'

    mc.file(rename=locAD)

    pipelineTools.doExportAssetAssemblyLocator(locPath)

    mc.file(f=True, save=True)
コード例 #4
0
    def paste(self):
        path = str(self.ui.pathLineEdit.text())
        item = self.ui.copyListWidget.currentItem()
        name = str(item.text())
        ars = []

        logPath = '%s/%s' % (path, name)

        if os.path.exists(logPath):
            log = fileUtils.ymlLoader(logPath)

            for ar in log.keys():
                adName = log[ar]['definition'].split('/')[-1].split('_AD')[0]
                if mc.objExists('%s*' % (adName)):
                    num = len(mc.ls('%s*' % (adName))) + 1
                else:
                    num = 1

                arName = asmUtils.createARNode('%s%d_AD_AR' % (adName, num))
                asmUtils.setARDefinitionPath(arName, log[ar]['definition'])

                mc.setAttr('%s.t' % arName, log[ar]['t'][0], log[ar]['t'][1],
                           log[ar]['t'][2])
                mc.setAttr('%s.r' % arName, log[ar]['r'][0], log[ar]['r'][1],
                           log[ar]['r'][2])
                mc.setAttr('%s.s' % arName, log[ar]['s'][0], log[ar]['s'][1],
                           log[ar]['s'][2])

                if log[ar]['type'] == 'parent':
                    asmUtils.setActiveRep(arName, 'AR')
                    gpuList = mc.listRelatives(arName, children=True)

                    for child in log[ar]['child'].keys():
                        mc.setAttr(
                            '%s_NS:%s.t' % (arName, child.split(':')[-1]),
                            log[ar]['child'][child]['t'][0],
                            log[ar]['child'][child]['t'][1],
                            log[ar]['child'][child]['t'][2])
                        mc.setAttr(
                            '%s_NS:%s.r' % (arName, child.split(':')[-1]),
                            log[ar]['child'][child]['r'][0],
                            log[ar]['child'][child]['r'][1],
                            log[ar]['child'][child]['r'][2])
                        mc.setAttr(
                            '%s_NS:%s.s' % (arName, child.split(':')[-1]),
                            log[ar]['child'][child]['s'][0],
                            log[ar]['child'][child]['s'][1],
                            log[ar]['child'][child]['s'][2])

                asmUtils.setAllActiveRep(arName)
                ars.append(arName)

            mc.select(ars)

        if self.ui.delAfterCheckBox.isChecked():
            os.remove(logPath)
コード例 #5
0
def main():
    logger.info('Running asmAssetExportCmd.py in batch mode ...')
    scenePath = sys.argv[1]
    logger.debug('Input argv[1], scenePath %s' % scenePath)
    # scenePath = 'P:/Lego_Pipeline/asset/3D/set/town/lpl_lab/setDress/dress/scenes/lpl_lab_dress_v025_TA.ma'

    logger.debug('Loading pipeline module ...')
    from tool.utils import entityInfo, fileUtils
    from tool.sceneAssembly import asm_utils as asmUtils
    from tool.setDress.utils import sd_utils
    reload(asmUtils)
    reload(sd_utils)
    reload(entityInfo)
    logger.debug('Loaded')

    asset = entityInfo.info(scenePath)

    mc.file(f=True, new=True)
    logger.debug('Start new scene')

    adName = '%s_AR' % asset.getRefNaming('ad', showExt=False)
    adNamespace = asset.getRefNaming('ad', showExt=False)
    adPath = '%s/%s' % (asset.getPath('ref'), asset.getRefNaming('ad'))
    locPath = '%s/%s' % (asset.getPath('ref'), asset.getRefNaming('loc'))
    publishDir = '%s/%s' % (asset.getPath('setDress'), 'publish')
    fileName = asset.fileName()
    publishMaya = '%s/%s.ma' % (publishDir, fileName)
    publishLoc = '%s/%s.abc' % (publishDir, fileName)

    if not os.path.exists(publishDir):
        os.makedirs(publishDir)
        logger.debug('%s created' % publishDir)

    logger.debug('adName : %s' % adName)
    logger.debug('adPath : %s' % adPath)
    logger.debug('adNamespace : %s' % adNamespace)

    logger.debug('creating ARNode %s ...' % adName)
    arName = asmUtils.createARNode(adName)

    logger.debug('setting ad path %s %s ...' % (arName, adPath))
    asmUtils.setARDefinitionPath(arName, adPath)

    logger.debug('setting namespace %s ...' % adNamespace)
    asmUtils.setARNamespace(arName, adNamespace)

    logger.debug('setting all active representation ...')
    asmUtils.setAllActiveRep(arName)
    logger.debug('set complete')

    mc.file(rename=publishMaya)
    logger.debug('rename scene to %s' % publishMaya)

    result = mc.file(f=True, save=True, type='mayaAscii')
    logger.debug('Virtual AR scene saved %s' % result)

    logger.info('Exporting abc locator %s ...' % locPath)
    sd_utils.exportAsmLocator(locPath, bake=False, version=scenePath)
    logger.debug('Export abc locator finish')

    logger.info('Copying abc hero ...')
    fileUtils.copy(locPath, publishLoc)
    logger.debug('Copy success %s' % publishLoc)