uLister
MAXScript
The uListerTools functions that read and write any cell of any uLister tab, run row verbs and open the panel from a script.
uLister publishes one MAXScript interface, uListerTools, which gives scripts the table the panel shows: every tab, column, row and cell, read and written by the grid's rules. It is named uListerTools, not uLister, because uLister is the plugin's own name and MAXScript names ignore case. Run showInterface uListerTools in the MAXScript Listener to list its functions; if uListerTools is undefined, uLister isn't loaded. The MAXScript reference lists the names every Verstice plugin answers to.
A cell is addressed by three values:
- category – a tab's label, in the same case:
"Objects","Lights","Cameras","Scatters","Proxies","Materials","Textures"or"Layers"."objects"doesn't match. - rowKey – a string of digits: the object's handle on the node tabs, an internal 3ds Max handle on Materials, Textures and Layers. Take keys from
rowKeysorchildKeys; don't build them. - column – the column's position, counting from
0, ascolumnslists it. Callcolumnsagain after objects of a new class arrive, because columns are added and can move.
Filter rules, sorting, grouping, saved views, the footer, the checked set and export have no function, and none of them reaches a script: rowKeys returns every top-level row. Filter and total in your script with getCell. In a batch or headless session there is no panel, so showPanel and togglePanel do nothing; every other function works.
Interface: uListerTools
Cell values go in and come out as text, as the grid reads and writes them: a Color is r,g,b, a Boolean true or false.
| Function | Parameters | Description |
|---|---|---|
categories | - | Returns the eight tab labels, in tab order. |
columns | <category> | Lists the tab again and returns its column titles; element 1 is column 0. The built-in columns come first, in that order: on Objects, Name is 0 and Material is 8. An unknown category returns an empty array. |
rowKeys | <category> | Lists the tab again and returns the keys of its top-level rows. |
childKeys | <category> <rowKey> | Lists the tab again and returns the keys of the row's direct children: map slots then sub-materials on Materials, sub-maps on Textures, child layers on Layers. They work with getCell and setCell. |
getCell | <category> <rowKey> <column> | Returns the cell's value as text at the current frame, without listing the tab again; "" for an unknown category, row or column, or a parameter the row lacks. |
setCell | <category> <rowKey> <column> <value> | Writes <value> by the same rules as a paste, without clamping to the parameter's range or listing the tab again. Returns false if the write is refused. One undo step, uLister edit; a refusal records none. |
rowAction | <category> <rowKey> <action> | Lists the tab again, then runs a verb on one row. Returns false for an unknown verb, or one that doesn't apply to the row. |
selfCheck | - | A diagnostic: returns true when uLister's internal table of column types is consistent. |
showPanel | - | Creates the panel the first time, then shows it and brings it to the front. Returns nothing. |
togglePanel | - | Hides the panel if it is visible; otherwise shows it. Returns nothing. |
uListerTools. rowAction Verbs
Verbs are case-sensitive strings, and each is one undo step, named as in brackets. The node tabs are Objects, Lights, Cameras, Scatters and Proxies; rows on Textures and Layers take no verbs.
| Verb | Description |
|---|---|
"select" | Node tabs. Replaces the scene selection with the row's object ( uLister select). |
"hide" | Node tabs. Hides the object ( uLister hide). |
"unhide" | Node tabs. Unhides it ( uLister unhide). |
"freeze" | Node tabs. Freezes it ( uLister freeze). |
"unfreeze" | Node tabs. Unfreezes it ( uLister unfreeze). |
"isolate" | Node tabs. Unhides it and hides every other object in the scene ( uLister isolate). |
"delete" | Node tabs. Deletes the object ( uLister delete). |
"assignSelected" | Materials rows that are materials. Assigns the material to every selected object ( uLister assign material). |
"selectUsers" | Materials rows that are materials. Replaces the scene selection with every object whose material is this one ( uLister select users). |
Warning
"delete" doesn't ask. Unlike Delete on the row menu, it deletes the object at once; Edit › Undo brings it back.
Example Scripts
General
List a tab's columns with their numbers:
cols = uListerTools.columns "Objects"
for i = 1 to cols.count do format "% %\n" (i - 1) cols[i]
Select the objects that use the first material:
keys = uListerTools.rowKeys "Materials"
if keys.count > 0 do uListerTools.rowAction "Materials" keys[1] "selectUsers"
Switch Renderable off for every object on the layer Props. findItem counts from 1, so subtract 1 to get the column number:
cols = uListerTools.columns "Objects"
layerCol = (findItem cols "Layer") - 1
rendCol = (findItem cols "Renderable") - 1
for k in uListerTools.rowKeys "Objects" do
(
if (uListerTools.getCell "Objects" k layerCol) == "Props" do
uListerTools.setCell "Objects" k rendCol "false"
)
Rename every light, checking each write:
keys = uListerTools.rowKeys "Lights"
for i = 1 to keys.count do
(
ok = uListerTools.setCell "Lights" keys[i] 0 ("Key_" + i as string)
if not ok do format "Refused: %\n" keys[i]
)
Toggle the Panel from a Button
The installed uLister_ShowLister macroScript calls showPanel, so it opens the panel but never closes it. For a button or key that does both, write your own macroScript that calls togglePanel:
macroScript My_uLister_Toggle
category:"My Tools"
buttonText:"uLister on/off"
toolTip:"Show or hide the uLister panel"
(
on execute do
(
try ( uListerTools.togglePanel() )
catch ( messageBox "The uLister plugin is not loaded." title:"uLister" )
)
)
Run it once in the MAXScript Listener or from Scripting › Run Script, and it appears under the category My Tools; place it on a toolbar or key the same way as uLister_ShowLister.