Exemplo n.º 1
0
    def publishFile(self, *args):
        # get database info on item
        item = Item(task=self.task, code=self.code, itemType=self.type)
        item.proxyMode = self.proxyMode
        item.publishAs()
        version.takeSnapShot(item.getDataDict())
        self.closeWin()

        logger.debug('publish ver %s, at %s' %
                     (item.publishVer, item.getPublishPath()))
        resp = pm.confirmDialog(
            title='Warning',
            ma='center',
            message='PUBLISH: %s %s \n Reopen working task?' %
            (item.name, item.task),
            button=['Ok', 'No'],
            defaultButton='Ok',
            dismissString='No')

        if resp == 'Ok':
            version.open(type=item.type,
                         task=item.task,
                         code=item.code,
                         force=True)
        else:
            pm.newFile(f=True, new=True)
Exemplo n.º 2
0
def ingestGroups(pathSrc, pathTgt):
    groupPath = r'wolftv\asset\group'
    proxyModelPath = r'modeling\proxy_model\desc'

    groupsFullPath = os.path.join(pathSrc, groupPath)
    logger.debug('groupFullPath: %s' % groupsFullPath)
    fileList = pm.getFileList(folder=groupsFullPath)

    progressWin = ProgressWindowWidget(title='groups', maxValue=len(fileList))

    for group in fileList:
        logger.info('importing %s to pipeLine' % group)
        progressWin.progressUpdate(1)

        fileName = group
        versionPath = os.path.join(groupsFullPath, fileName, proxyModelPath)
        versionsAvailable = pm.getFileList(folder=versionPath)
        maxVer = 0
        for ver in versionsAvailable:
            verNum = int(ver[1:])
            maxVer = max(maxVer, verNum)
            version = 'v%03d' % maxVer

        groupFullPath = os.path.join(versionPath, version)
        groupFile = pm.getFileList(folder=groupFullPath)[0]
        groupFullPath = os.path.join(groupFullPath, groupFile)

        ingestionDict = {
            'name': fileName,
            'version': maxVer,
            'sourcePath': groupFullPath,
            'assetType': 'group',
            'task': 'proxy',
            'setAssemble': os.path.split(pathSrc)[-1]
        }

        database.incrementNextCode('asset', fromBegining=True)
        itemMData = database.createItem(
            itemType='asset',
            name=fileName,
            path=pathTgt,
            workflow='group',
            customData={'ingestData': ingestionDict})
        itemProxy = Item(task='proxy', code=itemMData['proxy']['code'])
        itemModel = Item(task='model', code=itemMData['model']['code'])

        descDict = readDescription(groupFullPath,
                                   1,
                                   maxDepth=0,
                                   searchInGroupAsset=True)
        for component in descDict:
            logger.debug('add %s to %s' % (component['name'], fileName))
            itemList = database.searchName(component['name'])
            if 0 < len(itemList) > 1:
                proxyComponentMData = database.addSource(
                    item=itemProxy.getDataDict(),
                    ns='ref',
                    componentCode=itemList[0]['code'],
                    componentTask='proxy',
                    assembleMode='reference',
                    update=True,
                    proxyMode='proxy',
                    xform=component['xform'],
                    onSceneParent='')

                modelComponentMData = database.addSource(
                    item=itemModel.getDataDict(),
                    ns='ref',
                    componentCode=itemList[0]['code'],
                    componentTask='proxy',
                    assembleMode='reference',
                    update=True,
                    proxyMode='model',
                    xform=component['xform'],
                    onSceneParent='')
    progressWin.closeWindow()