Palette:virtualFile
Summary
This component embeds files within itself so you don't have to refer to, or depend on external files in your project. Instead, the embedded files will be saved within the .toe
or .tox
files containing this component.
It is an interface for the Virtual File System that is built into all Components via its vfs
member.
The virtualFile component lets you ingest files from your drives (using a path string or a table of path strings), or from TOPs.
Usage
Adding Virtual Files
There are three parameter-based ways to add files to the component. You can also use its Extension Class. To see a File List of embedded virtual files, wire a nullDAT to the second output, or click the List All Virtual Files To Textport parameter with a textport open.
To store multiple files, turn off the Remove All Files Before Adds parameter. You will now add a new file each time you use the following file add methods:
Add Virtual File From Disk
This adds any external file selected in the Source File parameter.
Add Virtual Files From Table
This adds multiple external files identified in the paths
column of the tableDAT specified in the Paths Table
parameter. You can also wire a path table into virtualFile's input. If the table has an overrideName
column, that column will be used to set the added file's names. Tip: to preserve file hierarchy, you can use a Folder DAT with the Relative Path column turned on wired into a Substitute DAT to change 'relpath' to 'overrideName'.
Add Virtual Image File From TOP
This converts a TOP image into an image file and stores that file without having to save the image externally. There are parameters to specify the image source, image file type, and virtual file name.
Accessing Virtual Files
Virtual files are accessed as if they were files on disk, by file in operators (e.g. Movie File In TOP or File In DAT). They are accessed using a special vfs
syntax to specify their location:
vfs:<component path>:<virtual file name>
The virtual file name can include slashes to simulate a folder structure. The vfs path can be put in the file
parameter of any operator that loads external files.
VFS Path Helpers
There are two ways to get a vfs
path automatically from the virtualFile component.
- The output DAT contains a tableDAT showing the paths of all virtual files in the
virtualPath
column". - The read-only Virtual Path parameter holds the
vfs
path of the virtual file at the index selected in the Index parameter.
Example expressions that might be used in a file
parameter:
# gets the file selected by Index parameter.
op('/virtualFile').par.Virtualpath
# gets the second virtual file if 'null1' is wired to output of a virtualFile component.
op('/null1')[2, 'virtualPath]
Parameters - VFS Page
Version Version
- Component Version
Help Help
- Open this wiki page
List All Virtual Files To Textport List
- Print the vfsFileList to textport
Remove All Virtual Files Remove
- Remove virtual files from this component
Echo Commands To Texport Echocommands
- Print vfs commands run by parameter functions. This is for visibility and learning of the TouchDesigner vfs Python commands.
Remove All Files Before Adds Removeallbeforeadds
- Remove all files first when adding virtual files
Index Virtualfileindex
- Index of the specific virtual file for parameters below
Virtual Path Virtualpath
- vfs path of the selected virtual file
Remove Virtual File Removesingle
- Remove the selected virtual file
Rename Virtual File Rename
- Open a dialog to give the selected virtual file a new internal filePath
Source File Filesource
- The external file to embed
Add From Disk Add
- Add the file selected in Source File parameter
Paths Table Pathstable
- Table with 'path' column containing file paths of files to embed. An optional 'overrideName' column will be used as well, if found.
Add From Table Addfromtable
- Add files specified in Paths Table DAT
Image Source TOP Imagesourcetop
- TOP to use to create virtual image file
Virtual File Name Virtualfilename
- Virtual name of the created file
Auto-Increment Name Autoincrementname
- When on, add one to the digit at end of Virtual File Name every time an image is embedded
Virtual File Image Filetype Virtualfileimagefiletype
- File type to embed
Add From TOP Addfromtop
- Add virtual file from Image Source TOP
Operator Inputs
- Input 0: Paths Table - Table with 'path' column (and optionally 'overrideName' column) containing file paths of files to embed. Will override Paths Table parameter
Operator Outputs
- Output 0 - info about all embedded virtual files
TouchDesigner Build: