Announcement

Collapse
No announcement yet.

VrayBitmap Reload in maxscript

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

  • VrayBitmap Reload in maxscript

    Hello, Support.
    I'm facing a little issue in my script. The script changes filenames of bitmaps (including VrayBitmaps) and in order to make it fast I would like to disable ref messages temporarily (using disableRefMsgs). The problem I have is that VrayBitmap (and only VrayBitmap) doesn't update after I enable ref messages using enableRefMsgs. Ofc I tried to run notifyDependents and it also doesn't help.
    Is there any hidden way to force VrayBitmap to reload?

    You may say that final time will not change because I still need to reload bitmaps in the end and it's a good point, but I still would like to have control over reloading process.

  • #2
    Can you post a simple version of the script? I just tested this and it seems to update automatically for both Bitmaps and VRayBitmaps.
    Aleksandar Hadzhiev | chaos.com
    Chaos Support Representative | contact us

    Comment


    • #3
      Originally posted by hermit.crab View Post
      Can you post a simple version of the script? I just tested this and it seems to update automatically for both Bitmaps and VRayBitmaps.
      Hi. How did you test it? Changing bitmap filename should be between disableRefMsgs​() and enableRefMsgs​()

      Comment


      • #4
        Code:
        for each in SceneMaterials where classof each == VRayMtl do (
        if classof each.texmap_diffuse == VRayBitmap then (
        each.texmap_diffuse.HDRIMapName = "xxx.png"
        )
        else (
        each.texmap_diffuse.fileName = "xxx.png"
        )
        )​
        I just did a quick test. Certainly not the way you use it.
        Aleksandar Hadzhiev | chaos.com
        Chaos Support Representative | contact us

        Comment


        • #5
          Thanks. Simplified version would look sth like this:

          Code:
          disableRefMsgs()
          (getClassInstances vraybitmap).filename = "xxx.png"
          enableRefMsgs()

          Comment


          • #6
            After some troubleshooting I found out that this works well:
            Code:
            newBitmap = bitmaptexture()
            newBitmap.filename = "C:\Users\Alexander\Desktop\\x.png"
            
            for each in (getclassinstances BitmapTexture) do (
            each.filename = newBitmap.filename
            )
            for each in (getclassinstances VRayBitmap) do (
            each.HDRIMapName = newBitmap.filename
            )
            newBitmap.reload()​
            Rather than trying to refresh the image through the Bitmap/VRayBitmap node, we reload the newly created bitmap.
            The difference between native Bitmaps and V-Ray bitmaps seems to be evident when checking the bitmap parameter of both:
            Code:
            (getclassinstances bitmaptex)[1].bitmap -> this references a Bitmap class
            (getclassinstances vraybitmap)[1].bitmap -> this references a String
            This is most likely why your method of updating does not work.
            Aleksandar Hadzhiev | chaos.com
            Chaos Support Representative | contact us

            Comment


            • #7
              Sorry but I guess you didn't get the issue. Probably my fault.
              What I need is the same "reload()" method but for vraybitmaps, if there is such a method ofc. If not, then I just can't change filename with disabled ref messages to speedup the process.

              Comment


              • #8
                I'll ask the devs.
                Aleksandar Hadzhiev | chaos.com
                Chaos Support Representative | contact us

                Comment


                • #9
                  No such option exists at this point, however, I've logged an improvement request (internal bug-tracker id: VMAX-14280) on your behalf.
                  Aleksandar Hadzhiev | chaos.com
                  Chaos Support Representative | contact us

                  Comment

                  Working...
                  X