In this video, we will be taking a look at not only creating a List but also how we can append and remove items from the List. We will also give the user the option to add to the List.
If you want to follow along you can download the Starting Template script here. Alternatively you can download the finished result here.
Creating a List is simple. We just need a reference name for the List and then we can either enter some items by default or append Items when needed.
Here is a List with items (strings) already added.
Here is an empty List (which we will be using in the example).
Once we have created a list we can then create Items that can be added to the list. These can be Strings and/or Numbers.
Now we have Items that can be added to our List we can simply append each one.
To Remove Items from the List.
If we have more than one Item we want to add to our List we need to use Extend.
To Remove all the Items from a List.
If you want more information about Lists, check the Blender Doc here.
Now we know how to create, append and remove items from our List we can create a little example.
In the Example, we will not only add a number of new Items to our List but also let the user add an Item using a String Property.
There are many different ways we can utilize Lists and this is just scratching the surface of what we can do with them. In a future Video we will be using Lists for something I think is pretty interesting so be sure to look out for that!.
I hope you find this video helpful and as always thanks for reading!.
No comments:
Post a Comment