PDA

View Full Version : replacing mat preview in Mat editor ?


u3dreal
06-10-2006, 03:13 PM
Hello all ,

once again i couldn't find anything abotu this topic here or in the reference maybe it's
not possible but i first want to ask you

http://img457.imageshack.us/img457/8458/matpreview3tv.jpg
This is a screenshot of the material i'm working on right now
I'm implementing material preview rendered with indigo

is there any way to replace the material preview with the bitmap you can see below.?



u3dreal ;)

u3dreal
06-10-2006, 03:17 PM
Also i have some problems when loading the rendered bitmaps as you see it works
quite good but when i do the preview on an other material in another slot
then i will write out a new bitmap containing the preview of the new material

unfortunatelly now when loading the bitmap into the bitmap in the material the
old bitmap gets exchanged as well is there any way to make this only change for the
new material

here is the code i came up with.


on dopre pressed do (

pre_file = createfile "C:\indigo\matpreview\previewmat.xml"

format "<scenedata>\n\n" to:Pre_file
format "\t\t<material>\n" to:Pre_file
format "\t\t\t<name>material</name>\n" to:Pre_file
format "\t\t\t<diffuse>\n" to:Pre_file
format "\t\t\t\t<colour>% % %</colour>\n" ((diffuse.r / 255)*gain) ((diffuse.g / 255)*gain) ((diffuse.b / 255)*gain) to:Pre_file
format "\t\t\t</diffuse>\n\n" to:Pre_file
format "\t\t</material>\n\n" to:Pre_file
format "</scenedata>\n\n" to:Pre_file
close pre_file
matname = activeMeditSlot
prebat = createfile "C:\Indigo\matpreview\preview.bat"
format "@ECHO OFF\n" to:prebat
format "START /B /min C:\Indigo\indigo.exe C:\indigo\matpreview\preview.xml -o c:\indigo\matpreview/%preview.png\n" matname to:prebat
format "EXIT\n" to:prebat
close prebat
ShellLaunch "C:\Indigo\matpreview\preview.bat" ""
clock.active = true


This generates the apropriate material information for the renderer and the batchfile to start the renderer this works OK


on clock tick do
(
valUp = (test.text as integer)-1
test.text = valUp as string

if clock.ticks == 20 then (

prename = "c:\indigo\matpreview/"+(matname as string)+"preview.png"
prebit = openBitMap prename
precop = copy prebit
prepic.bitmap = precop
test.text = "20"
clock.active = false
clock.ticks = 0
)
)


This updates the prepic bitmap in the GUI ,after waiting for 20sec for indigo to finish the preview ,with the rendered filename as you see i have been messing around with the copy bitmap fuction but it does not seem to work the way i use it.. when i do the update on the second matslot the previewimage (prepic) of the first slot will get updated as well
why that as the filename has changed..?

1preview for first slot
2preview for second slot

Does anyone have an idea ? help will be greatly apprechiated !


u3dreal ;)

CGTalk Moderation
06-10-2006, 03:17 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.