Beispiel #1
0
def import_all_gizmos():

    session = ftrack_connect.session.get_shared_session()
    task = session.query('select parent.id from Task '
                         'where id is "{0}"'.format(
                             os.environ["FTRACK_TASKID"])).one()
    versions = session.query('AssetVersion where asset.parent.id is "{0}" and'
                             ' asset.type.short is "nuke_gizmo"'.format(
                                 task["parent"]["id"]))

    # Collect all components.
    components = []
    for version in get_latest_versions(versions):
        components.extend(version["components"])

    # Collect all new components
    new_components = []
    for component in components:
        node_exists = nuke.exists(
            HelpFunctions.safeString(component["version"]["asset"]["name"]) +
            "_" + HelpFunctions.safeString(component["name"]))
        if not node_exists:
            new_components.append(component)

    progress_bar = ProgressBar()
    progress_bar.show()
    for progress in import_components(components):
        progress_bar.bar.setValue(progress * 100)

    progress_bar.deleteLater()
    def changeVersion(self, iAObj=None, applicationObject=None):
        n = nuke.toNode(HelpFunctions.safeString(applicationObject))
        n['file'].setValue(
            HelpFunctions.safeString(
                nukecon.Connector.windowsFixPath(iAObj.filePath)))
        self.setFTab(n, iAObj)

        return True
    def importAsset(self, iAObj=None):
        resultingNode = nuke.createNode("ReadGeo2", inpanel=False)
        resultingNode['file'].setValue(
            HelpFunctions.safeString(
                nukecon.Connector.windowsFixPath(iAObj.filePath)))
        resultingNode['name'].setValue(
            HelpFunctions.safeString(iAObj.assetName))

        self.addFTab(resultingNode)
        self.setFTab(resultingNode, iAObj)

        return 'Imported geo asset'
    def importAsset(self, iAObj=None):
        '''Import asset as new node.'''
        resultingNode = nuke.createNode('Read', inpanel=False)
        resultingNode['name'].setValue(
            HelpFunctions.safeString(iAObj.assetName) + '_' +
            HelpFunctions.safeString(iAObj.componentName))

        resultingNode['file'].fromUserText(
            HelpFunctions.safeString(iAObj.filePath))

        self.addFTab(resultingNode)
        self.setFTab(resultingNode, iAObj)
Beispiel #5
0
 def getUniqueSceneName(assetName):
     assetName = assetName
     res = nuke.toNode(HelpFunctions.safeString(assetName))
     if res:
         i = 0
         while res:
             uniqueAssetName = assetName + str(i)
             res = nuke.toNode(HelpFunctions.safeString(uniqueAssetName))
             i = i + 1
         return uniqueAssetName
     else:
         return assetName
Beispiel #6
0
 def getUniqueSceneName(assetName):
     assetName = assetName
     for n in hou.node('/').allSubChildren():
         if n.name().startswith(HelpFunctions.safeString(assetName)):
             if n:
                 i = 0
                 while n:
                     uniqueAssetName = assetName + str(i)
                     if n.name().startswith(
                             HelpFunctions.safeString(uniqueAssetName)):
                         i = i + 1
                 return uniqueAssetName
             else:
                 return assetName
Beispiel #7
0
    def createThumbNail(nodeObject):
        try:
            #test creating thumbnail
            reformatNode = nuke.nodes.Reformat()
            reformatNode['type'].setValue("to box")
            reformatNode['box_width'].setValue(200.0)

            reformatNode.setInput(0, nodeObject)

            w2 = nuke.nodes.Write()
            w2.setInput(0, reformatNode)
            thumbNailFilename = 'thumbnail_' + HelpFunctions.getUniqueNumber() + '.png'
            thumbnailDestination = os.path.join(tempfile.gettempdir(), thumbNailFilename)
            w2['file'].setValue(Connector.windowsFixPath(thumbnailDestination))
            w2['file_type'].setValue('png')

            curFrame = int(nuke.knob("frame"))
            nuke.execute(w2, curFrame, curFrame)

            nuke.delete(reformatNode)
            nuke.delete(w2)

            return thumbnailDestination
        except:
            import traceback
            traceback.print_exc(file=sys.stdout)
            return None
