Include context switching during regular File->Open operation#17
Include context switching during regular File->Open operation#17tk421storm wants to merge 5 commits into
Conversation
| #if we don't have an engine, we'll need to do some of the legwork ourselves | ||
| def showWarningDialog(message, details=None): | ||
|
|
||
| parent=QtGui.QApplication.activeWindow() |
There was a problem hiding this comment.
indentation contains tabs
local variable 'parent' is assigned to but never used
missing whitespace around operator
over-indented
|
|
||
| #if we don't have an engine, we'll need to do some of the legwork ourselves | ||
| def showWarningDialog(message, details=None): | ||
|
|
There was a problem hiding this comment.
blank line contains whitespace
indentation contains tabs
| self._layout.addWidget(self._text) | ||
|
|
||
| #if we don't have an engine, we'll need to do some of the legwork ourselves | ||
| def showWarningDialog(message, details=None): |
| self._layout.addWidget(self._label) | ||
| self._layout.addWidget(self._text) | ||
|
|
||
| #if we don't have an engine, we'll need to do some of the legwork ourselves |
There was a problem hiding this comment.
block comment should start with '# '
| self._layout = QtGui.QVBoxLayout(self) | ||
| self._layout.addWidget(self._label) | ||
| self._layout.addWidget(self._text) | ||
|
|
There was a problem hiding this comment.
blank line contains whitespace
indentation contains tabs
|
|
||
| self._label = QtGui.QLabel("<h3>"+message+"</h3>") | ||
| self._label.setTextFormat(QtCore.Qt.RichText) | ||
| self._text = QtGui.QTextEdit() |
| self.setObjectName("SGTK_WARNING_DIALOG") | ||
|
|
||
| self._label = QtGui.QLabel("<h3>"+message+"</h3>") | ||
| self._label.setTextFormat(QtCore.Qt.RichText) |
|
|
||
| self.setObjectName("SGTK_WARNING_DIALOG") | ||
|
|
||
| self._label = QtGui.QLabel("<h3>"+message+"</h3>") |
There was a problem hiding this comment.
indentation contains tabs
missing whitespace around arithmetic operator
|
|
||
| super(WarningDialog, self).__init__(*args, **kwargs) | ||
|
|
||
| self.setObjectName("SGTK_WARNING_DIALOG") |
| def __init__(self, message, details=None, *args, **kwargs): | ||
|
|
||
| super(WarningDialog, self).__init__(*args, **kwargs) | ||
|
|
There was a problem hiding this comment.
blank line contains whitespace
indentation contains tabs
|
|
||
| def __init__(self, message, details=None, *args, **kwargs): | ||
|
|
||
| super(WarningDialog, self).__init__(*args, **kwargs) |
There was a problem hiding this comment.
indentation contains tabs
over-indented
| class WarningDialog(QtGui.QWidget): | ||
|
|
||
| def __init__(self, message, details=None, *args, **kwargs): | ||
|
|
There was a problem hiding this comment.
blank line contains whitespace
indentation contains tabs
| #if we have an engine, we can simply use this class | ||
| class WarningDialog(QtGui.QWidget): | ||
|
|
||
| def __init__(self, message, details=None, *args, **kwargs): |
There was a problem hiding this comment.
indentation contains tabs
over-indented
|
|
||
| #if we have an engine, we can simply use this class | ||
| class WarningDialog(QtGui.QWidget): | ||
|
|
There was a problem hiding this comment.
blank line contains whitespace
indentation contains tabs
| from sgtk.platform.qt import QtGui, QtCore #@UnresolvedImport | ||
|
|
||
| #if we have an engine, we can simply use this class | ||
| class WarningDialog(QtGui.QWidget): |
| #but leave tools that can direct a user back to the correct context (ie Workfiles) | ||
|
|
||
| #engine._remove_shotgun_menu() | ||
|
|
| #TODO: replace with command that just remove tools requiring specific context (ie Publish) | ||
| #but leave tools that can direct a user back to the correct context (ie Workfiles) | ||
|
|
||
| #engine._remove_shotgun_menu() |
There was a problem hiding this comment.
block comment should start with '# '
|
|
||
| #TODO: replace with command that just remove tools requiring specific context (ie Publish) | ||
| #but leave tools that can direct a user back to the correct context (ie Workfiles) | ||
|
|
| logger.exception("Engine could not be started.") | ||
|
|
||
| #TODO: replace with command that just remove tools requiring specific context (ie Publish) | ||
| #but leave tools that can direct a user back to the correct context (ie Workfiles) |
There was a problem hiding this comment.
block comment should start with '# '
| # context was not sufficient! - disable tank! | ||
| logger.exception("Engine could not be started.") | ||
|
|
||
| #TODO: replace with command that just remove tools requiring specific context (ie Publish) |
There was a problem hiding this comment.
block comment should start with '# '
Switches from using the support email alias to pointing to the support site
| except sgtk.TankEngineInitError as e: | ||
| # context was not sufficient! - disable tank! | ||
| logger.exception("Engine could not be started.") | ||
|
|
| ) | ||
| sgtk.platform.start_engine(engine_name, new_context.sgtk, new_context) | ||
|
|
||
| except sgtk.TankEngineInitError as e: |
There was a problem hiding this comment.
local variable 'e' is assigned to but never used
| ) | ||
| ) | ||
| sgtk.platform.start_engine(engine_name, new_context.sgtk, new_context) | ||
|
|
| logger.debug( | ||
| "Starting new engine: %s, %s, %s" % ( | ||
| engine_name, | ||
| new_context.sgtk, |
| try: | ||
| logger.debug( | ||
| "Starting new engine: %s, %s, %s" % ( | ||
| engine_name, |
| logger.debug("SGTK Registering onLoad callback") | ||
| MaxPlus.NotificationManager.Register(MaxPlus.NotificationCodes.FilePostOpen, PostOpenProcess) | ||
| g_tank_callbacks_registered = True | ||
| #else: |
There was a problem hiding this comment.
block comment should start with '# '
| logger.debug("Setting up 3dsMax Context Switching callbacks") | ||
|
|
||
| # we'll assume context switching is allowed for now | ||
| #if engine.get_setting("automatic_context_switch"): |
There was a problem hiding this comment.
block comment should start with '# '
| """ | ||
|
|
||
| global g_tank_callbacks_registered | ||
|
|
| there is no current script open in your Nuke session. If there is a script currently open then this will spawn a | ||
| new Nuke instance and the callback won't be called. | ||
| """ | ||
|
|
| details=error) | ||
| return | ||
|
|
||
| def tank_ensure_callbacks_registered(engine=None): |
Pulled mostly from similar code in the tk-nuke engine, adapted to 3dsMax. I wasn't able to do testing in the environment without an "engine", since I don't understand how that could occur in our standard environment.