List Controllers

float_list : floatController
point3_list : point3Controller
position_list : positionController
rotation_list : rotationController
scale_list : scaleController

Constructor

float_list ...

point3_list ...

position_list ...

rotation_list ...

scale_list ...

Properties

The property list for a list controller contains the sub-controllers in the list controller (if any), plus an available property. The available property has a controller property, which contains a "phantom" controller. To add a controller to a list controller, assign the controller to the available.controller property. The following script shows an example of creating and adding controllers to a list controller.

Script:

p=float_list()               -- create a list controller

showproperties p             -- show its properties

p.available.controller       -- the "phantom" controller

p1=bezier_float()            -- create a new bezier float controller

p.available.controller=p1    -- add it to the list controller

p2=bezier_float()            -- create a new bezier float controller

p.available.controller=p2    -- add it to the list controller

getpropnames p               -- show the list controller properties

showproperties p             -- show the list controller properties

p.numSubs                    -- the number of list controller subAnims

getsubanimnames p            -- show the list controller subAnim names

p[2].object                  -- retrieve the second bezier float controller

Output:

Controller:Float_List          -- result line 1

  .available : float           -- output line 2

OK                             -- result line 2

Controller:                    -- result line 3 (the "phantom" controller)

Controller:Bezier_Float        -- result line 4

Controller:Bezier_Float        -- result line 5

Controller:Bezier_Float        -- result line 6

Controller:Bezier_Float        -- result line 7

#(#bezier_float, #available)   -- result line 8

  .bezier_float : float        -- output line 9

  .bezier_float : float        -- output line 9

  .available : float           -- output line 9

OK                             -- result line 9

3                              -- result line 10

#(#bezier_float, #bezier_float, #available) -- result line 11

Controller:Bezier_Float        -- result line 12

In line 9 of the output, only one occurrence of #bezier_float is shown. The reason for this is this is that multiple properties with the same name are not shown by MAXScript. This is because all property names are normally supposed to be unique. In the case of list controllers, this is not true. Instead of accessing the controllers added to a list controller as properties of the list controller, the controllers should be accessed through the subAnims of the list controller as shown in the last line of the example.

There currently is not a method for removing a controller from a list controller. To easiest way to accomplish this is to create a new list controller, instance all other sub-controllers from the original list controller, and then replace the original list controller with the new list controller. The following script shows a example which performs these actions.

Example:

-- creates new list controller from old, deleting indexed controller

-- returns the new controller

fn deleteFromListController list_cont index =

(

-- create new list controller based on class of input list controller

new_cont=execute ((classof list_cont as string) + "()")

-- for each subAnim (except the last, which is the phantom "available"

-- controller)..

for i=1 to (list_cont.numSubs-1) do

-- if not the sub-controller to delete

if i != index do

-- instance the sub-controller (contained in the .object property of

-- the subAnim) to the new list controller

new_cont.available.controller=list_cont[i].object

-- and return the new list controller

return new_cont

)

--

-- example usage (obj.pos already has list controller)

obj.pos.controller = deleteFromListController obj.pos.controller 2

Methods

listCtrl.getName <list_controller> <index_integer>

Returns the name of the indexed subcontroller in the list controller

listCtrl.setName <list_controller> <index_integer> <string>

Sets the name of the indexed subcontroller in the list controller. If the string is a null string (""), the default controller name is used.

listCtrl.getActive <list_controller>

Returns the index of the active subcontroller in the list controller

listCtrl.setActive <list_controller> <index_integer>

Sets the indexed subcontroller in the list controller as the active controller

See also