CinnamonMetal Posted February 4, 2019 Share Posted February 4, 2019 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 ? Quote Link to comment Share on other sites More sharing options...
davpe Posted February 4, 2019 Share Posted February 4, 2019 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... Quote Link to comment Share on other sites More sharing options...
CinnamonMetal Posted February 5, 2019 Author Share Posted February 5, 2019 By label you mean, if I wanted $pngLng to have a parameter label such as `PointL` ? What if I have a variable called $something but I don't create the same export name, I assume it's only used within the code but can't be exported obviously, correct ? Quote Link to comment Share on other sites More sharing options...
davpe Posted February 5, 2019 Share Posted February 5, 2019 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. Quote Link to comment Share on other sites More sharing options...
CinnamonMetal Posted February 5, 2019 Author Share Posted February 5, 2019 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 ? Quote Link to comment Share on other sites More sharing options...
davpe Posted February 6, 2019 Share Posted February 6, 2019 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. 1 Quote Link to comment Share on other sites More sharing options...
CinnamonMetal Posted February 6, 2019 Author Share Posted February 6, 2019 This is some, well; should be workable garbage code, although I don't know why I'm getting an error; unless I'm doing something wrong ? float $opp; vector $sUV = dPdt; @Cd.r = $sUV; Quote Link to comment Share on other sites More sharing options...
j00ey Posted February 6, 2019 Share Posted February 6, 2019 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. Quote Link to comment Share on other sites More sharing options...
CinnamonMetal Posted February 6, 2019 Author Share Posted February 6, 2019 @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 ? Quote Link to comment Share on other sites More sharing options...
j00ey Posted February 7, 2019 Share Posted February 7, 2019 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? Quote Link to comment Share on other sites More sharing options...
CinnamonMetal Posted February 7, 2019 Author Share Posted February 7, 2019 @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 Quote Link to comment Share on other sites More sharing options...
j00ey Posted February 7, 2019 Share Posted February 7, 2019 You can't make an output variable called pntColorList AND declare it in the body of your code. If you add the output and then change the line vector $pntColorList; to $pntColorList = 1; it won't error. Same goes for $pngList Quote Link to comment Share on other sites More sharing options...
CinnamonMetal Posted February 8, 2019 Author Share Posted February 8, 2019 (edited) @j00ey Why am I getting an error on this line; vector $pntList = set(1,1,1); ? Hopefully you can explain the error in the forEach end block ? Edited February 8, 2019 by CinnamonMetal Quote Link to comment Share on other sites More sharing options...
j00ey Posted February 8, 2019 Share Posted February 8, 2019 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); 1 Quote Link to comment Share on other sites More sharing options...
CinnamonMetal Posted February 8, 2019 Author Share Posted February 8, 2019 (edited) 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 ? Edited February 9, 2019 by CinnamonMetal Quote Link to comment Share on other sites More sharing options...
j00ey Posted February 12, 2019 Share Posted February 12, 2019 (edited) 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 February 12, 2019 by j00ey typos Quote Link to comment Share on other sites More sharing options...
CinnamonMetal Posted February 12, 2019 Author Share Posted February 12, 2019 In other words you mean; if($id > 2 && $id < 10){ $Cd = {0.4,0.6,0.1}; } And bind $Cd export out ? I don't see primnum working either; I thought you could use that global variable. Quote Link to comment Share on other sites More sharing options...
j00ey Posted February 12, 2019 Share Posted February 12, 2019 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 Quote Link to comment Share on other sites More sharing options...
CinnamonMetal Posted February 13, 2019 Author Share Posted February 13, 2019 (edited) @j00eyUnfortunetly this code is not working; I'm expecting to see color only on the specific primitives but instead I get an error ? $id = 0; if($id > 2 && $id < 10){ $Cd = {0.4,0.5,0.1}; } Edited February 13, 2019 by CinnamonMetal Quote Link to comment Share on other sites More sharing options...
j00ey Posted February 14, 2019 Share Posted February 14, 2019 Can you upload your scene and I'll have a look? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.