set attribute in VEX

   14183   8   2
User Avatar
Member
53 posts
Joined: June 2009
Offline
hi, in vex inline node i want to set a point attribute to my value.
i use addattribute(“attribute name”, “point number”, “value”);
but in result, that is create a new attribute with same name and set my value to that.

where is my problem.
User Avatar
Member
2199 posts
Joined: July 2005
Offline
not sure I follow you, but why not use the addAttribute node instead of the inline one?
The trick is finding just the right hammer for every screw
User Avatar
Member
53 posts
Joined: June 2009
Offline
i know add attribute node, but i think in scripting method, result are better an efficient.

i new in houdini (switch from maya).
in maya i wrote my programs with python and mel, but in vex i found strange things that i don't understand and confuse me.

i think VEX functions give me a lot of good abilities to do anything in my mind.
But first, i must more familiar with VEX Language.
User Avatar
Member
2199 posts
Joined: July 2005
Offline
I think you'll find the speed pretty much the same between inline and node.

In inline method you need to use $ in front of any variables that you pass in or out, maybe that's what you are missing. Might be easier to see what you are doing wrong if you can post a hip file.
The trick is finding just the right hammer for every screw
User Avatar
Member
53 posts
Joined: June 2009
Offline
more speed and more freedom.

but i found what is my wrong.
in inline, Houdini does loop in points that i didn't know that.
my code did loops in points too, and this double loop make me confused.
User Avatar
Member
2199 posts
Joined: July 2005
Offline
No vex nodes loop through points, that includes the inline node.
The trick is finding just the right hammer for every screw
User Avatar
Member
53 posts
Joined: June 2009
Offline
so, i confused again, i think i don't understand ptnum correctly.
i upload a simple code. i want to loop between all neighbours of each point and print each neighbour id in console.
but Houdini for each neighbour, loop between all points and print neighbour (n) of each point.

i want this:
(for each point, loop between all neighbour step)
pt 0 neighbour 0 is x
pt 0 neighbour 1 is y
pt 0 neighbour 2 is z
pt 1 neighbour 0 is x2
pt 1 neighbour 1 is y2
pt 1 neighbour 2 is z2
.
.
.
.

but Houdini print this:
(for each neighbour step, loop between all object points)
pt 0 neighbour 0 is x
pt 1 neighbour 0 is x2
.
.
pt 0 neighbour 1 is y
pt 1 neighbour 1 is y2
.
.
.

pt 0 neighbour 2 is z
pt 1 neighbour 2 is z2
.
.
.
.

Attachments:
loop.hipnc (43.2 KB)

User Avatar
Member
8538 posts
Joined: July 2007
Online
i think it is because VEX has SIMD architecture which means that each instruction is done on all points
so if you print first neighbour, it will print it for all points and so on

i am curious why are you using inline VOP when it can be done all with VOP nodes?
or if it is only VEX exercise, why are you not writing it as pure VEX op?
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
53 posts
Joined: June 2009
Offline
thanks tamte and Simon.
  • Quick Links