Variable checking.
#1
Posted 11 November 2011 - 10:04 AM
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.
#2
Posted 11 November 2011 - 11:38 AM
echo `isvariable ("EXISTS")` returns 1
echo `isvariable ("NOTEXIST")` returns 0
hou.variable in python but doesn't look like it's implemented yet
#3
Posted 14 November 2011 - 06:52 AM
AdamJ, on 11 November 2011 - 11:38 AM, said:
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?
#4
Posted 14 November 2011 - 07:14 AM
haspointattrib
hasvertexattrib
echo `haspointattrib("../OUT","uv")` returns 1 if uvs exist
Symbolic, on 14 November 2011 - 06:52 AM, said:
But I could not get it working:
echo `ishvariable("MAPU")` will return 0 ?
Any ideas?
Edited by AdamJ, 14 November 2011 - 07:15 AM.
#5
Posted 14 November 2011 - 08:04 AM
AdamJ, on 14 November 2011 - 07:14 AM, said:
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.
#6
Posted 14 November 2011 - 09:34 AM
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'.
#7
Posted 14 November 2011 - 09:57 AM
AdamJ, on 14 November 2011 - 09:34 AM, said:
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.
#8
Posted 14 November 2011 - 11:40 AM
point_parm_list = hou.node('/obj/geo2/point1').parms()
..
nx
ny
nz
douvw
mapu
mapv
mapw
domass
..
#9
Posted 15 November 2011 - 03:53 AM
Yep, this is waht I am going to do, lookup to a set of strings.
Cheers.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











