uiS[cript]Py: Quick 1st Example

NOTE there seems to be a quirk where wordpress is mutating certain symbols so to use example properly for now, please copy and paste to a text editor, and replace the single quote with.. Yes, what appears to be the same single quote on your keyboard… if you run into this issue. When I have it patched, this note will no longer ne here. Thanks.

Here is a quick example to get everyone started. Its not particularly meaningful but shows basic usage. The manual is in HTML with the download and is fairly complete. If its in there and promoted to the uispy namespace, for the most part its been working. Methods have docstrings and if using the built-in houdini Py Shell, you will see them as normal in the nice little popup.

import uiScriptPy as uispy

# basic container is needed in this case a row
myrow = uispy.ColunnUiScriptContainer(‘myrow’)

# a simple float tuple
myfloat = uispy.FloatUiScriptGadget(‘myfloat’, ‘My Float’, 3)

# Top of dialog
mywin = uispy.DialogUiScriptWindow(‘mywin’, ‘My Win’)

# set the float to the row
myrow.setUiScriptGadgets((myfloat,))

# set the container to the dialog
mywin.setUiScriptGadgets((myrow,))

# create a basic interger and set range on slider
myint = uispy.IntUiScriptGadget(‘myint’, ‘My Int’)
myint.setSliderRange(-10,10)

# append slide to the row container
myrow.addUiScriptGadget(myint)

# color widget with alpha
mycolor = uispy.ColorUiScriptGadget(‘mycolor’, ‘My Color’, has_alpha=True)

# a password string field
mypassword = uispy.StringUiScriptGadget(‘password’, ‘Password’)
mypassword.setIsPassword(True)

# a lablel with a little styling
mylabel = uispy.LabelUiScriptGadget(‘mylabel’, ‘My Label’)
mylabel.setTextLook(uispy.uiScriptTextLook.underline)

# basic column container
mycol = uispy.ColunnUiScriptContainer(‘mycol’)

# add color, password, and label to column
mycol.addUiScriptGadget(mycolor)
mycol.addUiScriptGadget(mypassword)
mycol.addUiScriptGadget(mylabel)

# a collapser is uncommon but useful to conserve space
# create collapsed initally, and containing column of widgets  
mycollapser = uispy.CollapserUiScriptContainer(‘mycollapser’, ‘My Collapser’, (mycol,), collapsed=True)

# set the row and collapser to the window
mywin.setUiScriptGadgets((myrow, mycollapser))

# create the dialog from the script
d = mywin.createHouDialog()

# now we can retrieve a gadget from the dialog
#  this can be thought of similar to a parameter object
#  for the parameter pane via parmTemplates
myfloat_gadget = d.uispy_gadgetTuple(‘myfloat’)

# query the raw values
myfloat_gadget.get()

# use extended method provided to destroy dialog cleanly
d.uispy_destroy()

 

uiS[cript]Py: Announcement. uispy download available

logo_400pxw

I have decided to make available a python wrapper for Houdini’s uiscript. It has been the result of needs I have had and was largely ripped from another defunct project. It should be considered alpha. I am aware of a couple efforts to do this, however I think uispy is fairly robust and useful.

Hopefully this will also provide an exploratory opportunity to document its clean-up here on  eyevex.com bit by bit in the New year (assuming compatibility with h16 for now). At that time some examples, tutorials and explanations will be coming, until then feel free to download and poke around.

It is acknowledged, that a few things are broken or missing, some the scripts are a bit hacky, there are places for improvement, and a bit that is completely wrong, but working. This is alpha, which mean it has only been used my myself and really only on a specific setup, in my case that’s Linux 64, kubuntu. Earlier versions were tested win win7, but have not been in sometime. Its development also means it lack some safety checks and sometimes you may be allowed to use values that wont properly build the dialog. This will be an area of improvement as the module is cleaned up.

Why do this at all…. There’s a few reasons to… and a few reasons not to. As uiS[cript]py uses only standard python and built-in Houdini libs, it provides a clean and safe way to create simple dialogs beyond the basic tree, multiline and lists in HOMs hou.ui While currently pySide and pyQt provide ways to build large robust interfaces, often a simple native dialog without worrying about qt deps or learning large libs is needed, and this fills that space. For those familiar with parmameterTemples in HOM, the naming of methods and usage closely mirrors that workflow. UI Script is also used for Cpp plugs as a quick way to build interfaces, in the future this may provide an easy way to design uis visually and dump the script.

This is a more advanced topic and not all basics wont be gone over, hopefully all interested will get something from it, but in the end the inner workings will likely most interesting to Pipeline/dept/show Tds. Example usages will probably be of broader interest and for reader that just wants to get to using it.

