Right-click on storyboarder under type and select list.
Right-click on empty parameter slot and select type of objects to be listed here we will create a list of models so under type->Scene->Model.
Click bottom handle and choose create value. You can add more list slots by pressing the plus in the bottom left corner. You can drag and drop models into these slots or use the context menu to select constants.
There are two methods for adding an item to your existing list:
The Add node is useful when you just want to add your item to the end of the list. With a list variable created you can just dereference the Add node and insert the item you want to add.
The insert node is useful when you want to add your item to a specific position in your list. After dereferencing the Insert node from your list variable, it takes two arguments:
The above nodes are good for adding a single item to your list, but sometimes you may want to add a bunch of items at once. You can do this by using the AddRange and InsertRange Nodes.
AddRange will allow you to add another list of items to the end of the dereferenced list.
InsertRange will allow you to insert a list of items into the dereferenced list.
There are several methods to remove an item from a list.
Note: Once you remove an item from the list all the items that were in the list after it will have their index shifted down one.
The RemoveAt node will allow you to remove an item at a specified index value.
RemoveRange Allows you to remove a sublist of items from the dereferenced list.
In order to access a certain position in your list you must dereference the Index node from your list variable.
To change the value stored at this position dereference a ChangeTo node and insert the new value as the argument.
The GetItem node allows you to retrieve the value stored at a given position in the list.
The IndexOf node allows you to retrieve the position a given item is stored at. It will return -1 if that item is not found in the list.
The BinarySearch node is a more efficient way to search a list for the index of a given value. It does not need to search the entire list contents like indexOf does. It is recommended to use BinarySearch when you are searching very large lists.
If you just want to know if a value exists in a list you can use the contains method. It will return true if the value is in the list and false if it is not.
From bottom handle of list object click LoopEach.
From upper right handle (action argument) drag out a connector and select the begin node, this will act as a lambda function.
Add a begin parameter by clicking the plus button in the bottom left of the node and right-clicking on the empty parameter space, select variable -> new.
You can rename the variable to something more descriptive by clicking on the newly created variable and changing the name in the properties panel.
Compile the lesson.
Drag from the right handle of the begin node and search your variable name.
Click on bottom handle and select the action to perform on list objects. This example uses animate.
It can be used in almost the same manner as the LoopEach node demonstrated in the above example except we need to add a wait node so that the rest of the lesson does not run until the ForkEach actions are complete.
Click to download the sample asset used in demonstration.
The Count Node can be used to retrieve the number of values in the list. Just dereference it from the list variable.
The Clear Node can be used to delete all values in the list. Just dereference it from the list variable.
This Example will animate a random model from the list.
Left-click on bottom handle of list object and select PickRandom.
Left-click on bottom handle of pickRandom node and select action you want to perform on the randomly selected object.
You must create a list variable in order for the shuffle function to be effective.
Create a list like normal (see beginning of article) and dereference a SaveTo node. Right-click in the empty parameter and select Variables > New. Click on the Unnamed variable and give it a name in the properties panel.
The values defined in the list object are now saved to the list variable and you can perform any list function directly from this variable in place of the list object.
Open the context menu and search your list variable.
Click the bottom handle and select shuffle.
Shuffle will mix the order of the values and therefore animating the list through the OneAtATime node after the shuffle can animate the objects in a different order than calling it before the shuffle. Shuffle mixes the objects randomly, so there is a slight chance the order will come out the same.
The usage is identical to the shuffle node demonstrated above.
The usage is identical to the shuffle node. Cannot be used on the SceneModel type.
The usage is identical to the shuffle node.
Next Message Box