Beispiel #8
0
def getMetaData(nodeName):
    n = nuke.toNode(HelpFunctions.safeString(nodeName))
    metaData = []
    metaData.append(('res_x', str(n.width())))
    metaData.append(('res_y', str(n.height())))

    return metaData
    def importAsset(self, iAObj=None):

        start, end = HelpFunctions.getFileSequenceStartEnd(iAObj.filePath)

        nuke.nodePaste(iAObj.filePath % start)

        if iAObj.options["importSettings"]:

            component = ftrack.Component(iAObj.componentId)
            parent = component.getVersion().getAsset().getParent()

            # Setup fps
            nuke.root()['fps'].setValue(parent.get('fps'))

            # Setup frame range
            nuke.root()['first_frame'].setValue(parent.get('fstart'))
            nuke.root()['last_frame'].setValue(parent.get('fend'))

            # Setup resolution
            width = parent.get("width")
            height = parent.get("height")
            fmt = None
            for f in nuke.formats():
                if f.width() == width and f.height() == height:
                    fmt = f

            if fmt:
                nuke.root()['format'].setValue(fmt.name())

        return
    def importAsset(self, iAObj=None):
        '''Create nuke read node from *iAObj.'''

        if iAObj.filePath.endswith('nk'):
            nuke.nodePaste(iAObj.filePath)
            return
        else:
            resultingNode = nuke.createNode('Read', inpanel=False)
            resultingNode['name'].setValue(
                HelpFunctions.safeString(iAObj.assetName) + '_' +
                HelpFunctions.safeString(iAObj.componentName))

        self.addFTab(resultingNode)

        # Compute frame range
        # TODO: Store these attributes on the component for easy access.
        resultingNode['file'].fromUserText(
            HelpFunctions.safeString(iAObj.filePath))

        start, end = self.getStartEndFrames(iAObj)

        resultingNode['first'].setValue(start)
        resultingNode['origfirst'].setValue(start)
        resultingNode['last'].setValue(end)
        resultingNode['origlast'].setValue(end)

        proxyPath = ''
        assetVersion = ftrack.AssetVersion(iAObj.assetVersionId)
        try:
            proxyPath = assetVersion.getComponent(name='proxy').getImportPath()
        except:
            pass

        try:
            proxyPath = assetVersion.getComponent(name=iAObj.componentName +
                                                  '_proxy').getImportPath()
        except:
            pass

        if proxyPath != '':
            resultingNode['proxy'].fromUserText(proxyPath)

        self.setFTab(resultingNode, iAObj)

        return 'Imported %s asset' % iAObj.componentName
Beispiel #11
0
 def setNodeColor(applicationObject='', latest=True):
     # Green RGB 20, 161, 74
     # Orange RGB 227, 99, 22
     latestColor = int('%02x%02x%02x%02x' % (20, 161, 74, 255), 16)
     oldColor = int('%02x%02x%02x%02x' % (227, 99, 22, 255), 16)
     n = nuke.toNode(HelpFunctions.safeString(applicationObject))
     if latest:
         n.knob("note_font_color").setValue(latestColor)
     else:
         n.knob("note_font_color").setValue(oldColor)
    def openBrowser(self):
        browser = TabbedBrowserDialog.buildForSession(self.spec, self.context)
        browser.setWindowTitle(FnAssetAPI.l("Publish to"))
        browser.setAcceptButtonTitle("Set")
        if not browser.exec_():
            return ''

        self.targetTask = browser.getSelection()[0]
        obj = connector.Connector.objectById(self.targetTask)
        self._lineEdit.setText(HelpFunctions.getPath(obj, slash=True))
    def publishAsset(self, iAObj=None):
        '''Publish the asset defined by the provided *iAObj*.'''

        panelComInstance = panelcom.PanelComInstance.instance()

        if hasattr(iAObj, 'customComponentName'):
            componentName = iAObj.customComponentName
        else:
            componentName = 'houdiniNodes'

        publishedComponents = []

        temporaryPath = HelpFunctions.temporaryFile(suffix='.hip')

        publishedComponents.append(
            FTComponent(
                componentname=componentName,
                path=temporaryPath
            )
        )

        if 'exportMode' in iAObj.options and (
                iAObj.options['exportMode'] == 'Selection') and (
                    componentName == 'houdiniNodes'):
            ''' Publish Selected Nodes'''
            selectednodes = hou.selectedNodes()
            selectednodes[0].parent().saveChildrenToFile(
                selectednodes, [], temporaryPath)

            panelComInstance.emitPublishProgressStep()

        elif componentName == 'houdiniPublishScene' and (
                iAObj.options['exportMode'] == 'Selection'):
            # Publish Main Scene in selection mode
            hou.copyNodesToClipboard(hou.selectedNodes())

            command = "hou.pasteNodesFromClipboard(hou.node('/obj'));\
            hou.hipFile.save('%s')" % (temporaryPath)

            cmd = '%s -c "%s"' % (os.path.join(
                os.getenv('HFS'), 'bin', 'hython'), command)
            os.system(cmd)

        elif componentName == 'houdiniPublishScene':
            # Publish Main Scene
            hou.hipFile.save(temporaryPath)

        panelComInstance.emitPublishProgressStep()

        return publishedComponents, 'Published ' + iAObj.assetType + ' asset'
    def _pixmapFromUrl(self, url):
        '''Retrieve *url* and return data as a pixmap.'''
        pixmap = self.thumbnailCache.get(url)
        if pixmap is None:
            data = HelpFunctions.getFileFromUrl(url)
            pixmap = QtGui.QPixmap()
            pixmap.loadFromData(data)
            self.thumbnailCache[url] = pixmap

        # Handle null pixmaps. E.g. JPG on Windows.
        if pixmap.isNull():
            pixmap = self.thumbnailCache.get(self.placholderThumbnail, pixmap)

        return pixmap
