Returns the TOP image as a Python NumPy array. Note that since NumPy arrays are referenced by line first, pixels are addressed as [h, w]. Currently data will always be in floating point, regardless of what the texture data format is on the GPU.

delayed - (Keyword, Optional) If set to True, the result may not be immediately available, waiting for the result to be downloaded from the GPU. This is useful to avoid long stalls that occur if immediately asking for the result. None will be returned if the result isn't ready yet. Call numpyArray() again, ideally on the next frame or later, to get the result.

writable - (Keyword, Optional) If set to True, the memory in the numpy array will be allocated in such a way that writes to it arn't slow. By default the memory the numpy array holds can be allocated in such a way that is very slow to write to. Note that in either case, writing to the numpy array will *not* change the data in the TOP.

Saves the image to a bytearray object in the requested file format. Support file formats are: .tif, .tiff, .jpg, .jpeg, .bmp, .png, .exr and .dds. Returns the bytearray object. To get the raw image data use numpyArray() or cudaArray() instead.

filetype - (Optional) A string specifying the file type to save as. If not given the default file type '.tiff' will be used. Just the suffix of the string is used to determine the file type. E.g '.tiff', 'file.tiff', 'C:/Files/file.tiff' will all work. Suffix must include the period.

True if the referenced operator currently exists, False if it has been deleted.

id → int(Read Only):

Unique id for the operator. This id can also be passed to the op() and ops() methods. Id's are not consistent when a file is re-opened, and will change if the OP is copied/pasted, changes OP types, deleted/undone. The id will not change if the OP is renamed though. Its data type is integer.

name → str :

Get or set the operator name.

path → str(Read Only):

Full path to the operator.

digits → int(Read Only):

Returns the numeric value of the last consecutive group of digits in the name, or None if not found. The digits can be in the middle of the name if there are none at the end of the name.

base → str(Read Only):

Returns the beginning portion of the name occurring before any digits.

passive → bool(Read Only):

If true, operator will not cook before its access methods are called. To use a passive version of an operator n, use passive(n).

curPar → td.Par(Read Only):

The parameter currently being evaluated. Can be used in a parameter expression to reference itself.

Storage is dictionary associated with this operator. Values stored in this dictionary are persistent, and saved with the operator. The dictionary attribute is read only, but not its contents. Its contents may be manipulated directly with methods such as OP.fetch() or OP.store() described below, or examined with an Examine DAT.

tags → list :

Get or set a set of user defined strings. Tags can be searched using OP.findChildren() and the OP Find DAT.

The set is a regular python set, and can be accessed accordingly:

n.tags=['effect','image filter']n.tags.add('darken')

children → list(Read Only):

A list of operators contained within this operator. Only component operators have children, otherwise an empty list is returned.

numChildren → int(Read Only):

Returns the number of children contained within the operator. Only component operators have children.

numChildrenRecursive → int(Read Only):

Returns the number of operators contained recursively within this operator. Only component operators have children.

op → OP or None(Read Only):

The Shortcut object, for accessing operators through paths or shortcuts.

Note a version of this method that searches relative to the current operator is also in the global td module.
op(pattern1, pattern2...)
Returns the first OP whose path matches the given pattern, relative to this OP, or None if nothing is found.
Multiple patterns may be specified which are all added to the search. Numeric OP ids may also be used.

pattern - Can be string following the Pattern Matching rules, specifying which OP to return, or an integer, which must be an OP Id. Multiple patterns can be given, the first matching OP will be returned.

b=n.op('project1')b=n.op('foot*','hand*')b=n.op(154)#or alternatively op(154), as its not relative to this operator.

op.shortcut
An operator specified with by a shortcut. If no operator exists an exception is raised. These shortcuts are global, and must be unique. That is, cutting and pasting an operator with a Global OP Shortcut specified will lead to a name conflict. One shortcut must be renamed in that case. Furthermore, only components can be given Global OP Shortcuts.

The Parent Shortcut object, for accessing parent components through indices or shortcuts.

Note a version of this method that searches relative to the current operator is also in the global td module.
parent(n) -> OP or None
The nth parent of this operator. If n not specified, returns the parent. If n = 2, returns the parent of the parent, etc. If no parent exists at that level, None is returned.

n - (Optional) n is the number of levels up to climb. When n = 1 it will return the operator's parent.

p=parent(2)#grandfather

parent.shortcut -> OP
A parent component specified with a shortcut. If no parent exists an exception is raised.

shortcut - Corresponds to the Parent Shortcut parameter specified in the target parent.

n=parent.Videoplayer

See also Parent Shortcut for more examples.

