Exemplo n.º 1
0
def main():
    MaxPlus.FileManager.Reset(True)

    w = QtWidgets.QWidget(MaxPlus.GetQMaxMainWindow(), QtCore.Qt.Dialog)
    _GCProtector.widgets.append(w)
    w.resize(250, 100)
    w.setWindowTitle('Spinner Test')

    main_layout = QtWidgets.QVBoxLayout()
    label = QtWidgets.QLabel("Click button to create a cylinder in the scene")
    main_layout.addWidget(label)

    spinner = QtWidgets.QSpinBox()
    spinner.setRange(1, 10)
    spinner.setValue(1)
    main_layout.addWidget(spinner)
    #spinner.valueChanged.connect(function)

    cylinder_btn = QtWidgets.QPushButton("Cylinder")
    cylinder_btn.clicked.connect(make_cylinder)
    main_layout.addWidget(cylinder_btn)

    #    textEdit = QtWidgets.QLineEdit()
    #    textEdit.setText("Edit box")
    #    main_layout.addWidget(textEdit)
    w.setLayout(main_layout)
    w.show()
Exemplo n.º 2
0
    def _get_dialog_parent(self):
        """
        Get the QWidget parent for all dialogs created through :meth:`show_dialog` :meth:`show_modal`.

        :return: QT Parent window (:class:`PySide.QtGui.QWidget`)
        """
        # Older versions of Max make use of special logic in _create_dialog
        # to handle window parenting. If we can, though, we should go with
        # the more standard approach to getting the main window.
        if self._max_version_to_year(self._get_max_version()) > 2020:
            # getMAXHWND returned a float instead of a long, which was completely
            # unusable with PySide in 2017 to 2020, but starting 2021
            # we can start using it properly.
            # This logic was taken from
            # https://help.autodesk.com/view/3DSMAX/2020/ENU/?guid=__developer_creating_python_uis_html
            import shiboken2
            from sgtk.platform.qt import QtGui

            widget = QtGui.QWidget.find(pymxs.runtime.windows.getMAXHWND())
            return shiboken2.wrapInstance(
                shiboken2.getCppPointer(widget)[0], QtGui.QMainWindow)
        elif self._max_version_to_year(self._get_max_version()) > 2017:
            #
            return MaxPlus.GetQMaxMainWindow()
        else:
            return super(MaxEngine, self)._get_dialog_parent()
Exemplo n.º 3
0
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()
Exemplo n.º 4
0
def GetMaxMainWindow():
    if MAXVERSION() >= MAX2021:
        import qtmax
        return qtmax.GetQMaxMainWindow()
    else:
        import MaxPlus
        return MaxPlus.GetQMaxMainWindow()
Exemplo n.º 5
0
	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()
Exemplo n.º 6
0
 def __init__(self, parent=MaxPlus.GetQMaxMainWindow()):
     super(Form, self).__init__(parent)
     self.setupUi(self)
     _GCProtector.widgets.append(self)
     self.updateSelectionLabel()
     self.explode_button.clicked.connect(self.do_explode)
     MaxPlus.NotificationManager.Register(
         MaxPlus.NotificationCodes.SelectionsetChanged,
         self.updateSelectionLabel)
