What are the Global expression variables for Python or where can I find them or is there a function to translate them from HScript?
lvar('') doesn't seem to work
For example:
A groupnode called test with the group name set to $OS returns test, right what it is supposed to do.
However, with the group name set to lvar('OS') it returns lvar__OS__.
I know that lvar('') is for translating local variables from HScript into Python but I havn't found any function so far that translates global variables.
Python global expression variables
9990 11 0- anon_user_21411066
- Member
- 210 posts
- Joined: 1月 2014
- Offline
- tamte
- Member
- 8590 posts
- Joined: 7月 2007
- Offline
- anon_user_21411066
- Member
- 210 posts
- Joined: 1月 2014
- Offline
- Netvudu
- Member
- 304 posts
- Joined: 5月 2006
- Offline
- anon_user_21411066
- Member
- 210 posts
- Joined: 1月 2014
- Offline
Netvudu
if I store the group name parameter in a variable, let´s say “gname”
then gname.eval()
returns the proper name of the group, even if you used $OS
I'm not quite shure what you mean but it sounds a bit too much for what I want.
$OS is used to pass the string of an operators name to a parameter, in this case it means that the group name is the same as the nodes name. In HScript thats pretty handy since $OS is just 3 characters to type. I have my default scripting laguage set to Python and I don't wanna change this everytime to HScript when I wanna use $OS. So a short handy command/expression/function would be nice.
- pezetko
- Member
- 387 posts
- Joined: 11月 2008
- Offline
- anon_user_21411066
- Member
- 210 posts
- Joined: 1月 2014
- Offline
- Netvudu
- Member
- 304 posts
- Joined: 5月 2006
- Offline
Korny Klown2
I'm not quite shure what you mean but it sounds a bit too much for what I want.
$OS is used to pass the string of an operators name to a parameter, in this case it means that the group name is the same as the nodes name. In HScript thats pretty handy since $OS is just 3 characters to type. I have my default scripting laguage set to Python and I don't wanna change this everytime to HScript when I wanna use $OS. So a short handy command/expression/function would be nice.
Ah, now I understand, sorry.
The reply I gave was oriented towards creating a python script and getting the group name.
What you want is the Python equivalent to $OS to write it in the parameter window.
What pezetko says works well, but it is indeed longer than $OS.
Two small tips (that you might already now)
-You can change the expression language just for one parameter by right-clicking and choosing “expression-Change language to Hscript”
-You can save a preset for any node. So what I would do is write this “hou.pwd().name()” or “$OS” on my node and save it as a preset so every time I create a group node I´m just one click away from it. You could even save it as the type default if you wanted to.
Hope it helps.
Javier Meroño
FX TD.
FX TD.
- anon_user_21411066
- Member
- 210 posts
- Joined: 1月 2014
- Offline
Netvudu
-You can change the expression language just for one parameter by right-clicking and choosing “expression-Change language to Hscript”
-You can save a preset for any node. So what I would do is write this “hou.pwd().name()” or “$OS” on my node and save it as a preset so every time I create a group node I´m just one click away from it. You could even save it as the type default if you wanted to.
Changing the expression language for one parameter or the entire node makes no difference to me since I would still have to change it everytime.
The preset trick doesn't work as well, respectively makes the the workaround even longer.
It kind of bugs me that I have to explicitly have to deal with HScript because Python is not capable of handling the same things as HScript.
Apart from that, I already mentioned that pezetkos scene works but when I type myself it doesn't. Why? Do I have to consider something special when writing Python code in a parameter? Expressions like ch('ty') work with no problem. hou.pwd().name() doesn't work at all.
- Netvudu
- Member
- 304 posts
- Joined: 5月 2006
- Offline
- anon_user_21411066
- Member
- 210 posts
- Joined: 1月 2014
- Offline
I don' understand that. Why does ch() automatically create a key and I don't have to care about anything, I can just type right away where for pwd().name() I specifically have to take care that I'm in the right state of the parameter and have to create key manually. Or is it not the expression but the parameter that is different then others?….anyway…
Inconsistency all over the place. :cry: So, so confusing.
Inconsistency all over the place. :cry: So, so confusing.
- pezetko
- Member
- 387 posts
- Joined: 11月 2008
- Offline
It's very consistent. Tomas explained it very well there:
http://forums.odforce.net/topic/15896-noob-how-to-eval-python-expression-in-group-parameter/ [forums.odforce.net]
http://forums.odforce.net/topic/15896-noob-how-to-eval-python-expression-in-group-parameter/ [forums.odforce.net]
-
- Quick Links