expression not working in Add SOP

   3230   2   0
User Avatar
Member
16 posts
Joined:
Offline
Hi everyone,

sorry if this is really a stupid thing but i was trying to have an add sop with the same number of points as there are primitives in another sop, now i can't seem to get this to work i try to insert an expression in the number of points field but it doesn't let me type anything there. I tried using ‘alt + e’ and inserted the following:
nprims(“../curves_grp”)
Where curves_grp is a group of curves, but the expression doesn't stick when i get out, if i press ‘alt+e’ again there's no expression there. Is this something i'm doing wrong or there's no support for expressions to define the number of points in Add SOP?

Another thing, i think it would be useful when dealing with expression functions to have some variable to automatically reference the input SOP, something like $INPUT or $PARENT that could be used by any expression even if one changes the node input. Not sure if something like that exists but i think that is probably easy to achieve if it doesn't.

Cheers
User Avatar
Member
4262 posts
Joined: July 2005
Offline
strayDog
Hi everyone,

sorry if this is really a stupid thing but i was trying to have an add sop with the same number of points as there are primitives in another sop, now i can't seem to get this to work i try to insert an expression in the number of points field but it doesn't let me type anything there. I tried using ‘alt + e’ and inserted the following:
nprims(“../curves_grp”)
Where curves_grp is a group of curves, but the expression doesn't stick when i get out, if i press ‘alt+e’ again there's no expression there. Is this something i'm doing wrong or there's no support for expressions to define the number of points in Add SOP?

The Add SOP can be a bit tricky. The best solution is to create the points with a Grid or Line SOP, then pipe that into a Add SOP and turn on Delete Geometry but Keep Points. Using the Add SOP to create a bunch of points can be quite slow since Houdini will create a UI dialog for each element.

Another thing, i think it would be useful when dealing with expression functions to have some variable to automatically reference the input SOP, something like $INPUT or $PARENT that could be used by any expression even if one changes the node input. Not sure if something like that exists but i think that is probably easy to achieve if it doesn't.

I agree. Sometimes what I do is create a custom expression like

string in(int inputnum) {
return opinputpath(“.”,inputnum);
}


Then in my expressions I can just type in something like
point(in(0),$PT,“P”,0)
if(coffees<2,round(float),float)
User Avatar
Member
16 posts
Joined:
Offline
Thanks Wolfwood,

I followed your suggestion, i used a line sop instead to create all the points and then simply deleted them with the Add SOP, after all the points positions are being set with a Point SOP anyway so this way i'm able to control the number of points through expressions which is what i was looking for.

About that custom expression, that's a nice tip my friend, i think i'll be using that from now on, nevertheless i believe implementing a variable to reference the input should be something pretty straightforward for such a great development team

Cheers
  • Quick Links