Jump to content

HDA UI-Design: Display attribute values using a label?


Scratch

Recommended Posts

Hey folks,

 

I have a HDA where I want to display e.g. $NPT as text of a label-parameter in an HDA's User Interface.

When the user changes the number of points created with this asset, I want the number to update in the UI (label) aswell.

 

Can this be done? Actually, it sounds pretty easy...but so far, I couldn't do it. I'm sure I'm missing something here...

 

Thanks in advance! :)

 

 

EDIT: I found a workaround-solution by creating a normal string-parameter where I've put in a expression to fetch the attrib-value I need. Afterwards, I locked the parameter so that it can't be manipulated that easy. Still...a nice label which can't be edited at all (=just a display only) would be way better.

 

EDIT2: The solution of EDIT1 does not work,...testing showed that the expression does not get picked up by new instances of the asset....

Edited by Scratch
Link to comment
Share on other sites

Guest mantragora

I see that you are 4 years old Houdini user, so I will not give you solution. Just a proof that it can be done:

 

DisplayPointCountOnUI.gif

 

Now @Scratch you head a little harder to find solution for your problem :)

Edited by fântastîque Mântragorîè
Link to comment
Share on other sites

It can be done using Python and spare parameter. Besides challenges of handling all possible cases when this label need to be updated (node created, input changed, spare parms deleted, etc.) there is two bugs connected with modifying node' template groups on my Windows PC: 1) parameter ladder and value sliders not work properly; 2) heisenbugs which causes crashes. Try to change value randomly, like a wild ape, I got a segfault after 30-60 secs. It destroys my usual workflow.

 

I'm here from the future just to say that `ch("someparm")` syntax on default value is working.

cOTHeOa.gif

Edited by f1480187
Link to comment
Share on other sites

Guest mantragora

It can be done using Python and spare parameter. Besides challenges of handling all possible cases when this label need to be updated (node created, input changed, spare parms deleted, etc.) there is two bugs connected with modifying node' template groups on my Windows PC: 1) parameter ladder and value sliders not work properly; 2) heisenbugs which causes crashes. Try to change value randomly, like a wild ape, I got a segfault after 30-60 secs. It destroys my usual workflow.

Oh my god. What a monster you created :)

You don't need to do any Python scripting to achieve this. And certainly no need to mess with any events. It's really simple guys. I will give you one more day ;)

 

Link not working. Is it part of idea?

Hmm... It works on Opera.

 

Try to grab the link below (you need to download it or press View Original, otherwise it will be static image):

http://1drv.ms/1LWdaJe

Edited by fântastîque Mântragorîè
Link to comment
Share on other sites

By evaluated hscript like this?

`ch("./scatter1/npts")

That means evaluate hscript expression (using that ` backtick) in the Label # parameter of the HDA interface.

So for displaying number of points it's possible to use expression like: npoints("./node")

Link to comment
Share on other sites

Guest mantragora

Oh, Petr, he didn't answered :(

 

But since you broke the magic spell of "NOT TELLING", this is how I made it on the animated gif:

`npoints(opinputpath(".", 0))`

to get point count on begin, and:

`npoints("./OUT")`

to get point count from OutputSOP inside asset.

Both placed in In the column field of a Label.

Link to comment
Share on other sites

Normal labels including labels of Label templates are just plain strings in ParmTemplate instances, they are not evaluated. The column labels thing is probably a parm values despite of special parameter interface layout. A bit confusing.

 

Spare parms, however, can be dynamically changed via Python pretty easily. There is bunch of special methods in hou.ParmTemplateGroup allowing users not to just change labels of Labels, but dynamically generate a big interface structures based on user actions or input files.

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...