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()
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)