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)