Macha Posted May 30, 2012 Share Posted May 30, 2012 (edited) I have 2 questions regarding vex and the inline vopsop. -Is it possible to define a function in the inlinevop and then call it as well? Something along the lines of: float f(float x, float y){ return x*y; } z=f(12.0,23.0); printf("z:%f ",z); We can do this with a Vex builder type by putting the functions in the outer code section if I remember correctly. But how about inline vop? -Is there a way to turn a string into a vex expression? For example, a user would enter "x^2" as a parameter and we could use it as x^2 in the code. Thanks! Edited May 30, 2012 by Macha Quote Link to comment Share on other sites More sharing options...
rdg Posted May 30, 2012 Share Posted May 30, 2012 f(float x, float y){ return x*y; } z=f(12.0,23.0); printf("z:%f ",z); You can specify an external header file on the inlineVOP. As far as I know this can't be part of an HDA section and probably want to sit somewhere in $HOUDINI_PATH/vex/include. Maybe helps. Quote Link to comment Share on other sites More sharing options...
nord3d Posted June 14, 2012 Share Posted June 14, 2012 ... -Is there a way to turn a string into a vex expression? For example, a user would enter "x^2" as a parameter and we could use it as x^2 in the code. Thanks! Hi there, How about the second question? It is also very interesting to me. As well as a way to execute a string in the one parameter's field as an expression in other parameter's field. I have tried eval(), but without success. Quote Link to comment Share on other sites More sharing options...
Guest mantragora Posted June 14, 2012 Share Posted June 14, 2012 (edited) Hi there, How about the second question? It is also very interesting to me. As well as a way to execute a string in the one parameter's field as an expression in other parameter's field. I have tried eval(), but without success. Not possible. For things like this you need interpreted/dynamic language. That means that, in Houdini world, Python is your answer. Edited June 14, 2012 by mantragora Quote Link to comment Share on other sites More sharing options...
nord3d Posted June 14, 2012 Share Posted June 14, 2012 Thanks, mantragora. So, it is possible, if use Python instead of HScript, for that parameter fields, I understand you correctly? Quote Link to comment Share on other sites More sharing options...
Guest mantragora Posted June 14, 2012 Share Posted June 14, 2012 1. You can create your own expressions in "Edit->Aliases and Variables->Expression" Tab. Maybe this is what you are looking for. 2. Why do you need this ? x^2 will not execute pow() function in Python without making comparisons with if:...elif:... so it's still not useful. You can probably add aliases to python classes that will allow something like this, but it will make bigger mess, for you to manage, than help. Quote Link to comment Share on other sites More sharing options...
nord3d Posted June 14, 2012 Share Posted June 14, 2012 Thank you again, I will think about it... Why? -For example, in the asset, user could type an expression, which would be executed in the SOP-node inside... 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.