Hi!
Noticed in nodes organizing, customizing… how to set color and shape and it works, but there given this too for returning default shape:
>>> node.setUserData(“nodeshape”, None)
I've changed shape, but can't revert, tried it so >
>>> n = hou.node(“/obj/geo1”)
>>> node.setUserData(“nodeshape”, None)
and so >
>>> n = hou.node(“/obj/geo1”)
>>> n.setUserData(“nodeshape”, None)
and tried to type instead of “nodeshape” - “circle”
haven't results, node is circle and circle
Please, advice
And for nodes renaming is given this:
>>> n.setUserData(“my data”, “my data value”)
I've tried to type it so as it's written and changing “my data” to “name” too, but it doesn't rename node, what I do wrong?
Thanks
Node name and default shape Python?
4099 8 1- RyuKu
- Member
- 171 posts
- Joined: Oct. 2016
- Offline
- Enivob
- Member
- 2528 posts
- Joined: June 2008
- Offline
Python has a feature called dir that will print out all the possible options available for an variable. In your case, once you have a node, try issuing a print dir(n).
In this image you can see all the options available for a node. One of them is setName.
Try reading the help as well.
In this image you can see all the options available for a node. One of them is setName.
Try reading the help as well.
Using Houdini Indie 20.0
Ubuntu 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
Ubuntu 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
- RyuKu
- Member
- 171 posts
- Joined: Oct. 2016
- Offline
Enivob,
hurrah - thanks - setName works!
I wrote it as:
>>> n.setName(“Ryu_Ku”)
If it is how it should be written.
Maybe you know how to use this too for changing to default node's shape back?
>>> node.setUserData(“nodeshape”, None)
Don't know how to write it to make working.
hurrah - thanks - setName works!
I wrote it as:
>>> n.setName(“Ryu_Ku”)
If it is how it should be written.
Maybe you know how to use this too for changing to default node's shape back?
>>> node.setUserData(“nodeshape”, None)
Don't know how to write it to make working.
Edited by RyuKu - Dec. 9, 2017 14:17:36
- tamte
- Member
- 8513 posts
- Joined: July 2007
- Online
- RyuKu
- Member
- 171 posts
- Joined: Oct. 2016
- Offline
Thanks, tamte!
So hoped for answer.
Yes, both your examples work. Thanks, thanks.
Your codes look absolutely differently from what I've firstly tried.
And even more interesting that " could be ‘ O_O
And don’t know if I could ask it here, or need new thread for it, but I've found one more thing to ask seems about Python too.
There was the example making something were called verbs appeared in the viewport after text was written inside of Font - not sure, but seems to make it works I need to change somehow background to violet/lilaceous/purplish as on the image, because if it's written on the black background - it the viewport are visible the text itself: verbdict = hou.sopNode… And the color - only the one difference I can notice.
Maybe you know how to make it appears?
Thanks for the reply given…and any advice
So hoped for answer.
Yes, both your examples work. Thanks, thanks.
Your codes look absolutely differently from what I've firstly tried.
And even more interesting that " could be ‘ O_O
And don’t know if I could ask it here, or need new thread for it, but I've found one more thing to ask seems about Python too.
There was the example making something were called verbs appeared in the viewport after text was written inside of Font - not sure, but seems to make it works I need to change somehow background to violet/lilaceous/purplish as on the image, because if it's written on the black background - it the viewport are visible the text itself: verbdict = hou.sopNode… And the color - only the one difference I can notice.
Maybe you know how to make it appears?
Thanks for the reply given…and any advice
- tamte
- Member
- 8513 posts
- Joined: July 2007
- Online
you simply need to insert Python expression in there instead of just text
to do that you can
1. Alt+click on the parameter label (in this case “Text”), this will create a keyframe that can hold an expression
by default is green to reflect that the scripting language is the same as current global scripting language on the node
2. RMB on the label and choose Expression/Change Language To Python, now it should turn purple
3. click inside of the parm and press Alt+E to edit the expression
4. write your expression in there and apply
or
4. you can even directly write your expression in the parameter, just make sure it's showing the expression and not the evaluated value, you can toggle that by clicking on the label
alternatively you can :
1. switch the global scripting language on the node to Python (H icon top right next to Cog icon)
2. Alt+click on the parameter label (in this case “Text”), this will create a keyframe that can hold an expression
by default is green to reflect that the scripting language is the same as current global scripting language on the node, in this case you want to keep it green as your global scripting language on the node is Python so in this case green is Python
3. 4. the same
to do that you can
1. Alt+click on the parameter label (in this case “Text”), this will create a keyframe that can hold an expression
by default is green to reflect that the scripting language is the same as current global scripting language on the node
2. RMB on the label and choose Expression/Change Language To Python, now it should turn purple
3. click inside of the parm and press Alt+E to edit the expression
4. write your expression in there and apply
or
4. you can even directly write your expression in the parameter, just make sure it's showing the expression and not the evaluated value, you can toggle that by clicking on the label
alternatively you can :
1. switch the global scripting language on the node to Python (H icon top right next to Cog icon)
2. Alt+click on the parameter label (in this case “Text”), this will create a keyframe that can hold an expression
by default is green to reflect that the scripting language is the same as current global scripting language on the node, in this case you want to keep it green as your global scripting language on the node is Python so in this case green is Python
3. 4. the same
Edited by tamte - Dec. 9, 2017 17:21:01
Tomas Slancik
FX Supervisor
Method Studios, NY
FX Supervisor
Method Studios, NY
- RyuKu
- Member
- 171 posts
- Joined: Oct. 2016
- Offline
Thanks again!
So detailed answer I didn't even wait!
You've predicted one of my questions in 1 - second 4 Read my thoughts.
And again both ways work.
Will I be very wrong if will remember it so > nodes (HScript) by the default are green, Python by the default is purple. To make Python works > we need to change either background of parameter to purple if node is HScript or the whole node to purple (Python) and in that case color of Python will become green?
If the creators of Houdini are going to remove HScript - will be the color of Python still purple? I will use the first method you wrote, think, cause like purple background more.
Please let me be more annoying if I am and one more question - how to write expressions on the grey background here in messages as you do?
Thank you!
So detailed answer I didn't even wait!
You've predicted one of my questions in 1 - second 4 Read my thoughts.
And again both ways work.
Will I be very wrong if will remember it so > nodes (HScript) by the default are green, Python by the default is purple. To make Python works > we need to change either background of parameter to purple if node is HScript or the whole node to purple (Python) and in that case color of Python will become green?
If the creators of Houdini are going to remove HScript - will be the color of Python still purple? I will use the first method you wrote, think, cause like purple background more.
Please let me be more annoying if I am and one more question - how to write expressions on the grey background here in messages as you do?
Thank you!
Edited by RyuKu - Dec. 9, 2017 18:44:56
- tamte
- Member
- 8513 posts
- Joined: July 2007
- Online
yes, that's the behavior
the purple simply means that the parameter language is not the one that's currently set, it's a bit confusing, but the color is not per language
Hscript is probably not going away in any near future, it's still very heavily used even by sidefx and it often evaluates faster than Python
the purple simply means that the parameter language is not the one that's currently set, it's a bit confusing, but the color is not per language
Hscript is probably not going away in any near future, it's still very heavily used even by sidefx and it often evaluates faster than Python
Ryu Ku
Please let me be more annoying if I am and one more question - how to write expressions on the grey background here in messages as you do?
just use [code] and [/code] tags, or simply press </* button from the bar to create them around your text, you can pick language there for syntax highlighting
Tomas Slancik
FX Supervisor
Method Studios, NY
FX Supervisor
Method Studios, NY
- RyuKu
- Member
- 171 posts
- Joined: Oct. 2016
- Offline
-
- Quick Links