def show(): se = scriptEditor.scriptEditorClass(parent=MaxPlus.GetQMaxWindow()) se.installEventFilter(MaxDialogEvents()) se.runCommand('import MaxPlus') se.MaxEventFilter = MaxDialogEvents() se.installEventFilter(se.MaxEventFilter) se.show()
def getMainWindow(): '''This function should be overriden''' if BoilerDict['Environment'] == 'Maya': win = omui.MQtUtil_mainWindow() ptr = wrapInstance(long(win), QtWidgets.QMainWindow) return ptr if BoilerDict['Environment'] == '3dsMax': try: mainWindow = MaxPlus.GetQMaxWindow() except AttributeError: None None None mainWindow = MaxPlus.GetQMaxMainWindow() return mainWindow if BoilerDict['Environment'] == 'Houdini': return hou.qt.mainWindow() if BoilerDict['Environment'] == 'Nuke': for obj in QtWidgets.QApplication.instance().topLevelWidgets(): if ( obj.inherits("QMainWindow") and obj.metaObject().className() == "Foundry::UI::DockMainWindow" ): return obj else: raise RuntimeError("Could not find DockMainWindow instance") return None if BoilerDict['Environment'] == 'Hiero': return hiero.ui.mainWindow()
def startup(self, origin): origin.timer.stop() if psVersion == 1: origin.messageParent = MaxPlus.GetQMaxWindow() else: origin.messageParent = MaxPlus.GetQMaxMainWindow() MaxPlus.NotificationManager.Register(MaxPlus.NotificationCodes.FilePostOpenProcess , origin.sceneOpen) origin.startasThread()
def show(): try: qtwindow = MaxPlus.GetQMaxWindow() except: qtwindow = MaxPlus.GetQMaxMainWindow() se = scriptEditor.scriptEditorClass(parent=qtwindow) #se.installEventFilter(MaxDialogEvents()) se.runCommand('import MaxPlus') #se.MaxEventFilter = MaxDialogEvents() #se.installEventFilter(se.MaxEventFilter) se.show()
def openKrakenEditor(): print 'Releasing the Kraken!' splash = KrakenSplash(app) splash.show() try: MaxPlus.CUI.DisableAccelerators() window = KrakenWindow(parent=MaxPlus.GetQMaxWindow()) window.addFocusInCallback(maxFocusInCallback) window.addFocusOutCallback(maxFocusOutCallback) _GCProtector.widgets.append(window) window.show() except Exception, e: print e
def version_updater(): """Helper function for version_updater UI for Max """ from anima.utils import do_db_setup do_db_setup() from anima import ui ui.SET_PYSIDE() from anima.ui import version_updater from anima.env import max as max_env m = max_env.Max() import MaxPlus max_window = MaxPlus.GetQMaxWindow() version_updater.UI(environment=m, executor=Executor(), parent=max_window)
def getMainWindow(): """This function should be overriden""" if BoilerDict["Environment"] == "Maya": win = omui.MQtUtil_mainWindow() ptr = wrapInstance(long(win), QtWidgets.QMainWindow) return ptr elif BoilerDict["Environment"] == "3dsMax": return MaxPlus.GetQMaxWindow() elif BoilerDict["Environment"] == "Houdini": return hou.qt.mainWindow() elif BoilerDict["Environment"] == "Nuke": # TODO // Needs a main window getter for nuke return None else: return None
def get_max_window(): """ Returns an instance of the current Max window """ # 17000 = Max 2015 # 18000 = Max 2016 # 19000 = Max 2017 # 20000 = Max version = int(helpers.get_max_version(as_year=True)) if version == 2014: import ctypes import ctypes.wintypes # Swig Object Containing HWND * pyobject = MaxPlus.Win32.GetMAXHWnd() # Getting actual HWND* mem address hwndptr = pyobject.__int__() # Casting to HWD* of Void* ptr = ctypes.c_void_p(hwndptr) # Getting actual Void* mem address (should be same as hwndptr) ptrvalue = ptr.value # Getting derefeerence Void* and get HWND as c_longlong clonglong = ctypes.c_longlong.from_address(ptrvalue) # Getting actual HWND value from c_longlong longhwnd = clonglong.value # Getting derefeerence Void* and get HWND as c_longlong chwnd = ctypes.wintypes.HWND.from_address(ptrvalue) # Getting actual HWND value from c_longlong hwnd = clonglong.value return hwnd elif version == 2015 or version == 2016: return long(MaxPlus.Win32.GetMAXHWnd()) elif version == 2017: return MaxPlus.GetQMaxWindow() else: return MaxPlus.GetQMaxMainWindow()
def app_window(): global APP_HANDLE if APP_HANDLE == None: if HOST == MAYA or HOST == MAYA2: mayaMainWindowPtr = omui.MQtUtil.mainWindow() mayaMainWindow = wrapInstance(long(mayaMainWindowPtr), Qt.QtWidgets.QWidget) APP_HANDLE = mayaMainWindow elif HOST == HOUDINI: #hou.ui.mainQtWindow() APP_HANDLE = hou.qt.mainWindow() elif HOST == NUKE: for obj in Qt.QtWidgets.QApplication.topLevelWidgets(): if (obj.inherits('QMainWindow') and obj.metaObject().className() == 'Foundry::UI::DockMainWindow'): APP_HANDLE = obj elif HOST == MAX: try: APP_HANDLE = MaxPlus.GetQMaxMainWindow( ) if QT5 else MaxPlus.GetQMaxWindow() except: # Max 2016 pass elif HOST == C4D: # TODO: No Qt windows. Mb transform main window handle? pass elif HOST == BLENDER: # TODO: No Qt windows. Mb transform main window handle? pass elif HOST == KATANA: for obj in UI4.App.Application.QtGui.qApp.topLevelWidgets(): if type(obj).__name__ == 'KatanaWindow': APP_HANDLE = obj return APP_HANDLE
def startup(self, origin): origin.timer.stop() if psVersion == 1: origin.messageParent = MaxPlus.GetQMaxWindow() else: origin.messageParent = MaxPlus.GetQMaxMainWindow()
def main(): #MaxPlus.FileManager.Reset(True) tool = LevelOfDetailChecker(parent=MaxPlus.GetQMaxWindow()) _GCProtector.widgets.append(tool) tool.show()
def main(): #MaxPlus.FileManager.Reset(True) form = Form() form.setParent(MaxPlus.GetQMaxWindow()) MaxPlus.MakeQWidgetDockable(form, 4) form.show()
image.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter) image.setMinimumWidth(256) main_layout.addWidget(image) self.btn = btn self.edt = edt self.image = image self.list = list self.proxy = proxy self.model = model self.selection_model = selection_model def currentChanged(self, current, previous): row = current.row() proxyIndex = self.proxy.index(row, 0) sourceIndex = self.proxy.mapToSource(proxyIndex) row = sourceIndex.row() image = self.proxy.sourceModel().icons[row] self.image.setPixmap(QPixmap(image)) def set_icon(self): i = self.list.currentIndex() if i is not None: path = self.model.data(i, Qt.DisplayRole) ico = QIcon(path) self.btn.setIcon(ico) if __name__ == '__main__': wnd = IconExplorer(MaxPlus.GetQMaxWindow()) wnd.show()
def startup(self): self.elapsed += 1 if self.elapsed > self.maxwait: self.timer.stop() if self.app == 1: self.timer.stop() if psVersion == 1: self.messageParent = MaxPlus.GetQMaxWindow() else: self.messageParent = MaxPlus.GetQMaxMainWindow() self.programName = "3dsMax" elif self.app == 2: if hou.ui.mainQtWindow() is not None: self.timer.stop() self.messageParent = hou.ui.mainQtWindow() if hou.ui.curDesktop().name() == "Technical": curShelfSet = "shelf_set_td" else: curShelfSet = "shelf_set_1" curShelves = hou.ShelfSet.shelves( hou.shelves.shelfSets()[curShelfSet]) shelfName = "pandora-v1.0.0" if not shelfName in hou.shelves.shelves(): news = hou.shelves.newShelf( file_path=hou.shelves.defaultFilePath(), name=shelfName, label="Pandora") hou.ShelfSet.setShelves( hou.shelves.shelfSets()[curShelfSet], curShelves + (news, )) submitterScript = "import PandoraInit\n\nPandoraInit.pandoraCore.openSubmitter()" if hou.shelves.tool("pandora_submitter") is not None: hou.shelves.tool("pandora_submitter").destroy() hou.shelves.newTool( file_path=hou.shelves.defaultFilePath(), name="pandora_submitter", label="Submitter", help="\"\"\"Open the Pandora renderjob submitter\"\"\"", script=submitterScript, icon=os.path.join(self.pandoraRoot, "Scripts", "UserInterfacesPandora", "pandoraSubmitter.png").replace( "\\", "/")) renderHandlerScript = "import PandoraInit\n\nPandoraInit.pandoraCore.openRenderHandler()" if hou.shelves.tool("pandora_renderhandler") is not None: hou.shelves.tool("pandora_renderhandler").destroy() hou.shelves.newTool( file_path=hou.shelves.defaultFilePath(), name="pandora_renderhandler", label="Render-Handler", help="\"\"\"Open the Pandora Render-Handler\"\"\"", script=renderHandlerScript, icon=os.path.join(self.pandoraRoot, "Scripts", "UserInterfacesPandora", "pandoraRenderHandler.png").replace( "\\", "/")) settingsScript = "import PandoraInit\n\nPandoraInit.pandoraCore.openSettings()" if hou.shelves.tool("pandora_settings") is not None: hou.shelves.tool("pandora_settings").destroy() hou.shelves.newTool( file_path=hou.shelves.defaultFilePath(), name="pandora_settings", label="Settings", help="\"\"\"Open the Pandora settings\"\"\"", script=settingsScript, icon=os.path.join(self.pandoraRoot, "Scripts", "UserInterfacesPandora", "pandoraSettings.png").replace( "\\", "/")) hou.Shelf.setTools( hou.shelves.shelves()[shelfName], (hou.shelves.tool("pandora_submitter"), hou.shelves.tool("pandora_renderhandler"), hou.shelves.tool("pandora_settings"))) else: pandoraShelf = hou.shelves.shelves()[shelfName] if pandoraShelf not in curShelves: hou.ShelfSet.setShelves( hou.shelves.shelfSets()[curShelfSet], curShelves + (pandoraShelf, )) self.programName = "Houdini" else: return None elif self.app == 3: import maya.mel as mel import maya.OpenMaya as api for obj in qApp.topLevelWidgets(): if obj.objectName() == 'MayaWindow': self.messageParent = obj break topLevelShelf = mel.eval('string $m = $gShelfTopLevel') if cmds.shelfTabLayout(topLevelShelf, query=True, tabLabelIndex=True) == None: return None self.timer.stop() self.programName = "Maya" elif self.app == 6: self.timer.stop() self.messageParent = QWidget() self.messageParent.setWindowFlags(self.messageParent.windowFlags() ^ Qt.WindowStaysOnTopHint) self.programName = "Blender"
def getMainWindow(): try: return MaxPlus.GetQMaxWindow() except: return QtWidgets.QWidget(MaxPlus.GetQMaxMainWindow(), QtCore.Qt.Dialog)
# primaryBoneNameList = ['Bip001 L Clavicle', 'Bip001 L UpperArm', 'Bip001 L Forearm'] primaryBoneNameList = ['Root'] poseLearner = ln.PoseLearner(regularMesh, referenceMesh, primarySkinMod, primaryBoneNameList, self.sysOption) poseLearner.processStart() # re-select the mesh to refresh the modifiers list displaying rt.select(regularMesh) class MainWindow(QtGui.QMainWindow): def __init__(self, parent): super(MainWindow, self).__init__(parent) # self.setWindowFlags(self.windowFlags() | QtCore.Qt.WindowStaysOnTopHint) ui = LODHelpersUI(self) self.setCentralWidget(ui) maxWindow = mp.GetQMaxWindow() mainWindow = MainWindow(maxWindow) mainWindow.show() mainWindow.move(mainWindow.pos().x() + 500, mainWindow.pos().y()) ########## UI ############# class _GCProtector(object): widgets = [] _GCProtector.widgets.append(mainWindow)
def __init__(self, parent=MaxPlus.GetQMaxWindow()): super(mainWindow, self).__init__(parent) self.setupUi(self) self.show() self.setWindowTitle('Widget')