Exemplo n.º 7
0
    def __init__(self, parent=MaxPlus.GetQMaxMainWindow()):
        super(Form, self).__init__(parent)

        self.resize(250, 300)
        self.setWindowTitle('Window')
        _GCProtector.widgets.append(self)

        main_layout = QtWidgets.QVBoxLayout()
        # Explode operations
        # PolyObject not yet supported in Python:
        '''
        groupbox1 = QtWidgets.QGroupBox("Explode Operations")
        radio1 = QtWidgets.QRadioButton("&Explode to Polygons")
        radio2 = QtWidgets.QRadioButton("Explode to Triangles")
        radio2.setChecked(True)
        
        vbox1 = QtWidgets.QVBoxLayout()
        vbox1.addWidget(radio1)
        vbox1.addWidget(radio2)
        groupbox1.setLayout(vbox1)
        
        main_layout.addWidget(groupbox1)
        '''

        #Explode options
        groupbox2 = QtWidgets.QGroupBox("Explode Options")
        self.checkbox1 = QtWidgets.QCheckBox("Add Shell Modifier")
        self.checkbox2 = QtWidgets.QCheckBox("Add Edit Mesh Modifier")
        self.checkbox3 = QtWidgets.QCheckBox("Collapse Modifier Stack")
        self.checkbox4 = QtWidgets.QCheckBox("Center Pivot")
        self.checkbox5 = QtWidgets.QCheckBox("Delete Original")
        vbox2 = QtWidgets.QVBoxLayout()
        vbox2.addWidget(self.checkbox1)
        vbox2.addWidget(self.checkbox2)
        vbox2.addWidget(self.checkbox3)
        vbox2.addWidget(self.checkbox4)
        vbox2.addWidget(self.checkbox5)

        label1 = QtWidgets.QLabel("Shell Offset:")
        self.spin1 = QtWidgets.QDoubleSpinBox()
        self.spin1.setMinimum(0.1)
        self.spin1.setSingleStep(0.1)
        self.spin1.setValue(0.1)
        vbox2.addWidget(label1)
        vbox2.addWidget(self.spin1)

        groupbox2.setLayout(vbox2)
        main_layout.addWidget(groupbox2)

        label = QtWidgets.QLabel("Explode Selected Objects")
        main_layout.addWidget(label)

        btn = QtWidgets.QPushButton("Explode")
        main_layout.addWidget(btn)
        self.setLayout(main_layout)

        btn.clicked.connect(self.do_explode)
Exemplo n.º 8
0
    def __init__(self, parent=MaxPlus.GetQMaxMainWindow()):
        super(KuesaLayersUi, self).__init__(parent)
        self.setWindowTitle('Kuesa Layer Manager')
        self.layout_main = QtWidgets.QVBoxLayout(self)

        bt_refresh = QtWidgets.QPushButton(self)
        bt_refresh.setText("Refresh")
        bt_refresh.setToolTip(
            "Refreshes the list and all layer status according to current selection."
        )
        bt_refresh.clicked.connect(self.callback_refresh)
        self.layout_main.addWidget(bt_refresh)
        self.list_layers = QtWidgets.QListWidget(self)
        self.list_layers.currentItemChanged.connect(self.callback_row_selected)
        self.layout_main.addWidget(self.list_layers)
        self.edit_name = QtWidgets.QLineEdit(self)
        self.edit_name.setToolTip(
            "Shows the name of the selected Layer. Edit this for new layers and for renaming existing layers."
        )
        self.layout_main.addWidget(self.edit_name)

        layout_buttons = QtWidgets.QHBoxLayout(self)
        bt_new = QtWidgets.QPushButton(self)
        bt_new.setText("New")
        bt_new.setToolTip(
            "Creates a new layer with the name specified above and attaches it to selected object(s)."
        )
        bt_new.clicked.connect(self.callback_new)
        layout_buttons.addWidget(bt_new)
        bt_rename = QtWidgets.QPushButton(self)
        bt_rename.setText("Rename")
        bt_rename.setToolTip("Renames selected layer as specified above.")
        bt_rename.clicked.connect(self.callback_rename)
        layout_buttons.addWidget(bt_rename)
        self.layout_main.addLayout(layout_buttons)

        layout_message = QtWidgets.QHBoxLayout(self)
        self.lb_message = QtWidgets.QLabel(self)
        self.lb_message.setAlignment(QtCore.Qt.AlignRight)
        layout_message.addWidget(self.lb_message)
        self.lb_message_sign = QtWidgets.QLabel(self)
        self.lb_message_sign.setFixedWidth(24)
        self.lb_message_sign.setAlignment(QtCore.Qt.AlignCenter)
        layout_message.addWidget(self.lb_message_sign)
        self.layout_main.addLayout(layout_message)

        self.setLayout(self.layout_main)
        self.show()

        self.block_count = 0

        self.callback_refresh()

        #todo: do we need callbacks for new scene, selection, etc.?

        self.finished.connect(self.callback_close_dialog)
 def __init__(self, parent=MaxPlus.GetQMaxMainWindow()):
     super(VertexColorView, self).__init__(parent)
     self.targetNodes = []
     self.coler_list = []
     self.obj_name = u""
     self.obj_type = u"ploy"
     self.setWindowTitle(u"버텍스 칼라 뷰")
     rt.disableSceneRedraw()
     self.progress()
     self.initUI()
     rt.enableSceneRedraw()
