コード例 #1
0
    def setupExternallCall(self):
        # e.g. fluidexplorer.exe /settings path=E:/TMP/ANNAANNA/ANNAANNA.fxp /load path=E:/FluidExplorer_Code/FlameShape/FlameShape1

        # FluidExplorer
        self.externalCall.pathToFluidExplorer = ProjectDetailsViewUtils.getPathFluidExplorer()
        if sys.platform.startswith('win'):
            self.externalCall.fluidExplorerCmd = 'fluidExplorer.exe'
        elif sys.platform.startswith(''):
            # TODO: UNIX
            pass

        # Settings file
        settingXMLFile = self.pathToXMLFile

        # Path to cached files
        cacheFile = ProjectDetailsViewUtils.getPathCacheFiles(self.pathToXMLFile)

        # Args
        self.externalCall.fluidExplorerArgs = '/settings path=' + str(settingXMLFile) + ' ' + '/load path=' + str(cacheFile)

        # For testing
        self.externalCall.pathToFluidExplorer = 'E:/FluidExplorer_Code/Release/'
        self.externalCall.pathToFluidExplorer = 'E:/Workspace_VisualStudio/fluidexplorer/Backup/fluidexplorer/bin/Win32/Debug/'
        self.externalCall.fluidExplorerCmd = 'fluidExplorer.exe'
        self.externalCall.fluidExplorerArgs = '/load path=E:\FluidExplorer_Code\FlameShape\FlameShape1'
コード例 #2
0
    def readProjectProperties(self, pathToXMLFile):
        xmReader = ProjectDetailsViewUtils()

        projectSettings = None
        try:
            projectSettings = xmReader.getProjectSubSettings(pathToXMLFile)
        except Exception as e:
            errorText = "An error occured while loading the project configuration file!\nDetails: " + str(e.message)
            self.showMessageBox(errorText, 'critical')
            self.lgr.error('Loading the project configuration file: %s', errorText)
            return projectSettings

        return projectSettings
コード例 #3
0
    def initComboBoxSimulations(self, projectSettings):

        # Stores animation index and path
        haspMap = {}

        # First item
        self.ui.comboBox_simulations.addItem('Select Sequence ...')

        try:
            num = int(projectSettings.numberOfSimulations)
        except:
            num = 0

        if num > 0:
            for i in range(num):

                # Firste entry
                tmpNameForElement = 'Sequence ' + str(i+1)

                # Folders
                tmpProject = projectSettings.projectName + '.fxp'
                index = self.pathToXMLFile.find(tmpProject)
                tmp = self.pathToXMLFile[0:index]
                tmp = tmp + '/' + str(i) + '/'
                #tmp = projectSettings.projectPath + "/" + str(i) + "/"
                if os.path.exists(tmp):
                    pathToXMLProjectFileList = ProjectDetailsViewUtils.getPathToXMLFile(tmp)

                    if len(pathToXMLProjectFileList) == 1:
                        if os.path.exists(pathToXMLProjectFileList[0]):
                            haspMap[i] = pathToXMLProjectFileList[0]
                            self.ui.comboBox_simulations.addItem(tmpNameForElement)

            self.hashMapToXMLProjectFile = haspMap