Beispiel #15
0
    def getStartEndFrames(self, component, iAObj):
        """Return start and end from *iAObj*."""

        if component.getSystemType() == "sequence":
            # Find out frame start and end from members if component
            # system type is sequence.
            members = component.getMembers(location=None)
            frames = [int(member.getName()) for member in members]
            start = min(frames)
            end = max(frames)
        else:
            start, end = HelpFunctions.getFileSequenceStartEnd(iAObj.filePath)

        return start, end
    def changeVersion(self, iAObj=None, applicationObject=None):
        n = nuke.toNode(HelpFunctions.safeString(applicationObject))
        #print assetVersionId
        proxyPath = ''
        try:
            proxyPath = ftrack.AssetVersion(iAObj.assetVersionId).getComponent(
                name='proxy').getImportPath()
        except:
            print 'No proxy'

        n['file'].fromUserText(HelpFunctions.safeString(iAObj.filePath))
        if proxyPath != '':
            n['proxy'].fromUserText(proxyPath)

        start, end = self.getStartEndFrames(iAObj)

        n['first'].setValue(start)
        n['origfirst'].setValue(start)
        n['last'].setValue(end)
        n['origlast'].setValue(end)

        self.setFTab(n, iAObj)

        return True
Beispiel #17
0
    def __init__(self, parent, task=None):
        '''Instansiate web view widget.'''
        QtWidgets.QWidget.__init__(self, parent)
        self.ui = Ui_WebView()
        self.ui.setupUi(self)

        self.webPage = QtWebCompat.QWebPage()

        self.persCookieJar = PersistentCookieJar(self)
        self.persCookieJar.load()

        proxy = HelpFunctions.getFtrackQNetworkProxy()
        if proxy:
            self.webPage.setProxy(proxy)

        self.ui.WebViewView.setPage(self.webPage)
    def publishContent(self, content, assetVersion, progressCallback=None):

        publishedComponents = []

        for c in content:
            filename = c[0]
            componentName = c[1]

            sequenceComponent = FTComponent()

            start = int(float(c[2]))
            end = int(float(c[3]))

            if not start - end == 0:
                sequence_format = u'{0} [{1}-{2}]'.format(filename, start, end)
            else:
                sequence_format = u'{0}'.format(filename, start)

            sequenceIdentifier = sequence_format

            metaData = []

            if not '_proxy' in componentName:
                metaData.append(('img_main', 'True'))

            for meta in c[5]:
                metaData.append((meta[0], meta[1]))

            sequenceComponent.componentname = componentName
            sequenceComponent.path = sequenceIdentifier
            sequenceComponent.metadata = metaData

            publishedComponents.append(sequenceComponent)

        try:
            node = nuke.toNode(HelpFunctions.safeString(content[0][4]))
            thumbnail = Connector.createThumbNail(node)
            if thumbnail:
                publishedComponents.append(
                    FTComponent(componentname='thumbnail', path=thumbnail))
        except:
            print 'Failed to create thumbnail'
            import sys
            traceback.print_exc(file=sys.stdout)

        return publishedComponents
 def changeVersion(self, iAObj=None, applicationObject=None):
     for n in hou.node('/').allSubChildren():
         if n.name().startswith(applicationObject):
             if iAObj.componentName == 'alembic':
                 n.parm('fileName').set(
                     HelpFunctions.safeString(iAObj.filePath))
                 hou.hscript(
                     "opparm -C {0} buildHierarchy (1)".format(
                         n.path()))
                 self.setFTab(n, iAObj)
                 return True
             elif iAObj.componentName == 'houdiniNodes':
                 results = n.glob('*')
                 for del_n in results:
                     del_n.destroy()
                 n.loadChildrenFromFile(iAObj.filePath)
                 n.setSelected(1)
                 self.setFTab(n, iAObj)
                 return True
