We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › Sequential file loading
Page Index Toggle Pages: 1
Sequential file loading (Read 451 times)
Sequential file loading
Apr 24th, 2008, 12:08am
 
i've got a sequence of .obj files, each one is a different key frame of animation for the same model that i created in Maya. I've made a script in maya that automates this process. I'm loading these into processing using my custom loader and interpolating the vertex values to create a rudimentary animation system.  Everything works fine but currently i'm loading it one by one.  It would be a hell of alot easier if i could load them sequentially. Also currently i'm loading my object using:

String frog1obj[];
importobj frog1;

void setup(){
 frog1obj =  loadStrings("frog1.obj");
 frog1 = new importobj(frog1obj);
}

then frog2 frog3 et cetera

what id'e like to do is:

importobj frog;

void setup(){
 frog = new importobj("frog*.obj")
}

So my 2 questions are:

a) how can i pass "frog.obj" as an argument to my class so that i can read it internally in my constructor using

frogobj = loadStrings("frog.obj");

b) if possible how do i load a bunch of files sequentially using wild cards.

Re: Sequential file loading
Reply #1 - Apr 24th, 2008, 12:16am
 
There are no wildcards, but you can do

Code:

importobj[] frogs;

void setup()
{
//...
frogs=new importobj[numObjs];
for(int i=0;i<numObjs;i++)
{
String[] tmp=loadStrings("frog"+i+".obj");
frogs[i]=importobj(tmp);
}
}


and as for doing it in a single step:
Code:
class importobj
{
importobj(String filename)
{
String[] tmp=loadStrings(filename);
//what is already in your current constructor
}
}

And of course this removes the loadStrings thing from the setup() function above, and you pass "frog"+i+".obj" to your importobj constructor.
Re: Sequential file loading
Reply #2 - Apr 24th, 2008, 12:57am
 
awesome, thanks john! i'll give this a shot after work.
Page Index Toggle Pages: 1