1
Vote

Export problems in 3dsmax 8

description

in 3dsmax 8 i have some issues while exporting
 
in function:
 
-- Remove unwanted chars that can cause problems in Xaml
fn CleanString str = (
print ("cleaning:"+str)
return (substituteString (substituteString str "." "_") " " "_")
)
MAXScript Rollout Handler Exception: -- Type error: Call needs function or class, got: undefined <<
 
removing substituteString fixes problem.
 
The same error in color convert function:
 
fn ColorToHex Clr = (
str="#"
C = (bit.intAsHex clr.a)
if C.count == 1 then str += "0"+C
    else str += C
C = (bit.intAsHex clr.r)
if C.count == 1 then str += "0"+C
    else str += C
C = (bit.intAsHex clr.g)
if C.count == 1 then str += "0"+C
    else str += C
C = (bit.intAsHex clr.b)
if C.count == 1 then str += "0"+C
    else str += C
return (toupper str)
)
 
in this function crashes when we call toupper function
 
The last error when we calling
 
n ExportMaterial mat outFile = (
    print "fn ExportMaterial"
    format "<MaterialGroup " to:outFile     
    format "x:Key = \"m%\" >\n" (CleanString mat.name) to:outFile

    format "<DiffuseMaterial>\n<DiffuseMaterial.Brush>\n" to:outFile
    if mat.diffusemap != undefined then
        format "<ImageBrush ViewportUnits=\"Absolute\" TileMode=\"Tile\"  ImageSource=\"%\"/>\n" (mat.diffusemap.bitmap.filename) to:outFile
    else
        format "<SolidColorBrush Color=\"%\"/>\n" (colorToHex mat.diffuse) to:outFile           
    format "</DiffuseMaterial.Brush>\n</DiffuseMaterial>\n " to:outFile         
 
    if mat.selfIllumMap != undefined then (
        format "<EmissiveMaterial>\n<EmissiveMaterial.Brush>\n"to:outFile
        format "<ImageBrush ViewportUnits=\"Absolute\" TileMode=\"Tile\"  ImageSource=\"%\"/>\n" (mat.selfIllumMap.bitmap.filename) to:outFile
        format "</EmissiveMaterial.Brush>\n</EmissiveMaterial>\n"to:outFile
    )
 
    format "</MaterialGroup>\n\n" to:outFile
)
problem on:
if mat.diffusemap
 
cannot find diffusemap or something like that.

file attachments

comments