Notifications
Clear all

[Closed] batch convert files – help please

I was hoping someone could help me out with this. I’m not a 3DS guys so it makes it extra difficult. I need to convert 600 files from an obscure file format, and individually export them to .FBX.

Details: I have a script that does the actual conversion. It gives me a browser in 3DS to select a file, and converts it and shows it in 3DS. Then it just needs to be exported.

Manually, this is taking forever. Does someone know how to do some sort of batch process for this? How would I batch all 600 files this way?

Huge thanks for anyone who can help with this.

sab

11 Replies

Check out Paul Neale’s PEN Batch script. Very easy to use.

http://paulneale.com/scripts/batchItMax/batchItMax.htm

Now that I think about it, you said Obscure file format. What kind of file types are we talking about? Not sure if PENs script only batch files .max files or not.

I have some other batch scripts here if you tell me the file format is put in and what needs to come out I “might” be able to help

the tool you mentioned works great! Unfortunately it only recognize .max files.

I’m specifically trying to convert .mdb files. It’s a game format and I’m trying to mod some of the assets and make a new animatic for it.
I use a script called twMax by Michael_DarkAngel which opens up a UI. I use it to ‘browse’ to the .mdb file and hit ‘import’. it does all the work of interpreting the .mdb file and brings in the model. I just export it as an .fbx from there.

Any thoughts?

Ive downloaded the package but it contains a billion scripts. Please send me the script which you want to automate it and I will edit it.

thanks for looking into this.
I call the twMax.ms script, which seems to call upon the other scripts and brings up the gui in 3DS and triggers the relevent use of all of the other scripts.
so I open the ScriptListener and record what I see. When I MAXScript > ‘run script’ the twMax.ms I get this:

Loading: twMax_witcherBase

Loading: twMax_witcherDanglynode

Loading: twMax_witcherEmitter

Loading: twMax_witcherLight

Loading: twMax_witcherDanglynode

Loading: twMax_guiImport

Loading: twMax_guiDebug

Loading: twMax_guiPrefs

This is obviously calling all the other scripts in the package to find paths, import the model, rebuild the geo and skeleton, read and bring in other stuff… Then I browse to a .mdb file and ‘import model -Import’ I get this part which is calling the paths and model name et al.

strFileName = J:\witcher Extracted\mdb\ob_torch_01.mdb

strModelName = J:\witcher Extracted\mdb\ob_torch_01.mdb

binReadFile = <BinStream:J:\witcher Extracted\mdb\ob_torch_01.mdb>

File Header = (fileHeader fileVersion:136 modelDataSize:10143 offsetRawData:0 offsetTexData:10024 rawDataSize:0 texDatasize:107)

Geometry Header = (geometryHeader modelAnimName:“ob_torch_01” offsetRootNode:332 geometryType:2)

Model Header = (modelHeader firstLOD:-1.0 lastLOD:-1.0 detailMap:“detailmap” animScale:1.0 superModelName:“NULL”)

[font=Arial][size=2]After that is a bunch of info about the verts and building the polys and debugging. Here’s a few random sample lines:

[/size][/font]Node Name : EmiterOgien02

Node Type : 5

Controller Type : 84

Data Rows : 1

Time Key Index : 0

Data Value Index : 1

Data Value Count : 3

normal #22.0 = [0,0,-1.39542e+035]

normal #23.0 = [-2.95252e+038,0,-1.39542e+035]

normal #24.0 = [0,-3.15401e+035,-7.29223e+019]

tvert #54.0 = [0.246474,-0.015074,0]

tvert #55.0 = [0.374934,-0.018685,0]

face #44.0 = 0 [71,70,73] 1

[font=Arial][size=2]Do you think that will be enough to go on? I’m not sure how well I can dig into the individual scripts without making some wild guesses. It’s not a language I know.

[/size][/font]

This should work. I’ve not tested it though as I don’t have any mdb files


(
	
	local files
	local folderPath = getSavePath()

	if folderPath != undefined do (
		
		mdbFiles = getFiles (folderPath + "\\*.mdb")
		
		for a=1 to mdbFiles.count do (
			
			local fbxPath = getFilenamePath mdbFiles[a] + ".fbx"
			
			importFile mdbFiles[a] #noPrompt --using: (you may need to specify the plugin name here)
			
			exportFile fbxPath #noPrompt selectedOnly:false using:FBXEXP
			
			format "Processed % of %" a mdbFiles.count
			
		)
		
	)
	
)

