ScriptSpot

Script

Batch Loader

By Anubis · 2009-10-05

Version
2.0
Version requirement
3ds Max 9+
Date updated
2012-10-26
Votes
75
Description

Quick Merge/Import multiple files.

UI v.1.7

Features:

  • Merge multiple .MAX files
  • Import multiple .* files (ie all that can be imported)!
  • Log all files where failed to load to Listener (if any)
  • Multiple history for recent used paths available
  • Limit count of recent paths to keep in history added
  • Group option available
  • Layer option available
  • Attach option available
  • "Auto" option (if is checked no prompt for Merge/Import) *
  • Dialog window is resizeable
  • Auto rename duplicated objects on import

[*] If "Auto" is unchecked then default Max Merge/Import dialog appear for each file.
It is slower alternative, but it is important and useful in some cases.

Additional Info

I noticed that there is interest in scripts like "Batch Merge". I also read the comments and requests, so here's what I created. Version history:
  • 1.0 - initial version
  • 1.1 - minor code polish up
  • 1.2 - INI file previously saved to Scripts folder, now saved within script source file location
  • 1.3 - added minimal dialogue size when the dialogue is resized
  • 1.4 - suppress the name conflict dialogue when imports and "Auto" option is on (now auto rename)
  • 1.5 - create layer per file using it file name as label
  • 1.6 - minor fixes
  • 1.7 - attach per file as mesh or poly
  • 1.8 - suppress additional imports dialogue; browse for folder dialogue start in recent path
  • 1.9 - auto renaming rewriten (as the auto suggested name is not always correct, now append count digits)
  • 2.0 - now check (by name) for existing layer and create new only if not exist
(TodoList: Remove stored paths that no more exist)
Attachments

Tags: import, max, batch, 3ds, files, fbx, anubis, meshes, obj, merge

Comments (55)

Subfolders checkbox

rachka · 2024-02-03

It'd be very nice to have a subfolders checkbox so it can read different directories within.

Subfolders checkbox

rachka · 2024-02-03

It'd be very nice to have a subfolders checkbox so it can read different directories within.

Use Scene Material function

GoodVibes · 2020-06-19

Hi, Panayot! Your script is very useful, especially when creating a kitbash for a project. Tell me please, is it possible to add the Use Scene Material function to this script to make instances from the same materials?

missing import options

rachka · 2015-07-01

It would be nice if the script has import options.

asymptote · 2013-08-21

@ barigazy, maybe, but I'd like Batch Loader to do this automatically for me so both areas are relevant :P

Renaming Imported Files.

asymptote · 2013-08-21

More of a question than a request, but is it possible to rename 3ds files when the original name is longer than 8 digits ?

eg:

Original filename is "Driver_Status_green.3ds"

Imported filename is "Status_g00"

Is it beyond the capabilities of the 3ds file format and/or Maxscript, that the imported file can be renamed to the original file automatically ?

Thanks

barigazy · 2013-08-21

Hey asymptote
You question is more for forum topic :)

Great script...

milie · 2013-08-01

Is there any way to:

- Read subfolders? Let's say i want to merge multiple max files that each has it's own directory.
This script, http://bit.ly/19Af8e5, manages reading subfolders great.

- Merge multiple max files and keep their individual layers, while adding the file name as prefix, something like:
teapot.max_layerA
teapot.max_layerB
teapot.max_layerC
box.max_layer0
box.max_layerA

Thanks

asymptote · 2013-06-19

Ah I was assuming you were importing 3ds files, I bow out and await the genius of Branco to solve your issue :)

edit: In fact I was going to ask the same thing if it's possible to have file sorting order as in Explorer, Name / Date / Filesize etc, I just never got round to asking.

barigazy · 2013-06-19

Hey guys I think that this is not right place for discussion. Can someone open new threat in forum section or use threat posted below as example and we continue discussion there.
BTW sorting problem can be solved using qsort method. Take a look this EXAMPLE

barigazy · 2013-06-19

I found the problem.
You need to sort "Listitems" array before load in to multilist box.

barigazy · 2013-06-19

I hope this can solve problem.

--Replace line 172 ei next code
for i = 1 to sel.count do append seqFiles listFiles[sel[i]]
--with this
for p in listFiles do
(
for i in sel where matchPattern p pattern:("*"+mlb_files.items[i]) ignoreCase:on do append seqFiles p
)

barigazy · 2013-06-19

Also not forget to use sort method as I explained in my previous post (lines 128,147,158)

barigazy thank you!

rachka · 2013-06-20

thanks barigazy! everything's OK now!

barigazy · 2013-08-12

I'm glad to hear that your problem is solved.
I hope that Anubis will integrate this into the new update.

;)

asymptote · 2013-06-19

@ rachka , Are you using the attach as poly function ? If your 3ds file is made up of several parts each part will be imported separately and named accordingly.

