PDA

View Full Version : Batch importing SAT files, duplicates bug.


Vsai
11-30-2010, 10:11 PM
I'm attempting to batch import a large directory of SAT files into 3dsmax.

the problem i am having is that the importer is incrementally importing everything that it has previously imported.

(This behavior shows up with dragging the SAT files into the viewport 1 by 1 also, not just in script)

EX:
given a directory of 5 files, fileA -> fileE

in a loop
fileA imports fine
when attempting to import fileB, fileB imports, but also a second copy of fileA is imported again. (prompting for duplicates..)
when attempting to import fileC, the new set of imported objects includes all objects from filesA, B, and C..

ghettoey thrown together import code below:


(
fn getFilesRecursive root pattern =
(
dir_array = GetDirectories (root+"/*")
for d in dir_array do
join dir_array (GetDirectories (d+"/*"))
my_files = #()
for f in dir_array do
join my_files (getFiles (f + pattern))

my_files
)

fn importFileList fArr =
(
setWaitCursor()
if fArr.count!=0 then
(
for f in fArr do
(
try(
format "%\n" f
local fname=getFilenameFile f
importFile f #noprompt
nLayer = LayerManager.newLayerFromName fname
for i = 1 to selection.count do ( nLayer.addnode selection[i] )

)catch( print "failure while importing the file: " + fname)
)
)
setArrowCursor()
)

fn filterFileSizes fArr =
(
filteredArr = #()
for f in fArr do
(
if ((getfilesize f) < 12000000) do
append filteredArr f
)

filteredArr
)

satFiles = getFilesRecursive "C:/Users/vs/Documents/3DSAT" "*.sat"
importFileList (filterFileSizes satFiles)

)


It works fine when used with other filetypes. (3ds/fbx...) but the duplicates error pops up with SAT files every time.

Anyone have any ideas?

3dsmax 2011 64bit

CGTalk Moderation
11-30-2010, 10:11 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.