Join our discord community

Please or Register to create posts and topics.

Playblast state in 3ds Max 2020

Hey, Richard!

first of all, thanks for the amazing tool!

The playblast state doesn't work properly with the 3ds max 2020 version. Looks like Autodesk updated a makepreview daliog and UIAccessor solution doesn't work anymore, bet they also updated a CreatePreview function (finally!). So I added a few lines in Prims_3dsMax_Functions.py file. Kept an old part for earlier versions, but for 20000 and above,  added an updated CreatePreview function. Tested with  3ds max 2020 and 2021.
Changed lines: 1177 -1275.

Would be great if you could change this part for the next update!

Thanks!

        self.executeScript(
            origin,
        """
dnSendKeys = (dotNetClass "System.Windows.Forms.SendKeys")
dnmarshal = (dotNetClass "System.Runtime.InteropServices.Marshal")
insidedialog = false
global createPreviewVersion =(maxVersion())[1]
global pathstring = \"%s\"
global rStart = %s
global rEnd = %s
global sceneFps = frameRate

fn setoutput =
(
   window = (windows.getChildHWND 0 ("JPEG Image Control") )
   if window != undefined then
   (
      UIAccessor.pressbutton (UIAccessor.GetChildWindows window[1])[1]
   ) else
   (
      window = undefined
      window = (windows.getChildHWND 0 ("File Exists") )
      if window != undefined then
      (
         UIAccessor.pressbutton ((UIAccessor.GetChildWindows (window[1]))[2])
      ) else
      (
         window = (windows.getChildHWND 0 ("Create Animated Sequence File...") )
         if window != undefined then
         (
            if not insidedialog then
            (
               insidedialog = true
               createsequence = window[1]
               ptrstring = dnmarshal.StringToHGlobalUni(\"%s\")
               windows.sendMessage (UIAccessor.GetChildWindows createsequence)[13] 12 0 ptrstring
               windows.sendMessage (UIAccessor.GetChildWindows createsequence)[13] 6 1 0

               windows.sendMessage (UIAccessor.GetChildWindows createsequence)[15] 0x014E 8 0
               windows.sendMessage (UIAccessor.GetChildWindows createsequence)[15] 6 1 0
               dnSendKeys.sendwait ("{DOWN}")
               dnSendKeys.sendwait ("{UP}")

               UIAccessor.pressbutton (UIAccessor.GetChildWindows window[1])[17]
            )
         ) else 
         (
            window = (windows.getChildHWND 0 ("Make Preview") )
            if window != undefined then
            (
               makepreview = window[1]
               tmpstyle = 2
               windows.sendMessage (UIAccessor.GetChildWindows makepreview)[56] 0x014E tmpstyle 0
               windows.sendMessage (UIAccessor.GetChildWindows makepreview)[56] 6 1 0
               if tmpstyle == 0 then (
                  dnSendKeys.sendwait ("{DOWN}")
                  dnSendKeys.sendwait ("{UP}")
               ) else (
                  dnSendKeys.sendwait ("{UP}")
                  dnSendKeys.sendwait ("{DOWN}")
               )
               windows.sendMessage (UIAccessor.GetChildWindows makepreview)[33] 0x00F5 1 0
               UIAccessor.pressbutton (UIAccessor.GetChildWindows makepreview)[65]
               UIAccessor.pressbutton (UIAccessor.GetChildWindows makepreview)[37]
               return true
            )
         )
      )
   )
   return true
)


tmpanimrange = [animationrange.start, animationrange.end]
animationrange = interval rStart rEnd
ViewCubeOps.Visibility = false
    if createPreviewVersion<22000 then
    (
        DialogMonitorOPS.Enabled = true
        DialogMonitorOPS.RegisterNotification setoutput id:#myoutput
        max preview
        CreatePreview outputAVI:False percentsize:100 start:rStart end:rEnd skip:1 fps:sceneFps dspGeometry:True dspShapes:False dspLights:False dspCameras:False dspHelpers:False dspParticles:True dspBones:False dspGrid:False dspSafeFrame:False dspFrameNums:False dspBkg:True
        DialogMonitorOPS.UnRegisterNotification  id:#myoutput
        DialogMonitorOPS.Enabled = false
    )
    else
    (
        CreatePreview filename:pathstring outputAVI:False percentsize:100 start:rStart end:rEnd skip:1 fps:sceneFps dspGeometry:True dspShapes:False dspLights:False dspCameras:False dspHelpers:False dspParticles:True dspBones:False dspGrid:False dspSafeFrame:False dspFrameNums:False dspBkg:True
    )
ViewCubeOps.Visibility = True
animationrange = interval tmpanimrange.x tmpanimrange.y
"""
        % (
            outputName.replace("\\", "\\\\"),
            jobFrames[0],
            jobFrames[1],
            outputName.replace("\\", "\\\\"),
            ),
        )
Uploaded files:
  • You need to login to have access to uploads.

Hey @almantas,

awesome, thanks a lot for that. I'll add this in the next update v1.3.0.68.

Cheers,

Richard