PDA

View Full Version : Importing multiple files



Morte
05-04-10, 04:51 PM
Hi, there im quite new to zscripting, and im trying to wrtie a script which would go and import all obj's in specified folder. I believe showing an example is a good idea:
Say I have folder C:\Models\ where is x obj files. I would like to write a script which would go and import all obj from this specific folder.

Importing one or any fixed size and name is easy as ican simply write

[ISubPalette,"ZPlugin:Import Tools"]
[IButton,"ZPlugin:Import Tools:Import", "Some texr",
[FileNameSetNext,"C:\Models\1.obj"]
[IPress,Tool:Import]
]

There is no while loop in zscripts so i am wondering how i can go about iterating here... any help would be appreciated:)
I believe it can be done as subtool master multi append has similar functionality. Btw. is there any way to see subtool master surce code somewhere?
Thanks in advance:)!

marcus_civis
05-06-10, 01:53 AM
You can effectively create a while loop in zscript by using the [LoopExit command:


[Loop,10000,//large value
[If,myTest == 1,[LoopExit]]
//do stuff
]//end loop

To get the file names in a folder you need to use a DLL. If you're on a PC then the ZFileUtils will work (though note that some of the mesh/ZBrush functions included in the DLL will not work with ZBrush 3.5). There's info and the download link here:

http://www.pixologic.com/docs/index.php?title=ZScript_FileUtils

I'm sorry to say the code for Subtool Master is not available.

HTH,

Morte
05-22-10, 03:49 PM
Sorry for such late reply... Firstoff all thanks Marcus, the info was very helpful.
Hey is there a way to simulate pressing the return button usin zscript?