Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Max: reset scene and clear undo buffer when starting new scene #493

14 changes: 9 additions & 5 deletions client/ayon_core/hosts/max/api/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,7 @@ def install(self):

self._has_been_setup = True

def context_setting():
return lib.set_context_setting()

rt.callbacks.addScript(rt.Name('systemPostNew'),
context_setting)
rt.callbacks.addScript(rt.Name('systemPostNew'), on_new)

rt.callbacks.addScript(rt.Name('filePostOpen'),
lib.check_colorspace)
Expand Down Expand Up @@ -163,6 +159,14 @@ def ls() -> list:
yield lib.read(container)


def on_new():
lib.set_context_setting()
if rt.checkForSave():
rt.resetMaxFile(rt.Name("noPrompt"))
rt.clearUndoBuffer()
rt.redrawViews()


def containerise(name: str, nodes: list, context,
namespace=None, loader=None, suffix="_CON"):
data = {
Expand Down