Пример #1
0
    def _create_dialog(self, title, bundle, widget, parent):
        """
        Parent function override to install event filtering in order to allow proper events to
        reach window dialogs (such as keyboard events).
        """
        dialog = sgtk.platform.Engine._create_dialog(self, title, bundle,
                                                     widget, parent)

        # Attaching the dialog to Max is a matter of whether this is a new
        # enough version of 3ds Max. Anything short of 2016 SP1 is going to
        # fail here with an AttributeError, so we can just catch that and
        # continue on without the new-style parenting.
        if self._parent_to_max and self._max_version_to_year(
                self._get_max_version()) <= 2019:
            previous_parent = dialog.parent()
            try:
                self.log_debug("Attempting to attach dialog to 3ds Max...")
                # widget must be parentless when calling MaxPlus.AttachQWidgetToMax
                dialog.setParent(None)
                MaxPlus.AttachQWidgetToMax(dialog)
                self.log_debug("AttachQWidgetToMax successful.")
            except AttributeError:
                dialog.setParent(previous_parent)
                self.log_debug(
                    "AttachQWidgetToMax not available in this version of 3ds Max."
                )

        dialog.installEventFilter(self.dialogEvents)

        # Add to tracked dialogs (will be removed in eventFilter)
        self._safe_dialog.append(dialog)

        # Apply the engine-level stylesheet.
        self._apply_external_styleshet(self, dialog)

        return dialog
Пример #2
0
 def attach_qt_widget_to_max(self, widget):
     """Attaches Qt widget to Max GUI."""
     MaxPlus.AttachQWidgetToMax(widget, False)
Пример #3
0
def store_widget_3dsmax(self):
   MaxPlus.AttachQWidgetToMax(self)