Hi,
I've been working on fracturing and controlling where fracturing is active and had someone help me get this working in Houdini 15.
I was watching a tutorial over on Digital Tutors about Controlling Your Fractures in Houdini and it was done in an earlier version.
What I did in the node where my fractured object lives is do an attribute transfer of color to denote which fractured pieces I wanted to remain inactive.
Anyway, this code was in the PopWrangle node.
The SOP path is: /obj/vase/OUT_ACTIVE_PASSIVE
Which I get. That's letting the PopWrangle node know what to look at.
It's this code that I'm wondering about, but mostly the first line.
vector Cd = point(@OpInput1, “Cd”, @ptnum );
This line I get, except the syntax of the i@. Not sure what that is, but I understand that this is setting the active to either 1 or 0 based on the color which I set to black or white on the attribute transfer.
i@active = int(Cd.x);
I come from a programming background. JavaScript, Actionscript and going way back, Pascal, Basic and should I even say Cobol (that was in college though) so I get scripting and syntax and logic.
Just trying to grasp how it works in Houdini.
Thanks,
Jim
PopWrangle - Understanding what a script is doing.
2507 3 1- reelinspirations
- Member
- 177 posts
- Joined: Nov. 2015
- Offline
- sidenimjay
- Member
- 702 posts
- Joined:
- Offline
the i@ is declaring a new integer attribute on the geometry, v@foo creates a vector attribute etc…
when you use int foo or vector foo, it creates it as a local var to the current code
vector Cd = point(@OpInput1, “Cd”, @ptnum );
for this line, the point function is looking to the second input, inputs are 0 based, and getting the color attribute for the current point number in the first input, @ptnum
does that make sense?
when you use int foo or vector foo, it creates it as a local var to the current code
vector Cd = point(@OpInput1, “Cd”, @ptnum );
for this line, the point function is looking to the second input, inputs are 0 based, and getting the color attribute for the current point number in the first input, @ptnum
does that make sense?
- reelinspirations
- Member
- 177 posts
- Joined: Nov. 2015
- Offline
OK, that does make sense, thanks.
I'm just curious why it needs to look at OpInput1 instead of OpInput0?
So @ptnum is the current point number, I get that.
What I'm trying to ‘wrap’ my head around is that a node ‘loops’ through all the points or whatever and applies it to ALL the points without me having to manually to a for loop in standard programming.
In the ‘old’ days, I would write a for loop and loop through an array.
Also, is there some documentation on what attributes are available for points intrinsically, and I'm assuming I can create my own attributes.
Hopefully I can understand the OpInput0 and 1 stuff so I know WHICH input to look at.
Thanks for the explanation.
Jim
I'm just curious why it needs to look at OpInput1 instead of OpInput0?
So @ptnum is the current point number, I get that.
What I'm trying to ‘wrap’ my head around is that a node ‘loops’ through all the points or whatever and applies it to ALL the points without me having to manually to a for loop in standard programming.
In the ‘old’ days, I would write a for loop and loop through an array.
Also, is there some documentation on what attributes are available for points intrinsically, and I'm assuming I can create my own attributes.
Hopefully I can understand the OpInput0 and 1 stuff so I know WHICH input to look at.
Thanks for the explanation.
Jim
- sidenimjay
- Member
- 702 posts
- Joined:
- Offline
you can now use 0,1,2,3 instead of @opinput1 …that makes more sense to my brain as well
v@Cd = point(1, “Cd”, @ptnum); to get from the second input,
if you want the Cd value from the first input it is more common to just use
vector myColor = @Cd; and avoid the point function lookup
the vex code actually, and I may need correction from the devs on this, but I understand it to execute on all the points at once, in threads, rather than a typical for loop from point 0 to point-n
you can write standard flow control statements as well, but those would also execute per point/entity type
creating your own attributes is as easy as using the @ syntax instead of just the type label
v@Cd = point(1, “Cd”, @ptnum); to get from the second input,
if you want the Cd value from the first input it is more common to just use
vector myColor = @Cd; and avoid the point function lookup
the vex code actually, and I may need correction from the devs on this, but I understand it to execute on all the points at once, in threads, rather than a typical for loop from point 0 to point-n
you can write standard flow control statements as well, but those would also execute per point/entity type
creating your own attributes is as easy as using the @ syntax instead of just the type label
-
- Quick Links