Jump to content

inline vop


Recommended Posts

When using the inline vop node; I understand that you can set multiple output types but how does the Inline VEX code link with the output types ? For example, if I create a variable named $pntLng or I assign Cd to $pntLng as such $pngLng = @Cd;. How would the output type variable name link to the Inline VEX variable $pntLng ? The output type has two options where one can enter Output Names, how can the right side of a Output name be used ?

Link to comment
Share on other sites

there are no links or anything. it's paired by names. so if you want to export $pngLng your output has to be named the same, as well as data type.

the right side column from the output variable name is supposed to be Label. Not sure how that can be used in this case... 

Link to comment
Share on other sites

yeah typically you can have a parameter Name and then Label which can be more user friendly or something. not sure thou where Label gets propagated with inline VOP.

you can't export parameter that's not been defined. in other words, you can only export parameters that you are using in the particular inline VOP. that's the entire logic. on output, inline VOP is looking for the equally named existing parameter and if that doesn't exist it raises an error that parameter is unidentified or something along those lines.

Link to comment
Share on other sites

You mention one can't export parameters which are not defined for output.  Although I have a crude test example, which I have a variable within the inline vop but I'm not defining it for export but the inline vop doesn't give me any errors. 

Why I asked, if you define a variable inside the inline vop without declaring it as an exported parameter, is the variable only being used within the context of the code but not export, unless it is being declared for export ?

Link to comment
Share on other sites

in the inline VOP you can define as many variables as you want. any variable can be exported if you specify matching name in Outputs section of inline VOP. you don't have to export all the variables defined in code thou. only if you want to send any particular variable further down the stream you have to export it (you always want to export at least one variable obviously). variables that are not exported only exist within the particular inline VOP.

  • Like 1
Link to comment
Share on other sites

There's no @ syntax in inline VOPs. If you want to export Cd, add it to the output section as a vector, then in your code you can refer to it -
$Cd.r = $sUV;
 
Presumably dPdt is declared somewhere above your snippet..? If not that will throw an error too.
 
You don't have to use the $ prefix for variables that are only used internally in the Inline VOP but if you don't and you have more than one Inline in the same network using the same variable name, you'll get errors too.

 

Link to comment
Share on other sites

@j00ey If I understand correctly, if I make a variable called $pntList and I want to export the variable, I must make a export name called pntList as well; correct ? 

From my experiments if I do what I mentioned above, I get an error; but if I give the export name a different name then what is the variable within the inline vop; no error is thrown ? Meanwhile you are saying if I use something like the $Cd.r variable I must give an export name of the same variable name, in this case either @Cd or @Cd.r.  Although if you supply a different export name, it won't be linked with the variable within the inline vop, correct ?

Link to comment
Share on other sites

You can name your variables however you want to, you just have to make sure they match up if you want to export something for use outside the Inline VOP [but in the same VOPnet]. There's no @ syntax in Inline VOPs so @Cd will throw an eror. $Cd is fine.

Can you put up a sample scene with your error in it and I'll take a look at it?

Link to comment
Share on other sites

@j00ey When you look in the scene within the inline VOP, there is a variable named $pntColorList.  When creating an export variable of the same name, you get an error, although if; as seen in the attached scene you give a different name for the export name, no error is thrown ? Although if I'm correct, the variable $pngList is not accessible for export because the export name is different ?  

qa_inlinevop.hipnc

Link to comment
Share on other sites

From what I can see in that screengrab it looks like you've got an output called pntList, in which case your line should read :

$pntList = set(1,1,1);

if you put 'vector' before it you are declaring it, and it's already declared. [Anything you put in your list of outputs is declared automatically]. Just like in a wrangle in SOPs if you write :

float value = 1;
float value = 2;

you'll get an error, that should be

float value = 1;
value = 2;

By the way, if you're setting a vector with constants you don't need to use set(). You can just write

$pntList = {1,1,1};

Use set() if you need to set it with other variables, eg:

float valueA = 1;

float valueB = 2;

vector values = set(valueA, valueB, 0);

  • Like 1
Link to comment
Share on other sites

17 hours ago, j00ey said:

Just like in a wrangle in SOPs if you write :

float value = 1;
float value = 2;

you'll get an error, that should be

float value = 1;
value = 2;

Don't you mean, f@value = 2; ?

Within the inline vop I have these lines of code; 

if($primnum > 0.5 && $primnum < 0.45){
$Cd = noise(cos(34));
}

Although I don't see any noise applied to only the primitives in the condition ?

vop_loop.png

Edited by CinnamonMetal
Link to comment
Share on other sites

There are a few issues with this.

Firstly, I don't think you have access to primnum inside a shading context. You can use something like id and bind that to do the same thing.

But assuming you did that, it would be an integer, not a float. And this condition can never be true - a float can't be greater then 0.5 and also less than 0.45.

($primnum > 0.5 && $primnum < 0.45)

Regards the declaration thing, you can actually write

f@value=1;

f@value = 2;

because that's setting the value of a geometry attribute

but you can't declare it twice - replacing f@ with float will throw an error.

Edited by j00ey
typos
Link to comment
Share on other sites

Yes that should work.

A good way to check what variables you have access to for free, put down a globals VOP and look at the list.

If you want to use primnum, just give your geometry an attribute that mirrors it, eg id. You can do that with an enumerate SOP, or manually in a wrangle just put for instance:

i@id = @primnum;

then you can bind that in your shader and use it

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