Jump to content
CinnamonMetal

Storing Prims in array, restoring the previous array

Recommended Posts

I'm hoping I can get a second input on a problem;

int max;
float radi;
addattrib(0,"Cd","PpColor",{0.3,0.6,0.2});
for(int k=6;k<=@primnum;k++){
        append(i[]@pprimList,@primnum);
            foreach(int primms;i[]@pprimList){
            removeprim(0,primms,1);
        for(int v=5;v<=@primnum;v++){
            append(i[]@pprimList,@primnum);
        if(i[]@pprimList<=4){
            printf("%g\n",@pprimList);
            break;
            }
        }
    }
}

The first loop, loops over all the primitives stores them in an array then deletes those primitives greater then 6.  Considering the array is now empty, the second loop, loop over all the primitives less then 5 and stores them in the previous array; then checks if the array is less then equal to 4, print the items in the array.

Except it's not working ?

Share this post


Link to post
Share on other sites

functions like removeprim() only get executed at the very end of the code, so the @primnum and @numprim values will not update during code execution.
if you really want to build it like this, you have to store them in temporary variables and keep track of the current primitive number in that way

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×