CGTalk > Software > Autodesk 3ds max > 3dsMax SDK and MaxScript
Login register
reply share thread « Previous Thread | Next Thread »  
 
Thread Tools Search this Thread Display Modes
Old 07-12-2014, 10:57 AM   #1
ravihara
Frequenter
 
ravihara's Avatar
portfolio
Ravihara Weerathunge
cgninja
Kandy, Sri Lanka
 
Join Date: Oct 2010
Posts: 259
Question how to reload a bitmap

I coded a tool that i can transfer pose data from one workstation to another, easily using INI files. Recently i added this new window (1) that pops up when we select a pose from the list box (2), giving a thumbnail of the pose.
my problem is, when i replace/update an existing pose, my function that overwrittes the old thumbnail image do its work properly (as you can see in (3), the old image is replaced by the new one),
but my code that loads the thumbnail, when i select an item from the pose list still loads the old thumbnail of the replaced pose.(as you can see in the (1) window)
this problem exist until i restart max.
so how can I get rid of this old thumbnail 'cache'- (i suppose) and make my listbox click even load the new bitmap? (as you can see by the code i used in the end of the thread i even tried freeSceneBitmaps() function, but no good)




my current code :

Code:
on expression_list selected nameIndex do ( --make text box have the slected item's name set_textbox_to_sel_name() looking_bitmap=openBitMap (getFilenamePath(getSourceFileName()) + "\\snapgrabs\\"+ edt1.text + ".jpg") if looking_bitmap != undefined then ( --reads the dimentions of the current looking bitmap looking_bitmap_w = looking_bitmap.width looking_bitmap_h = looking_bitmap.height createdialog thumbview looking_bitmap_w looking_bitmap_h style:#(#style_toolwindow) thumbview.thumbnail.width= looking_bitmap_w thumbview.thumbnail.height= looking_bitmap_h freeSceneBitmaps() thumbview.thumbnail.filename = (getFilenamePath(getSourceFileName()) + "\\snapgrabs\\"+ edt1.text + ".jpg") ) else DestroyDialog thumbview )
__________________
"A jug fills drop by drop."
-Buddha

 
Old 07-13-2014, 01:31 AM   #2
ricozone
Veteran
 
ricozone's Avatar
portfolio
Eric Bellanger
CG artist
Nantes, France
 
Join Date: Dec 2002
Posts: 81
Send a message via MSN to ricozone
You don't have to "freescenebitmaps()" to close the old bitmap.
Just make a "close yourBitmap" or "free yourBitmap".
But all of this is not necessary.

To update the control "thumbnail" in your dialog "thumbview", you should assign its bitmap propertie to the replaced one.

For example :
Code:
( delete objects try( destroyDialog rl_test )catch() -- creation of a first bitmap to the disk for the purpose of this example f = (getDir #scripts + "\\test.jpg") tmpBmp = bitmap 100 80 color:black tmpBmp.filename = f save tmpBmp close tmpBmp free tmpBmp -- -- so, load bmp from disk img = openBitmap (getDir #scripts + "\\test.jpg") rollout rl_test "test" ( imgTag imgt "" bitmap:img width:100 height:80 on imgt mouseDown do ( delete objects Plane() Teapot() ) on imgt mouseup do ( -- replace img newImg = gw.getViewportDib() newImg.filename = f save newImg -- replace -- reload to UI imgt.bitmap = newImg -- UI update is done ) )--end rl createDialog rl_test 130 110 )
__________________
Rico)
=====================
 
Old 07-13-2014, 05:10 PM   #3
ravihara
Frequenter
 
ravihara's Avatar
portfolio
Ravihara Weerathunge
cgninja
Kandy, Sri Lanka
 
Join Date: Oct 2010
Posts: 259
thanks for the code! will try it bro!
__________________
"A jug fills drop by drop."
-Buddha

 
Old 07-13-2014, 05:45 PM   #4
ravihara
Frequenter
 
ravihara's Avatar
portfolio
Ravihara Weerathunge
cgninja
Kandy, Sri Lanka
 
Join Date: Oct 2010
Posts: 259
it give no trouble when i use your method. but here, im trying to do the saving and loading part separately. so i will have to use 'openBitmap' not even for the beginning, but when i load it. the problem is, it seems to be loading the same old bitmap no matter what i try.
__________________
"A jug fills drop by drop."
-Buddha

 
reply share thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 12:34 PM.


Powered by vBulletin
Copyright ©2000 - 2016, Jelsoft Enterprises Ltd.