Bitmap swapping
Hi all, im a maxscript novice.
Im trying to swap a bitmap image in the ui with a button click. Ive tried calling a function from bitmap filename:. a variable works but not with the buttons.
so far not great:)
fn test1 =
(
img1 = @"B:\images1.jpg"
)
fn test2 =
(
img1 = @"B:\images2.jpg"
)
rollout _test "test"
(
bitmap bmp1 "Bitmap" pos:[7,11] width:146 height:121 --filename: --not sure here
button _A "A"
on _A pressed do
(
test1()
)
button _B "B"
on _B pressed do
(
test2()
))
createdialog _test
any help is appreciated
Comments
Thanks Swordslayer, really
Thanks Swordslayer, really appreciate the help!
The underscore is something i picked up from a tutorial. and murge is a typo lol.
I cant seem to get the max file to merge though. Ill look into variable scope.
thanks again
thanks, that helped a
thanks, that helped a lot!!!
I have another issue trying to fix with string trimming.
the result is pulled into a list box, and i need to remove the .jpg and replace with .max to merge a max file on selection.
_MatItems = GetFiles @"F:\test\*.jpg"
_MatItemsUI = #()
for i = 1 to _MatItems.count do
(
_MatItemsUI[i] = (filterstring _MatItems[i] @"\") [7]
)
Rollout _MatImport "Exterior Materials" width:310
(
bitmap bmp1 "Bitmap" pos:[7,11] width:300 height:300
Listbox _InteriorMats "Materials" items: _MatItemsUI
Button _ApplyMat "Apply Material"
on _ApplyMat pressed do
(
MurgeFile = _MatItems[_InteriorMats.selection]".max"
mergemaxfile MurgeFile
)
createdialog _MatImport
Basically, aomething like
Basically, aomething like this should do the trick:
Btw. you have a peculiar choice of variable names, why all the underscores and stuff like murge instead of merge? Get used to using explicit locals, read about variable scope in the reference and fear not and use simple var names ;)
Some of my scripts and MCGs :: 3ds Max SDK Intro for Scripters
Use the bitmap property
Use the bitmap property instead:
Some of my scripts and MCGs :: 3ds Max SDK Intro for Scripters