コード例 #4
0
    def exploreSimulationsClicked(self):
        self.lgr.info('Explore simulations clicked')

        # Check of corredt scene is opened
        currentSceneName = cmds.file(q=True, sceneName=True)
        sceneFromConfigFile = self.projectSettings.mayaFilePath
        isSameScene = ProjectDetailsViewUtils.checkIfCorrectSceneIsOpened(currentSceneName, sceneFromConfigFile)
        if not isSameScene:
            strError = 'Please open the correct maya scene first!\nPath: ' + sceneFromConfigFile
            self.lgr.warning('Please open the correct maya scene first! Path: %s', sceneFromConfigFile)
            self.showMessageBox(strError, 'warning')
            return

        # Check if xml files are available
        if not len(self.hashMapToXMLProjectFile) == int(self.projectSettings.numberOfSimulations) + 1:
            self.lgr.warning('Number of XML cache files is not correct')
            errorMsg = "The number of .xml cache files is not correct!\nPlease check the project folder or create the simulation again."
            self.showMessageBox(errorMsg, 'warning')
            return

        # Check if fluidexplorer app is running
        isFXProcessRunning = ProjectDetailsViewUtils.checkIfProcessIsRunning_WIN(self.FLUIDEXPLORER_APP_NAME)
        if isFXProcessRunning:
            return

        # Check if path exists
        pathToFXAPP = self.externalCall.pathToFluidExplorer + '/' + self.externalCall.fluidExplorerCmd
        if not os.path.exists(os.path.abspath(pathToFXAPP)):
            self.lgr.error('Cannot find the FluidExplorer application executable')
            errorMsg = "Cannot find the FluidExplorer application executable!" + "\n" + "Please check if  the executable file is available."
            self.showMessageBox(errorMsg, 'warning')
            return

        # Run the worker thread
        if self.workThread:
            self.workThread.stop()

            # Start thread again
            self.workThread = WorkThread(self.externalCall)
            self.connect(self.workThread, QtCore.SIGNAL("update(QString)"), self.updateIndexFromThread)
            self.workThread.start()

        else:
            # Start thread
            self.workThread = WorkThread(self.externalCall)
            self.connect(self.workThread, QtCore.SIGNAL("update(QString)"), self.updateIndexFromThread)
            self.workThread.start()
コード例 #5
0
    def applyCacheClicked(self):
        # Check of corredt scene is opened
        currentSceneName = cmds.file(q=True, sceneName=True)
        sceneFromConfigFile = self.projectSettings.mayaFilePath
        isSameScene = ProjectDetailsViewUtils.checkIfCorrectSceneIsOpened(currentSceneName, sceneFromConfigFile)
        if not isSameScene:
            strError = 'Please open the correct maya scene first!\nPath: ' + sceneFromConfigFile
            self.lgr.warning('Please open the correct maya scene first! Path: %s', sceneFromConfigFile)
            self.showMessageBox(strError, 'warning')
            return

        # Same scene ...
        currentIndex = self.ui.comboBox_simulations.currentIndex()
        if currentIndex >= 1:
            self.PathToXMLCache = self.hashMapToXMLProjectFile[currentIndex-1]
            if self.PathToXMLCache == self.currentAnimationLoaded:
                # Do not load the cache which is already loaded! -> pass
                cmds.select(self.projectSettings.fluidContainerName, r=True)
                pass
            else:
                self.lgr.info('Load cache file: %s', self.PathToXMLCache)
                self.currentAnimationLoaded = self.PathToXMLCache

                # Set animation start and edn time
                canSetTime = ProjectDetailsViewUtils.setAnimationStartEndTime(self.projectSettings.animationStartTime, self.projectSettings.animationEndTime)
                if not canSetTime:
                    self.lgr.warning('Cannot set the start / end time of the animation')
                    self.showMessageBox('Cannot set the start / end time of the animation.', 'warning')

                # Load cache file
                try:
                    LoadFluidCacheFile.applyCacheFile(self.PathToXMLCache, self.projectSettings.fluidContainerName)
                except Exception as e:
                    self.lgr.error('%s', e.message)
                    self.showMessageBox(e.message, 'critical')

            # Set the values
            ProjectDetailsViewUtils.applyValuesFromXMLFile(self.PathToXMLCache, self.projectSettings.fluidContainerName)
コード例 #6
0
 def ScriptJobMethodCall(self):
     if self.workThread:
         self.workThread.stop()
     ProjectDetailsViewUtils.checkIfProcessExistsAndClose(self.FLUIDEXPLORER_APP_NAME)
     self.PathToXMLCache = ''
コード例 #7
0
 def initPreview(self, projectSettings):
     if projectSettings.cam_persp == '1' or projectSettings.cam_persp == '1':
         self.hashMapToGIF = ProjectDetailsViewUtils.getGIFHashMap(projectSettings)
     else:
         self.ui.checkBox_showPreview.setEnabled(False)