Jump to content

How to connect a value conditionally in VOPs?


Recommended Posts

I am using the Transform Matrix VOP, and in the asset level, I have a checkbox for using a custom Translation. I want to hook the Custom Translation if this checkbox is turned on.

How can I do this in the VOP level? Do I have to use an If VOP? Because I am not sure if I have to bring my Transform Matrix VOP inside.

Thanks :)

Link to comment
Share on other sites

you can use Switch VOP to switch among several values

or if you want to optimize for speed more the If VOP is better since you can do all your conditional calculations inside and they will only be evaluated once condition is true

  • Like 1
Link to comment
Share on other sites

Thanks anim. If I use the switch VOP, what should I connect for the "no value"? Basically I want the Translate value in the Transform Matrix to either have the value I supply or nothing connected to it.

Kind of like the Null SOP, but Null VOP doesn't seem to have an output only input.

Link to comment
Share on other sites

Guest mantragora

Thanks anim. If I use the switch VOP, what should I connect for the "no value"? Basically I want the Translate value in the Transform Matrix to either have the value I supply or nothing connected to it.

Kind of like the Null SOP, but Null VOP doesn't seem to have an output only input.

If you don't connect your value Transform will have [0,0,0]. Can't you just plug Vector[0,0,0] into second input as default ?

  • Like 1
Link to comment
Share on other sites

That makes sense. I didn't realize that was the standard way. But what about VOPs that have more connectable parameters than it shows in the parameters pane like the Lookat VOP?

In that case, no connection would mean 0,0,0 vector for From and To Location fields. But what happens to the Up Vector? Would it also be 0,0,0 for no connection?

Link to comment
Share on other sites

Guest mantragora
But what happens to the Up Vector? Would it also be 0,0,0 for no connection?

You set Up vector for your geometry and you don't want to change it. It's needed for proper geometry orientation.

Link to comment
Share on other sites

Guest mantragora

Thanks that's also an interesting VOP. I went with the Switch SOP for this case.

VEX doesn't have switch{} implemented like you can find in C++ or other C-like languages. So if you check the VEX code generated by TwoWaySwitchVOP and SwitchVOP or any other conditional VOP, you can see that they are using "if{}-else{}", conditional operator "?:" or variations of both for checks. No magic there.

  • Like 1
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...