VOP SOP: how do I get the number of primitives in input?

   9040   3   1
User Avatar
Member
55 posts
Joined: July 2005
Offline
It is my first VOP SOP and I need to get the number of primitives in input 0. I have seen a function “int nprimitives( string filename )” and it seems to work only with a filename. Is there an equivalent with an input that I have not seen? And moreover, I'd like not to go into coding already, so if there is such an equivalent, is it accesible within VOP? or only with VEX functions?
and actually I am still not clear with the differences between VOP and VEX. are all VEX functions wrapped into VOP? when do I need to go into coding instead of making a visual graph?

thanks in advance for a few hints about this
User Avatar
Staff
2540 posts
Joined: July 2005
Offline
Not availabe right now. VEX is really good at dealing with points but not with Primitives.

To get around this, you can put an attribute Create SOP before your custom operator to build a point attribute. Create an attribute called, say nprim and for the Value use:

nprims(“../”+opinput(“.”, 0))

which will return the name of the SOP coming in to the Attribute Create SOP automatically. This way you keep the ability to wire in anything and then use the point attribute with the number of prims on each point.

To inherit the attribute, put down a parameter VOP and give it the same name as your custom point attribute with the prim number in it, in this case nprim and use it in your VOP. Check on “Use input value if parameter not bound”.

To wrap them all together as a single tool, you could turn this in to a Custom Object and put it in an OTL.
There's at least one school like the old school!
User Avatar
Member
8068 posts
Joined: July 2005
Offline
On the Parameter VOP, I think Jeff meant the “Export Parameter” toggle needs to be on?
User Avatar
Staff
2540 posts
Joined: July 2005
Offline
Yep, thanks Ed, I did mean the export parameter.
There's at least one school like the old school!
  • Quick Links