Beispiel #20
0
def scan_for_new_assets():
    '''Scan scene for outdated asset versions.'''
    allAssets = connector.Connector.getAssets()
    message = ''

    check_items = []
    scanned_ftrack_nodes = []

    for ftrack_node in allAssets:
        ftrack_node = ftrack_node[1]
        n = nuke.toNode(HelpFunctions.safeString(ftrack_node))
        ftrack_asset_version_id_url = n.knob('assetVersionId').value()

        url = urlparse.urlparse(ftrack_asset_version_id_url)
        query = urlparse.parse_qs(url.query)
        entityType = query.get('entityType')[0]

        asset_version_id = url.netloc
        component_name = n.knob('componentName').value()

        if asset_version_id is None:
            nuke.message(
                'FTrack node "{0}" does not contain data!'.format(ftrack_node))
            continue

        new_item = {
            'asset_version_id': asset_version_id,
            'component_name': component_name
        }
        check_items.append(new_item)
        scanned_ftrack_nodes.append(ftrack_node)

    if scanned_ftrack_nodes:
        import ftrack_api
        session = ftrack_api.Session(auto_connect_event_hub=False,
                                     plugin_paths=None)
        scanner = ftrack_connect.asset_version_scanner.Scanner(
            session=session,
            result_handler=(
                lambda result: ftrack_connect.util.invoke_in_main_thread(
                    handle_scan_result, result, scanned_ftrack_nodes)))
        scanner.scan(check_items)
    def setFTab(self, resultingNode, iAObj):
        componentId = ftrack.Component(
            iAObj.componentId).getEntityRef()
        assetVersionId = ftrack.AssetVersion(
            iAObj.assetVersionId).getEntityRef()

        components = {
            'componentId': HelpFunctions.safeString(componentId),
            'componentName': HelpFunctions.safeString(iAObj.componentName),
            'assetVersionId': HelpFunctions.safeString(assetVersionId),
            'assetVersion': HelpFunctions.safeString(iAObj.assetVersion),
            'assetName': HelpFunctions.safeString(iAObj.assetName),
            'assetType': HelpFunctions.safeString(iAObj.assetType),
            'assetId': HelpFunctions.safeString(iAObj.assetId)
        }

        for comp in components:
            resultingNode.parm(comp).set(components[comp])
    def makeUI(self):
        self.mainWidget = QtWidgets.QWidget()
        applyTheme(self.mainWidget, 'integration')

        self.mainWidget.setContentsMargins(0, 0, 0, 0)
        self.hlayout = QtWidgets.QHBoxLayout()
        self.hlayout.setContentsMargins(0, 0, 0, 0)
        self.mainWidget.setLayout(self.hlayout)

        self._lineEdit = QtWidgets.QLineEdit()
        self._lineEdit.setText(
            HelpFunctions.getPath(self.current_task, slash=True))
        self.hlayout.addWidget(self._lineEdit)

        self._browse = QtWidgets.QPushButton("Browse")
        self.hlayout.addWidget(self._browse)

        QtCore.QObject.connect(self._browse, QtCore.SIGNAL('clicked()'),
                               self.openBrowser)

        return self.mainWidget
    def publishContent(self, content, assetVersion, progressCallback=None):
        '''Return components to publish.'''
        components = []

        for row in content:
            filename = row[0]
            componentName = row[1]

            components.append(
                FTComponent(componentname=componentName, path=filename))

        try:
            node = nuke.toNode(HelpFunctions.safeString(content[0][4]))
            thumbnail = Connector.createThumbNail(node)
            if thumbnail:
                components.append(
                    FTComponent(componentname='thumbnail', path=thumbnail))
        except Exception:
            pass

        return components
    def setFTab(self, resultingNode, iAObj):
        componentId = ftrack.Component(iAObj.componentId).getEntityRef()
        assetVersionId = ftrack.AssetVersion(
            iAObj.assetVersionId).getEntityRef()

        resultingNode.knob('assetId').setValue(
            HelpFunctions.safeString(iAObj.assetId))

        resultingNode.knob('componentId').setValue(
            HelpFunctions.safeString(componentId))
        resultingNode.knob('componentName').setValue(
            HelpFunctions.safeString(iAObj.componentName))
        resultingNode.knob('assetVersionId').setValue(
            HelpFunctions.safeString(assetVersionId))
        resultingNode.knob('assetVersion').setValue(
            HelpFunctions.safeString(iAObj.assetVersion))
        resultingNode.knob('assetName').setValue(
            HelpFunctions.safeString(iAObj.assetName))
        resultingNode.knob('assetType').setValue(
            HelpFunctions.safeString(iAObj.assetType))
