Another script...another newbie problem!
I'm trying to develop a script that let me change diffuse texture of a certain material.
I started studying Joe Gunn old script "face switcher": this script change material ID (but first we need to create a multiamterial with a lot of submaterials with different textures), while I think it's faster to have only one material and change its texture.
The script let you choose a directory to sort bitmap from, create thumbnails and...nothing.
The scope is to change material texture clicking on the corresponding thumbnail and to create a keyframe for material diffuse slot.
This is my result:
try(destroyDialog ::texchange)catch()
rollout texchange"TEXTURE CHANGE"
(
--interface
button btnSetD "Set Dir:" pos:[5,5] width:50 height:20 toolTip:"directory immagini"
edittext Fdir "" pos:[55,5] width:100 height:20
button btn01 "01" pos:[5,30] width:30 height:30
button btn02 "02" offset:[-30,-35] width:30 height:30
button btn03 "03" offset:[0,-35] width:30 height:30
button btn04 "04" offset:[30,-35] width:30 height:30
button btn05 "05" offset:[60,-35] width:30 height:30
--choose bitmap path
on btnSetD pressed do
(
local curpath = Fdir.text
local newPath = getSavePath initialDir:(curpath) caption:"Select the path where your Face Images are located"
if newPath != undefined then
--create thumbnails
(
Fdir.text = newpath
btn01.images = #(Fdir.text + "\01.png", Fdir.text + "\01.png", 1, 1, 1, 1, 1)
btn02.images = #(Fdir.text + "\02.png", Fdir.text + "\02.png", 1, 1, 1, 1, 1)
btn03.images = #(Fdir.text + "\03.png", Fdir.text + "\03.png", 1, 1, 1, 1, 1)
btn04.images = #(Fdir.text + "\04.png", Fdir.text + "\04.png", 1, 1, 1, 1, 1)
btn05.images = #(Fdir.text + "\05.png", Fdir.text + "\05.png", 1, 1, 1, 1, 1)
)
)
--actions
on btn01 pressed do
(
--and here the problem... load 1st thumbnail image to object material
)
on btn02 pressed do
(
--same, and so on...
)
)
createdialog texchange 160 200 10 110 style:#(#style_titlebar, #style_sysmenu, #style_toolwindow)
I hope to have been clear enought... any idea?
barigazy · 2014-07-04