[Closed] how to free the clipboardBitmap?
Hi, I have written a maxscript to bake the lightingmap of the object I’ve selected with only the push of a button, and with the posibility to render to the clipboard.
I use :
setclipboardBitmap bakeBitmap
It is working, but the clipboard remains always with the first texture. If i change the parameters (for example, the padding of the texture) and render again , the image in the clipboard is the same i rendered the first time. I noticed that if I re-open the max file and bake the object with the new parameters, it works, but I have to know how to free the clipboard memory to avoid re-open the max file always I want to re-bake the textures with new parameters.
any help?
Long shot, can’t test it at the moment, but you could try freeSceneBitmaps()
you should be able to clear the clipboard like so –
bmp1 = bitmap 3020 2040 color:white
setclipboardBitmap bmp1
getclipboardBitmap() -- returns bitmap
clip = dotnetclass "Clipboard"
if clip.containsimage() do clip.clear()
getclipboardBitmap() -- returns undefined
the thing would be whether the memory is freed or not. let us know.
thanks, LoneRobot, but now I see it’s not a problem of freeing the clipboard memory. Your code works, but still I get the same image in the clipboard. When I bake the texture, it always save a image to disk. Then, to copy the texture to clipboard, I use this code:
bakeBitMap = openBitMap ficheroOcclusion
setclipboardBitmap bakeBitmap
but i’m always getting the same image in clipboard although the file in disk (ficheroOcclusion) is different because i change the parameters before baking the texture.
Are you maybe loading the bitmap to the clipboard without first RELOADING the bakeBitMap variable?
I mean, once you’ve run “bakeBitMap = openBitMap ficheroOcclusion”, the bakeBitmap variable will hold the bitmap opened at that point. Just because the file on the disk changes, it does not mean that the variable will be updated.
Maybe sharing some of the code would help shed some light into the problem.
I have found the problem. MarcoBrunetta was right. I was using close bakeBitmap but didnt work. now I tried with bakeBitMap = () after copying it to the clipboard and it works!!
thanks all!!