Whoops, forgot to reset max inbetween each import/export. Here is the updated code that resets max.

Edit: Also noticed I had not set the fbx export file name properly. Sorted now.


(
	
	local files
	local folderPath = getSavePath()

	if folderPath != undefined do (
		
		mdbFiles = getFiles (folderPath + "\\*.mdb")
		
		for a=1 to mdbFiles.count do (
			
			resetMaxFile #noPrompt
			
			local fbxPath = getFilenamePath mdbFiles[a] + getFilenameFile mdbFiles[a] + ".fbx"
			
			importFile mdbFiles[a] #noPrompt --using: (you may need to specify the plugin name here)
			
			exportFile fbxPath #noPrompt selectedOnly:false using:FBXEXP
			
			format "Processed % of %" a mdbFiles.count
		
		)
	
	)

)

here’s some .mdb files
.ExternalClass .ecxhmmessage P{padding:0px;}.ExternalClass body.ecxhmmessage{font-size:10pt;font-family:Tahoma;} http://hostwiz.biz/MDBfiles.html

well, the good news is that it’s doing what it’s suppose to.
The bad news is that it isn’t doing what I want it to. This is my fault in assuming the twMax.ms script would do all the work alone.
So I dug around in the twMax_guiGeneral.ms and found the command twMax_importer(). So I ran your code again with that command between your import and export commands. It gave me some errors that it was missing some definitions so I added :

[color=wheat]importFile mdbFiles[a] #noPrompt [size=1]“C:\Program Files\Autodesk\3ds Max 9\Scripts wMax wMax.ms”[/size]

[/color]strFileName = mdbFiles[a]

[size=1]global[/size] strModelName = strFilename
[size=1]global[/size] binReadFile = fopen strModelName [size=1]“rb”
[/size]strCheck = ReadString binReadFile
twMax_importer()

It seems to converts everything (big smile)!!!
But before each conversion it gives me two pop-up buttons that I have to click through before it will continue:

[size=1][size=1][color=cyan]no appropriate import module found

improper file format

It’s a bit annoying considering the number of files I’m trying to convert. Do you think it’s reacting to the [color=#f4a460]importFile mdbFiles[a]’ part of the script?:
[color=sandybrown]importFile mdbFiles[a] #noPrompt [size=1][size=1]“C:\Program Files\Autodesk\3ds Max 9\Scripts wMax wMax.ms”[/size]

thoughts?

[/color][/color][/size][/color][/size][/size]

There is no need for the string after “importfile”. This is doing absolutely nothing and the import function is ignoring it. The reason you are getting those errors is because there is no plugin that Max can use to import an mdb file. Instead, it looks like the twMax script you’re using is doing the file importing, so there is no need to use “importFile” at all.

Try using this code and see how you get on:


(
	--Load twMax.ms script
	fileIn "C:\Program Files\Autodesk\3ds Max 9\Scripts	wMax	wMax.ms" 
	
	--Define local variables
	local files
	local folderPath = getSavePath()

	if folderPath != undefined do (
		
		--Find mdb files in chosen directory
		mdbFiles = getFiles (folderPath + "\\*.mdb")
		
		--Loop through all mdb files found
		for a=1 to mdbFiles.count do (
			
			--Reset Max
			resetMaxFile #noPrompt
			
			--Define FBX path
			local fbxPath = getFilenamePath mdbFiles[a] + getFilenameFile mdbFiles[a] + ".fbx"
			
			--Import mdb file using twMax script
			strFileName = mdbFiles[a]
			global strModelName = strFilename					--Any reason these are global? Best to avoid global vales where possible as they can interfere with other scripts.
			global binReadFile = fopen strModelName "rb"
			strCheck = ReadString binReadFile
			twMax_importer()
			
			--Export to FBX
			exportFile fbxPath #noPrompt selectedOnly:false using:FBXEXP
			
			--User feedback on loop progress
			format "Processed % of %" a mdbFiles.count
		
		)
		
	)

)

Page 1 / 2