Jump to content

Add list of strings to parameter interface


Recommended Posts

Hi All ! 

 

So I have an array of strings. Each string is a character_name in the scene, the array is therefore listing all the characters in the scene. 

I would like to list all the characters in the scene in the parameter interface of a Null node. 

 

So my questions is, how do we take array data and list it in the parameter interface of a null node?

The number of characters in the array changes too. 

 

I really can't seem to find any information about this anywhere so any ideas would be really useful! 

Thanks 

Link to comment
Share on other sites

Hey Mark !

I assume your null parameter interface is a multi-parm block.
The idea is, in Python, to set the multiparm block number to the amount of items of your array, then for each items of your array, set the string parameter for the character name.

geo = hou.pwd().geometry()

characters = geo.stringListAttribValue("characters")

hou.parm("../UI/characters").set(len(characters))

for i, character in enumerate(characters):
    parm_name = "../UI/character_{}".format(i)
    hou.parm(parm_name).set(character)

list_of_string_to_parameter_interface.hipnc

  • Like 2
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...