Also, if you'd take the time to post screen shots of your issue you might get to a solution quicker ;)

screenshots

rachka · 2013-06-19

So we have two screenshots.
http://dox.bg/files/dw?a=dac405ac49
http://dox.bg/files/dw?a=552044f957
One before your code and one after your code. On the first screenshot the script shows random listing of a bunch of .max files so I have to search through the whole list and manually select the files I want to load which in this case are from maple_cal_01.max until maple_cal_09.max. At the left we see the loaded files. No problem - the files are the same I selected.
On the second screenshot which is after your code, we see the files properly listed by their file names. When I (of course this time with no searching through the list) select again the files from maple_cal_01.max until maple_cal_09.max the script loads (as we see at the left) files that are not those I have selected. Actually the files that are loaded are those from the random list from the first screenshot which is before your code. They stay on the same lines that now are occupied by the properly listed files, namely from maple_cal_01.max until maple_cal_09. What happens is that the script now displays the files properly but still reads them (and loads them) as if they are situated in the random list before your code.

the script loads and lists files by random order

rachka · 2013-06-18

Seems like the script loads and lists files by random order instead of by name. Is this on purpose? I can't see the reason behind this. It's a real mess. Otherwise the script is great.

@rachka

barigazy · 2013-06-18

Find all lines with this code

mlb_files.items = for f in listFiles collect (filenameFromPath f)
-- and replace ei. add "sort" method
mlb_files.items = sort (for f in listFiles collect (filenameFromPath f))

rachka · 2013-06-18

barigazy, where to put this code?

barigazy · 2013-06-18

Open Batch Loader script in MaxScript Editor and change next lines (128,147,158) with this line:

mlb_files.items = sort (for f in listFiles collect (filenameFromPath f))

barigazy thank you, but...

rachka · 2013-06-18

thanks man, but now it orders them properly by their file names, and loads them randomly just like before. maybe some other code is needed?

barigazy · 2013-06-18

Now I not unerstand you. You asked for it : "Seems like the script loads and lists files by random order instead of by name".

barigazy

rachka · 2013-06-19

well, the script listed the files randomly which was the annoying part and when I picked the files I wished to be loaded, the script loaded those exact files. after I put your code the script lists the files properly by their file names but loads them randomly i.e. loads files I didn't choose as if the script reads from the previous random list i.e. what happens now is that the script displays (lists) the files properly but loads files different from those I pick from the list.

time saver

nicks1008 · 2013-06-17

A huge time saver. thanks alot "Anubis". best thing is that it keeps the history of
recent directories. :)

Small bug

kino · 2012-10-23

If you have file which name is "0.obj" (zero) it will break the layer creation process. In line 235 FName-variable has filename "0" in it..

Thanks for the great script anyway! :)

Hey Kino

Anubis · 2012-10-26

Thanks for reporting this tipo, I fixed it ;)

asymptote · 2012-05-08

Is there any reason you can think of that this would run slower on Max 2010 64 ?
I've recently switched to 64 bit and importing takes ages compared to 32.
Granted, I am importing 2212 objects, but they come in at a crawl. (about 45 mins)
Maybe a heapsize issue ?

EDIT: Found the problem, if I have Outliner open at the same time as importing it slows to a crawl.

Absolutely Perfect!I can't

asymptote · 2011-11-16

Absolutely Perfect!

I can't thank you enough, as I've said before I'm totally lost without this little script.
I love the way it now numbers the imported files, the entire scene is more organized , and each object now has a sequential relationship, I can see which file came in, and in what order.

Many thanks for your time and patience on this one :)

Richard

v.1.9 update log

Anubis · 2011-11-16

issue detected:
Max auto suggested names for renaming are not always correct.

solution:
Now BL append count digits to the duplicating objects names.

Thanks to Richard Missin,
who send me testing files that reproduce the issue.

update is out - v.1.8

Anubis · 2011-11-12

It was very quick editing, I hope its fine now.

asymptote · 2011-11-12

Ok, thanks Anubis, I did turn off "Auto" and held down the enter key, when it comes across a name conflict, It shows the old name and suggests a new name, if I hit Ok for the new name, the name conflict re-appears.
It seems not to accept the suggested name, so when "Auto" is on I get stuck in the loop ;)
Why I have no clue :/

patience

Anubis · 2011-11-12

Ah, the suggested new name affect just one (current) object, for that Max continue to ask. See the picture above in the description that show "Import Name Conflict" dialogue. Now imagine you have many 3ds and the objects inside them are named "object1", "object2", etc. After importing 1st 3ds, Max will start asking for new name for each new object as the names they have already exist. But do not worry, I'll fix that soon ;)

asymptote · 2011-11-12

The main problem is it's not giving me the option to rename.
The "Import Name Conflict" dialogue doesn't stay on the screen for longer than a nano second.

