Jump to content

setting attribute components in an expression


gnarlog

Recommended Posts

Hi there,

I'm fairly new to Houdini, and this may be common knowledge, but I couldn't find any reference to it, so here goes:

If I have an attribCreate sop set to create a vector and I open the expression editor through one of the component fields, can I set the other components in that expression?

Thanks a lot,

Matt

Link to comment
Share on other sites

  • 3 weeks later...

Hi Mangi! Thanks for the response. So... Let me see if I can put this more clearly. I'm actually working on a scene right now where I'd like to be able to do what I'm talking about. I have a windforce node connected to a pyro sim. I want the wind to blow toward the camera, so I subtract a reference point from the camera position. I want that vector to be normalized. So it would be really handy to be able to open the expression editor in one of the velocity parameter fields and do something like:

{

vector windDir = (camPosX - refPosX, camPosY - refPosY, camPosZ - refPosZ,);

vector windDirNorm = normalize(windX, windY, windZ);

....

}

And then assign the components of windDirNorm to the corresponding parameter fields. As far as I know, when you return whatever you've calculated, it applies exclusively to the parameter field that you opened the expression editor in. Of course, it's not really a big deal to use a vop sop to do that job, but it would certainly be nice to be able to specify a field in a vector parameter to assign the component results to from a vector calculation in an expression.

Does that make any sense?

Thanks a lot,

Matt

Link to comment
Share on other sites

Unfortunately this is an inherent limitation of SOP nodes: only one return type to match the parameter's type leading to repetition and overhead. POPs allow you to toggle some three component vectors in to a vector parameter type that never made it in to SOPs and again return type limited to the parameter containing the expression. Plus this is not threaded.

We now have the Wrangle type operators if you want to work in SOPs without having to dive in to VOPs nor mess about with parameter expressions. You bypass all of that and work with attributes directly and it's all threaded..

If it is a point attribute you wish to modify, the Point Wrangle SOP is just awesome.

Here's a shot at what you want to do with a Point Wrangle SOP:


vector camPos = chv("/obj/cam1/t"); // use chv() to import a vector parameter
vector refPos = {1,0,1};
v@windDir = camPos - refPos;
@windDir = normalize(@windDir);
[/CODE]

Hope this helps.

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...