Announcement

Collapse
No announcement yet.

V-Ray Messages window prevents modal dialogs from showing (locks up 3ds max)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • V-Ray Messages window prevents modal dialogs from showing (locks up 3ds max)

    Hello, I see a serious problem with the V-Ray messages window (V-Ray 5, hotfix 2). When it opens because of a warning/error at roughly the same time as a message box from my plugin then 3ds max appears to be frozen. The messages window pushes the modal message box behind other windows or prevents it even from being drawn at all. The user isn't aware that he can not operate 3ds max because of a modal dialog, because he can not even see the dialog. So the user ends up thinking my plugin froze 3ds max. Only closing the V-Ray messages window helps, which is not obvious to the user, because the messages window may be minimized or out of site on another screen. Since the messages windows does not behave like a modal dialog usually the user also does not expect that closing it would help at all.

    The problem can be reproduced using 2 lines of MAXScript (I see this in a 3ds max C++ plugin, this is just the easiest way to demonstrate it):

    Code:
    -[B]- close vray message window before trying this, execute all lines at once
    vrayShowMsgLogWindow()
    sleep 3 -- optional
    messageBox "When you see me everything is awesome!"[/B]
    The result varies, sometimes you can not see the message box at all until you close the message window or the message box is pushed behind some other window like the Framebuffer or the Script Editor. The weird thing is that V-Ray appears to delay the opening of the messages window until the modal dialog is shown. So you can do something else between the 2 lines of code (e.g. sleep 3) and the problem will still occur. This seems to be what makes it so likely to occur. This does not just happen when the windows want to open at the exact same time. This problem already somewhat exists in V-Ray Next, but there the message box was just pushed behind the message window or framebuffer and still accessible. In V-Ray 5 you can not see or move the modal dialog to the front anymore.

    The problem very likely to occur when using my PSD exporter (psd-manager), because:
    • psd-manager needs to ask the user to overwrite a file: yes/no via a message box at the beginning of the rendering. (very likely)
    • V-Ray usually prints some warning at the start of a render (also very likely)
    • V-Ray messages window is set to be show on warnings/errors by default
    • V-Ray messages window is currently closed (also very likely, because users click it away because it takes up screen space)
    For example if any render element is used in the scene V-Ray prints a misleading warning about render elements not being saved. Which is not true when my plugin is present, because it saves the framebuffer as PSD. There is no need for users to set a filename in the V-Ray settings (neither RAW or separate render channels). It would be nice to to able to disable this specific message programmatically.

    My guess is that it has something to do with the V-Ray message window running in another thread and this conflicting with the 3ds max window message loop. I don't use any threads. I already tried a lot of things like different parent windows for the modal dialog. The problem seems to be on the V-Ray side.

    Daniel
    Last edited by dans; 05-11-2020, 03:18 PM.
    Daniel Schmidt - Developer of psd-manager

  • #2
    Hello,

    In vrayShowMsgLogWindow we just post a message to show the window - so it needs windows messages to be processed in order to actually appear (we use ShowWindowAsync). What if you add a call to GetCOREInterface()->CheckMAXMessages() after calling vrayShowMsgLogWindow ?

    Best regards,
    Yavor
    Yavor Rubenov
    V-Ray for 3ds Max developer

    Comment


    • #3
      I'm not using vrayShowMsgLogWindow myself. The above MAXScript is just to demonstrate the issue. V-Ray is popping up it's messages window automatically because of warnings/errors. I'm just opening a modal MessageBox within my implementation of Effect::RenderBegin() at the start of the rendering in my render effect plugin.
      MessageBox(ip->GetMAXHWnd(), message, GetString(IDS_DIALOG_CAPTION), MB_YESNO );

      I tried calling CheckMAXMessages() before ::MessageBox(...) but it did not make a difference (tried that before na many other things, but just tried again, to be sure). The main problem is that the v-ray messages windows influences the z-order of other windows. It pushes my window behind the V-Ray framebuffer when it shows up. Why does this happen?

      The only workaround I found is to give a window the topmost style. However, I can not do this for 3ds max built-in dialogs (the 3ds max logging system message box example). The topmost style also has other side affects like that the dialogs will show up in front of all other windows even when 3ds max is currently in the background.

      Daniel
      Daniel Schmidt - Developer of psd-manager

      Comment


      • #4
        Yep I understood that the vrayShowMsgLogWindow is just an example. In any case (calling the MAXScript function or during rendering) we do ShowWindowAsync(hWnd, SW_SHOW); when we need to show the message window. In it we don't do anything related to window z ordering.
        By the way - what Max version are you trying ?
        Yavor Rubenov
        V-Ray for 3ds Max developer

        Comment


        • #5
          I'm using 3ds Max 2021.2 here wth V-Ray 5 Hotfix 2.

          Daniel
          Daniel Schmidt - Developer of psd-manager

          Comment


          • #6
            Hm can you try with some older Max version - like 2019 ?
            We've noticed some issue that started happening in Max 2020 with message boxes going behind the VFB that only happen in Max 2020 and later.
            Yavor Rubenov
            V-Ray for 3ds Max developer

            Comment


            • #7
              Also - can you try with the latest stable V-Ray builds (for example https://nightlies.chaosgroup.com/mai...e_5.0/20201121) - there were some changes that seem to fix the issue we had with some of our message boxes - maybe it will fix this one too.
              Yavor Rubenov
              V-Ray for 3ds Max developer

              Comment


              • #8
                I tried the build 30453 you pointed out on 2019 and 2021 and did the MAXScript test - unfortunatelly no change. (A difference between 2019 and 2021 is that I can still interact with the V-Ray VFB in 2019, but not in 2021 while the modal dialog is shown.) The result with the dialog being pushed to the back of the z-order is the same tough. I also reproduced this on 2018 with V-Ray Next Update 3.2. So the fundamental issue is really not new. It is just more problematic now with access to the other top level windows being blocked when the modal dialog is shown. Now you can not move them out of the way to find the hidden modal dialog. Users with mutiple screens will notice this less because large top level windows are positioned on a separate screen and less likely to hide the modal dialog.

                Could you reproduce the MAXScript example I posted?

                I captured the window state after executing the test script using Spy++ from Visual Studio.
                • Left: V-Ray Messages window and modal dialog just opened
                • Right: closed the V-Ray messages window
                The MAXScript message box is created, but is placed right above the 3ds max main window (so behind the framebuffer, Material Editor or any other top level window).
                When closing the Messages Window the MAXScript dialog immediately moves to the top of the window layer stack.


                Click image for larger version

Name:	Screenshot Spy VRay Messages.png
Views:	448
Size:	154.0 KB
ID:	1093206

                Daniel
                Daniel Schmidt - Developer of psd-manager

                Comment


                • #9
                  Yes I reproduce it with the MAXScript. We'll try to debug this a bit more and see what comes up. (Internal ID VMAX-10502)
                  Last edited by yavor.rubenov; 24-11-2020, 05:40 AM.
                  Yavor Rubenov
                  V-Ray for 3ds Max developer

                  Comment

                  Working...
                  X