Exemplo n.º 10
0
def main():
    if MaxPlus:
        main_window = MaxPlus.GetQMaxMainWindow()
    else:
        main_window_widget = QWidget.find(int(runtime.windows.getMAXHWND()))
        main_window = shiboken2.wrapInstance(
            shiboken2.getCppPointer(main_window_widget)[0], QMainWindow)

    msg_box = QMessageBox(main_window)
    msg_box.setText('Hello World!')
    msg_box.show()
Exemplo n.º 11
0
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()
Exemplo n.º 12
0
def getMainWindow():
    """Returns the main window.

    Source: https://stackoverflow.com/a/46739609/2403000, https://autode.sk/36jLSbE
    """
    try:
        return MaxPlus.GetQMaxMainWindow()
    except AttributeError:
        for widget in QtWidgets.QApplication.topLevelWidgets():
            if type(widget
                    ) == QtWidgets.QWidget and widget.parentWidget() is None:
                return widget
Exemplo n.º 13
0
    def _get_dialog_parent(self):
        """
        Get the QWidget parent for all dialogs created through :meth:`show_dialog` :meth:`show_modal`.

        :return: QT Parent window (:class:`PySide.QtGui.QWidget`)
        """
        # Older versions of Max make use of special logic in _create_dialog
        # to handle window parenting. If we can, though, we should go with
        # the more standard approach to getting the main window.
        if self._max_version_to_year(self._get_max_version()) > 2019:
            return MaxPlus.GetQMaxMainWindow()
        else:
            return super(MaxEngine, self)._get_dialog_parent()
Exemplo n.º 14
0
    def __init__(self, parent=MaxPlus.GetQMaxMainWindow()):
        super(RenderFarmingBarnUI, self).__init__(parent)

        # ---------------------------------------------------
        #                 Layouts
        # ---------------------------------------------------

        self._main_layout = QtW.QVBoxLayout()
        self._sheep_layout = QtW.QHBoxLayout()

        # ---------------------------------------------------
        #                 Window
        # ---------------------------------------------------

        self.setWindowTitle("Barn - RenderFarming{}".format(__version__))

        # ---------------------------------------------------
        #                 Widgets
        # ---------------------------------------------------

        # A list of constructors for objects inheriting the Sheep class

        self._sheep = [
            ToggleSphericalWidget(),
            ClearMaterial(),
            WireColorEdits(),
            VisibilityToggle(),
            QuickExporter()
        ]

        self._display_message_mw = MessageWidget()

        # ---------------------------------------------------
        #                 Initialization
        # ---------------------------------------------------

        for widget in self._sheep:
            self._sheep_layout.addWidget(widget)
            widget.Message.connect(self._display_message_handler)
            widget.InitStatusBar.connect(self._display_status_bar_handler)
            widget.StAdd.connect(self._add_status_bar_handler)

        # ---------------------------------------------------
        #                 Final Setup
        # ---------------------------------------------------

        self.setLayout(self._main_layout)
        self._main_layout.addLayout(self._sheep_layout)
        self._main_layout.addWidget(self._display_message_mw)
Exemplo n.º 15
0
 def __init__(self, parent=MaxPlus.GetQMaxMainWindow()):
     super(FileToolUI, self).__init__(parent)
     RT.clearlistener()
     # print("FileToolUI __init__")
     self.m_main_dir_path = RT.getFilenamePath(RT.maxfilepath)
     self.m_backup_dir_path = self.m_main_dir_path + FileToolUI._backup_dir_name
     self.m_current_MaxFilePath = RT.getFilenamePath(RT.maxfilepath)
     if self.m_current_MaxFilePath.endswith("_bak\\"):
         self._isCurrentFolder_backupFolder = True
     self.m_current_maxfile_name = RT.getFilenameFile(
         RT.maxFileName).split(',')[0]
     self.m_current_file_set = self.GetCurrentFileNameSet()
     self.fileSet_List = []
     self.setWindowTitle(u"파일툴 - " + FileToolUI_var_str)
     self.initUI()
Exemplo n.º 16
0
    def __init__(self, parent=MaxPlus.GetQMaxMainWindow()):
        super(AnimRef, self).__init__(parent)

        self.init()

        self.setWindowFlags(QtCore.Qt.WindowType.Window)
        self.resize(720, 460)
        self.setWindowTitle("AnimRef v1.3.1")

        self.defineVariables()
        self.defineSignals()
        self.defineIcons()
        self.start()

        self.setWindowIcon(self.icon)
        self.timer = QtCore.QTimer(self)
