magneto Posted April 15, 2012 Share Posted April 15, 2012 Suppose you have a VEX SOP like Mountain SOP. How would you access point variables like $PT, etc? I noticed it doesn't recognize them. So you can't even use the point expression. Are they not supported in VEX SOPs? Why aren't point variables not allowed since it makes sense to have them in VEX SOPs that are point based? Am I missing something? Sure you can dip into VOPs and do it there but that defeats the purpose of having a VEX SOP in the first place. Thanks Quote Link to comment Share on other sites More sharing options...
Guest mantragora Posted April 15, 2012 Share Posted April 15, 2012 You want to access it in code or in UI parameter ? Quote Link to comment Share on other sites More sharing options...
ehsan parizi Posted April 15, 2012 Share Posted April 15, 2012 (edited) if you're talking about VOP SOP, just use point number, from your input! if you're talking about VEX SOP, you need a vex code, that you can use point # there! Edited April 15, 2012 by ehsan parizi Quote Link to comment Share on other sites More sharing options...
magneto Posted April 15, 2012 Author Share Posted April 15, 2012 Sorry I meant doing something like this. Say in the Mountain SOP, specify the height as $PT or some other point attribute. Either via the $ sign or the point expression. But I want to differ the value as a user, just like I can in the Point SOP. I thought I could do the same in VEX SOPs since they also act like the Point SOP. Quote Link to comment Share on other sites More sharing options...
Guest mantragora Posted April 15, 2012 Share Posted April 15, 2012 The only way to pull up any attribute in VEX land from SOPs is to import it. Quote Link to comment Share on other sites More sharing options...
ehsan parizi Posted April 15, 2012 Share Posted April 15, 2012 The only way to pull up any attribute in VEX land from SOPs is to import it. I think he's specifically asking about the mountain SOP! Quote Link to comment Share on other sites More sharing options...
Guest mantragora Posted April 15, 2012 Share Posted April 15, 2012 I think he's specifically asking about the mountain SOP! Yes, I know. Mountain SOP is just pure VEX. You can edit its VEX code. It's the same like you would made your own New Operator Type and put all that code inside it. You just get the same Mountain SOP. It is not operator like other compiled SOPs. Quote Link to comment Share on other sites More sharing options...
magneto Posted April 15, 2012 Author Share Posted April 15, 2012 No I meant for any VEX SOP. To be able to use values that varies per point. So for any numerical parameter, I want to be able to vary them using point attributes, or even just point numbers. Due to the nature of VEX, all point variables/attributes and the point expressions could easily be added for support, right? Something all VEX SOPs could inherit. For instance I have some VEX SOPs that are useful to me, but without this variation, I have to do the same effect in VOPs. Quote Link to comment Share on other sites More sharing options...
sanostol Posted April 15, 2012 Share Posted April 15, 2012 (edited) You can also use a parameterVOP to get data from geometry. if the attribute exist it gets imported from the geometry if not it is pulled from the parameter. for example if you want to drive the height of the mountain sop with a $ variable just put a attributeSOP in front of it createing that height attibute and drive it with $, but I'm quite sure rebuilding that expression in vex will result in much faster networks Edited April 15, 2012 by sanostol 1 Quote Link to comment Share on other sites More sharing options...
ehsan parizi Posted April 15, 2012 Share Posted April 15, 2012 No I meant for any VEX SOP. To be able to use values that varies per point. So for any numerical parameter, I want to be able to vary them using point attributes, or even just point numbers. Due to the nature of VEX, all point variables/attributes and the point expressions could easily be added for support, right? Something all VEX SOPs could inherit. For instance I have some VEX SOPs that are useful to me, but without this variation, I have to do the same effect in VOPs. I'm a bit confused, but all I know is that, if you do it through vex code, (which your vex SOPs are probably made that way) you should have access to point attribs, and if you're using a VOP SOP(which is pretty much a gui for vex code) you have point number already in your inputs, and you can import any other attribute with import attrib! Quote Link to comment Share on other sites More sharing options...
Guest mantragora Posted April 15, 2012 Share Posted April 15, 2012 No I meant for any VEX SOP. To be able to use values that varies per point. So for any numerical parameter, I want to be able to vary them using point attributes, or even just point numbers. Due to the nature of VEX, all point variables/attributes and the point expressions could easily be added for support, right? Something all VEX SOPs could inherit. For instance I have some VEX SOPs that are useful to me, but without this variation, I have to do the same effect in VOPs. In that case just add importVOP or code to pull up attribute and do your operation with in in your code. To allow customization of this thru the UI just add string parameter, so user can pick attribute name, and menu, so user can choose type (float, int, etc.). Then use those parameters to drive import()/importVOP. Quote Link to comment Share on other sites More sharing options...
magneto Posted April 15, 2012 Author Share Posted April 15, 2012 (edited) @sanostol: Thanks, that's a great trick. I knew if I could override parameters in VOPs but not outside them to affect VEX SOPs. That's pretty neat. But yeah mine was basically being able to do this directly inside the parameter fields of a VEX SOP, without creating an attribute to override existing ones. Here is the pic: @ehsan: I know I can import anything in code, but I want the code to not care about attributes. Something like this: sop deform(float amount = 0) { P[0] += amount; } But on the user level, you should be able to plug any value into amount, using attributes, etc. @mantragora: So you mean creating a string parameter for each parameter? Basically sort of replicating an AttribCreate SOP for every parameter? Edited April 15, 2012 by magneto Quote Link to comment Share on other sites More sharing options...
sanostol Posted April 15, 2012 Share Posted April 15, 2012 in the exampleimage you posted you can use a parameter vop lingering around to directly pull the data instead of that point expression 1 Quote Link to comment Share on other sites More sharing options...
magneto Posted April 15, 2012 Author Share Posted April 15, 2012 Thanks sanostol. So you mean using a parameter vop to import some values/attributes and then refer to that parameter in any parameter inside the VEX SOP (Mountain SOP in this case)? If so, would this be preferred to using attribute create to override the VEX SOP parameters? Quote Link to comment Share on other sites More sharing options...
sanostol Posted April 15, 2012 Share Posted April 15, 2012 (edited) mh, maybe I do not understand what you are aiming for. I just meant that that point expression just reads in the per point values of the attribute roughness. but if this attribute exists it gets used anyway the mountsop looks for rough, by the way by hovering the mouseover the attribute houdini will tell you the internal name. that pointexpression just takes more time, I guess. what ever You can do in vop/vexland just do it as it is incredible fast Edited April 15, 2012 by sanostol Quote Link to comment Share on other sites More sharing options...
magneto Posted April 15, 2012 Author Share Posted April 15, 2012 Yes that's what I meant. The override method works. I was just looking for a direct way of doing this. Like if you had an attribute used for something else, that you want to use for another parameter in a VEX SOP, then you will have to create another attribute with the same name as the parameter you want to override. Being able to use point variables/attributes and the point expression directly inside the fields is more intuitive, as you do it pretty much everywhere in Houdini. Quote Link to comment Share on other sites More sharing options...
Guest mantragora Posted April 15, 2012 Share Posted April 15, 2012 Hell with this. I wanted to prepare some inteligent example but I'm completely out of ideas . Something like this. You can change attribute name and type and it will pickup and do different transform. it\'s_magic...NOT.rar 1 Quote Link to comment Share on other sites More sharing options...
magneto Posted April 15, 2012 Author Share Posted April 15, 2012 Thanks mantragora, nice example Although this allows you to import parameters, it would clutter the UI alot if you had this for each parameter alongside actual parameters. Another nice thing if this was supported directly in VEX parameter fields is that you wouldn't care about the value type. 1 Quote Link to comment Share on other sites More sharing options...
Guest mantragora Posted April 15, 2012 Share Posted April 15, 2012 (edited) Thanks mantragora, nice example Although this allows you to import parameters, it would clutter the UI alot if you had this for each parameter alongside actual parameters. You can make your own UI and hide one that you don't need. Another nice thing if this was supported directly in VEX parameter fields is that you wouldn't care about the value type. So you send attribute called MAGIC. It's a float. Your code picks it up. Now you change your attribute and make it vector. And you want to use only Y to drive your code. How your code will figure this out if you don't tell it what type of attribute it is ? VEX is not python. It's not interpreted/dynamic language. It's staticaly typed/compiled. Theoretically you can solve this by using arrays. From Help: 3. int import(string attrib_name; float values[] &; int input; int pt_num) This form lets you import attributes containing arbitrary length arrays of floats, such as capture data. So then you don't need type menu on your UI. You just take care of casting and other things in your code: #pragma oplabel "Magic Example" #pragma opname "magic_example" #pragma opmininputs 1 #pragma opmaxinputs 1 #pragma label magicname "Magic Name" sop magic_example(string magicname = "magic") { float magicvalue[] = {0.0, 0.0, 0.0}; import(magicname, magicvalue, 0); if(magicname == "magicfloat") P += normalize(N) * set(0, magicvalue[0]/100, 0); if(magicname == "magicvector") P *= (vector)magicvalue/100; } But this is bigger clutter in your code than it needs to be. On the other hand you got structs now. You got also functions. You can make your onw logic to solve those type of situations and than just #include needed functions to manage convertions and returning correct values from attributes. Edited April 16, 2012 by mantragora 1 Quote Link to comment Share on other sites More sharing options...
Guest mantragora Posted April 15, 2012 Share Posted April 15, 2012 (edited) MAGIC DOUBLE-POST Edited April 15, 2012 by mantragora 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.