Hi Didier!
Look at 688 string(latest modification of script), between description of phong-mat and default-mat
if mat.display_name[0,5] == "sfpho"
@stream.print "shader {",
"\n\tname \"#{name}\"",
"\n\ttype phong",
"\n\tdiff { \"sRGB nonlinear\" ", mat.color.to_a[0..2].collect{ |x| "%.3f" % (x.to_f/255) }.join( " " ), " }",
"\n\tspec { \"sRGB nonlinear\" ", mat.color.to_a[0..2].collect{ |x| "%.3f" % (x.to_f/255) }.join( " " ), " } 150 ",
"\n\tsamples 8",
"\n}\n\n"
return name
# AMB added
elsif mat.texture
# check which extension it is
filepath = File.dirname(mat.texture.filename) + "/"
filename = File.basename(mat.texture.filename)
filename = filename.split(".")[0] if filename.split(".").length > 1
[".jpg",".png",".tif",".bmp",".gif",".tga"].each do |ext|
testfile = filepath + filename + ext
unless File.exists?(testfile)
tw = Sketchup.create_texture_writer
tw.load(entity, true)
tw.write(entity, true, testfile)
end
@stream.print "shader {",
"\n\tname \"#{name}\"",
"\n\ttype diffuse",
"\n\ttexture \"#{testfile}\"",
"\n}\n\n"
return name
end
######
else
@stream.print "shader {",
"\n\tname \"#{name}\"",
"\n\ttype diffuse",
"\n\tdiff ", mat.color.to_a[0..2].collect{ |x| "%.3f" % (x.to_f/255) }.join( " " ),
"\n}\n\n"
return name
end
end
end
end
# Materialcode
def export_default_material
return if @exported_names.include? DEFAULT_MATERIAL
reserve_name( DEFAULT_MATERIAL )
@stream.print "shader {",
"\n\tname \"", DEFAULT_MATERIAL, '"',
"\n\ttype diffuse",
"\n\tdiff 0.8 0.8 0.8",
"\n}\n\n"
end