TechnicallyArtistic
07-18-2011, 06:38 PM
I'm trying to modify the md5export script to get the file name when it's exporting to save myself some file naming nightmares.
I'm not really familiar with Max Script but am familiar with Mel Script so I'm kind of blind of what part I'm looking for here.
I assume I'm using something like
getFileNameFile()
Here is the chunk of code I think it goes into from what I can tell. Can anybody see how this chunk might be modified to get the file name to name this export file so I don't have to type it in each time I export out a file? It just needs to be the same name as the .max file but with the .md5 extension instead.
function md5export = (
cursel = GetCurrentSelection()
mesh = cursel[1]
if mesh == undefined do
(
messagebox "no object selected"
return undefined
)
if (((classof mesh.baseobject) as string) != "Editable_mesh") do
(
messagebox "selected obj is not an editable_mesh"
return undefined
)
if g_export_anim_only then
(
animfilename = getsavefilename caption:"Save MD5anim" types:"MD5anim (*.md5anim)|*.md5anim"
if animfilename != undefined do
(
animfile = createfile animfilename
if (animfile != undefined) do
(
md5 = md5exportobj mesh
-- format "%" (md5[1] as string) to:outfile
format "%" (md5[2] as string) to:animfile
-- format "%\n" (md5[1] as string)
-- format "%\n" (md5[2] as string)
-- close outfile
close animfile
)
)
)
else
(
outfilename = getsavefilename caption:"Save MD5" types:"MD5mesh (*.md5mesh)|*.md5mesh"
if outfilename != undefined do
(
outfile=createfile outfilename
animfilename = copy outfilename
endindx = findstring animfilename ".md5mesh"
animfilename = replace animfilename endindx 8 ".md5anim"
animfilename = getsavefilename caption:"Save MD5anim" filename:animfilename types:"MD5anim (*.md5anim)|*.md5anim"
if animfilename != undefined then animfile = createfile animfilename
if (outfile!= undefined and animfile != undefined) do
(
md5 = md5exportobj mesh
format "%" (md5[1] as string) to:outfile
format "%" (md5[2] as string) to:animfile
-- format "%\n" (md5[1] as string)
-- format "%\n" (md5[2] as string)
close outfile
close animfile
)
)
)
)
Also, if that's not it any anybody wanted to see the whole file, it can be downloaded here:
http://home.mnet-online.de/der/3dsmax-md5exporter.zip
I'm not really familiar with Max Script but am familiar with Mel Script so I'm kind of blind of what part I'm looking for here.
I assume I'm using something like
getFileNameFile()
Here is the chunk of code I think it goes into from what I can tell. Can anybody see how this chunk might be modified to get the file name to name this export file so I don't have to type it in each time I export out a file? It just needs to be the same name as the .max file but with the .md5 extension instead.
function md5export = (
cursel = GetCurrentSelection()
mesh = cursel[1]
if mesh == undefined do
(
messagebox "no object selected"
return undefined
)
if (((classof mesh.baseobject) as string) != "Editable_mesh") do
(
messagebox "selected obj is not an editable_mesh"
return undefined
)
if g_export_anim_only then
(
animfilename = getsavefilename caption:"Save MD5anim" types:"MD5anim (*.md5anim)|*.md5anim"
if animfilename != undefined do
(
animfile = createfile animfilename
if (animfile != undefined) do
(
md5 = md5exportobj mesh
-- format "%" (md5[1] as string) to:outfile
format "%" (md5[2] as string) to:animfile
-- format "%\n" (md5[1] as string)
-- format "%\n" (md5[2] as string)
-- close outfile
close animfile
)
)
)
else
(
outfilename = getsavefilename caption:"Save MD5" types:"MD5mesh (*.md5mesh)|*.md5mesh"
if outfilename != undefined do
(
outfile=createfile outfilename
animfilename = copy outfilename
endindx = findstring animfilename ".md5mesh"
animfilename = replace animfilename endindx 8 ".md5anim"
animfilename = getsavefilename caption:"Save MD5anim" filename:animfilename types:"MD5anim (*.md5anim)|*.md5anim"
if animfilename != undefined then animfile = createfile animfilename
if (outfile!= undefined and animfile != undefined) do
(
md5 = md5exportobj mesh
format "%" (md5[1] as string) to:outfile
format "%" (md5[2] as string) to:animfile
-- format "%\n" (md5[1] as string)
-- format "%\n" (md5[2] as string)
close outfile
close animfile
)
)
)
)
Also, if that's not it any anybody wanted to see the whole file, it can be downloaded here:
http://home.mnet-online.de/der/3dsmax-md5exporter.zip
