Notifications
Clear all

[Closed] bitmap rendering problems in dialog

Hi Everyone,

I am new here and in this field also.

I am writing a script to show material properties of a selected object in the scene. So far, it can show a list of materials when an object is selected then a material bitmap can be opened in a dialog.

The problem is, it works fine for the first object then if i select some other object in the scene and try to open a material bitmap, the dialog shows the old bitmap (that of previous displayed material) not the currently selected one. I checked by printing the bitmap name and its correct that means prints the currently selected bitmap name but the result in dialog is not correct, always displaying the old bitmap.

Can anyone have some idea how to correct this?

Thanks

2 Replies

Hey masd,

You’ll have to post the code for us to get a clear picture of what’s going wrong, but if I had to guess, I would say your code is referencing the currently selected object with the $ keyword. When you execute the script the $ is appropriately the currently selected object, however, you’ll have to re-execute the script if you change selections. As far as the code is concerned, $ means whatever was currently selected at execution time. If you want the script to update dynamically, you’ll need to use a callback mechanism. Just search “callbacks” in the help file for that info. Forgive me if this isn’t your problem.

Thanks d3coy for replying

In main script function, when an object is selected, list is populated and on double click an item it shows the map in a dialog

 
--If the user picked an object, then 
on chooseit picked obj do
(
if obj != undefined do 
(
	 gSelObj = obj
	 UpdateMatIDList obj
)
)
-- show bitmap in a new dialog on double click
on MatIDui doubleclicked val do 
(
if gSelObj != undefined do UpdateDisplayBitmap gSelObj.material 1 
) 

and in UpdateDisplayBitmap funtion

 rollout test_bitmaps "Testing Bitmap" 
(
bitmap showBitmap 
)
test_bitmaps.showBitmap.bitmap = mat.diffuseMap.bitmap
print test_bitmaps.showBitmap.bitmap
createDialog test_bitmaps width:mat.diffuseMap.bitmap.width height:mat.diffuseMap.bitmap.height

Thanks for any help