Jump to content

VEX syntax error help


magneto

Recommended Posts

I have a simple function I am trying to call from inside a VOP builder node, but I get a syntax error:

vector calculate (float x, y, z)
{
	return {x,y,z};
}

in the return line.

I also tried:

return vector(x,y,z);

but same error.

Any ideas on how to fix this?

Link to comment
Share on other sites

Thanks guys.

Symek, your reply fixed it, thanks.

I was looking at the voplib.h where I saw:

vector	vop_floattovec(float x, y, z)	{ return vector(x, y, z);} 

Also didn't realize I can't return using {x,y,z}. Because if I hardcode some value like {1,2,3}, then it allows the return.

Link to comment
Share on other sites

Also didn't realize I can't return using {x,y,z}. Because if I hardcode some value like {1,2,3}, then it allows the return.

Maybe that's cause it's a reference to a constant.

Is there anything in the manual that discusses variable scope and life cycle?

Are vectors handled as simple types or objects? Do they have a copy operator?

vector y = {1,2,3};

vector x = y;

Does the above work? will X be a copy of Y or a reference to Y?

Link to comment
Share on other sites

Those are good questions. I don't think there is any detail on those in the VEX help. Would be good to try it out :)

Also is there an equivalent of creating VOP Builder OPs, like creating VOP SOPs using VEX?

Like reading a function from a file and creating a node representation of it.

From what I see from other VOPs like cross, dot, etc, you still need to create a front-end and add all inputs/outputs as well as parameters (if you want them). It would be really cool if they could be dynamically created like that.

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