Notifications
Clear all

[Closed] Disable Scene Redraw / Focus Jumping

I’ve got a really tricky problem which is proving inconsistent in it’s reproduction.

I’m running a script, and it’s occasionally making 3dsmax grab foreground focus. It’s the ExocortexAlemic export function that redraws the viewport it would appear.

I’m using disableSceneRedraw which does stop it, but this is quite a complicated script I’ve inherited and it’s managing to escape out of the disable redraw occasionally on 2nd run or when the script
runs the same functionality multiple times. Again, very tricky to reproduce. I have a small test snippet that works before my other script has been run, no focus stealing.


with redraw off
(
   sleep 5
   --jump to another window whilst this is running.
   ExocortexAlembic.createExportJobs ""
)

However once my more complex script runs, it stops even this simple test script from working.

So my question is there another command I can use to disable the max UI until the end of my script?? Something with windows messages?

I’ve tried disableRefMsgs, suspendeditting… nothing seems to work!

4 Replies

Not sure if this is what you need, but you can disable the viewports panel redrawing like:


(
    
    fn SetViewportsRedraw state =
    (    
        WM_SETREDRAW = 11    --0x000B
        
        for j in (windows.getchildrenhwnd #max) where j[4] == "ViewPanel" do
        (
            panel = j[1]
            case state of
            (
                true:
                (
                    windows.sendmessage panel WM_SETREDRAW 1 0
                    completeredraw()
                )
                false: windows.sendmessage panel WM_SETREDRAW 0 0
            )
            exit
        )
    )

    SetViewportsRedraw on
    
)

have you tried the Progress Bar Display?
you can put the progressStart at the beginning of your script and put the progressEnd at the end.
the progress bar will lock the entire UI of max.

Thanks guys I’ll try that tomorrow!

Thanks @Nanhua, that does indeed work, nice and simple too! Thank you very much!!