ciel9979 Posted February 24, 2014 Share Posted February 24, 2014 Hi, this is my first post here. I've been trying to call a vector array function in VEX, but it either returned "Internal Compiler Error" or "Syntax error, unexpected identifier, expecting ';'". I also checked Array help file and the example as below didn't work at all: To specify a literal array, use curly braces, with the array members separated by commas:vector[] rgb_array(){return { {1, , }, {, 1, }, {, , 1} };} Here is the simple code I tried to compile, but it returned an error message "Syntax error, unexpected identifier, expecting ';'." vector an_array[] = {{1,1,1}, {2,2,2}};vector a[];vector[] testFunction(vector[] a){ return a;}a=testFunction[an_array]; Does anyone know if VEX supports array function? Thank you very much! Quote Link to comment Share on other sites More sharing options...
magneto Posted February 24, 2014 Share Posted February 24, 2014 I think you can only return arrays in specific places like Outer Code fields of Inline/Snippet VOP and standalone VEX operators like VEX SOP, etc. Just define the functions in those places and then call them in the Code field. 2 Quote Link to comment Share on other sites More sharing options...
ciel9979 Posted February 24, 2014 Author Share Posted February 24, 2014 Thanks for your reply, magneto. My codes are in snippet vop inside the attribVOP. For those non-array functions like "vector testFunction(vector a)", they work, but not for "vector[] testFunction(vector[] a)" Maybe it's VEX that hasn't supported array functions yet Quote Link to comment Share on other sites More sharing options...
magneto Posted February 24, 2014 Share Posted February 24, 2014 Yeah just paste those functions into Outer Field. You can't do this using Wrangle SOPs as the Outer Field parameter is not exposed. So you have to use AttribVOP SOP with a Snippet/Inline VOP. Quote Link to comment Share on other sites More sharing options...
Albande Posted February 6, 2017 Share Posted February 6, 2017 Hi, If you use a vfl include file to store your function, you can return an array. And then you can use that signature "vector[] testFunction(vector[] a)" :) Quote Link to comment Share on other sites More sharing options...
acey195 Posted February 6, 2017 Share Posted February 6, 2017 This was a very old topic (possibly talking H13 here) I am pretty sure more array support was added in native H14 and onwards. Quote Link to comment Share on other sites More sharing options...
f1480187 Posted February 7, 2017 Share Posted February 7, 2017 Wrangles (more generally, functions defined inside other functions), still not support returning arrays in Houdini 15.5. Most convenient workaround is modifying an argument. In code file: float[] foo() { return array(1, 2, 3, 4, 5); } bar = foo(); In wrangle: void foo(float arr[]) { arr = array(1, 2, 3, 4, 5); } foo(bar); 1 1 Quote Link to comment Share on other sites More sharing options...
ttrx22 Posted September 20, 2019 Share Posted September 20, 2019 Year 2019...had issue with this in Houdini 17.5. Solution is to add word 'function' and everything works only then. function int[] getPointsForPrim(int targetPrimID){ int pts[] = primpoints(0, targetPrimID); return pts; } 3 6 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.