Jump to content

A Simple Python Basic Question.


ghang

Recommended Posts

how do i use the variable in "tx"

ps:

>>> x = 200

in /obj/geo1/tx ; i don't know how to put the x variable in tx.

i try:

hou.ch(x)

hou.ch($x)

hou.ch("x")

hou.ch("$x")

$x

x

tx = x

can some one tell what command should i use to using Python HOM to input variable please ?

what I want to do is just let the node to use variable that define in Python Textport.

very thank you!!

post-4016-125082659331_thumb.jpg

post-4016-125082689797_thumb.jpg

Link to comment
Share on other sites

what I want to do is just let the node to use variable that define in Python Textport.

That's the point. It's not an easy question as you may think. Houdini's Python textport operates at different name space (separate thread?), similar to Shelf Tools, and node's parameters don't have direct access to its variables. This is specially noticeable with refreshing issues. While you may (as graham suggested at sesi forum), import __main__, or use hou.session module to link paramter to your variable, it won't update interactively while you'll be changing variable's value (you could try to force paramter to be time dependent with hou.frame() for example, but I'm not sure how this would work).

Fortuantelly this is not an usual way of doing things in Houdini. Think of nodes as classes and paramters as attributes which you can link together to store variables and control one with another. Same result, nicer and cleaner ;)

cheers,

skk.

Link to comment
Share on other sites

thanks for everyone reply

I think I got what I need from your kindly reply :D

cheers

Funny misunderstanding..., so you wanted to set parameter with Python, not use textport variable in parameter expression... the first one is explained in HOM help at the very beginning :unsure: ) .

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...