appending values to an array, making array grow or shrink?

   999   0   0
User Avatar
Member
245 posts
Joined: 9月 2008
Offline
hi all...

let's say i have an array
string myarr={"A","B","C","D","E"};

string mynewarr={};

and

int myz=@P.z;

i want to append values from the "myarr" array into "mynewarr" array by using the Keyboard CHOP.

so far when i use the


append(mynewarr,myarr);

i only get one value appended to the at-first-empty "mynewarr" and when I run the playhead using scroll-lock to access the keyboard for interaction, i still only get the last key pressed appended to the array. the array is not growing let's say

{A}
{A,C}
{A,C,D}
etc.

it is doing this instead:
{A}
{C}
{D}
and as you can see it is the last key i pressed rather than growing.

i think what is happening is that since I have to define the array at the top of my attribute wrangle sop as an empty array, it is getting re-initialized at every frame and then appending the last key pressed to that newly initialized array, rather than building the array as i desire.

I can't seem to pass the array from an upstream previous attribute wrangle sop into the downstream second attribute wrangle where I am doing the array-building.

can anyone provide insight on how to fix my problem? it seems i am missing something really basic, and i am very new to using the attribute wrangle, even after several iterations of houdini.

thanks in advance.
  • Quick Links