Difference between revisions of "VFS Class"

From TouchDesigner Documentation
Jump to: navigation, search
 
Line 32: Line 32:
 
|returns=VFSFile
 
|returns=VFSFile
 
|text=Add an embedded file from a bytearray to the component. Returns a VFSFile instance of the added file.
 
|text=Add an embedded file from a bytearray to the component. Returns a VFSFile instance of the added file.
* byteArray - A bytearray representing the contents of the file.
+
* byteArray - A bytearray or bytes object representing the contents of the file.
 
* name - The name of the file on VFS.}}
 
* name - The name of the file on VFS.}}
 
{{ClassMethod
 
{{ClassMethod

Latest revision as of 11:08, 20 October 2020

The VFS Class describes a COMP's virtual file system.


Members[edit]

ownerOP (Read Only):

Get the OP owner.

Methods[edit]

[name]VFSFile:

VFS Files may be easily accessed using the [] syntax.

  • name - Must be an exact VFS file name. Wildcards are not supported. If not found, an error will be raised.
p = op('base1').vfs['Banana.tif']

addByteArray(byteArray, name)VFSFile:

Add an embedded file from a bytearray to the component. Returns a VFSFile instance of the added file.

  • byteArray - A bytearray or bytes object representing the contents of the file.
  • name - The name of the file on VFS.

addFile(filePath, overrideName=None)VFSFile:

Add an embedded file from disk to the component with an option to override the name. Returns a VFSFile instance of the added file.

  • filePath - The path of the file on disk to add.
  • overrideName (Keyword, Optional) - When specified, will override the name of the file in VFS.

export(folder, pattern='*', overwrite=False)list:

Exports any matching files to the folder on disk. If overwrite is True then any existing files on disks with the same name will be overwritten. Returns a list of paths on disk to the exported files.

  • folder - The folder on disk to export the files to.
  • pattern (Keyword, Optional) - The pattern to match names by.
  • overwrite (Keyword, Optional) - When True, will overwrite any files that share the same name.
# VFS contains one file with name 'A/B.tif'
COMP.vfs.export('C:/tmp') # returns ['C:/tmp/A/B.tif']

find(pattern='*')list:

Finds all files in VFS with names matching the pattern. Returns a list of VFSFile objects.

  • pattern (Keyword, Optional) - The pattern to match names by.


Lets you embed files inside a .tox or .toe file. Operators like the Movie File In TOP that read regular files can also read the embedded VFS files using a vfs: syntax.

An Operator Family that contains its own Network inside. There are twelve 3D Object Component and eight 2D Panel Component types. See also Network Path.

Any of the procedural data operators. OPs do all the work in TouchDesigner. They "cook" and output data to other OPs, which ultimately result in new images, data and audio being generated. See Node.