I will update that soon

Anubis · 2011-11-12

If you turn off 'auto' option you can rename the objects manually but that not solve anything, right? I already suppress the "Import Name Conflict" dialogue, so Max auto rename them, but of'cuz I can suppress and that import dialog you have.

stay tuned ;)

asymptote · 2011-11-12

Ha ha yes. Your memory is better than mine ;)I forgot I'd posted that, and thought this was a different problem.
It's definitely the internal name problem, (I checked the offending files)
my problem is what to do when i come across it.
Can it be made to ignore skip them ? or in some way to identify them and choose to skip them ? I don't fancy checking the internal names of 3000 files manually :)A way to terminate the import process would be helpful too.
I've mailed the author of the program that exports the 3ds, to see if I can solve the problem at it's source.

thanks.

asymptote · 2011-11-12

Thanks for the updates, but I now sometimes have a problem when importing objects.
I get the "An object with that name already exists...etc"
When i click OK, the "Import Name Conflict" dialogue briefly flashes up then returns to "An object with that name already exists...etc".
It simply doesn't give me time to enter a unique name, I'm locked in the process and the only way out is to restart Max.
This is probably an internal 3ds name thing, because there are no objects in the scene.
Is there any way to cancel the entire process if I change my mind half way through ?

Max 2011 32 btw.

thanks

Anubis · 2011-11-12

Hi asymptote,
I remember you ask me about this before.
You're still the only one who report such problem.
It's again about this dialog, right?

(i get the picture from your old post)

Incredible

sebandraos · 2011-11-03

Thank you so much for this. It has streamlined my workflow enormously. I will be using this on an almost daily basis for, probably, years to come.

Awesome, keep up the good work

Seb

Thanks

Anubis · 2011-11-03

🙂

Thanks everybody

Anubis · 2011-10-30

A requested update (v.1.7) is done.
Now can attach per file as mesh or poly.

Just what i needed,

crystal3d · 2011-10-04

Many many thanks

asymptote · 2011-05-17

Cool, A new version ;).... A great script just got even better ... many thanks.

1rv · 2011-02-01

It's OK now, sorry. I think it's bacause I tried to import .skp files of v.8
(max2010 supports v.7 only).
And thank you once more for your efforts!

'addnode' error

1rv · 2011-01-31

I constantly get error:
unknown property: 'addnode' in underline
Any thoughts?

Anubis · 2011-01-31

Hi, did you use last script version? addNode is when create layers. Can you post more details.

Script_Butler · 2011-01-25

This seems like a rather handy script!

One question, is it possible, although I doubt it, to be able to merge a particular layer from a .max file?

Not yet

Anubis · 2011-01-27

Ah, I see this asked before somewhere, but not yet on hand such kind of access (to layers in external files on merging) in Max.

[Edit] I wrote a quick script for Merge By Layer (and hope its useful)

Amazing!

caebrasil · 2011-01-24

You can't imagine how much you help me with this script! Dozens of .fbx files in one unique process, and it works perfectly!
Thank you very much!
One little sugestion (maybe little, I don't know) is the possibility of do a layer for each file, with the same name. This will be very usefull... at least for me... :)
Regards,
Caetano Brasil

Thanks for the nice feedback

Anubis · 2011-01-25

Creating layer for each file with the same name is not a problem. I'll add this to the script as soon as have some free time.

[Edit] the script is updated, enjoy.

asymptote · 2010-10-04

Strange I know......I'll look into it some more, I can get the objects into the scene by unchecking the "Auto" and holding down the enter key...until that dialogue pops up, then I have to manually rename a couple of files...hold down the enter key until the dialogue pops up .....etc etc....It's the first time I've ever seen that dialogue too. I generally do these things in a rush and i'm too impatient to take note of whats going on, I'll run the process again and take a closer look.

thx

asymptote · 2010-10-04

It's not working for me now...I've just switched to max 2009 for a project and I'm getting this message when using on a folder with 1065 objects. Is there a limit to the renaming ? Or is this a 2009 thing, also there's no way to cancel the process I have to Ctrl Alt Del and kill max to get out of the sequence.

Using the "Auto" function it asks me to rename , but then doesn't let me rename, obviously because it's supressing the dialogue.

I'm stuck without this script, any suggestions ?...thanks

 

Anubis · 2010-10-04

That's really strange... I never see this dialog in my Max. I'm write and still use this script exactly in Max 2009, and without any problems, even with much more object.

Whether someone else can confirm same issue?

asymptote · 2010-09-03

Perfect!...I use this everyday, now I don't need to wedge a heavy spoon on my enter button to import 2000+ files. ;)

Many thx for the update.

Anubis · 2010-09-03

A requested update is ready. Now all duplicated objects names auto renamed on import. Enjoy.