示例#1
0
 def publishAsset(iAObj=None):
     assetHandler = FTAssetHandlerInstance.instance()
     pubAsset = assetHandler.getAssetClass(iAObj.assetType)
     if pubAsset:
         publishedComponents, message = pubAsset.publishAsset(iAObj)
         return publishedComponents, message
     else:
         return [], 'assetType not supported'
示例#2
0
def registerAssetTypes():
    assetHandler = FTAssetHandlerInstance.instance()
    assetHandler.registerAssetType(name='cam', cls=CameraAsset)
    assetHandler.registerAssetType(name='lgt', cls=LightRigAsset)
    assetHandler.registerAssetType(name='rig', cls=RigAsset)
    assetHandler.registerAssetType(name='audio', cls=AudioAsset)
    assetHandler.registerAssetType(name='geo', cls=GeometryAsset)
    assetHandler.registerAssetType(name='scene', cls=SceneAsset)
示例#3
0
 def changeVersion(applicationObject=None, iAObj=None):
     assetHandler = FTAssetHandlerInstance.instance()
     changeAsset = assetHandler.getAssetClass(iAObj.assetType)
     if changeAsset:
         result = changeAsset.changeVersion(iAObj, applicationObject)
         return result
     else:
         print 'assetType not supported'
         return False
示例#4
0
 def publishAsset(iAObj=None):
     assetHandler = FTAssetHandlerInstance.instance()
     pubAsset = assetHandler.getAssetClass(iAObj.assetType)
     if pubAsset:
         publishedComponents, message = pubAsset.publishAsset(iAObj)
         #result = pubAsset.changeVersion(iAObj, applicationObject)
         return publishedComponents, message
     else:
         return [], 'assetType not supported'
def registerAssetTypes():
    assetHandler = FTAssetHandlerInstance.instance()
    assetHandler.registerAssetType(name='cam', cls=CameraAsset)
    assetHandler.registerAssetType(name='img', cls=ImageSequenceAsset)
    assetHandler.registerAssetType(name='geo', cls=GeometryAsset)
    assetHandler.registerAssetType(name='render', cls=RenderAsset)

    # new mill asset types
    assetHandler.registerAssetType(name='nuke_gizmo', cls=GizmoAsset)
    assetHandler.registerAssetType(name='comp', cls=NukeSceneAsset)
    def __init__(self, parent, task=None, connector=None):
        '''Instansiate widget with *connector*.'''
        if not connector:
            raise ValueError(
                'Please provide a connector object for %s'.format(
                    self.__class__.__name__
                )
            )

        super(ImportOptionsWidget, self).__init__(parent)
        self.ui = Ui_ImportOptions()
        self.ui.setupUi(self)

        self.stackedOptionsWidget = StackedOptionsWidget(
            self, connector=connector
        )

        xml = """<?xml version="1.0" encoding="UTF-8" ?>
            <options>
                <assettype name="default">
                    <tab name="Options">
                        <row name="Import mode" accepts="maya">
                            <option type="radio" name="importMode">
                                <optionitem name="Reference" value="True"/>
                                <optionitem name="Import"/>
                            </option>
                        </row>
                        <row name="Preserve References" accepts="maya">
                            <option type="checkbox" name="mayaReference" value="True"/>
                        </row>
                        <row name="Add Asset Namespace" accepts="maya">
                            <option type="checkbox" name="mayaNamespace" value="False"/>
                        </row>
                    </tab>
                </assettype>
                {0}
            </options>
        """

        xmlExtraAssetTypes = ""
        assetHandler = FTAssetHandlerInstance.instance()
        assetTypesStr = sorted(assetHandler.getAssetTypes())
        for assetTypeStr in assetTypesStr:
            assetClass = assetHandler.getAssetClass(assetTypeStr)
            if hasattr(assetClass, 'importOptions'):
                xmlExtraAssetTypes += '<assettype name="' + assetTypeStr + '">'
                xmlExtraAssetTypes += assetClass.importOptions()
                xmlExtraAssetTypes += '</assettype>'

        xml = xml.format(xmlExtraAssetTypes)

        self.stackedOptionsWidget.initStackedOptions(xml)
        self.ui.optionsPlaceHolderLayout.addWidget(self.stackedOptionsWidget)