Beispiel #25
0
 def selectObject(applicationObject='', clearSelection=True):
     if clearSelection:
         nukescripts.clear_selection_recursive()
     n = nuke.toNode(HelpFunctions.safeString(applicationObject))
     n.knob('selected').setValue(True)
 def changeVersion(self, iAObj=None, applicationObject=None):
     '''Change current version of the give *iAObj* and *applicationObject*.'''
     n = nuke.toNode(HelpFunctions.safeString(applicationObject))
     n['file'].fromUserText(HelpFunctions.safeString(iAObj.filePath))
     self.setFTab(n, iAObj)
     return True
Beispiel #27
0
    def publishAsset(self, iAObj=None):
        '''Publish the asset defined by the provided *iAObj*.'''
        panelComInstance = panelcom.PanelComInstance.instance()

        if hasattr(iAObj, 'customComponentName'):
            componentName = iAObj.customComponentName
        else:
            componentName = 'mayaBinary'

        channels = True
        preserveReferences = False
        constructionHistory = False
        constraints = False
        expressions = False
        shader = False

        if iAObj.options.get('mayaHistory'):
            constructionHistory = iAObj.options['mayaHistory']

        if iAObj.options.get('mayaChannels'):
            channels = iAObj.options['mayaChannels']

        if iAObj.options.get('mayaPreserveref'):
            preserveReferences = iAObj.options['mayaPreserveref']

        if iAObj.options.get('mayaShaders'):
            shader = iAObj.options['mayaShaders']

        if iAObj.options.get('mayaConstraints'):
            constraints = iAObj.options['mayaConstraints']

        if iAObj.options.get('mayaExpressions'):
            expressions = iAObj.options['mayaExpressions']

        if iAObj.options.get('exportMode') == 'Selection':
            exportSelectedMode = True
            exportAllMode = False
        else:
            exportSelectedMode = False
            exportAllMode = True

        publishedComponents = []

        temporaryPath = HelpFunctions.temporaryFile(suffix='.mb')
        publishedComponents.append(
            FTComponent(componentname=componentName, path=temporaryPath))

        mc.file(temporaryPath,
                op='v=0',
                typ='mayaBinary',
                preserveReferences=preserveReferences,
                constructionHistory=constructionHistory,
                channels=channels,
                constraints=constraints,
                expressions=expressions,
                shader=shader,
                exportSelected=exportSelectedMode,
                exportAll=exportAllMode,
                force=True)

        dependenciesVersion = []
        dependencies = mc.ls(type='ftrackAssetNode')
        for dependency in dependencies:
            dependencyAssetId = mc.getAttr('{0}.assetId'.format(dependency))
            if dependencyAssetId:
                dependencyVersion = ftrack.AssetVersion(dependencyAssetId)
                dependenciesVersion.append(dependencyVersion)

        currentVersion = ftrack.AssetVersion(iAObj.assetVersionId)
        currentVersion.addUsesVersions(versions=dependenciesVersion)

        panelComInstance.emitPublishProgressStep()

        return publishedComponents, 'Published ' + iAObj.assetType + ' asset'