Exemplo n.º 17
0
def main():
    w = QtWidgets.QWidget(MaxPlus.GetQMaxMainWindow())
    _GCProtector.widgets.append(w)
    w.resize(250, 100)
    w.setWindowTitle('Combine 2 Nodes')

    main_layout = QtWidgets.QVBoxLayout()
    label = QtWidgets.QLabel("Combine 2 Nodes")
    main_layout.addWidget(label)

    combine_btn = QtWidgets.QPushButton("Combine")
    combine_btn.clicked.connect(CombineNodes)
    main_layout.addWidget(combine_btn)

    w.setLayout(main_layout)
    w.show()
Exemplo n.º 18
0
 def __init__(self):
     QMainWindow.__init__(self, MaxPlus.GetQMaxMainWindow())
     self.resize(800, 600)
     self.setWindowTitle("Max Tools Updater")
     self.mainWidget = QWidget(self)
     self.central_layout = QVBoxLayout()
     menu_bar = QMenuBar()
     settingAct = QAction("&Settings", self)
     settingAct.setStatusTip("Open setting window")
     settingAct.connect(SIGNAL("triggered()"), self, SLOT("open()"))
     menu_bar.addAction(settingAct)
     self.mainWidget.setLayout(self.central_layout)
     self.central_layout.addWidget(menu_bar)
     self.tabs = QTabWidget()
     self.setCentralWidget(self.mainWidget)
     self.activePackageWidgets = list()
Exemplo n.º 19
0
def createInstance():
    app = QtWidgets.QApplication.instance()
    if not app:
        app = QtWidgets.QApplication([])

    try:
        mainWindow = MaxPlus.GetQMaxMainWindow()
        mainWindow.setObjectName('MaxWindow')
    except:
        mainWindow = [
            x for x in app.topLevelWidgets() if x.objectName() == 'MayaWindow'
        ][0]

    hotBox = HotBox(parent=mainWindow)
    _GCProtector.widgets.append(hotBox)

    return hotBox
Exemplo n.º 20
0
 def __init__(self, parent=MaxPlus.GetQMaxMainWindow()):
     super(ChangeFileNameUI, self).__init__(parent)
     #
     self._input_file_nameSet = FileNameSet()
     self._set_file_name = u''
     #
     self.main_layout = QtWidgets.QVBoxLayout()
     self.input_qlineedit = QtWidgets.QLineEdit()
     self.main_layout.addWidget(self.input_qlineedit)
     self.rename_btn = QtWidgets.QPushButton(u'변경 실행',
                                             default=True,
                                             autoDefault=True)
     self.main_layout.addWidget(self.rename_btn)
     self.rename_btn.clicked.connect(self.renameFiles)
     # print('init')
     self.setLayout(self.main_layout)
     self.setWindowTitle(u'이름 수정')
Exemplo n.º 21
0
 def __init__(self, parent=MaxPlus.GetQMaxMainWindow()):
     #print('BipedMainWindow __init__')
     in_time = timeit.default_timer()
     super(BipedMainWindow, self).__init__(parent)
     #print('super: BipedMainWindow클래스 실행 완료 시간 : {}'.format(str(timeit.default_timer() - in_time)))
     title_text = u'{} - {}'.format(self.m_title_text,
                                    self.m_file_log.Get())
     self.setWindowTitle(title_text)
     self.m_biped_list = self.GetBipedComs()
     #self.m_biped_class = bipedSelect(rt.getnodeByName('Bip001'))
     self.CreditLayout()
     self.ConnectWidget()
     #바이페드가 여러게 생성되었을 경우 초기값을 돌려줌
     if self.m_biped_class is not None:
         self.m_biped_class = self.m_biped_list[0]
     self.m_bip_file_dir = os.path.join(rt.maxfilepath,
                                        self.m_bip_path_folder_name)
     self.show()
