find primitive neighbours?

   5936   4   0
User Avatar
Member
1075 posts
Joined: 4月 2017
Offline
The neighbour(s)(count) functions are all for points. Is there a way to do the same thing for primitives? …or do I have to start by finding point neibours and… (*jumps through hoops) …find the primitives a few line of code later?

-Olivier
User Avatar
Member
1075 posts
Joined: 4月 2017
Offline
Ah!

So, instead of running over primitives I ran over points with this. The trick was to use the pointprims function and the len function to see what point was connected to more than one primitive:

int ptprims[] = pointprims(0, @ptnum);

i@group_needsstairs = 0;
if(len(ptprims) >= 2)
    {
    foreach(int currentprim; ptprims)
        {
        setprimgroup(0, "needsstairs", currentprim, 1, "set");
        }
    }

-Olivier
User Avatar
Member
8785 posts
Joined: 7月 2007
Offline
in case you want polys that share an edge with a given or current poly you can use
i[]@primnbrs = polyneighbours(0, @primnum);
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
1075 posts
Joined: 4月 2017
Offline
Ah great!

Thanks.

-Olivier
User Avatar
Member
3 posts
Joined: 11月 2017
Offline
I wrote a solution for this over in this thread:

https://www.sidefx.com/forum/topic/70966/?page=1#post-301099 [www.sidefx.com]
Director / Lead FX TD
  • Quick Links