7 entries in UI Design

Progress Bar Updater

A struct to simply and easily update a progress bar by providing just start and end values, and calling update()

Thursday, May 1st, 2008

Updating a progress bar is fairly simple in conceptual terms, but it always takes a slightly different bit of code to do it right:

  • What if the sequence is backwards?
  • What if you’re incrementing in units of 2, or 3, or 10?
  • How big is the progress jump?

It makes sense to abstract the process and stick it in a struct. The progressBarUpdater does just that, and really is as simple as:

  1. Create a struct instance
  2. Initialize it with a reference to a progress bar, and the known start and end values of the calculation
  3. Call update() for each loop iteration.

In code, starting with a 2-line initialization, it looks like this:

pbu = progressBarUpdater()
pbu.init pb1 startValue endValue

And to update the progress bar, this is the only command you need to place in the loop:

pbu.update()

The pbUpdater struct already knows everything it needs to know, so it’s just one call.

Download

Download progressBarUpdater.ms.

UI Manager

Save and load rollout settings, such as size, position, control states, items, etc to a preferences file

Thursday, May 1st, 2008

A struct containing methods to save and load rollout settings, such as size, position, control states, items, etc
to a preferences file, as well as methods to accomplish UI control tasks for example keeping one spinner higher or lower
than another when editing ranges.

Usage

To manage a rollout or dialog, you simply:

  1. create a struct instance
  2. initialize it with a reference to a rollout
  3. Manage the rollout by calling the struct’s methods

In code, that’s as easy as this:

ui = uiManager()
ui.initialize roTools
ui.loadPosition()

All settings are saved to an .ini file named after the rollout title, so in this case, an ini file named “Tools.ini” would be saved to your max installation’s /plugcfg folder.

Methods

This is a work in progress, and will be updated from time to time with new methods.

Dialog functions

  • savePosition - save the dialog position
  • loadPosition - load the dialog position
  • saveSize - save the dialog size
  • loadSize - restore the dialog size

Rollout functions

  • autoSizeFloater - resize the floater to exactly the size of all open rollouts
  • toggleRollout - set one or several rollouts open
  • loadRolloutStates - save all rolled-up / down states (not yet implemented)
  • saveRolloutStates - load all rolled-up / down states (not yet implemented)

Control functions

  • updateSpinnerPair - ensure that spinners react as a pair, eg one can never go higher than the other
  • moveListboxItem – move selected Listbox items up or down, and have them remain selected
  • moveMultiListboxItems – move multiple MultiListbox selections up or down, and have them remain selected
  • getValue - abstract function to get a control’s value (not yet implimented)
  • setValue - abstract function to set a controls’s value (not yet implimented)

Preference functions (WIP)

  • saveValue - save a control’s value
  • loadValue - load a control’s value
  • saveAllValues - save all controls’ values
  • loadAllValues - load all controls’ values

Downloads

Download uiManager0.52.ms. Place in your scripts/startup directory, or just include the file when you need it.

These example files will get you started:

  • Preferences functionality – save and restore a dialog’s position when re-running a script
  • Floater functionality – open only selected rollouts, and automatically resize when opening rollouts

ActiveX TreeView Functions

A set of functions for manipulating ActiveX Treeviews

Sunday, October 21st, 2007

This MAXScript entry has not yet been completed…
(more…)

HTML Help Template

An HTML template for a good-looking help system for your scripts

Tuesday, September 13th, 2005

This MAXScript entry has not yet been completed…
(more…)

Flash UI Examples

Character select, graphing and joystick control examples of using Flash as a rich interface to 3dsmax

Tuesday, August 30th, 2005

Flash has always allowed the use of Active X controls in its interface rollouts, and by using Flash’s FS Commands, you can allow interaction in the Flash interface to affect 3dsmax, and 3dsmax interaction to feedback to Flash. It’s a really easy way to build rich interfaces within 3dsmax without getting into C++ plugins.

The following demos were all completed from 2002 to 2005 using Flash 4, and its quite basic (by today’s standards) scripting language. I can’t even remember if it was called ActionScript then, or was just Flash.

Anyway. Needless to say, if you want to do funky Flash interaction these days you should be looking at .net inside 3dsmax and ActionScript 2 / 3 in Flash using ExternalInterface to provide the communication between the two.

Now for the demos…

Axis Control Demo

This demo basically demonstrates a frame-loop running inside Flash that allows you to drag a joystick-like button to control the animation of a selected object in 3dsmax.

It’s really interesting to see an object react in realtime in the max viewport, and you can set animation mode on, then play the timeline to record the movement as well.

Graphing Demo

This demo shows 2-way communication. The demo maxscript animates a ball, then sends the coordinates to Flash. You can also click the radio buttons to show another view in Flash, and in Flash, click the animation key indicators to start the 3dsmax timeline playing from that point.

It’s interesting to compare the actual trajectory in the max viewports with the Flash app. With a little more thought I’m sure some cool stuff could be achieved with this, especially now (late 2009) as we now have proper 3D in Flash.

Character UI Demo

Probably the most useful demo of the three, this demo is simply to demonstrate how you could build a custom interface within Flash, then use it to select elements in your scene without having to muck about with selection sets, or the scene explorer. In the real world it would probably be written more flexibly, i.e. with XML files and not hard-coding the element names, but you get the idea.

Note: the demo below is actually interactive.

Download and installation

You can download the demo files here, and start poking around both the 3dsmax and Flash scripts to see how they work.

In 3dsmax you MUST edit the path to the swf file in each of the scripts before you run them, or else they simply won’t work, or you will get errors.

Lastly – as I said at the top, this would certainly NOT be the way to do it today! But it’s interesting to think that this sort of thing could be done 7 years ago. Did anyone take advantage of it? Not to my knowledge which is a real shame I think.

If I was still a 3dsmax TD today, I imagine I would be doing this sort of stuff all the time!

Enjoy.

HTML Interface

A set of functions that allow you to run any MaxScript command from a rollout's ActiveX HTML control

Sunday, June 26th, 2005

MaxHtml provides methods to run max commands from an ActiveX HTML page. Also, provides simple methods to write back to the page.

Example uses:

  • Run MaxScript commands as part of a help system
  • Build a custom UI using HTML / JavaScript

It’s form is a struct (function library) in conjunction with a JavaScript library. It is designed for programmers to use within their scripts.

Demo UI

Functions

This is just a base set of functions. I may add more at some point.

parseUrl Parse and run the max command from the web page
addMaxLink Add a MaxScript link to the web page
addHtmlLink Add a normal HTML link to the web page
setBgColor Set the background color of the page to the max UI color

Implementation

HTML

3dsMax

  • Include maxHtml.ms in your MaxScript
  • Set up the ActiveX browser control to display your html page
  • Use the control’s BeforeNavigate2 event to intercept the links in the web page
  • Pass the url along to the maxHtml struct like so: maxHtml.parseUrl url

Explore the demo to see how things work. Be sure to change the path in the top of the demo.ms file to point to towards the html demo file!

Download

Download MaxHtml.zip

Easy Icons

A range of code-only icons to spice-up your UI and minimize distribution files

Tuesday, January 4th, 2005

This MAXScript entry has not yet been completed…
(more…)