示例#7
0
 def importAsset(iAObj):
     iAObj.assetName = "%s_%s_AST" % (iAObj.assetType.upper(),
                                      iAObj.assetName)
     # Check if this AssetName already exists in scene
     # Need to Done!
     assetHandler = FTAssetHandlerInstance.instance()
     importAsset = assetHandler.getAssetClass(iAObj.assetType)
     if importAsset:
         result = importAsset.importAsset(iAObj)
         return result
     else:
         return 'assetType not supported'
示例#8
0
    def importAsset(iAObj):
        # Check if this AssetName already exists in scene
        iAObj.assetName = Connector.getUniqueSceneName(iAObj.assetName)

        assetHandler = FTAssetHandlerInstance.instance()
        importAsset = assetHandler.getAssetClass(iAObj.assetType)

        if importAsset:
            result = importAsset.importAsset(iAObj)
            return result
        else:
            return 'assetType not supported'
    def __init__(self, parent, browseMode='Shot'):
        QtGui.QWidget.__init__(self, parent)
        self.ui = Ui_ExportAssetOptions()
        self.ui.setupUi(self)
        self.currentAssetType = None
        self.currentTask = None
        self.browseMode = browseMode
        self.ui.ListAssetsViewModel = QtGui.QStandardItemModel()

        self.ui.ListAssetsSortModel = QtGui.QSortFilterProxyModel()

        self.ui.ListAssetsSortModel.setDynamicSortFilter(True)
        self.ui.ListAssetsSortModel.setFilterKeyColumn(1)
        self.ui.ListAssetsSortModel.setSourceModel(self.ui.ListAssetsViewModel)

        self.ui.ListAssetNamesComboBox.setModel(self.ui.ListAssetsSortModel)

        self.ui.ListAssetsComboBoxModel = QtGui.QStandardItemModel()

        assetTypeItem = QtGui.QStandardItem('Select AssetType')
        self.assetTypes = []
        self.assetTypes.append('')
        self.ui.ListAssetsComboBoxModel.appendRow(assetTypeItem)

        assetHandler = FTAssetHandlerInstance.instance()
        self.assetTypesStr = sorted(assetHandler.getAssetTypes())

        for assetTypeStr in self.assetTypesStr:
            try:
                assetType = ftrack.AssetType(assetTypeStr)
            except:
                log.warning(
                    '{0} not available in ftrack'.format(assetTypeStr)
                )
                continue
            assetTypeItem = QtGui.QStandardItem(assetType.getName())
            assetTypeItem.type = assetType.getShort()
            self.assetTypes.append(assetTypeItem.type)
            self.ui.ListAssetsComboBoxModel.appendRow(assetTypeItem)

        self.ui.ListAssetsComboBox.setModel(self.ui.ListAssetsComboBoxModel)

        self.ui.AssetTaskComboBoxModel = QtGui.QStandardItemModel()
        self.ui.AssetTaskComboBox.setModel(self.ui.AssetTaskComboBoxModel)

        self.ui.ListAssetNamesComboBox.currentIndexChanged[str].connect(
            self.onAssetChanged
        )

        if browseMode == 'Task':
            self.ui.AssetTaskComboBox.hide()
            self.ui.assetTaskLabel.hide()
