ScriptSpot home

Forum topic · Scripts Wanted

Modify existing script to batch import all files in a folder to the scene

By _MaZ_TeR_ · 2020-06-26

Downloads
Description

Basically, the script I have forces me to open every single file in a folder one by one with it, so it takes forever to import all the files to the scene. Don't know why the person who made it didn't add batch functionality to it though. I basically want the script to batch import everything in a folder to the scene.

Comments (4)
Panteleev Sergey

.

I doubt that anyone would register on a random forum just to have a look at the script.

Reply to _MaZ_TeR_
Panteleev Sergey

.

Changes:


...
directory = getSavePath() -- select a folder where *.rcb.win and *.GEO files are located
if directory != undefined do -- if path exists
(

	gnames = getFiles (directory+"\\*.rcb.win") -- get all *.rcb.win file names
	fnames = getFiles (directory+"\\*.GEO") -- get all *.GEO filenames
  
	for i = 1 to amax gnames.count fnames.count do -- iterate over filenames and do everything that was in the original script
	(
		gname = gnames[i]
		fname = fnames[i]
		
		g = fopen gname "rb"
		f = fopen fname "rb"
...

Since you didn't provide any additional info on how this supposed to work I assumed that directory contains equal amounts of *.rcb.win & *.GEO files. If it's not the case or if you need to select pairs of corresponding *.rcb.win & .GEO files then this probably won't work as expected.

Attachments
Reply to Panteleev Sergey
_MaZ_TeR_

*

Oh right, the script is supposed to first pick an individual .rcb.win file of your choosing and then import all the .geo files inside a folder of your choosing to the scene, as in the .rcb is the model's skeleton and the .geo files are the mesh files. The script basically pulls the model's skeleton and weight data into the meshes.