In this tutorial you will learn how to create a reusable node, that loads any kind of visual element and provides its data as a texture directly to a 2D Layer or to a Material inside a 3D Layer.
In some cases it is not predefined whether the data you may use for a texture is always an image or a movie. Internally Ventuz handles data types of such visuals in different ways and a designer has to work a way around those differences. A node has been created for this to become possible: The Visuals Indexer Node. We will create a Content Container which contains this node to handle this. The result can be saved into the project repository for later reuse.
This node will especially come in handy when using the Ventuz Director. You can then create Templates with selectable Textures and Movies (or even Live Videos) and the operator of the Director does not have to care about the source of the texture.
We will start up with a one single node located in the Content Editor on the Layer Level in your scene:
Next you will need an example file for each of the visual formats for testing the node. Place them in the respective directories:
You may also configure an input for a Live Video.
Double click the small gray triangle in the Content Node. You should now see a blank Content Editor and an empty Hierarchy Editor. Firstly you will need to create four Nodes:
The result should look similiar to this:
The Visual Indexer node has two Input Properties. Firstly the Uri, which defines the path of the file one wants to inspect and secondly a TreatTextureAsImage boolean which prevents the node from handling texture files differently from image files. Since the Texture Loader can also handle image files, we check this property and hence ignore the Texture outputs of this node.
Now you can bind the File property of the TexLoader node to the ImagesUri output of the Visuals Indexer. Drag the File property onto the Visuals Indexer node and choose the ImagesUri output in the dropdown list.You can now bind the File property of the Movie Loader node to the MoviesUri output of the Visuals Indexer node. Repeat this for the Live Video node and also bind the Ordinal Property.
Now each of the three nodes load the right type of file. That is due to the Visuals Indexer, which inspects the file specified in its Uri input and passes it to that output corresponding to the file type.
Because we want to design our container in the way that we can input an uri and get the corresponding Texture on the output of the container we need to find a way to switch the Texture Properties based on the incoming uri.
To do so we use a Value Switch and connect all the Texture ouputs to the Value Switch. To switch the Case property based on the !XXXInvalidUri output of the VisualIndexer we can simply use an Int Expression, create three BOOLEAN inputs via the Custom Model and connect them. The respective expression can look like the following based on the naming of your inputs.
!ImageInvalid ? 0: !MovieInvalid?1: !LiveInvalid?2:-1
Lastly all you need to do is expose the Uriproperty of the Visuals Indexer and the output of the Value Switch so that one can choose a file from outside the Content Container and get the respective Texture. To achieve this you need to click the little square left to the property. If you want to rename it for better recognition outside the container double click and change the properties as you like it.
To exit the Content Container press Level UP or use the shortcut CTRL + U Now you can rename the Container (to e.g. "Visuals Loader") and change its Node Icon and finally drop it onto the Project Repository for later reuse in your project.
Your own custom Node can now be used as an input for a 2D Layer Texture Property or as an input for a Material Node.
You now have a node that can load any visual file as a texture. When using this node as part of a Ventuz Template an operator of the Ventuz Director does not have to care about the file types he is loading as an asset into a template's properties.
You may now want to learn more about the Ventuz Director or read more on how to create templates. See the following sites to get more information about this feature of Ventuz: