Jump to content

Custom Vex Node & Global Variables ?


superdjo

Recommended Posts

Hello all.

I Have a simple question. When for example I create a custom VOP node in a POP context, do my stuff in it (add parameters, operations etc...) I can add Global Variables such as $PT etc... in the custom parameters of that VOP POP in the POP network.

Now I rewrite the whole VOP POP in VEX as a POP Operator, write my code (for example copy paste the code given with view Vex Code of the VOP POP and paste it in this VEX operator change the pragmas (name etc..) to make it match ) Now in the parameters of this newly created Vex operator I can't add Global variables, my node goes red and says it can't compute the script on the parameter where I added for example $PT.

I thought $PT and other global variable were accessible in POP context anywhere. Am I doing anything wrong ? have I forgotten something to define in the vex code before compiling ? I do already define it as POP with "#define VOP_OP" "#define VOP_POP" and the pop(my params){my code}. I know I can change my code to make this work internally but I would like my node to be generic.

Anyone have a clue ? Any insight would be appreciated.

Link to comment
Share on other sites

superdjo,

Unfortunately I don't have any experience in writing vex, so I can't help you.

But I do have a question that's related to the topic, so I hope it is ok if I post it here.

Is there a way to acces the point position (like $TY in vop's) in a vop pop parameter field ?

I would like to use an expression, which takes advantage of the particle postion in the Y axis.

Link to comment
Share on other sites

superdjo,

Unfortunately I don't have any experience in writing vex, so I can't help you.

But I do have a question that's related to the topic, so I hope it is ok if I post it here.

Is there a way to acces the point position (like $TY in vop's) in a vop pop parameter field ?

I would like to use an expression, which takes advantage of the particle postion in the Y axis.

Hey Nerox. To answer your question it works perfectly out of the box in a custom VOP POP, any particle global variable works as long as you're in POP context. Some variables are similar in other context.

Anyway you can wrtie an expression using $TY $TX $TZ $PT $AGE etc... in a custom made VOP POP parameter. It won't work inside the VOP network but you have access to your parameter outside of it as long as you don't tick "hidden" in the parameter node's parameter (wow, redundant) and that's where you put your expression.

The funny thing is, this does work perfectly in a VOP POP or any VOPS as a matter of fact but it doesn't work in a VEX POP. Though I haven't tried VEX SOP and see if I can input SOP global variables in the parameters. I'll check it out and see if this is just a POP problem or a VEX problem

Link to comment
Share on other sites

Hey Nerox. To answer your question it works perfectly out of the box in a custom VOP POP, any particle global variable works as long as you're in POP context. Some variables are similar in other context.

Anyway you can wrtie an expression using $TY $TX $TZ $PT $AGE etc... in a custom made VOP POP parameter. It won't work inside the VOP network but you have access to your parameter outside of it as long as you don't tick "hidden" in the parameter node's parameter (wow, redundant) and that's where you put your expression.

The funny thing is, this does work perfectly in a VOP POP or any VOPS as a matter of fact but it doesn't work in a VEX POP. Though I haven't tried VEX SOP and see if I can input SOP global variables in the parameters. I'll check it out and see if this is just a POP problem or a VEX problem

Hi Superdjo, that's interesting because to me it doesn't seem to work. I have a chopf() expression which samples a channel in chop's (per particle). I would like the sampled frame being driven by the position in y axis of the particle ($TY). But the expression returns 0, where it seems to work if I just fill in a number like 10 or 5. Just $TY doesn't work ether.

chopf("../../../chopnet1/OUT/tubeSize", $TY)

Are you sure, the parameters are processed on a per particle basis. Where the local variables are accessible? (It sounds logical, but ..)

post-3959-1245740746_thumb.png

Edited by Nerox
Link to comment
Share on other sites

Hmmm, how strange.

I've tried an example and it doesn't work with just $TX. But what does work and this is very strange is try adding an attribute node, name the attribute for example "position" set the vector values of it to $TX $TY $TZ, then in the vop pop use popoint($PT,"position",0) with 0 for X, 1 for Y or 2 for Z. In this expression $PT seems to work whereas if I write just $PT alone I would'nt get the value of it in the VOP POP it'll always be 0. Maybe its due to the fact that in the VOP you already have access to those values ? I don't have a clue. Any houdini masters have any insight ?

Link to comment
Share on other sites

Hmmm, how strange.

I've tried an example and it doesn't work with just $TX. But what does work and this is very strange is try adding an attribute node, name the attribute for example "position" set the vector values of it to $TX $TY $TZ, then in the vop pop use popoint($PT,"position",0) with 0 for X, 1 for Y or 2 for Z. In this expression $PT seems to work whereas if I write just $PT alone I would'nt get the value of it in the VOP POP it'll always be 0. Maybe its due to the fact that in the VOP you already have access to those values ? I don't have a clue. Any houdini masters have any insight ?

Maybe you simply can't use any expressions in Vop's due to the fact that Vop's is allready a expression driven environment (Vertex Expression Operators, if I'm right).

If so, next question that comes up is: Can I access chop's inside Vop's like the chopf expression does?

Link to comment
Share on other sites

As for importing a chop channel in a VOP POP, I've never done that. I wouldn't know. But if your chop channel is created procedurally you could in a certain way reproduce the same effect in VOPs with math function etc... you wouldn't get a visual curve out of it though. But before have you tried doing it the opposite way ? importing the point attributes in Chops and then re exporting them after the Chops operations are done ? I have no clue if that would work, I don't have access to Houdini right now.

Anyway I think I'm going to have to learn the HDK and see what it could offer me.

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