Beispiel #28
0
    def publishAsset(self, iAObj=None):
        '''Publish the asset defined by the provided *iAObj*.'''

        publishedComponents = []

        totalSteps = self.getTotalSteps(steps=[
            iAObj.options['mayaBinary'], iAObj.options['alembic'],
            iAObj.options['mayaPublishScene']
        ])
        panelComInstance = panelcom.PanelComInstance.instance()
        panelComInstance.setTotalExportSteps(totalSteps)

        if iAObj.options['mayaBinary']:
            iAObj.setTotalSteps = False
            mayaComponents, message = GenericAsset.publishAsset(self, iAObj)
            publishedComponents += mayaComponents

        if iAObj.options['mayaPublishScene']:
            iAObjCopy = self.getSceneSettingsObj(iAObj)
            sceneComponents, message = GenericAsset.publishAsset(
                self, iAObjCopy)
            publishedComponents += sceneComponents

        if iAObj.options.get('alembic'):
            if iAObj.options.get('alembicExportMode') == 'Selection':
                nodes = mc.ls(sl=True, long=True)
                selectednodes = None
            else:
                selectednodes = mc.ls(sl=True, long=True)
                nodes = mc.ls(type='transform', long=True)
            objCommand = ''
            for n in nodes:
                objCommand = objCommand + '-root ' + n + ' '
            mc.loadPlugin('AbcExport.so', qt=1)

            temporaryPath = HelpFunctions.temporaryFile(suffix='.abc')
            publishedComponents.append(
                FTComponent(componentname='alembic', path=temporaryPath))

            alembicJobArgs = ''

            if iAObj.options.get('alembicUvwrite'):
                alembicJobArgs += '-uvWrite '

            if iAObj.options.get('alembicWorldspace'):
                alembicJobArgs += '-worldSpace '

            if iAObj.options.get('alembicWritevisibility'):
                alembicJobArgs += '-writeVisibility '

            if iAObj.options.get('alembicAnimation'):
                alembicJobArgs += '-frameRange {0} {1} -step {2} '.format(
                    iAObj.options['frameStart'], iAObj.options['frameEnd'],
                    iAObj.options['alembicEval'])

            alembicJobArgs += ' ' + objCommand + '-file ' + temporaryPath

            mc.AbcExport(j=alembicJobArgs)

            if selectednodes:
                mc.select(selectednodes)

            panelComInstance.emitPublishProgressStep()

        return publishedComponents, 'Published GeometryAsset asset'
Beispiel #29
0
 def removeObject(applicationObject=''):
     deleteMeNode = nuke.toNode(HelpFunctions.safeString(applicationObject))
     nuke.delete(deleteMeNode)
