Difference between revisions of "OP Class"

From TouchDesigner Documentation
Jump to: navigation, search
Line 4: Line 4:
 
|Sectionsummary=
 
|Sectionsummary=
 
|items=
 
|items=
 +
{{SubSection|title=General
 +
|text=
 +
}}
 +
{{ClassMember
 +
    |class=OP
 +
    |name=valid
 +
    |type=bool
 +
    |set=0
 +
    |text=True if the referenced operator currently exists, False if it has been deleted.
 +
}}
 +
{{ClassMember
 +
    |class=OP
 +
    |name=id
 +
    |type=int
 +
    |set=0
 +
    |text=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.
 +
}}
 +
{{ClassMember
 +
    |class=OP
 +
    |name=name
 +
    |type=str
 +
    |set=1
 +
    |text=Get or set the operator name.
 +
}}
 +
{{ClassMember
 +
    |class=OP
 +
    |name=path
 +
    |type=str
 +
    |set=0
 +
    |text=Full path to the operator.
 +
}}
 +
{{ClassMember
 +
    |class=OP
 +
    |name=digits
 +
    |type=int
 +
    |set=0
 +
    |text=Returns the numeric value of the last consecutive group of digits in the name, or None if not found.
 +
}}
 +
{{ClassMember
 +
    |class=OP
 +
    |name=base
 +
    |type=str
 +
    |set=0
 +
    |text=Returns the beginning portion of the name occurring before any digits.
 +
}}
 +
{{ClassMember
 +
    |class=OP
 +
    |name=passive
 +
    |type=bool
 +
    |set=0
 +
    |text=If true, operator will not cook before its access methods are called.  To use a passive version of an operator n, use passive(n).
 +
}}
 +
{{ClassMember
 +
    |class=OP
 +
    |name=time
 +
    |type=OP
 +
    |set=0
 +
    |text=Time Component that defines the operator's time reference.
 +
}}
 +
{{ClassMember
 +
    |class=OP
 +
    |name=ext
 +
    |type=class
 +
    |set=0
 +
    |text=The object to search for parent extensions.
 +
<syntaxhighlight lang=python>
 +
me.ext.MyClass
 +
</syntaxhighlight>
 +
}}
 +
{{ClassMember
 +
    |class=OP
 +
    |name=mod
 +
    |type=mod
 +
    |set=0
 +
    |text=Get a module on demand object that searches for DAT modules relative to this operator.
 +
}}
 +
{{ClassMember
 +
    |class=OP
 +
    |name=par
 +
    |type=td.Par
 +
    |set=0
 +
    |text=An intermediate parameter collection object, from which a specific parameter can be found.
 +
<syntaxhighlight lang=python>
 +
n.par.tx
 +
</syntaxhighlight>
 +
}}
 +
{{ClassMember
 +
    |class=OP
 +
    |name=customPars
 +
    |type=list
 +
    |set=0
 +
    |text=A list of all custom parameters.
 +
}}
 +
{{ClassMember
 +
    |class=OP
 +
    |name=customPages
 +
    |type=list
 +
    |set=0
 +
    |text=A list of all custom pages.
 +
}}
 +
{{ClassMember
 +
    |class=OP
 +
    |name=customTuplets
 +
    |type=list
 +
    |set=0
 +
    |text=A list of all parameter tuplets, where a tuplet is a set of parameters all drawn on the same line of a dialog, sharing the same label.
 +
}}
 +
{{ClassMember
 +
    |class=OP
 +
    |name=replicator
 +
    |type=OP or None
 +
    |set=0
 +
    |text=The replicatorCOMP that created this operator, if any.
 +
}}
 +
{{ClassMember
 +
    |class=OP
 +
    |name=storage
 +
    |type=dict
 +
    |set=0
 +
    |text=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.
 +
}}
 +
{{ClassMember
 +
    |class=OP
 +
    |name=tags
 +
    |type=list
 +
    |set=1
 +
    |text=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:
 +
<syntaxhighlight lang=python>
 +
n.tags = ['effect', 'image filter']
 +
n.tags.add('darken')
 +
</syntaxhighlight>
 +
}}
 +
{{ClassMember
 +
    |class=OP
 +
    |name=children
 +
    |type=list
 +
    |set=0
 +
    |text=A list of operators contained within this operator.  Only component operators have children, otherwise an empty list is returned.
 +
}}
 +
{{ClassMember
 +
    |class=OP
 +
    |name=op
 +
    |type=OP or None
 +
    |set=0
 +
    |text=The OPFinder 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.
 +
<syntaxhighlight lang=python>
 +
b = n.op('project1')
 +
b = n.op('foot*', 'hand*')
 +
b = n.op(154)  #or alternatively op(154), as its not relative to this operator.
 +
</syntaxhighlight>
 +
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.
 +
*shortcut - Corresponds to the Global OP Shortcut parameter specified in the target operator.
 +
<syntaxhighlight lang=python>
 +
b = me.op.Videoplayer  #or alternatively op.Videoplayer, as its not relative to this operator.
 +
</syntaxhighlight>
 +
To list all Global OP Shortcuts:
 +
<syntaxhighlight lang=python>
 +
for x in op:
 +
print(x)
 +
</syntaxhighlight>
 +
}}
 +
{{ClassMember
 +
    |class=OP
 +
    |name=parent
 +
    |type=OP
 +
    |set=0
 +
    |text=The ParentFinder 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.
 +
<syntaxhighlight lang=python>
 +
p = me.parent(2) #grandfather
 +
</syntaxhighlight>
 +
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.
 +
<syntaxhighlight lang=python>
 +
n = me.parent.Videoplayer
 +
</syntaxhighlight>
 +
See also Parent Shortcut for more examples.
 +
}}
 
