magneto Posted January 26, 2012 Share Posted January 26, 2012 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? Quote Link to comment Share on other sites More sharing options...
hopbin9 Posted January 26, 2012 Share Posted January 26, 2012 I don't think there is anything wrong with that function. It might be a bracing issue outside the function you have a missing ; or { } Quote Link to comment Share on other sites More sharing options...
symek Posted January 26, 2012 Share Posted January 26, 2012 {x,y,z} cant be returned, but set(x,y,z) can: vector calculate (float x, y, z) { return set(x,y,z); } 1 Quote Link to comment Share on other sites More sharing options...
hopbin9 Posted January 26, 2012 Share Posted January 26, 2012 Is that because vector(x,y,z) is a type cast? and not a constructor? Quote Link to comment Share on other sites More sharing options...
magneto Posted January 26, 2012 Author Share Posted January 26, 2012 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. Quote Link to comment Share on other sites More sharing options...
hopbin9 Posted January 26, 2012 Share Posted January 26, 2012 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? Quote Link to comment Share on other sites More sharing options...
magneto Posted January 26, 2012 Author Share Posted January 26, 2012 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. 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.