コード例 #1
0
ファイル: TrackwayManager.py プロジェクト: sernst/Cadence
    def getSelectedTokenUid(self):
        """ This returns the URL of the currently selected token, or None. """

        conn   = nimble.getConnection()
        result = conn.runPythonModule(GetSelectedUidList, runInMaya=True)

        # Check to see if the remote command execution was successful
        if not result.success:
            PyGlassBasicDialogManager.openOk(
                self,
                'Failed UID Query',
                'Unable to get selected UID list from Maya',
                'Error')
            return None

        selectedUidList = result.payload['selectedUidList']
        if len(selectedUidList) == 0:
            return None

        # check to see if it really is a proxy or token that was selected
        uid = selectedUidList[0]
        if uid.endswith('_proxy') or uid.endswith('_token'):
            return uid
        else:
            return None
コード例 #2
0
ファイル: TrackwayManager.py プロジェクト: sernst/Cadence
    def getSelectedTracks(self):
        """ This returns a list of track model instances corresponding to the
            track nodes that are currently selected.  To achieve this, it first
            runs a remote script to get a list of track UIDs from the selected
            Maya track nodes. A list of the corresponding track models is then
            returned. """

        conn   = nimble.getConnection()
        result = conn.runPythonModule(GetSelectedUidList, runInMaya=True )

        # Check to see if the remote command execution was successful
        if not result.success:
            PyGlassBasicDialogManager.openOk(
                self,
                'Failed UID Query',
                'Unable to get selected UID list from Maya',
                'Error')
            return None

        # from this UID list, create the corresponding track list
        selectedUidList = result.payload['selectedUidList']
        if len(selectedUidList) == 0:
            return None

        tracks = list()
        for uid in selectedUidList:
            track = self.getTrackByUid(uid)
            if track:
                track.updateFromNode()
                tracks.append(track)
        return tracks
コード例 #3
0
ファイル: TrackwayManager.py プロジェクト: sernst/Cadence
    def getSelectedTokenUids(self):
        """ This returns a list of URL of the currently selected tokens, or
            None. """

        conn   = nimble.getConnection()
        result = conn.runPythonModule(GetSelectedUidList, runInMaya=True)

        # Check to see if the remote command execution was successful
        if not result.success:
            PyGlassBasicDialogManager.openOk(
                self,
                'Failed UID Query',
                'Unable to get selected UID list from Maya',
                'Error')
            return None

        selectedUidList = result.payload['selectedUidList']
        if len(selectedUidList) == 0:
            return None

        # return those UIDs corresponding to proxies or tokens
        tokenUidList = list()
        for uid in selectedUidList:
            if uid.endswith('_proxy') or uid.endswith('_token'):
                tokenUidList.append(uid)

        return tokenUidList
コード例 #4
0
 def _handleInitializeSceneClick(self):
     conn   = nimble.getConnection()
     result = conn.runPythonModule(InitializeTrackwayScene)
     if not result.success:
         header = u'Failed'
         message = u'Unable to initialize your Maya scene'
         PyGlassBasicDialogManager.openOk(
             self.mainWindow,
             header,
             message,
             u'Initialize Scene')
     self._iniBtn.setText(u'Reinitialize')
コード例 #5
0
    def _handleDeploymentExecutionComplete(self, event):
        self._serverThread.completeSignal.signal.disconnect(self._handleDeploymentExecutionComplete)
        self._serverThread.logSignal.signal.disconnect(self._handleLogData)
        self._serverThread = None

        if not event.target.success:
            PyGlassBasicDialogManager.openOk(
                parent=self,
                header=u'Deployment Failed',
                message=u'An error caused the site deployment to fail')
            self.mainWindow.updateStatusBar(u'Deployment FAILED')
        else:
            self.mainWindow.updateStatusBar(u'Deployment SUCCESS')
        self._closeBtn.setEnabled(True)
コード例 #6
0
    def _handleTrackNodesCreated(self, event):
        result = event.target.output

        if not result.success:
            PyGlassBasicDialogManager.openOk(
                parent=self,
                header=u'Load Error',
                message=u'Unable to load tracks')
        else:
            PyGlassBasicDialogManager.openOk(
                parent=self,
                header=str(event.target.userData['count']) + ' Tracks Created')

        self.mainWindow.hideLoading(self)
コード例 #7
0
    def _handleInitializeDatabase(self):
        self.mainWindow.showLoading(self)
        self.refreshGui()
        if AlembicUtils.initializeDatabase(
                databaseUrl=self.currentDatabaseUrl,
                resourcesPath=self.currentAppResourcesPath,
                localResourcesPath=self.currentLocalAppResourcesPath):
            PyGlassBasicDialogManager.openOk(
                self,
                'Initialization Complete',
                'Alembic migration environment created.')
        else:
            PyGlassBasicDialogManager.openOk(
                self,
                'Initialization Aborted',
                'Alembic migration already exists.')

        self.mainWindow.hideLoading(self)
コード例 #8
0
    def _handleImportComplete(self, event):
        actionType = 'Export' if isinstance(self._thread, TrackExporterRemoteThread) else 'Import'

        if not event.target.success:
            print('ERROR: %s Failed' % actionType)
            print('  OUTPUT:', event.target.output)
            print('  ERROR:', event.target.error)
            PyGlassBasicDialogManager.openOk(
                parent=self,
                header='ERROR',
                message='%s operation failed' % actionType)
        else:
            PyGlassBasicDialogManager.openOk(
                parent=self,
                header='Success',
                message='%s operation complete' % actionType)

        self.mainWindow.showStatusDone(self)
コード例 #9
0
ファイル: TrackwayManager.py プロジェクト: sernst/Cadence
    def getUidList(self):
        """ Returns a list of the UIDs of all track nodes currently loaded into
            Maya. """

        conn   = nimble.getConnection()

        result = conn.runPythonModule(GetUidList, runInMaya=True)

        # and check to see if the remote command execution was successful
        if not result.success:
            PyGlassBasicDialogManager.openOk(
                parent=self,
                header='ERROR',
                message='Unable to get UID list from Maya')
            self.closeSession()
            return None

        self.closeSession()
        return result.payload['uidList']
コード例 #10
0
    def _handleCreate(self):
        self.mainWindow.showLoading(self)
        self.refreshGui()

        mainWidget = self.mainWindow.getWidgetFromID('main')

        AlembicUtils.createRevision(
            databaseUrl=mainWidget.currentDatabaseUrl,
            message=self.migrationTitle,
            resourcesPath=mainWidget.currentAppResourcesPath,
            localResourcesPath=mainWidget.currentLocalAppResourcesPath,
            info=self.migrationInfo)

        PyGlassBasicDialogManager.openOk(
            parent=self,
            header='New Revision Created',
            message='New migration revision file has been created.')

        self.mainWindow.hideLoading(self)
        mainWidget.refresh()
        self.mainWindow.setActiveWidget('main')