Beispiel #30
0
    def publishAsset(self, iAObj=None):
        '''Publish the asset defined by the provided *iAObj*.'''
        pubMessage = 'Published cameraasset asset'

        # Only export selection when exporting camera
        iAObj.options['exportMode'] = 'Selection'
        publishedComponents = []

        totalSteps = self.getTotalSteps(steps=[
            iAObj.options['cameraBake'], iAObj.options['cameraMaya'],
            iAObj.options['cameraAlembic'], iAObj.options['mayaPublishScene']
        ])
        panelComInstance = panelcom.PanelComInstance.instance()
        panelComInstance.setTotalExportSteps(totalSteps + 1)

        # Get original selection
        nodes = mc.ls(sl=True)

        # Get camera shape and parent transforms
        cameraShape = ''
        for node in nodes:
            if mc.nodeType(node) == 'camera':
                cameraShape = node
            else:
                cameraShapes = mc.listRelatives(node,
                                                allDescendents=True,
                                                type='camera')
                if len(cameraShapes) > 0:
                    # We only care about one camera
                    cameraShape = cameraShapes[0]

        if cameraShape == '':
            return None, 'No camera selected'

        cameraTransform = mc.listRelatives(cameraShape,
                                           type='transform',
                                           parent=True)
        cameraTransform = cameraTransform[0]

        if iAObj.options['cameraBake']:
            tmpCamComponents = mc.duplicate(cameraTransform, un=1, rc=1)
            if mc.nodeType(tmpCamComponents[0]) == 'transform':
                tmpCam = tmpCamComponents[0]
            else:
                tmpCam = mc.ls(tmpCamComponents, type='transform')[0]
            pConstraint = mc.parentConstraint(cameraTransform, tmpCam)
            try:
                mc.parent(tmpCam, world=True)
            except RuntimeError:
                print 'camera already in world space'

            mc.bakeResults(tmpCam,
                           simulation=True,
                           t=(float(iAObj.options['frameStart']),
                              float(iAObj.options['frameEnd'])),
                           sb=1,
                           at=['tx', 'ty', 'tz', 'rx', 'ry', 'rz'],
                           hi='below')

            mc.delete(pConstraint)
            cameraTransform = tmpCam
            panelComInstance.emitPublishProgressStep()

        if iAObj.options['cameraLock']:
            # Get original lock values so we can revert after exporting
            origCamLocktx = mc.getAttr('{0}.tx'.format(cameraTransform),
                                       l=True)
            origCamLockty = mc.getAttr('{0}.ty'.format(cameraTransform),
                                       l=True)
            origCamLocktz = mc.getAttr('{0}.tz'.format(cameraTransform),
                                       l=True)
            origCamLockrx = mc.getAttr('{0}.rx'.format(cameraTransform),
                                       l=True)
            origCamLockry = mc.getAttr('{0}.ry'.format(cameraTransform),
                                       l=True)
            origCamLockrz = mc.getAttr('{0}.rz'.format(cameraTransform),
                                       l=True)
            origCamLocksx = mc.getAttr('{0}.sx'.format(cameraTransform),
                                       l=True)
            origCamLocksy = mc.getAttr('{0}.sy'.format(cameraTransform),
                                       l=True)
            origCamLocksz = mc.getAttr('{0}.sz'.format(cameraTransform),
                                       l=True)

            # Lock transform
            mc.setAttr('{0}.tx'.format(cameraTransform), l=True)
            mc.setAttr('{0}.ty'.format(cameraTransform), l=True)
            mc.setAttr('{0}.tz'.format(cameraTransform), l=True)
            mc.setAttr('{0}.rx'.format(cameraTransform), l=True)
            mc.setAttr('{0}.ry'.format(cameraTransform), l=True)
            mc.setAttr('{0}.rz'.format(cameraTransform), l=True)
            mc.setAttr('{0}.sx'.format(cameraTransform), l=True)
            mc.setAttr('{0}.sy'.format(cameraTransform), l=True)
            mc.setAttr('{0}.sz'.format(cameraTransform), l=True)

        if iAObj.options['cameraMaya']:
            iAObj.setTotalSteps = False
            mayaComponents, message = GenericAsset.publishAsset(self, iAObj)
            publishedComponents += mayaComponents

        if iAObj.options['cameraAlembic']:
            mc.loadPlugin('AbcExport.so', qt=1)
            temporaryPath = HelpFunctions.temporaryFile(suffix='.abc')
            publishedComponents.append(
                FTComponent(componentname='alembic', path=temporaryPath))

            alembicJobArgs = ''
            alembicJobArgs += '-fr {0} {1}'.format(iAObj.options['frameStart'],
                                                   iAObj.options['frameEnd'])
            objCommand = '-root ' + cameraTransform + ' '
            alembicJobArgs += ' ' + objCommand + '-file ' + temporaryPath
            alembicJobArgs += ' -step ' + str(iAObj.options['alembicSteps'])
            try:
                mc.AbcExport(j=alembicJobArgs)
            except:
                import traceback
                var = traceback.format_exc()
                return None, var
            panelComInstance.emitPublishProgressStep()

        if iAObj.options['cameraLock']:
            # Revert camera locks to original
            mc.setAttr('{0}.tx'.format(cameraTransform), l=origCamLocktx)
            mc.setAttr('{0}.ty'.format(cameraTransform), l=origCamLockty)
            mc.setAttr('{0}.tz'.format(cameraTransform), l=origCamLocktz)
            mc.setAttr('{0}.rx'.format(cameraTransform), l=origCamLockrx)
            mc.setAttr('{0}.ry'.format(cameraTransform), l=origCamLockry)
            mc.setAttr('{0}.rz'.format(cameraTransform), l=origCamLockrz)
            mc.setAttr('{0}.sx'.format(cameraTransform), l=origCamLocksx)
            mc.setAttr('{0}.sy'.format(cameraTransform), l=origCamLocksy)
            mc.setAttr('{0}.sz'.format(cameraTransform), l=origCamLocksz)

        if iAObj.options['cameraBake']:
            mc.delete(cameraTransform)
        # Set back original selection
        mc.select(nodes)
        panelComInstance.emitPublishProgressStep()

        if iAObj.options['mayaPublishScene']:
            iAObjCopy = self.getSceneSettingsObj(iAObj)
            sceneComponents, message = GenericAsset.publishAsset(
                self, iAObjCopy)
            publishedComponents += sceneComponents

        return publishedComponents, pubMessage