{{SubSection|title=Common Flags
 
{{SubSection|title=Common Flags
 
|text=The following methods get or set specific operator [[Flags|flags]].  Note specific operators may contain other flags not in this section.
 
|text=The following methods get or set specific operator [[Flags|flags]].  Note specific operators may contain other flags not in this section.
Line 32: Line 221:
 
     |set=1
 
     |set=1
 
     |text=Get or set cooking flag. Components only.
 
     |text=Get or set cooking flag. Components only.
}}
 
{{ClassMember
 
    |class=OP
 
    |name=base
 
    |type=str
 
    |set=0
 
    |text=Returns the beginning portion of the name occurring before any digits.
 
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
Line 46: Line 228:
 
     |set=1
 
     |set=1
 
     |text=Get or set bypass flag.
 
     |text=Get or set bypass flag.
}}
 
{{ClassMember
 
    |class=OP
 
    |name=children
 
    |type=list
 
    |set=0
 
    |text=A list of operators contained within this operator.  Only component operators have children, otherwise an empty list is returned.
 
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
Line 172: Line 347:
 
     |set=1
 
     |set=1
 
     |text=Get or set current flag.
 
     |text=Get or set current flag.
}}
 
{{ClassMember
 
    |class=OP
 
    |name=customPages
 
    |type=list
 
    |set=0
 
    |text=A list of all custom pages.
 
}}
 
{{ClassMember
 
    |class=OP
 
    |name=customPars
 
    |type=list
 
    |set=0
 
    |text=A list of all custom parameters.
 
}}
 
{{ClassMember
 
    |class=OP
 
    |name=customTuplets
 
    |type=list
 
    |set=0
 
    |text=A list of all parameter tuplets, where a tuplet is a set of parameters all drawn on the same line of a dialog, sharing the same label.
 
}}
 
{{ClassMember
 
    |class=OP
 
    |name=digits
 
    |type=int
 
    |set=0
 
    |text=Returns the numeric value of the last consecutive group of digits in the name, or None if not found.
 
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
Line 235: Line 382:
 
     |set=1
 
     |set=1
 
     |text=Get or set the expose flag which hides a node from view in a network.
 
     |text=Get or set the expose flag which hides a node from view in a network.
}}
 
{{ClassMember
 
    |class=OP
 
    |name=ext
 
    |type=class
 
    |set=0
 
    |text=The object to search for parent extensions.
 
<syntaxhighlight lang=python>
 
me.ext.MyClass
 
</syntaxhighlight>
 
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
Line 336: Line 473:
 
     |set=1
 
     |set=1
 
     |text=Get or set lock flag.
 
     |text=Get or set lock flag.
}}
 
{{ClassMember
 
    |class=OP
 
    |name=mod
 
    |type=mod
 
    |set=0
 
    |text=Get a module on demand object that searches for DAT modules relative to this operator.
 
}}
 
{{ClassMember
 
    |class=OP
 
    |name=name
 
    |type=str
 
    |set=1
 
    |text=Get or set the operator name.
 
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
Line 392: Line 515:
 
     |set=1
 
     |set=1
 
     |text=Get or set node Y value, expressed in network editor units, measured from its bottom edge.
 
     |text=Get or set node Y value, expressed in network editor units, measured from its bottom edge.
}}
 
{{ClassMember
 
    |class=OP
 
    |name=op
 
    |type=OP or None
 
    |set=0
 
    |text=The OPFinder 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.
 
<syntaxhighlight lang=python>
 
b = n.op('project1')
 
b = n.op('foot*', 'hand*')
 
b = n.op(154)  #or alternatively op(154), as its not relative to this operator.
 
</syntaxhighlight>
 
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.
 
*shortcut - Corresponds to the Global OP Shortcut parameter specified in the target operator.
 
<syntaxhighlight lang=python>
 
b = me.op.Videoplayer  #or alternatively op.Videoplayer, as its not relative to this operator.
 
</syntaxhighlight>
 
To list all Global OP Shortcuts:
 
<syntaxhighlight lang=python>
 
for x in op:
 
print(x)
 
</syntaxhighlight>
 
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
Line 434: Line 529:
 
     |set=0
 
     |set=0
 
     |text=List of output operators from this operator.
 
     |text=List of output operators from this operator.
}}
 
{{ClassMember
 
    |class=OP
 
    |name=par
 
    |type=td.Par
 
    |set=0
 
    |text=An intermediate parameter collection object, from which a specific parameter can be found.
 
<syntaxhighlight lang=python>
 
n.par.tx
 
</syntaxhighlight>
 
}}
 
{{ClassMember
 
    |class=OP
 
    |name=parent
 
    |type=OP
 
    |set=0
 
    |text=The ParentFinder 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.
 
<syntaxhighlight lang=python>
 
p = me.parent(2) #grandfather
 
</syntaxhighlight>
 
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.
 
<syntaxhighlight lang=python>
 
n = me.parent.Videoplayer
 
</syntaxhighlight>
 
See also Parent Shortcut for more examples.
 
}}
 
{{ClassMember
 
    |class=OP
 
    |name=path
 
    |type=str
 
    |set=0
 
    |text=Full path to the operator.
 
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
Line 486: Line 543:
 
     |set=1
 
     |set=1
 
     |text=Get or set render flag.
 
     |text=Get or set render flag.
}}
 
{{ClassMember
 
    |class=OP
 
    |name=replicator
 
    |type=OP or None
 
    |set=0
 
    |text=The replicatorCOMP that created this operator, if any.
 
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
Line 514: Line 564:
 
     |set=1
 
     |set=1
 
     |text=Get or set show docked flag. This controls whether this node is visible or hidden when it is docked to another node.
 
     |text=Get or set show docked flag. This controls whether this node is visible or hidden when it is docked to another node.
}}
 
{{ClassMember
 
    |class=OP
 
    |name=storage
 
    |type=dict
 
    |set=0
 
    |text=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.
 
}}
 
{{ClassMember
 
    |class=OP
 
    |name=tags
 
    |type=list
 
    |set=1
 
    |text=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:
 
<syntaxhighlight lang=python>
 
n.tags = ['effect', 'image filter']
 
n.tags.add('darken')
 
</syntaxhighlight>
 
}}
 
{{ClassMember
 
    |class=OP
 
    |name=time
 
    |type=OP
 
    |set=0
 
    |text=Time Component that defines the operator's time reference.
 
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
Line 547: Line 571:
 
     |set=0
 
     |set=0
 
     |text=Number of times the operator has cooked.
 
     |text=Number of times the operator has cooked.
}}
 
{{ClassMember
 
    |class=OP
 
    |name=valid
 
    |type=bool
 
    |set=0
 
    |text=True if the referenced operator currently exists, False if it has been deleted.
 
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
Line 568: Line 585:
 
     |set=1
 
     |set=1
 
     |text=Get or set the warning message associated with this OP.
 
     |text=Get or set the warning message associated with this OP.
}}
 
{{ClassMember
 
    |class=OP
 
    |name=id
 
    |type=int
 
    |set=0
 
    |text=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.
 
}}
 
{{ClassMember
 
    |class=OP
 
    |name=passive
 
    |type=bool
 
    |set=0
 
    |text=If true, operator will not cook before its access methods are called.  To use a passive version of an operator n, use passive(n).
 
 
}}}}
 
}}}}
 
