Hi, I´m learning python and there is something I don´t know how to do.
I´m creating this two variables:
char = hou.node('/obj/Char_Rig_01')
R_clavicle_bone = hou.node('/obj/Char_Rig_01/R_clavicle_bone')
But I want in the second variable to use the data from the first variable, something like this
R_clavicle_bone = hou.node('char/R_clavicle_bone')
The first node is subnetwork and the second is a bone inside the subnet. Please help with this ...
Python concatenation
2419 6 0-
- Angel Fucaraccio
- Member
- 55 posts
- Joined: Oct. 2018
- Offline
-
- Andr
- Member
- 899 posts
- Joined: Feb. 2016
- Offline
Hello, do you want to concatenate the paths to the nodes?
When you use the char variable between the "", python wouldn't read it as variable, instead it would return just the word "char" and not the object.
Also char is a node object in your case, and concatenating it with a string type doesn't really make sense.
I guess you want to use char.path() to return the path to the char node in string format.
You could do something like this:
When you use the char variable between the "", python wouldn't read it as variable, instead it would return just the word "char" and not the object.
Also char is a node object in your case, and concatenating it with a string type doesn't really make sense.
I guess you want to use char.path() to return the path to the char node in string format.
You could do something like this:
#first build your path path = char.path() + '/R_clavicle_bone' #then ask for the node object R_clavicle_bone = hou.node(path)
Edited by Andr - Oct. 8, 2021 07:47:31
-
- tamte
- Member
- 9384 posts
- Joined: July 2007
- Offline
-
- Angel Fucaraccio
- Member
- 55 posts
- Joined: Oct. 2018
- Offline
-
- Angel Fucaraccio
- Member
- 55 posts
- Joined: Oct. 2018
- Offline
Hi ... so I´m back with another issue.
This works for what I need to work with the bones inside the "Char_Rig_01"
And now I need to add a line where it presses a button, this work
But of course, I want to use the char variable I set at the beginning ... but this doesn´t work
So, how can I concatenate the "char" variable + '/Geo/capture_cache1/stashinput' ?
This works for what I need to work with the bones inside the "Char_Rig_01"
char = hou.node('/obj/Char_Rig_01')
And now I need to add a line where it presses a button, this work
hou.parm('obj/Char_Rig_01/Geo/capture_cache1/stashinput').pressButton()
But of course, I want to use the char variable I set at the beginning ... but this doesn´t work
hou.parm(char'/Geo/capture_cache1/stashinput').pressButton()
So, how can I concatenate the "char" variable + '/Geo/capture_cache1/stashinput' ?
-
- tamte
- Member
- 9384 posts
- Joined: July 2007
- Offline
Angel Fucaraccioyou can use the same logic as before
But of course, I want to use the char variable I set at the beginning ... but this doesn´t work
hou.parm(char'/Geo/capture_cache1/stashinput').pressButton()
char.parm("Geo/capture_cache1/stashinput").pressButton()
alternatively (not preferred) just for reference how to recreate full parameter path:
hou.parm(char.path() + '/Geo/capture_cache1/stashinput').pressButton()
Tomas Slancik
CG Supervisor
Framestore, NY
CG Supervisor
Framestore, NY
-
- Angel Fucaraccio
- Member
- 55 posts
- Joined: Oct. 2018
- Offline
-
- Quick Links