happy CG’ing. (|;-D>

eyevexTools HOM redundant functions depreciation

This space has gotten a bit stagnant and as for a multitude of reasons several post never made it to publish, however I am moving forward with a larger series on uiS[cript]Py. Most of eyevextools is working although need to be tested in recent versions. However, a lot of the much needed functionality we explored here has since appeared in the HOM module. This is great, but has made much of EVT redundant. In the near future I will be depreciating these parts. Posts and downloads will remain available for those that want to follow along but depreciated features wont be maintained.

(|;-D>

SIGGRAPH 2013

Status

I will be at SIGGRAPH Sun-Thurs for those that want to meet up my contact info is available on my main site www.dansportfolio.com

Sorry for the late postings, I have run into a bit of unexpected work hours on some productions but there will be lot of good stuff coming soon (|;-D>

Status

I have been busy this winter in a several step move hopefully keeping me in Montreal making good CGs for some time. Hold tight as I prepare an in-depth series of advanced posts and library addictions the next couple of weeks.

As I haven’t had a chance to decide the best way to deal with comments that are %99.9 spam, I have had to shut down commenting for the moment. For the few people that have posted legit comments I do appreciate the feedback and feel free to email me as I do still want to hear it, just not links to replica merchandise and grey market pharmaceuticals.

Congrats to the SESI crew on another release full of surprises tools to help make the Magic happen with H12.5 I haven’t had time to verify compatibility of EVT pys, so any that find hiccups, please do email me.

Happy CG’in (|;-D>

TnT: Viewport Gradient: part 2 — How

H12 viewport gradient

H12 viewport gradient

In $HOME/houdini12.x add a directory “config”, if it does not already exist. Next, the Houdini installation location is needed to grab the config file of lower path precedence and edit a copy of it. If you are unsure of the install location do any…

  • from inside Houdini, windows menu -> shell
  • source houdini_setup to get a proper environment
  • use the Houdini Command Line Tools in windows

whichever prompt you now have simply enter echo $HFS if in *nix or echo %HFS% if in windows.

** NOTE ** Windows users may get a slightly funny looking value such as… C:\PROGRA~1\SIDEF~1\HOUDINI~1.101 –this is a legacy DOS 8.3 FAT name or DOS SFN — What this means and why it exist is beyond the scope of this post, but suffice it to say, if too difficult to decipher actual location, simply put the SFN into the windows explorer address bar and [ENTER] and it will resolve to the actual location.

Now that the intallation folder is known, copy from installed path/houdini/config/scheme file to $HOME/houdini12.x/config/scheme file
replacing “installed path” with your installation path, “scheme file” with either 3DSceneColors.wb (if altering Dark) or 3DSceneColors.bw (if altering Light) and 12.x with 12.0 or 12.1 (most likely works in earlier versions but is untested).

Somewhere along the line (or maybe I hadn’t initially noticed) the ability to set two viewport colors snuck into these files. Lets take a look inside, but 1st close Houdini. Open the scheme file copy made in $HOME/houdini12.x/config in a text editor ie kate, gedit, wordpad etc … The scheme files contains many options and most are pointless to change, as changing one tends to lead to changing another to keep the color scheme from becoming a mess, so best to start with those below adjusting others only as needed. We are interested in:

BackgroundColor:               0.70 0.70 0.70  # background color
BackgroundBottomColor:   0.45 0.33 0.22  # background color at bottom of viewport

at the top of the file control the gradient, and further down ….

GridColor:                           0.10 0.10 0.10  # reference plane

.. .as noted, controls the grid color, which in most cases will also need to be changed to keep it from getting lost in the gradient colors.

If editing Light scheme you might be surprised to learn it already has a beyond subtle gradient. Feel free to play around with the RGB float values, but remember to save and restart for changes to take effect.

Through experimentation, the brown gradient shown can be achieved with…

BackgroundColor:               0.70 0.70 0.70  # background color
BackgroundBottomColor:   0.45 0.33 0.22  # background color at bottom of viewport

or for a nice fading blue …

BackgroundColor:               0.70 0.70 0.70  # background color
BackgroundBottomColor:   0.14 0.28 0.75  # background color at bottom of viewport

and in both cases I altered the grid to have it stand out as …

GridColor:                           0.10 0.10 0.10  # reference plane

That should about do it. If you want two gradient themes you can override both the light and the dark themes. If you mess up or a lot of warning get spit out on Houdini load, you can always copy a fresh version of the file back to $HOME/houdini12.x/config and give it another go. Happy customizing!