Jump to content

how to stuff $P into a array


sanostol

Recommended Posts

SOP

Just thinking out loud here, but:

Feed a dummy, single-point geometry to the first input of a VopSOP, and the geometry with the points you want to put into the array into the second input, then in an inline vop (inside the VopSOP), write something like this:

vector $pts[] = array(P);
int $n = npoints(1);
resize($pts,$n);

vector $p;
int $i;
for($i=0;i<$n;i++) {
   if(!import("P",$p,1,$i)) break;
   $pts[$i] = $p;
}
float $larr[] = serialize($pts);
addattribute("points",$larr,arraylength($pts));

This would stuff the point array into a float[] attribute called "points". To recover the vectors, you'd need to unserialize() the array after importing the attribute.

Untested.

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...