Last active
January 21, 2021 02:30
-
-
Save tpoveda/eb668ca1bd7504123e37a0d461d3ffd2 to your computer and use it in GitHub Desktop.
PyMxs - Forces the creation of a new 3ds Max scene without prompting any UI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def force_new_scene(): | |
""" | |
Forces the creation of a new 3ds Max scene without prompting any UI | |
""" | |
mxs_function = """fn mf = ( | |
local windowHandle = DialogMonitorOPS.GetWindowHandle() | |
if (windowHandle != 0) then ( | |
UIAccessor.PressButtonByName windowHandle "Do&n't Save" | |
) | |
return true | |
) | |
""" | |
rt.execute('mf={}'.format(mxs_function)) | |
rt.DialogMonitorOPS.unRegisterNotification(id=rt.Name('forceNewFile')) | |
rt.DialogMonitorOPS.registerNotification(rt.mf, id=rt.Name('forceNewFile')) | |
rt.DialogMonitorOPS.enabled = True | |
rt.actionMan.executeAction(0, '16') # new file macro action | |
rt.DialogMonitorOPS.unRegisterNotification(id=rt.Name('forceNewFile')) | |
rt.DialogMonitorOPS.enabled = False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment