def closeEvent(self, event): # ProjectDetailsViewUtils.killProcess_WIN('fluidexplorer') # Stop thread if running if self.workThread: self.workThread.stop() # self.workThread.terminate() FluidExplorerUtils.killProcess('fluidexplorer')
def readSimulationDataPath(self, choosenDir): try: tmpProjectName = FluidExplorerUtils.readAttributeFromXmlConfigurationsFile(choosenDir, "ProjectName") tmpProjectPath = FluidExplorerUtils.readAttributeFromXmlConfigurationsFile(choosenDir, "ProjectPath") except: return "" path = tmpProjectPath + "/" + tmpProjectName return path
def __init__(self, parent=getMayaWindow()): # Initialize qt window super(ControlMainWindow, self).__init__(parent) self.ui = mainUi.Ui_MainWindow() self.ui = mainUi.Ui_MainWindow() self.ui.setupUi(self) # Show always on top self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) # Set up dark_orange style sheet self.setStyleSheet(ControlMainWindow.getStyleSheet()) # Url for the help page self.url = FLUID_EXPLORER_URL # Initialize connections and icons for the buttons self.createConnections() self.setupButtons() # Position of the plugin main window in the maya app self.centre() # Subprocess number self.pid = None # Close fluidexp if running FluidExplorerUtils.killProcess("fluidexplorer") # Details View self.detailsView = None if self.detailsView: self.detailsView.close() # For tests only runTests = True # runTests = False if runTests: import maya.mel as mel # Animation Start/End Time cmds.playbackOptions(animationStartTime=1.00) cmds.playbackOptions(animationEndTime=15.00) # Logging self.lgr = logging.getLogger("FluidExplorerPlugin")
def checkIfFluidNodeExistsInScene(self, choosenFile): tmpFluidNodeName = FluidExplorerUtils.readAttributeFromXmlConfigurationsFile(choosenFile, "FluidBoxName") self.lgr.info("Fluid container name from the settings file: %s", tmpFluidNodeName) if cmds.objExists(tmpFluidNodeName): return [True, ""] else: return [ False, "Cannot find the specified Fluid Container in the opened project!\n" "Please check if the the node '" + tmpFluidNodeName + "' exists.", ]
def checkPrjRoot(self, choosenDir, currentScene): isSameScene = True isNumberOk = True canReadConfigFile = True try: tmpSimulationName = FluidExplorerUtils.readAttributeFromXmlConfigurationsFile(choosenDir, "ProjectName") tmpPath = FluidExplorerUtils.readAttributeFromXmlConfigurationsFile(choosenDir, "MayaFilePath") self.lgr.info("Path of the maya file to load: %s", tmpSimulationName) except: canReadConfigFile = False errorText = "An error occured while loading the project configuration file!" return [canReadConfigFile, isNumberOk, isSameScene, errorText] if tmpSimulationName == "" or tmpSimulationName == None: canReadConfigFile = False errorText = "An error occured while loading the project configuration file!\nProperty: 'MayaFilePath'" return [canReadConfigFile, isNumberOk, isSameScene, errorText] # Check if same scene opened tmpSimulationName_low = tmpSimulationName.lower() # currentScene_low = currentScene.lower() currentScene_low = self.getPrpjectNameFromString(currentScene).lower() if tmpSimulationName_low != currentScene_low: isSameScene = False errorTxt = ( "Please load the correct maya scene file first!\nProject name: " + tmpSimulationName + "\nProject path: " + tmpPath ) return [canReadConfigFile, isNumberOk, isSameScene, errorTxt] return [canReadConfigFile, isNumberOk, isSameScene, ""]
def closeEvent(self, event): # close (x button) event FluidExplorerUtils.killProcess("fluidexplorer")