Posted 11 years ago
·
Author
This is a vbs script written by dcdani @ imvu (http://www.dcdani.com).
The purpose of this script is to join multiple mesh files (xmf) into a single mesh file. For example, if you have 2 chair meshes, it will combine them into a single product. Both meshes will retain their texture information and positioning. However, if both products share the same position, it will clip them into each other.
The purpose of this script is to join multiple mesh files (xmf) into a single mesh file. For example, if you have 2 chair meshes, it will combine them into a single product. Both meshes will retain their texture information and positioning. However, if both products share the same position, it will clip them into each other.
' By dcdani @ imvu
' www.dcdani.com
'
' se le arrastran encima los ficheros y los junta en uno solo :-|
Set WshShell = WScript.CreateObject("WScript.Shell")
Set inCsvSys = CreateObject("Scripting.FileSystemObject")
dim resultado,rtxt,submeshes
dim fout
If Wscript.Arguments.Count = 0 Then
msgbox "Please drag-drop files to join"
Else
resultado="":submeshes=0
fout=Replace(WScript.ScriptFullName, WScript.ScriptName, "") & "joined.xmf"
' w=WshShell.Popup("Joining... please wait", 1, "_JoinXmf by dcdani @imvu www.dcdani.com ", 64)
for k=0 to Wscript.Arguments.Count-1
leefichero Wscript.Arguments(k)
rtxt=rtxt & vbcrlf & "Procesado:" & Wscript.Arguments(k)
next
Set outxmf = inCsvSys.OpenTextFile(fout ,"2",True)
outxmf.writeline "<HEADER MAGIC=""XMF"" VERSION=""919"" />"
outxmf.writeline "<MESH NUMSUBMESH=" & """" & submeshes & """" & ">"
resultado=replace(resultado,vbcrlf & vbcrlf ,vbcrlf)
outxmf.writeline resultado
outxmf.writeline "</MESH>"
msgbox "xmf Joiner : www.dcdani.com . dcdani @ imvu " & vbcrlf & "Submeshes:" & submeshes & vbcrlf & "File created in :" & fout
outxmf.close
End If
sub leefichero(f)
Set inxmf = inCsvSys.OpenTextFile(f,"1",True)
dim fall
fall=inxmf.ReadAll
if instr(fall,"<MESH") then
fall=right(fall,len(fall)-instr(fall,"<MESH")-5)
if instr(fall,"NUMSUBMESH=") then
duma=left(fall,instr(fall,"NUMSUBMESH=")-1)
dumb=right(fall,len(fall)-instr(fall,"NUMSUBMESH=")-11)
dumc=left(dumb,instr(dumb,"""")-1)
submeshes=submeshes + dumc*1
fall=dumb
' tenemos hasta el submeshes, terminamos la linea
fall=right(fall,len(fall)-instr(fall,vbcrlf)-1)
end if
end if
fall=replace(fall,vbcrlf & "</MESH>","")
resultado=resultado & fall
inxmf.Close
end sub