NestorPL
08-14-2007, 10:43 PM
Hello everyone!
I'm writing a little geometry exporter for the OpenGL project I'm doing.
So far I've managed to get the geometry out right, but I have major problems with texture names.
What I already have: all geometry data, mapping data, material ID data per face
Whan I need: list of texture names without the full path that were used with the object in question, so I can corelate that with the texture database in my project.
My attempt so far :
out_name = "c:/testdump2.dat"
out_file = fopen out_name "wb"
mats=sceneMaterials
for mtl in mats do
(
if (classof mtl == standardMaterial) then
(
if mtl.diffuseMap != undefined then
(
WriteString out_file mtl.diffuseMap.filename
)
)
else if (classof mtl == multimaterial) then
(
for sMat in mtl do
(
if sMat.diffuseMap != undefined then
(
WriteString out_file mtl.diffuseMap.filename
)
)
)
)
)
The error message I get is : >> MAXScript Rollout Handler Exception: -- Unknown property: "diffuseMap" in #Multi/Sub-Object:Material #79(Standard:Material #25, Standard:Material #26, Standard:Material #27) <<
#56(Standard:Material #26, Standard:Material #25, Standard:Material #27) <<
Oddly enough, it appears at random parts of the above code really. Refreshing the source of maxscript to make it run makes me furious sometimes.
Anyways, can someone point what I am doing wrong here?
The output of the file is expected to be :
tex1.bmp
tex2.bmp
etc etc.
Thanks in advance for any tips you might have.
I'm writing a little geometry exporter for the OpenGL project I'm doing.
So far I've managed to get the geometry out right, but I have major problems with texture names.
What I already have: all geometry data, mapping data, material ID data per face
Whan I need: list of texture names without the full path that were used with the object in question, so I can corelate that with the texture database in my project.
My attempt so far :
out_name = "c:/testdump2.dat"
out_file = fopen out_name "wb"
mats=sceneMaterials
for mtl in mats do
(
if (classof mtl == standardMaterial) then
(
if mtl.diffuseMap != undefined then
(
WriteString out_file mtl.diffuseMap.filename
)
)
else if (classof mtl == multimaterial) then
(
for sMat in mtl do
(
if sMat.diffuseMap != undefined then
(
WriteString out_file mtl.diffuseMap.filename
)
)
)
)
)
The error message I get is : >> MAXScript Rollout Handler Exception: -- Unknown property: "diffuseMap" in #Multi/Sub-Object:Material #79(Standard:Material #25, Standard:Material #26, Standard:Material #27) <<
#56(Standard:Material #26, Standard:Material #25, Standard:Material #27) <<
Oddly enough, it appears at random parts of the above code really. Refreshing the source of maxscript to make it run makes me furious sometimes.
Anyways, can someone point what I am doing wrong here?
The output of the file is expected to be :
tex1.bmp
tex2.bmp
etc etc.
Thanks in advance for any tips you might have.