iop → OP(Read Only):

The Internal Operator Shortcut object, for accessing internal shortcuts.
Note: a version of this method that searches relative to the current operator is also in the global td Module.

ipar → OP(Read Only):

The Internal Operator Parameter Shortcut object, for accessing internal shortcuts.
Note: a version of this method that searches relative to the current operator is also in the global td Module.

Last offset from frame start at which this operator cook began, expressed in milliseconds.

cookEndTime → float(Read Only):

Last offset from frame start at which this operator cook ended, expressed in milliseconds. Other operators may have cooked between the start and end time. See the cookTime member for this operator's specific cook duration.

cookedThisFrame → bool(Read Only):

True when this operator has cooked this frame.

cookedPreviousFrame → bool(Read Only):

True when this operator has cooked the previous frame.

childrenCookTime → float(Read Only):

Deprecated The total accumulated cook time of all children of this operator during the last frame. Zero if the operator is not a COMP and/or has no children.

childrenCPUCookTime → float(Read Only):

The total accumulated cook time of all children of this operator during the last frame. Zero if the operator is not a COMP and/or has no children.

childrenCookAbsFrame → float(Read Only):

Deprecated The absolute frame on which childrenCookTime is based.

childrenCPUCookAbsFrame → float(Read Only):

The absolute frame on which childrenCPUCookTime is based.

gpuCookTime → float(Read Only):

Duration of GPU operations during the last measured cook (in milliseconds).

childrenGPUCookTime → float(Read Only):

The total accumulated GPU cook time of all children of this operator during the last frame. Zero if the operator is not a COMP and/or has no children.

childrenGPUCookAbsFrame → float(Read Only):

The absolute frame on which childrenGPUCookTime is based.

totalCooks → int(Read Only):

Number of times the operator has cooked.

cpuMemory → int(Read Only):

The approximate amount of CPU memory this Operator is using, in bytes.

Note: If searching for a single parameter given a name, it's much more efficient to use the subscript operator. For example:

name = 'MyName1'
op('geo1').par[name]

cook(force=False, recurse=False)→ None:

Cook the contents of the operator if required.

force - (Keyword, Optional) If True, the operator will always cook, even if it wouldn't under normal circumstances.

recurse - (Keyword, Optional) If True, all children and sub-children of the operator will be cooked.

ops(pattern1, pattern2..)→ list:

Returns a (possibly empty) list of OPs that match the patterns, relative to this OP.

Multiple patterns may be provided. Numeric OP ids may also be used.

pattern - Can be string following the Pattern Matching rules, specifying which OPs to return, or an integer, which must be an OP Id. Multiple patterns can be given and all matched OPs will be returned.

Note a version of this method that searches relative to '/' is also in the global td module.

newlist=n.ops('arm*','leg*','leg5/foot*')

copyParameters(OP, custom=True, builtin=True)→ None:

Copy all of the parameters from the specified operator. Both operators should be the same type.

builtin - (Keyword, Optional) When True, built in parameters will be copied.

op('geo1').copyParameters(op('geo2'))

changeType(OPtype)→ OP:

Change referenced operator to a new operator type. After this call, this OP object should no longer be referenced. Instead use the returned OP object.

OPtype - The python class name of the operator type you want to change this operator to. This is not a string, but instead is a class defined in the global td module.

n=op('wave1').changeType(nullCHOP)#changes 'wave1' into a Null CHOPn=op('text1').changeType(tcpipDAT)#changes 'text1' operator into a TCPIP DAT

dependenciesTo(OP)→ list:

Returns a (possibly empty) list of operator dependency paths between this operator and the specified operator. Multiple paths may be found.

evalExpression(str)→ value:

Evaluate the expression from the context of this OP. Can be used to evaluate arbitrary snippets of code from arbitrary locations.

str - The expression to evaluate.

op('wave1').evalExpression('me.digits')#returns 1

If the expression already resides in a parameter, use that parameters evalExpression()() method instead.

destroy()→ None:

Destroy the operator referenced by this OP. An exception will be raised if the OP's operator has already been destroyed.

var(name, search=True)→ str:

Evaluate a variable. This will return the empty string, if not found. Most information obtained from variables (except for Root and Component variables) are accessible through other means in Python, usually in the global td module.

name - The variable name to search for.

search - (Keyword, Optional) If set to True (which is default) the operator hierarchy is searched until a variable matching that name is found. If false, the search is constrained to the operator.

openMenu(x=None, y=None)→ None:

Open a node menu for the operator at x, y. Opens at mouse if x & y are not specified.

Storage can be used to keep data within components. Storage is implemented as one python dictionary per node.

