Jump to content

Human readable UI script examples


Guest mantragora

Recommended Posts

Guest mantragora

Hiiiiiiiiiiiiiii.

 

So, it's 6AM. I still don't sleep. I'm looking at all *.ui files in Houdini installation and I'm still stuck at having Dialog and f*cking toggle. 

Q. Does anyone have normal, not scattered on multiple files, examples of ui created with UI script?

 

No, I can't use HuiLib.

 

Thanks!

 

Love you!

Link to comment
Share on other sites

example of a dialog with  fu**** toggles  :

 

 

#define LABEL_WIDTH    1.5

a.val := 1;
b.val := 1;
c.val := 1;



show_dialog = DIALOG "Toggle Buttons Example"
{
    LAYOUT(vertical) MARGIN(0.1) SPACING(0.1) LOOK(plain)
    VALUE(dlg.val) HSTRETCH WIDTH(1) HEIGHT(0.75)     
    
    
    {
    LAYOUT(cell)    # cell layouts are useful for table layouts    
    
    TOGGLE_BUTTON "A":LABEL_WIDTH CELL(1,0) VALUE(a.val);    
    
    TOGGLE_BUTTON "B":LABEL_WIDTH CELL(1,1) VALUE(b.val);
    
    TOGGLE_BUTTON "C":LABEL_WIDTH CELL(1,2) VALUE(c.val);    
    }   
    
 

    {
    LAYOUT(horizontal) JUSTIFY(center,center)     
    ACTION_BUTTON "Close"  VALUE(on_close);
    }

}
 

Link to comment
Share on other sites

Guest mantragora

Q No.2:

 

Can I set DIALOG (or any control) name from variable somehow?

For example this:

dialog.name := "This is not dialog";

+ this:

dialog.window = DIALOG dialog.name
// or
dialog.window = DIALOG (dialog.name)

will fail, with "Nesting Error".

 

EDIT:

Answering myself. 

 

No, you can't. But you can #define it:

#define DIALOG_NAME "This is not dialog"
dialog.window = DIALOG DIALOG_NAME 
Edited by fântastîque Mântragorîè
Link to comment
Share on other sites

Guest mantragora

Q No.3:

 

How the hell I glue it with my Python code?

Should I make properties in my python that will get/set data in my code and they get called by something in the UI Script?

 

Lets say I have this:

import hou
import os
 
def PrepareAssetList():
    # get all installed digital assets
    loadedAssets = hou.hda.loadedFiles()
        
    assetDict = {}
    for asset in loadedAssets:
        assetDict[os.path.basename(asset)] = os.path.dirname(asset)
    
    # let user select which should be expanded       
    selected = hou.ui.selectFromList(assetDict.keys())
    
    if selected == ():
        return None    
    
    return selected
I want to have list of select asset names visible in DIALOG window. How to do this? Edited by fântastîque Mântragorîè
Link to comment
Share on other sites

Guest mantragora

The native houdini ui is good (in my opinion) just for simple dialog.

To be honest , the ui syntax is little obscure for me.

If you plan to  use more 'advanced' ui , i think pyside(pyqt) is better.

Yeah, I will probably go with PySide, but it would be cool to get some not so clear things sorted out for UI script. And make some really easy to follow examples. So if anyone wants to jump in and share something, don't be shay, DO IT!

Thanks!

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