Jump to content

python expression on an "attribcreate" node.


Symbolic

Recommended Posts

Hi,

I would like to create a string attribute storing the name of the previously connected node.

If I go with the `opinputpath(".",0)` solution... this returns the whole path... I can go into stripping out the last part... but I would like to do that with the python way...

I usually have my python commands on a button, never had a python to be evaluated on a node. How does that work?

Thanks.

Link to comment
Share on other sites

Thanks. Actually I was suggested a better way for this. Just to share it... You need to switch the node's expression language to "python" firtst. Then "Edit expression". Type the python code in and hit apply or accept and the box is green. No need for a keyframe. Because setting a keyframe really messes up that box... really... :)

Link to comment
Share on other sites

I guess so. But if you just type it in. It just does not get green. Then when you set a keyframe... it gets green but the syntax gets messed up as well. Maybe it is just for me. I found it cleaner to be done with the expression editor.

Sorry, I totally forgot to mention about the actual python code to list the inputs. It is:

hou.pwd().inputs()[0].name()

Thanks.

Edited by Symbolic
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...