When an element of storage is changed by using n.store() as explained below, expressions and operators that depend on it will automatically re-cook. It is retrieved with the n.fetch() function.

Storage is saved in .toe and .tox files and restored on startup.

Storage can hold any python object type (not just strings as in Tscript variables). Storage elements can also have optional startup values, specified separately. Use these startup values for example, to avoid saving and loading some session specific object, and instead save or load a well defined object like None.

Return an object from the OP storage dictionary. If the item is not found, and a default it supplied, it will be returned instead.

key - The name of the entry to retrieve.

default - (Optional) If provided and no item is found then the passed value/object is returned instead.

storeDefault - (Keyword, Optional) If True, and the key is not found, the default is stored as well.

search - (Keyword, Optional) If True, the parent of each OP is searched recursively until a match is found

v=n.fetch('sales5',0.0)

fetchOwner(key)→ OP:

Return the operator which contains the stored key, or None if not found.

key - The key to the stored entry you are looking for.

who=n.fetchOwner('sales5')#find the OP that has a storage entry called 'sales5'

store(key, value)→ value:

Add the key/value pair to the OP's storage dictionary, or replace it if it already exists. If this value is not intended to be saved and loaded in the toe file, it can be be given an alternate value for saving and loading, by using the method storeStartupValue described below.

key - A string name for the storage entry. Use this name to retrieve the value using fetch().

value - The value/object to store.

n.store('sales5',34.5)# stores a floating point value 34.5.n.store('moviebank',op('/project1/movies'))# stores an OP for easy access later on.

unstore(keys1, keys2..)→ None:

For key, remove it from the OP's storage dictionary. Pattern Matching is supported as well.

keys - The name or pattern defining which key/value pairs to remove from the storage dictionary.

n.unstore('sales*')# removes all entries from this OPs storage that start with 'sales'

storeStartupValue(key, value)→ None:

Add the key/value pair to the OP's storage startup dictionary. The storage element will take on this value when the file starts up.

key - A string name for the storage startup entry.

value - The startup value/object to store.

n.storeStartupValue('sales5',1)# 'sales5' will have a value of 1 when the file starts up.

unstoreStartupValue(keys1, keys2..)→ None:

For key, remove it from the OP's storage startup dictionary. Pattern Matching is supported as well. This does not affect the stored value, just its startup value.

keys - The name or pattern defining which key/value pairs to remove from the storage startup dictionary.

n.unstoreStartupValue('sales*')# removes all entries from this OPs storage startup that start with 'sales'

Returns a dictionary with persistent data about the object suitable for pickling and deep copies.

__setstate__()→ dict:

Reads the dictionary to update persistent details about the object, suitable for unpickling and deep copies.

TouchDesigner Build:

An Operator Family that creates, composites and modifies images, and reads/writes images and movies to/from files and the network. TOPs run on the graphics card's GPU.

The Graphics Processing Unit. This is the high-speed, many-core processor of the graphics card/chip that takes geometry, images and data from the CPU and creates images and processed data.

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.

An Operator Family that manipulates text strings: multi-line text or tables. Multi-line text is often a command Script, but can be any multi-line text. Tables are rows and columns of cells, each containing a text string.

A name for a component that is accessible from any node in a project, which can be declared in a component's Global Operator Shortcut parameter.

A Parent Shortcut is a parameter on a component that contains a name that you can use anywhere inside the component to refer to that component using the syntax parent.Name, for example parent.Effect.width to obtain panel width.

(1) Indicator of certain states of an operator (bypass, display, lock), or (2) option of a Tscript command.

To re-compute the output data of the Operators. An operator cooks when (1) its inputs change, (2) its Parameters change, (3) when the timeline moves forward in some cases, or (4) Scripting commands are run on the node. When the operator is a Gadget, it also cooks when a user interacts with it. When an operator cooks, it usually causes operators connected to its output to re-cook. When TouchDesigner draws the screen, it re-cooks all the necessary operators in all Networks, contributing to a frame's total "cook time".

A set of commands located in a Text DAT that are triggered to run under certain conditions. There are two scripting languages in TouchDesigner: Python and the original Tscript. Scripts and single-line commands can also be run in the Textport.

An Operator Family that reads, creates and modifies 3D polygons, curves, NURBS surfaces, spheres, meatballs and other 3D surface data.

Creates a new component for every line in a table. Unlike Clone, it automatically creates copies of a master component.

Storage is a python dictionary associated with any operator, used to keep user-specified data within the operator.

TOuch Environment file, the file type used by TouchDesigner to save your project.

TouchDesigner Component file, the file type used to save a Component from TouchDesigner.