Jump to content

VEX SOP and local variables


Bandu

Recommended Posts

Hi guys,

I'm doing a VEX SOP Geometry Operator and I'm wondering if there is a way to define my own Local Variables like $CEX $CEY $CEZ for example.

I want to be able to use them in my Parameter node if possible.

In detail, I needed different type of Scale Operator I wrote and it works fine.

I need to compute my geometry center in order to work it properly.

The only way I found is to type my previous transformation in Parameter node ( if the geometry is transformed ) and use this values inside VEX.

In Houdini Transform Operator I can type $CEX, $CEY, $CEZ to get the center of the object ( origin for scale ) or any values I like.

Now I need the same Local Variables for my Operator ( even $XMAX... $BBX... ) so it will compute them automatically inside my own Operator as soon as I write them in my parameter dialog.

Thanks,

Bandu

Link to comment
Share on other sites

this method calculate always the center point, I want to use $XMAX, $BBX and all other variables and expressions using this variables, like is standard Houdini transfer node. At the same point it will allow me to create my own local variables if I only knew how to declare them.

Thanks anyway!

Link to comment
Share on other sites

this method calculate always the center point, I want to use $XMAX, $BBX and all other variables and expressions using this variables, like is standard Houdini transfer node. At the same point it will allow me to create my own local variables if I only knew how to declare them.

I think the only way to expose these as local variables is to write the OP using the HDK. VEX can create attributes and map them to variable names, but those would only be available further down the chain, not in the OP itself.

Link to comment
Share on other sites

  • 7 years later...

One way that I found how to get that is

1. Create a box oriented to your input geo 

2. To create an attribute called BBX which their value is $BBX (or the axis of your choice) then in Attri VOP use a bind and call this last attribute

3. Use a multiply between "Cd" and "BBX", add a ramp to remap the color information

4. Voila, even if your geometry moves the ramp follows it, very usefulll to grade emitters or points or whatever you need. Hope it help you out.

Regards!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...