wateryfield Posted August 5, 2014 Share Posted August 5, 2014 1. I wonder why the node name can't be digital-only, such as 1, 2 or 10.1. 2. And another problem, i want create a font with content was the number of the node name, such as the node name was s11 , the font content was 11, how can i get the number, opdigits(`$OS`) not working at font. 3. I can get the name by $OS in Hscript, how to get the node name use VEX, and where can i find all the VEX attributes? Any help will be appreciated. Thanks! Quote Link to comment Share on other sites More sharing options...
anim Posted August 5, 2014 Share Posted August 5, 2014 1. probably the same reason why variable in any programming language can't be a number, how would you distinguish between variable and number? 2. as you are putting expressions into string field, you need to use ticks `opdigits($OS)` 3. you can create string parameter and put $OS in there or in wrangle snippets you can insert `$OS` into your code like string name = `$OS`; or in shading context you can use getobjectname() finction not sure what you mean by all VEX attributes, here are some links: http://www.sidefx.com/docs/houdini13.0/vex/contexts/ http://www.sidefx.com/docs/houdini13.0/vex/snippets http://www.sidefx.com/docs/houdini13.0/vex/functions/ 1 1 Quote Link to comment Share on other sites More sharing options...
wateryfield Posted August 5, 2014 Author Share Posted August 5, 2014 1. probably the same reason why variable in any programming language can't be a number, how would you distinguish between variable and number? 2. as you are putting expressions into string field, you need to use ticks `opdigits($OS)` 3. you can create string parameter and put $OS in there or in wrangle snippets you can insert `$OS` into your code like string name = `$OS`; or in shading context you can use getobjectname() finction not sure what you mean by all VEX attributes, here are some links: http://www.sidefx.com/docs/houdini13.0/vex/contexts/ http://www.sidefx.com/docs/houdini13.0/vex/snippets http://www.sidefx.com/docs/houdini13.0/vex/functions/ Anim, Thanks for your super fast respond. There is too much thing i have to learn. I will have a try soon! 1 Quote Link to comment Share on other sites More sharing options...
wateryfield Posted August 5, 2014 Author Share Posted August 5, 2014 (edited) 1. probably the same reason why variable in any programming language can't be a number, how would you distinguish between variable and number? 2. as you are putting expressions into string field, you need to use ticks `opdigits($OS)` 3. you can create string parameter and put $OS in there or in wrangle snippets you can insert `$OS` into your code like string name = `$OS`; or in shading context you can use getobjectname() finction not sure what you mean by all VEX attributes, here are some links: http://www.sidefx.com/docs/houdini13.0/vex/contexts/ http://www.sidefx.com/docs/houdini13.0/vex/snippets http://www.sidefx.com/docs/houdini13.0/vex/functions/ Anim, I get a problem. Is `$OS` can direct insert into wrangle . string name = `$OS`; s@s = name; or s@s = `$OS`; It not working, or i was a wrong syntax. And the getobjectname() finction , I confuse with the string getobjectname() Returns the name of the current object whose shader is being run, or the empty string if there is no current object. What mean whose shader is being run? Thanks! Edited August 5, 2014 by wateryfield Quote Link to comment Share on other sites More sharing options...
eetu Posted August 5, 2014 Share Posted August 5, 2014 There is too much thing i have to learn. However much one learns, this is still true Quote Link to comment Share on other sites More sharing options...
iamyog Posted August 5, 2014 Share Posted August 5, 2014 (edited) Is `$OS` can direct insert into wrangle . string name = `$OS`; s@s = name; It not working, or i was a wrong syntax. I don't think there is a VEX function that will let you grab the node name but an easy workaround is to edit the parameter interface (via the gear button) and add a string parameter to your node. Let's call it operator_name In the new created field you can type $OS to access the name you want. It is now accessible in your VEX code via the ch() function. s@my_name = ch("operator_name"); EDIT : after anim answer (below), I learnt that you can actually easily access '$' variable with simple double quotes... thanks Edited August 5, 2014 by iamyog 1 Quote Link to comment Share on other sites More sharing options...
anim Posted August 5, 2014 Share Posted August 5, 2014 ... string name = `$OS`; s@s = name; or s@s = `$OS`; It not working, or i was a wrong syntax.... my mistake, I was writing from top of my head instead of checking in H this is the correct syntax string name = "$OS"; the $OS gets expanded and inserted into VEX code before that get's compiled. it wouldn't work with animated variables as VEX is compiled only on first frame, but $OS is not changing so it should be safe ... And the getobjectname() finction , I confuse with the What mean whose shader is being run? Thanks! it means it returns the name of the object that the shader belongs to/is called from so if you have 2 objects A and B and you assign the same shader to them with getobjectname() function inside that function returns A when evaluating that shader on object A and B when evaluating it on B etc. 1 Quote Link to comment Share on other sites More sharing options...
Jason Posted August 5, 2014 Share Posted August 5, 2014 However much one learns, this is still true Houdini is huge ball of threads -- pick one and start pulling.... Quote Link to comment Share on other sites More sharing options...
wateryfield Posted August 5, 2014 Author Share Posted August 5, 2014 I don't think there is a VEX function that will let you grab the node name but an easy workaround is to edit the parameter interface (via the gear button) and add a string parameter to your node. Let's call it operator_name In the new created field you can type $OS to access the name you want. It is now accessible in your VEX code via the ch() function. s@my_name = ch("operator_name"); EDIT : after anim answer (below), I learnt that you can actually easily access '$' variable with simple double quotes... thanks Thanks, it is a good idea. And anim 's answer working well too. string name = "$OS"; Quote Link to comment Share on other sites More sharing options...
wateryfield Posted August 5, 2014 Author Share Posted August 5, 2014 my mistake, I was writing from top of my head instead of checking in H this is the correct syntax string name = "$OS"; the $OS gets expanded and inserted into VEX code before that get's compiled. it wouldn't work with animated variables as VEX is compiled only on first frame, but $OS is not changing so it should be safe it means it returns the name of the object that the shader belongs to/is called from so if you have 2 objects A and B and you assign the same shader to them with getobjectname() function inside that function returns A when evaluating that shader on object A and B when evaluating it on B etc. Thanks. Working! 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.