Assign created bitmap to button as icon
Hello, I want to create a bitmap image using maxscript and after to use it as icon for button in rollout.
Code logic look good, but I cant figure out why it doesn't work.
bitmapForIcon = bitmap 24 24 color:red filename:"RedIcon" rollout rl_Test "Test" width:130 height:30 ( button bt_myButton width:24 height:24 images:#(bitmapForIcon, undefined, 1, 1, 1, 1, 1) ) createDialog rl_Test
Maybe somebody know what is wrong here.
Thank you.
Comments
There is an example in
There is an example in maxscript reference that show how to use the rendered image as a bitmap in the custom rollout. Try to find it.Read again "Bitmap".
Tools and Scripts for Autodesk 3dsMax
gray image
just copy pasted the code. result : my image is gray..
What max version are you
What max version are you trying to do this on? Doesnt work for me in Max 2011 and I think it worked in prior versions, at least up to 2009. I had the same issue and used "imgTag" instead of a button which works great for stuff like this and is even more flexible, cause you have more event handlers like hover and it recognizes which mousebutton you used to click.
Cheers
Never get low & slow & out of ideas
i've got max 2012. Yes,
i've got max 2012. Yes, imgTag works, but got some problems there to. I can only the lbuttondown event get to work..
Same problem
I've got the same problem.. someboy know what's going on?
i dont know what you are
i dont know what you are expecting for the code to do..
but for me its working fine.. a nice red icon is generated.. if that's what you are trying to do
mjbg what version of 3dmax
mjbg what version of 3dmax are you using? I have tested script in 2011x64 and 2012x64 and icon doesn't appear on button :(
in the example from Maxscript help bitmap image is loaded from render frame buffer will work if will be defined alpha masc
rollout image_button_test "Image Button"
(
button theButton "Press To Render!" width:200 height:200
on theButton pressed do
(
theBmp = render outputsize:[200,200] vfb:off
alphaImg = bitmap 200 200 color:black
theButton.images = #(theBmp, alphaImg, 1,1,1,1,1 )
)
)
createDialog image_button_test 210 210
All work nice if I will write
All work nice if I will write code above this way
bitmapForIcon = bitmap 24 24 color:red filename:"RedIcon"
bitmapAlphaIcon = bitmap 24 24 color:black
rollout rl_Test "Test" width:130 height:30
(
button bt_myButton width:24 height:24 images:#(bitmapForIcon, bitmapAlphaIcon, 1, 1, 1, 1, 1)
)
createDialog rl_Test
The lesson is: ALWAYS DEFINE ALPHA image for icons
cool :)
cool :)
Never get low & slow & out of ideas