create pt at prim center (transfer @N?)

   2600   5   0
User Avatar
Member
1004 posts
Joined: April 2017
Offline
Hi!

in a primitive wrangle, I created a point at the center of each primitive. I wanted to use setpointattrib() function to set the @N of the new point to match the primitive. I understand that setpointattrib only works on input points but doesn't work with points created in the wrangle with the addpoint function.

How can I easily set the @N of the new point to match its primitive's @N?

-Olivier
User Avatar
Member
8516 posts
Joined: July 2007
Online
olivierth
I understand that setpointattrib only works on input points but doesn't work with points created in the wrangle with the addpoint function
why wouldn't it? Primwrangle:
int pt = addpoint(0, @P);
vector N = prim_normal(0, @primnum, .5, .5);
setpointattrib(0, "N", pt, N);
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
1004 posts
Joined: April 2017
Offline
I was trying something similar but it did not work. I thought the “setpointattrib(0, ”N“, pt, N);” would not work since the “0” is telling it to set the attribute on the input geometry. Not on the wrangle created points… ?!

Here's a screengrab I did before changing my code (forgot to copy paste in the forum). What was wrong in my code?

Thanks for the help.

-Olivier

Attachments:
Create_center_point_with_N.JPG (79.2 KB)

User Avatar
Member
8516 posts
Joined: July 2007
Online
notice that you are adding your point to geometry referenced by handle 0
so you can also set it as 0 will contain that point, well, maybe not exactly what is happening, but you can think of it that way, obviously it will not work with anything else than 0 at this point

you've put “primN” in there instead of primN

so it will make your N string attribute and set value of “primN” everywhere
but ig you put primN, which is vector variable, it would create vector attribute N with value contained in primN variable per point
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
8516 posts
Joined: July 2007
Online
notice that you are adding your point to geometry referenced by handle 0
so you can also set it as 0 will contain that point, well, maybe not exactly what is happening, but you can think of it that way, obviously it will not work with anything else than 0 at this point

you've put “primN” in there instead of primN

so it will make your N string attribute and set value of “primN” everywhere
but ig you put primN, which is vector variable, it would create vector attribute N with value contained in primN variable per point
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
1004 posts
Joined: April 2017
Offline
ah! the quotation marks!

Many of my mistakes are silly things like that.

Thanks!

-Olvier
  • Quick Links