示例#10
0
    def __init__(self, parent, browseMode='Shot'):
        QtWidgets.QWidget.__init__(self, parent)
        self.ui = Ui_ExportAssetOptions()
        self.ui.setupUi(self)
        self.currentAssetType = None
        self.currentTask = None
        self.browseMode = browseMode
        self.ui.ListAssetsViewModel = QtGui.QStandardItemModel()

        self.ui.ListAssetsSortModel = QtCore.QSortFilterProxyModel()

        self.ui.ListAssetsSortModel.setDynamicSortFilter(True)
        self.ui.ListAssetsSortModel.setFilterKeyColumn(1)
        self.ui.ListAssetsSortModel.setSourceModel(self.ui.ListAssetsViewModel)

        self.ui.ListAssetNamesComboBox.setModel(self.ui.ListAssetsSortModel)

        self.ui.ListAssetsComboBoxModel = QtGui.QStandardItemModel()

        assetTypeItem = QtGui.QStandardItem('Select AssetType')
        self.assetTypes = []
        self.assetTypes.append('')
        self.ui.ListAssetsComboBoxModel.appendRow(assetTypeItem)

        assetHandler = FTAssetHandlerInstance.instance()
        self.assetTypesStr = sorted(assetHandler.getAssetTypes())

        for assetTypeStr in self.assetTypesStr:
            try:
                assetType = ftrack.AssetType(assetTypeStr)
            except:
                log.warning('{0} not available in ftrack'.format(assetTypeStr))
                continue
            assetTypeItem = QtGui.QStandardItem(assetType.getName())
            assetTypeItem.type = assetType.getShort()
            self.assetTypes.append(assetTypeItem.type)
            self.ui.ListAssetsComboBoxModel.appendRow(assetTypeItem)

        self.ui.ListAssetsComboBox.setModel(self.ui.ListAssetsComboBoxModel)

        self.ui.AssetTaskComboBoxModel = QtGui.QStandardItemModel()
        self.ui.AssetTaskComboBox.setModel(self.ui.AssetTaskComboBoxModel)

        self.ui.ListAssetNamesComboBox.currentIndexChanged[str].connect(
            self.onAssetChanged)

        if browseMode == 'Task':
            self.ui.AssetTaskComboBox.hide()
            self.ui.assetTaskLabel.hide()
