Jump to content

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 ?

Link to comment
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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...