{{ClassMethodSection|empty=
 
{{ClassMethodSection|empty=

Revision as of 20:18, 25 September 2017

The OP class defines a reference to a single operator.


Members[edit]

General[edit]

validbool (Read Only):

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

idint (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.

namestr :

Get or set the operator name.

pathstr (Read Only):

Full path to the operator.

digitsint (Read Only):

Returns the numeric value of the last consecutive group of digits in the name, or None if not found.

basestr (Read Only):

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

passivebool (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).

timeOP (Read Only):

Time Component that defines the operator's time reference.

extclass (Read Only):

The object to search for parent extensions.

me.ext.MyClass

modmod (Read Only):

Get a module on demand object that searches for DAT modules relative to this operator.

partd.Par (Read Only):

An intermediate parameter collection object, from which a specific parameter can be found.

n.par.tx

customParslist (Read Only):

A list of all custom parameters.

customPageslist (Read Only):

A list of all custom pages.

customTupletslist (Read Only):

A list of all parameter tuplets, where a tuplet is a set of parameters all drawn on the same line of a dialog, sharing the same label.

replicatorOP or None (Read Only):

The replicatorCOMP that created this operator, if any.

storagedict (Read Only):

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.

tagslist :

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')

childrenlist (Read Only):

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

opOP or None (Read Only):

The OPFinder 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.

  • shortcut - Corresponds to the Global OP Shortcut parameter specified in the target operator.
b = me.op.Videoplayer   #or alternatively op.Videoplayer, as its not relative to this operator.

To list all Global OP Shortcuts:

for x in op:
	print(x)

parentOP (Read Only):

The ParentFinder 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 = me.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 = me.parent.Videoplayer

See also Parent Shortcut for more examples.

Common Flags[edit]

The following methods get or set specific operator flags. Note specific operators may contain other flags not in this section.

Appearance[edit]

Connection[edit]

See also the OP.parent methods. To connect components together see COMP_Class#Connection section.

Cook Information[edit]

Type[edit]

activeViewerbool :

Get or set viewer active flag.

allowCookingbool :

Get or set cooking flag. Components only.

bypassbool :

Get or set bypass flag.

childrenCookAbsFramefloat (Read Only):

The absolute frame on which childrenCookTime is based.

childrenCookTimefloat (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.

childrenGPUCookAbsFramefloat (Read Only):

The absolute frame on which childrenGPUCookTime is based.

childrenGPUCookTimefloat (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.

cloneImmunebool :

Get or set clone immune flag.

colortuple(r, g, b) :

Get or set color value, expressed as a 3-tuple, representing its red, green, blue values. To convert between color spaces, use the built in colorsys module.

commentstr :

Get or set comment string.

cookAbsFramefloat (Read Only):

Last absolute frame at which this operator cooked.

cookEndTimefloat (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.

cookFramefloat (Read Only):

Last frame at which this operator cooked.

cookStartTimefloat (Read Only):

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

cookTimefloat (Read Only):

Duration of the last measured cook (in milliseconds).

cookedPreviousFramebool (Read Only):

True when this operator has cooked the previous frame.

cookedThisFramebool (Read Only):

True when this operator has cooked this frame.

cpuMemoryint (Read Only):

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

curPartd.Par (Read Only):

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

currentbool :

Get or set current flag.

displaybool :

Get or set display flag.

dockOP :

Get or set the operator this operator is docked to. To clear docking, set this member to None.

dockedlist (Read Only):

The (possibly empty) list of operators docked to this node.

errorstr :

Get or set the error message associated with this OP.

exposebool :

Get or set the expose flag which hides a node from view in a network.

gpuCookTimefloat (Read Only):

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

inputConnectorslist (Read Only):

List of input connectors asssociated with this operator.

inputslist (Read Only):

List of input operators to this operator. To get the number of inputs, use len(OP.inputs).

isBasebool (Read Only):

True if the operator is a Base (miscellaneous) component.

isCHOPbool (Read Only):

True if the operator is a CHOP.

isCOMPbool (Read Only):

True if the operator is a component.

isDATbool (Read Only):

True if the operator is a DAT.

isMATbool (Read Only):

True if the operator is a Material.

isObjectbool (Read Only):

True if the operator is an object.

isPanelbool (Read Only):

True if the operator is a Panel.

isSOPbool (Read Only):

True if the operator is a SOP.

isTOPbool (Read Only):

True if the operators is a TOP.

lockbool :

Get or set lock flag.

nodeCenterXint :

Get or set node X value, expressed in network editor units, measured from its center.

nodeCenterYint :

Get or set node Y value, expressed in network editor units, measured from its center.

nodeHeightint :

Get or set node height, expressed in network editor units.

nodeWidthint :

Get or set node width, expressed in network editor units.

nodeXint :

Get or set node X value, expressed in network editor units, measured from its left edge.

nodeYint :

Get or set node Y value, expressed in network editor units, measured from its bottom edge.

outputConnectorslist (Read Only):

List of output connectors associated with this operator.

outputslist (Read Only):

List of output operators from this operator.

pythonbool :

Get or set parameter expression language as python.

renderbool :

Get or set render flag.

selectedbool :

Get or set selected flag. This controls if the node is part of the network selection. (yellow box around it).

showCustomOnlybool :

Get or set the Show Custom Only Flag which controls whether or not non custom parameters are display in parameter dialogs.

showDockedbool :

Get or set show docked flag. This controls whether this node is visible or hidden when it is docked to another node.

totalCooksint (Read Only):

Number of times the operator has cooked.

viewerbool :

Get or set viewer flag.

warningstr :

Get or set the warning message associated with this OP.

Methods[edit]

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*')

storeStartupValue(key, value):

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.

resetNodeSize():

Reset the node tile size to its default width and height.

unstore(keys1, keys2..):

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'

dependenciesTo(OP)list:

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

pars(pattern)list:

Returns a (possibly empty) list of parameter objects that match the pattern.

  • pattern - Is a string following the Pattern Matching rules, specifying which parameters to return.
newlist = op('geo1').pars('t?', 'r?', 's?') #translate/rotate/scale parameters

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.

openParameters()None:

Open a floating dialog containing the operator parameters.

clearScriptErrors(recurse=False, error='*')None:

Clear any errors generated during script execution. These may be generated during execution of DATs, Script Nodes, Replicator COMP callbacks, etc.

  • recurse - Clear script errors in any children or subchildren as well.
  • error - Pattern to match when clearing errors
op('/project1').clearScriptErrors(recurse=True)

warnings(recurse=False)str:

Get warning messages associated with this OP.

destroy()None:

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

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'

addError(msg)None:

Adds an error to a node. Only valid if error is added while a node is cooking.

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').evaluateExpression('me.digits')  #returns 1

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

addScriptErrors(msg)None:

Adds a script error to a node.

copyParameters(OP)None:

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

  • OP - The operator to copy.
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 CHOP
n = op('text1').changeType(tcpipDAT) #changes 'text1' operator into a TCPIP DAT

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.

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'

errors(recurse=False)str:

Get error messages associated with this OP.

addWarning(msg)None:

Adds a warning to a node. Only valid if warning is added while a node is cooking.

resetViewer(recurse=False)None:

Reset the OP content viewer to default view settings.

  • recurse - (Keyword, Optional) If True, this is done for all children and sub-children as well.
op('/').resetViewer(recurse=True) # reset the viewer for all operators in the entire file.

fetch(key, default, search=True, storeDefault=False)value:

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)

scriptErrors(recurse=False)str:

Get script error and warning messages associated with this OP.

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.

openViewer(unique=False, borders=True):

Open a floating content viewer for the OP.

  • unique - (Keyword, Optional) If False, any existing viewer for this OP will be re-used and popped to the foreground. If unique is True, a new window is created each time instead.
  • borders - (Keyword, Optional) If true, the floating window containing the viewer will have borders.
op('geo1').openViewer(unique=True, borders=False) #opens a new borderless viewer window for 'geo1'

closeViewer(topMost=False)None:

Close the floating content viewers of the OP.

  • topMost - (Keyword, Optional) If True, any viewer window containing any parent of this OP is closed instead.
op('wave1').closeViewer()
op('wave1').closeViewer(topMost=True) # any viewer that contains 'wave1' will be closed.

TouchDesigner Build:

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 contains its own Network inside. There are twelve 3D Object Component and eight 2D Panel Component types. See also Network Path.

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.

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

Matching strings using wildcard characters and bracketing. Useful in "Select" parameters to select multiple operators, paths, etc.

Matching strings using wildcard characters and bracketing. Useful in "Select" parameters to select multiple operators, paths, etc.

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.

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".

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.

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.

An Operator Family which operate on Channels (a series of numbers) which are used for animation, audio, mathematics, simulation, logic, UI construction, and many other applications.

An Operator Family that associates a shader with a SOP or Geometry Object for rendering textured and lit objects.

A custom interactive control panel built within TouchDesigner. Panels are created using Panel Components whose look is created entirely with TOPs.

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

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.

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

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.

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

TouchDesigner is a hierarchy of components. "root" is the top-most network in the hierarchy. The Path is simply /. A typical path is /project1/moviein1.