VEX code for scaling pscale per point per time step

   1954   6   0
User Avatar
Member
436 posts
Joined: July 2005
Offline
I Just cannot get this syntax right.

In either pointWrangle SOP or attributeWrangleSOP
To scale a float attribute (pscale) per point per time step.
@pscale == .9 ;
or
$pscale == .9 ;

No good
What am I getting wrong?
User Avatar
Member
436 posts
Joined: July 2005
Offline
For Maya users equivalent MEL code would be
pscale *= .9 ;
User Avatar
Member
8833 posts
Joined: July 2007
Offline
Dave_ah
For Maya users equivalent MEL code would be
pscale *= .9 ;
so why wouldn't you try the same? (instead of trying == which is comparison of equality and not an assignment)
@pscale *= 0.9;

assuming you run it in DOP environment, like Solver SOP or directly DOP net
Edited by tamte - July 3, 2023 01:39:17
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
436 posts
Joined: July 2005
Offline
tamte
Dave_ah
For Maya users equivalent MEL code would be
pscale *= .9 ;
so why wouldn't you try the same? (instead of trying == which is comparison of equality and not an assignment)
@pscale *= 0.9;

assuming you run it in DOP environment, like Solver SOP or directly DOP net
pscale *= .9 ;
Does not work in SOP level pointWrangle and attributeWrangle SOPs. Houdini generates syntax error and bypasses the SOP node.
User Avatar
Member
8833 posts
Joined: July 2007
Offline
Dave_ah
tamte
Dave_ah
For Maya users equivalent MEL code would be
pscale *= .9 ;
so why wouldn't you try the same? (instead of trying == which is comparison of equality and not an assignment)
@pscale *= 0.9;

assuming you run it in DOP environment, like Solver SOP or directly DOP net
pscale *= .9 ;
Does not work in SOP level pointWrangle and attributeWrangle SOPs. Houdini generates syntax error and bypasses the SOP node.
you forgot @ to bind to pscale attribute

here is an example in plain SOPs where this will be applied once to incoming value

and also inside of Solver SOP where it will be applied every timestep

Attachments:
scale_pscale.hipnc (116.7 KB)

Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
436 posts
Joined: July 2005
Offline
tamte
Dave_ah
tamte
Dave_ah
For Maya users equivalent MEL code would be
pscale *= .9 ;
so why wouldn't you try the same? (instead of trying == which is comparison of equality and not an assignment)
@pscale *= 0.9;

assuming you run it in DOP environment, like Solver SOP or directly DOP net
pscale *= .9 ;
Does not work in SOP level pointWrangle and attributeWrangle SOPs. Houdini generates syntax error and bypasses the SOP node.
you forgot @ to bind to pscale attribute

here is an example in plain SOPs where this will be applied once to incoming value

and also inside of Solver SOP where it will be applied every timestep


What is the difference between $pscale and @pscale in VEX? @pscale reads like Py.
Overall how does Houdini treat, in expression, @attribute vs. $attribute .
User Avatar
Member
2129 posts
Joined: Sept. 2015
Offline
Dave_ah
What is the difference between $pscale and @pscale in VEX? @pscale reads like Py.
Overall how does Houdini treat, in expression, @attribute vs. $attribute .

The @ symbol is typically used in a vex context to refer to the name that follows as an attribute.
The $ symbol is typically used in a context in which Hscript is being used.

That's the short and simple explanation although there is a bit more to it in certain cases.
For example, sometimes in a vex context you can use an Hscript expression(where $name is used) if enclosed within back ticks.

if(`$F > 5`) @pscale = 2; // Works in a wrangle code window but is less efficient than the next purely vex line.

if(@Frame > 5) @pscale = 2;
  • Quick Links