Symbolic Posted November 11, 2011 Share Posted November 11, 2011 Hi, For a tool, I am trying to check if a specified variable is correct or not? Is there an expression to ruturn this check? ex: $MAPU will return "ok", $MAPG (if it does not exist) should return "error" Any ideas? Thanks. Quote Link to comment Share on other sites More sharing options...
AdamJ Posted November 11, 2011 Share Posted November 11, 2011 hscript.. echo `isvariable ("EXISTS")` returns 1 echo `isvariable ("NOTEXIST")` returns 0 hou.variable in python but doesn't look like it's implemented yet Quote Link to comment Share on other sites More sharing options...
Symbolic Posted November 14, 2011 Author Share Posted November 14, 2011 hscript.. echo `isvariable ("EXISTS")` returns 1 echo `isvariable ("NOTEXIST")` returns 0 hou.variable in python but doesn't look like it's implemented yet Thanks! But I could not get it working: echo `ishvariable("MAPU")` will return 0 ? Any ideas? Quote Link to comment Share on other sites More sharing options...
AdamJ Posted November 14, 2011 Share Posted November 14, 2011 (edited) I think you get an 'h' in there.. but from 'MAPU' I think you're looking for a way to check if there's an attribute rather than a session variable.. have a look at haspointattrib hasvertexattrib echo `haspointattrib("../OUT","uv")` returns 1 if uvs exist Thanks! But I could not get it working: echo `ishvariable("MAPU")` will return 0 ? Any ideas? Edited November 14, 2011 by AdamJ Quote Link to comment Share on other sites More sharing options...
Symbolic Posted November 14, 2011 Author Share Posted November 14, 2011 I think you get an 'h' in there.. but from 'MAPU' I think you're looking for a way to check if there's an attribute rather than a session variable.. have a look at haspointattrib hasvertexattrib echo `haspointattrib("../OUT","uv")` returns 1 if uvs exist Hello AdamJ, Sorry for the multiple posts. I need to explain this in a better way. The problem is this: I have two string inputs on my OTL (1) Attribute to use: (2) Component: So if the user goes "foo" in section (1), then he may specify "FOO1" as the first component in section (2). I can check both of those conditions, I check if the attribute "foo" exists, then I guarantee that it is mapped and "FOO1, FOO2, FOO3" are valid. If "foo" does not exist, I flag and error. * * * However, lets have a look in a more complex situation as bellow, (Here I need an extra way of variable checking) So if the user goes "uv" in section (1), then he may specify "MAPU" as the component or "UV1" for the first component If he miss types MAPU as MAPG for example, the process will fail. So as you see, I need to check the native Houdini variables towards this. The "h" in there was for that, "ishvariable", is supposed to check the native Houdini variables (I guess?). Any ideas? Thanks for the help. Quote Link to comment Share on other sites More sharing options...
AdamJ Posted November 14, 2011 Share Posted November 14, 2011 ishvariable will check only the variables that are declared in houdini (show up in Edit->Aliases and Variables window). isvariable is just a superset, it will check in houdini or os onse. For checking/remapping strings have a look at 'strmatch'.. btw if if you add '-k' you can search for command/expressions that contain the keyword you're looking for. So if you want to find expressions that have something to do with strings you can do 'exhelp -k string'. Quote Link to comment Share on other sites More sharing options...
Symbolic Posted November 14, 2011 Author Share Posted November 14, 2011 ishvariable will check only the variables that are declared in houdini (show up in Edit->Aliases and Variables window). isvariable is just a superset, it will check in houdini or os onse. For checking/remapping strings have a look at 'strmatch'.. btw if if you add '-k' you can search for command/expressions that contain the keyword you're looking for. So if you want to find expressions that have something to do with strings you can do 'exhelp -k string'. Thanks AdamJ, However I still do not know how to check if $MAPG is a wrong, well I can do that with some string by string checking. But it would have been nice to be able to check if a string is one of Houdini's own declared variables, like $CR, $PT, $MAPU etc. Thanks. Quote Link to comment Share on other sites More sharing options...
AdamJ Posted November 14, 2011 Share Posted November 14, 2011 you could check user input against parm list .. point_parm_list = hou.node('/obj/geo2/point1').parms() .. nx ny nz douvw mapu mapv mapw domass .. Quote Link to comment Share on other sites More sharing options...
Symbolic Posted November 15, 2011 Author Share Posted November 15, 2011 Hello! Thank you very much! Yep, this is waht I am going to do, lookup to a set of strings. Cheers. 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.