Merge pull request #493 from ynput/bugfix/the_scene_isn't_reset_correctly_when_starting_new_scene_after_loading_objects

Max: reset scene and clear undo buffer when starting new scene
This commit is contained in:
Kayla Man 2024-05-16 17:37:07 +08:00 committed by GitHub
commit c133c97aea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -52,11 +52,7 @@ class MaxHost(HostBase, IWorkfileHost, ILoadHost, IPublishHost):
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)
@ -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 = {