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.

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​()

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.

Thanks. Simplified version would look sth like this:


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

​

After some troubleshooting I found out that this works well:


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:


(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.

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.

I’ll ask the devs.

No such option exists at this point, however, I’ve logged an improvement request (internal bug-tracker id: VMAX-14280) on your behalf.