def main():
    MaxPlus.FileManager.Reset(True)
    mainWindow = MaxPlus.GetQMaxMainWindow()


    # QAction reused by both dockable widgets.
    cylinderIconPath = os.path.dirname(os.path.realpath(__file__)) + "\\demoPySideToolBarCylinderIcon_48.png"
    cylinderIcon = QtGui.QIcon(cylinderIconPath)
    createCylAction = QtWidgets.QAction(cylinderIcon, u"Create Cylinder", mainWindow)
    createCylAction.triggered.connect(make_cylinder)


    # QDockWidget construction and placement over the main window
    dockWidget = QtWidgets.QDockWidget(mainWindow)
    _GCProtector.widgets.append(dockWidget)  # Required to avoid destruction of widget after script has completed execution

    dockWidget.setObjectName("Creators")  # Required for position persistence
    dockWidget.setWindowTitle("Creators") # Required to see dock widget name in toolbar customize popup
    dockToolButton = QtWidgets.QToolButton()
    dockToolButton.setAutoRaise(True)
    dockToolButton.setDefaultAction(createCylAction)
    dockToolButton.setToolButtonStyle(QtCore.Qt.ToolButtonTextOnly)
    dockWidget.setWidget(dockToolButton)

    mainWindow.addDockWidget(QtCore.Qt.LeftDockWidgetArea, dockWidget)
    dockWidget.setFloating(True)
    dockWidget.show()

	
    # QToolBar construction and attachement to main window
    toolBarWidget = QtWidgets.QToolBar(mainWindow)
    _GCProtector.widgets.append(dockWidget)  # Required to avoid destruction of widget afetr script has completed execution

    toolBarWidget.setObjectName("Creators TB")  # Required for position persistence
    toolBarWidget.setWindowTitle("Creators TB") # Required to see toolbar name in toolbar customize popup
    toolBarWidget.setFloatable(True)
    toolBarWidget.addAction(createCylAction)

    mainWindow.addToolBar(QtCore.Qt.BottomToolBarArea, toolBarWidget)
    toolBarWidget.show()

    toolBarPos = getPosToDockToolBar(dockWidget)
    makeToolBarFloating(toolBarWidget, toolBarPos)
Exemplo n.º 23
0
def main():
    dialog = Dialog(MaxPlus.GetQMaxMainWindow())
    dialog.resize(WIDTH, HEIGHT)
    _GCProtector.widgets.append(dialog)
	
    wolfWidget.setWindowTitle("PyWolf Viewer")
    wolfWidget.resize(WIDTH, HEIGHT)
    _GCProtector.widgets.append(wolfWidget)

    title = "Wolf Engine Plugin for Autodesk 3ds Max "  + wolf_version
    dialog.setWindowTitle(title)
	
	#create first tab	
    main_tab = QTabWidget()
    main_tab.addTab(init_pywolf(), "3Ds Max Helper")
    main_tab.addTab(init_helper(), "Wolf Viewer")
	
    clear_log()
    if wolf_version == "":
	    logger.log("Error, could not find PyWolf")
    else:
		#run main thread of wolf engine
        run_wolf()

    #clear log
	clear_log_btn = QPushButton("Clear Log")
	clear_log_btn.clicked.connect(clear_log)

	#create vertex box layout
	main_layout = QVBoxLayout()
	main_layout.addWidget(main_tab)
	main_layout.addWidget(logger)
	main_layout.addWidget(clear_log_btn)
	
    dialog.setLayout(main_layout)
    dialog.setWindowModality(Qt.NonModal)
    dialog.show()
	
    #register callbacks
    callbacks.register_all()
    
    print title + " just launched"
Exemplo n.º 24
0
    def __init__(self, parent=MaxPlus.GetQMaxMainWindow()):
        super(QTimeSegDialogUI, self).__init__(parent)

        self._clg = logging.getLogger("renderFarming.UI.SATSDialog")

        self._dialog_box = QTimeSegDialogDefinition()

        main_layout = QtW.QVBoxLayout()
        main_layout.addWidget(self._dialog_box)

        self.setLayout(main_layout)

        self._start_frame = 0
        self._end_frame = 0
        self._nth_frame = 1

        self._status_message = str()

        # ---------------------------------------------------
        #                 Widget Definitions
        # ---------------------------------------------------

        self._sats_btnbx = self._dialog_box.sats_btnbx

        self._sats_end_sb = self._dialog_box.sats_end_sb
        self._sats_start_sb = self._dialog_box.sats_start_sb
        self._sats_evr_nth_frm_sb = self._dialog_box.sats_evr_nth_frm_sb

        self._sats_end_sb.setValue(int(rt.animationRange.end))
        self._sats_start_sb.setValue(int(rt.animationRange.start))
        self._sats_evr_nth_frm_sb.setValue(int(rt.rendNThFrame))

        # ---------------------------------------------------
        #               Function Connections
        # ---------------------------------------------------

        # noinspection PyUnresolvedReferences
        self._sats_btnbx.accepted.connect(self._sats_accept_handler)
        # noinspection PyUnresolvedReferences
        self._sats_btnbx.rejected.connect(self._sats_reject_handler)