示例#11
0
    def importAsset(iAObj):
        '''Import the asset provided by *iAObj*'''
        iAObj.assetName = '_'.join(
            [iAObj.assetType.upper(), iAObj.assetName, 'AST'])
        # Maya converts - to _ so let's do that as well
        iAObj.assetName = iAObj.assetName.replace('-', '_')

        # Check if this AssetName already exists in scene
        iAObj.assetName = Connector.getUniqueSceneName(iAObj.assetName)

        assetHandler = FTAssetHandlerInstance.instance()
        importAsset = assetHandler.getAssetClass(iAObj.assetType)
        if importAsset:
            result = importAsset.importAsset(iAObj)
            return result
        else:
            return 'assetType not supported'
    def importAsset(iAObj):
        '''Import the asset provided by *iAObj*'''
        iAObj.assetName = "_".join(
            [iAObj.assetType.upper(), iAObj.assetName, "AST"]
        )
        # Maya converts - to _ so let's do that as well
        iAObj.assetName = iAObj.assetName.replace('-', '_')

        # Check if this AssetName already exists in scene
        iAObj.assetName = Connector.getUniqueSceneName(iAObj.assetName)

        assetHandler = FTAssetHandlerInstance.instance()
        importAsset = assetHandler.getAssetClass(iAObj.assetType)
        if importAsset:
            result = importAsset.importAsset(iAObj)
            return result
        else:
            return 'assetType not supported'
    def updateAssetTypeOptions(self):
        '''Update list of asset types to filter by.'''
        self.assetTypeSelectorModel.clear()

        assetTypes = ftrack.getAssetTypes()
        assetTypes = sorted(assetTypes,
                            key=lambda assetType: assetType.getName().lower())

        assetTypeItem = QtGui.QStandardItem('Show All')
        self.assetTypeSelectorModel.appendRow(assetTypeItem)

        assetHandler = FTAssetHandlerInstance.instance()
        assetTypesStr = sorted(assetHandler.getAssetTypes())

        for assetTypeStr in assetTypesStr:
            try:
                assetType = ftrack.AssetType(assetTypeStr)
            except:
                print assetTypeStr + ' not available in ftrack'
                continue

            assetTypeItem = QtGui.QStandardItem(assetType.getName())
            assetTypeItem.type = assetType.getShort()
            self.assetTypeSelectorModel.appendRow(assetTypeItem)
    def updateView(self, ftrackId=None):
        '''Update to view entity identified by *ftrackId*.'''
        self.latestFtrackId = ftrackId

        try:
            assetHandler = FTAssetHandlerInstance.instance()
            task = ftrack.Task(ftrackId)
            assets = task.getAssets(assetTypes=assetHandler.getAssetTypes())
            assets = sorted(assets, key=lambda a: a.getName().lower())
            self.assetTable.clearContents()
            self.assetTable.setRowCount(len(assets))
            blankRows = 0
            for i in range(len(assets)):
                assetName = assets[i].getName()
                assetVersions = assets[i].getVersions()

                # Temporary alias
                column = self.assetTableColumns.index

                if assetName != '' and assetVersions:
                    item = QtWidgets.QTableWidgetItem(assetName)
                    item.id = assets[i].getId()
                    item.setToolTip(assetName)

                    j = i - blankRows
                    self.assetTable.setItem(j, column('Asset'), item)

                    self.assetTable.setItem(j, column('Author'),
                                            QtWidgets.QTableWidgetItem(''))

                    self.assetTable.setItem(j, column('Date'),
                                            QtWidgets.QTableWidgetItem(''))

                    assetType = assets[i].getType()
                    itemType = QtWidgets.QTableWidgetItem(assetType.getShort())
                    self.assetTable.setItem(j, column('Asset Type Code'),
                                            itemType)

                    itemTypeLong = QtWidgets.QTableWidgetItem(
                        assetType.getName())
                    self.assetTable.setItem(j, column('Asset Type'),
                                            itemTypeLong)

                    assetVersions = assets[i].getVersions()
                    versionComboBox = QtWidgets.QComboBox()
                    self.assetTable.setCellWidget(j, column('Version'),
                                                  versionComboBox)

                    # Populate version list
                    for version in reversed(assetVersions):
                        versionComboBox.addItem(str(version.getVersion()),
                                                version)

                    try:
                        authorName = assetVersions[-1].getUser().getName()
                    except ftrack.ftrackerror.FTrackError:
                        # This error can happen if a version does not have an user,
                        # for example if the user has been deleted after publishing
                        # the version.
                        authorName = 'No User Found'

                    author = QtWidgets.QTableWidgetItem(authorName)
                    self.assetTable.setItem(j, column('Author'), author)

                    author = QtWidgets.QTableWidgetItem(
                        assetVersions[-1].getDate().strftime('%Y-%m-%d %H:%M'))
                    self.assetTable.setItem(j, column('Date'), author)

                    # Map version widget to row number to enable simple lookup
                    versionComboBox.currentIndexChanged[int].connect(
                        self.assetTableSignalMapper.map)

                    self.assetTableSignalMapper.setMapping(versionComboBox, j)

                else:
                    blankRows += 1

            self.assetTable.setRowCount(len(assets) - blankRows)

        except:
            traceback.print_exc(file=sys.stdout)
示例#15
0
def register_assets():
    assetHandler = FTAssetHandlerInstance.instance()
    assetHandler.registerAssetType(name="cache", cls=CacheAsset)
    assetHandler.registerAssetType(name="img", cls=ImageSequenceAsset)
    assetHandler.registerAssetType(name="mov", cls=MovieAsset)
def registerAssetTypes():
    assetHandler = FTAssetHandlerInstance.instance()
    assetHandler.registerAssetType(name='geo', cls=GeometryAsset)
def registerAssetTypes():
    assetHandler = FTAssetHandlerInstance.instance()
    assetHandler.registerAssetType(name='scene', cls=SceneAsset)
    assetHandler.registerAssetType(name='geo', cls=GeometryAsset)
    assetHandler.registerAssetType(name='cam', cls=CameraAsset)
示例#18
0
def register_assets():
    assetHandler = FTAssetHandlerInstance.instance()
    assetHandler.registerAssetType(name="scene", cls=SceneAsset)