Exemplo n.º 25
0
def main():
    MaxPlus.FileManager.Reset(True)

    w = QtWidgets.QWidget(MaxPlus.GetQMaxMainWindow(), QtCore.Qt.Dialog)
    _GCProtector.widgets.append(w)
    w.resize(250, 100)
    w.setWindowTitle('PySide Qt Window')

    main_layout = QtWidgets.QVBoxLayout()
    label = QtWidgets.QLabel("Click button to create a cylinder in the scene")
    main_layout.addWidget(label)

    cylinder_btn = QtWidgets.QPushButton("Cylinder")
    cylinder_btn.clicked.connect(make_cylinder)
    main_layout.addWidget(cylinder_btn)

    textEdit = QtWidgets.QLineEdit()
    textEdit.setText("Edit box")
    main_layout.addWidget(textEdit)

    w.setLayout(main_layout)
    w.show()
Exemplo n.º 26
0
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()
Exemplo n.º 27
0
def main():

    #get main win
    mainWindow = MaxPlus.GetQMaxMainWindow()

    #get ptgui widget
    dockWidgets = [
        x for x in mainWindow.children() if x.__class__.__name__ == 'PTGUI'
    ]

    ptdlg = None

    #if widget in array dont run - else run
    if (len(dockWidgets) > 0):
        ptdlg = dockWidgets[0]
        print '\n', "PolygonTools is Already Running.", '\n'
    else:
        ptdlg = gui.PTGUI(parent=mainWindow)
        print '\n', "PolygonTools Started!", '\n'

    #window properties
    ptdlg.setFloating(True)
    ptdlg.show()
Exemplo n.º 28
0
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
Exemplo n.º 29
0
    def getCurrentVersion2(packageConfig):
        try:
            if packageConfig.connection_type == ConnectionType.LOCAL:
                server_folder = packageConfig.network_path
                server_folder = os.path.join(server_folder,
                                             packageConfig.package_name)
                serverFileVersion = os.path.join(server_folder, "version.xml")
                version = utility.get_release_version(serverFileVersion)
                return version

            if packageConfig.connection_type == ConnectionType.FTP:
                fileName = "version.xml"
                tempDownload = tempfile.NamedTemporaryFile(suffix=".xml",
                                                           delete=False)
                filePath = os.path.abspath(tempDownload.name)
                gFile = open(filePath, "wb")
                ftps = ftplib.FTP_TLS(packageConfig.host)
                ftps.login(
                    packageConfig.username, packageConfig.password
                )  # login anonymously before securing control channel
                ftps.prot_p(
                )  # switch to secure data connection.. IMPORTANT! Otherwise, only the user and password is encrypted and not all the file data.
                ftps.cwd("{0}/{1}/".format(packageConfig.ftp_path,
                                           packageConfig.package_name))

                ftps.retrbinary('RETR ' + fileName, gFile.write, 1024)
                ftps.quit()
                gFile.flush()
                gFile.close()
                return utility.get_release_version(filePath)
        except:
            msg = QMessageBox(MaxPlus.GetQMaxMainWindow())
            msg.setText(
                "Impossible to retrieve a connection for package {0}.\nMake sure connection settings are valids"
                .format(packageConfig.package_name))
            msg.show()
Exemplo n.º 30
0
import sys
import MaxPlus
from functools import partial
from PySide2 import QtCore
from PySide2 import QtGui
from PySide2 import QtWidgets
from pymxs import runtime as cmds
#init rtt functions
sys.path.append(os.path.dirname(__file__))
import rttFunctions as rtt
reload(rtt)
#Ui file
uifile = os.path.join(os.path.dirname(os.path.dirname(__file__)),
                      "gui\\rtt_GlobalOption.ui")
uiType, baseType = MaxPlus.LoadUiType(uifile)
mainWindow = MaxPlus.GetQMaxMainWindow()


class _GCProtector(object):
    widgets = []


class RttWidgetGlobalOptions(baseType, uiType):
    def __init__(self, parent=mainWindow, settings="draft"):
        baseType.__init__(self)
        uiType.__init__(self)
        self.settings = settings
        self.setupUi(self)
        self.populateSettings(self.settings)
        self.setUpConnections()