Difference between revisions of "OP Class"

From TouchDesigner Documentation
Jump to: navigation, search
(Tag: 2018.28070)
(30 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{TDClassSummary|summary=The OP class defines a reference to a single operator.}}
+
{{TDClassSummary|label=OP|summary=The OP class defines a reference to a single [[Operator|operator]].}}
 
<section begin=HELPBODY />
 
<section begin=HELPBODY />
 
{{ClassMemberSection|empty=
 
{{ClassMemberSection|empty=
Line 40: Line 40:
 
     |type=int
 
     |type=int
 
     |set=0
 
     |set=0
     |text=Returns the numeric value of the last consecutive group of digits in the name, or None if not found.
+
     |text=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.
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
Line 55: Line 55:
 
     |set=0
 
     |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).
 
     |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=curPar
 +
    |type=td.Par
 +
    |set=0
 +
    |text=The parameter currently being evaluated. Can be used in a parameter expression to reference itself.
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
Line 61: Line 68:
 
     |type=OP
 
     |type=OP
 
     |set=0
 
     |set=0
     |text=Time Component that defines the operator's time reference.
+
     |text=[[timeCOMP Class|Time Component]] that defines the operator's time reference.}}
}}
 
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
Line 68: Line 74:
 
     |type=class
 
     |type=class
 
     |set=0
 
     |set=0
     |text=The object to search for parent extensions.
+
     |text=The object to search for parent [[Extensions|extensions]].
 
<syntaxhighlight lang=python>
 
<syntaxhighlight lang=python>
 
me.ext.MyClass
 
me.ext.MyClass
</syntaxhighlight>
+
</syntaxhighlight>}}
}}
 
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
Line 78: Line 83:
 
     |type=mod
 
     |type=mod
 
     |set=0
 
     |set=0
     |text=Get a module on demand object that searches for DAT modules relative to this operator.
+
     |text=Get a [[MOD Class|module on demand]] object that searches for DAT modules relative to this operator.}}
}}
 
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
Line 85: Line 89:
 
     |type=td.Par
 
     |type=td.Par
 
     |set=0
 
     |set=0
     |text=An intermediate parameter collection object, from which a specific parameter can be found.
+
     |text=An intermediate [[ParCollection Class|parameter collection]] object, from which a specific [[Par Class|parameter]] can be found.
 
<syntaxhighlight lang=python>
 
<syntaxhighlight lang=python>
 
n.par.tx
 
n.par.tx
</syntaxhighlight>
+
</syntaxhighlight>}}
}}
 
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
Line 95: Line 98:
 
     |type=list
 
     |type=list
 
     |set=0
 
     |set=0
     |text=A list of all custom parameters.
+
     |text=A list of all [[Par Class|custom parameters]].}}
}}
 
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
Line 102: Line 104:
 
     |type=list
 
     |type=list
 
     |set=0
 
     |set=0
     |text=A list of all custom pages.
+
     |text=A list of all [[Page Class|custom pages]].}}
}}
 
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
Line 116: Line 117:
 
     |type=OP or None
 
     |type=OP or None
 
     |set=0
 
     |set=0
     |text=The replicatorCOMP that created this operator, if any.
+
     |text=The [[replicatorCOMP Class|replicatorCOMP]] that created this operator, if any.}}
}}
 
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
Line 123: Line 123:
 
     |type=dict
 
     |type=dict
 
     |set=0
 
     |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.
+
     |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
 
{{ClassMember
 
     |class=OP
 
     |class=OP
Line 130: Line 129:
 
     |type=list
 
     |type=list
 
     |set=1
 
     |set=1
     |text=Get or set a set of user defined strings. Tags can be searched using OP.findChildren() and the OP Find DAT.
+
     |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:
 
The set is a regular python set, and can be accessed accordingly:
 
<syntaxhighlight lang=python>
 
<syntaxhighlight lang=python>
 
n.tags = ['effect', 'image filter']
 
n.tags = ['effect', 'image filter']
 
n.tags.add('darken')
 
n.tags.add('darken')
</syntaxhighlight>
+
</syntaxhighlight>}}
}}
 
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
Line 142: Line 140:
 
     |type=list
 
     |type=list
 
     |set=0
 
     |set=0
     |text=A list of operators contained within this operator. Only component operators have children, otherwise an empty list is returned.
+
     |text=A list of [[OP Class|operators]] contained within this operator. Only [[COMP Class|component]] operators have children, otherwise an empty list is returned.}}
}}
+
{{ClassMember
 +
    |class=OP
 +
    |name=numChildren
 +
    |type=int
 +
    |set=0
 +
    |text=Returns the number of children contained within the operator. Only [[COMP Class|component]] operators have children.}}
 +
{{ClassMember
 +
    |class=OP
 +
    |name=numChildrenRecursive
 +
    |type=int
 +
    |set=0
 +
    |text=Returns the number of operators contained recursively within this operator. Only [[COMP Class|component]] operators have children.}}
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
Line 149: Line 158:
 
     |type=OP or None
 
     |type=OP or None
 
     |set=0
 
     |set=0
     |text=The OPFinder object, for accessing operators through paths or shortcuts.
+
     |text=The [[Global OP Shortcut|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.
+
Note a version of this method that searches relative to the current operator is also in the global [[td Module|td module]].
 
op(pattern1, pattern2...)
 
op(pattern1, pattern2...)
 
Returns the first OP whose path matches the given pattern, relative to this OP, or None if nothing is found.
 
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.
 
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.
+
*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>
 
<syntaxhighlight lang=python>
 
b = n.op('project1')
 
b = n.op('project1')
Line 161: Line 170:
 
</syntaxhighlight>
 
</syntaxhighlight>
 
op.shortcut
 
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.
+
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.
 
*shortcut - Corresponds to the Global OP Shortcut parameter specified in the target operator.
 
<syntaxhighlight lang=python>
 
<syntaxhighlight lang=python>
Line 170: Line 179:
 
for x in op:
 
for x in op:
 
print(x)
 
print(x)
</syntaxhighlight>
+
</syntaxhighlight>}}
}}
 
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
Line 177: Line 185:
 
     |type=OP
 
     |type=OP
 
     |set=0
 
     |set=0
     |text=The ParentFinder object, for accessing parent components through indices or shortcuts.
+
     |text=The [[Parent Shortcut|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.
+
Note a version of this method that searches relative to the current operator is also in the global [[td Module|td module]].
 
parent(n) -> OP or None
 
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.
+
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.
 
*n - (Optional) n is the number of levels up to climb. When n = 1 it will return the operator's parent.
 
<syntaxhighlight lang=python>
 
<syntaxhighlight lang=python>
Line 186: Line 194:
 
</syntaxhighlight>
 
</syntaxhighlight>
 
parent.shortcut -> OP
 
parent.shortcut -> OP
A parent component specified with a shortcut. If no parent exists an exception is raised.
+
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.
+
*shortcut - Corresponds to the [[Parent Shortcut]] parameter specified in the target parent.
 
<syntaxhighlight lang=python>
 
<syntaxhighlight lang=python>
 
n = me.parent.Videoplayer
 
n = me.parent.Videoplayer
 
</syntaxhighlight>
 
</syntaxhighlight>
See also Parent Shortcut for more examples.
+
See also Parent Shortcut for more examples.}}
}}
+
{{ClassMember
 +
    |class=OP
 +
    |name=iop
 +
    |type=OP
 +
    |set=0
 +
    |text=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]].}}
 +
{{ClassMember
 +
    |class=OP
 +
    |name=ipar
 +
    |type=OP
 +
    |set=0
 +
    |text=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]].}}
 
{{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.
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
Line 201: Line 224:
 
     |type=bool
 
     |type=bool
 
     |set=1
 
     |set=1
     |text=Get or set viewer active flag.
+
     |text=Get or set [[Viewer Active Flag|viewer active flag]].}}
}}
 
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
Line 208: Line 230:
 
     |type=bool
 
     |type=bool
 
     |set=1
 
     |set=1
     |text=Get or set cooking flag. Components only.
+
     |text=Get or set [[Cooking Flag|cooking flag]]. Only COMPs can disable this flag.}}
}}
 
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
Line 215: Line 236:
 
     |type=bool
 
     |type=bool
 
     |set=1
 
     |set=1
     |text=Get or set bypass flag.
+
     |text=Get or set [[Bypass Flag|bypass flag]].}}
}}
 
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
Line 222: Line 242:
 
     |type=bool
 
     |type=bool
 
     |set=1
 
     |set=1
     |text=Get or set clone immune flag.
+
     |text=Get or set [[Immune Flag|clone immune flag]].}}
}}
 
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
Line 229: Line 248:
 
     |type=bool
 
     |type=bool
 
     |set=1
 
     |set=1
     |text=Get or set current flag.
+
     |text=Get or set [[Current Flag|current flag]].}}
}}
 
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
Line 236: Line 254:
 
     |type=bool
 
     |type=bool
 
     |set=1
 
     |set=1
     |text=Get or set display flag.
+
     |text=Get or set [[Display Flag|display flag]].}}
}}
 
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
Line 243: Line 260:
 
     |type=bool
 
     |type=bool
 
     |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 [[Flag|expose flag]] which hides a node from view in a network.}}
}}
 
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
Line 250: Line 266:
 
     |type=bool
 
     |type=bool
 
     |set=1
 
     |set=1
     |text=Get or set lock flag.
+
     |text=Get or set [[Lock Flag|lock flag]].}}
}}
 
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
Line 257: Line 272:
 
     |type=bool
 
     |type=bool
 
     |set=1
 
     |set=1
     |text=Get or set selected flag. This controls if the node is part of the network selection. (yellow box around it).
+
     |text=Get or set [[Selected Flag|selected flag]]. This controls if the node is part of the network selection. (yellow box around it).}}
}}
 
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
Line 271: Line 285:
 
     |type=bool
 
     |type=bool
 
     |set=1
 
     |set=1
     |text=Get or set render flag.
+
     |text=Get or set [[Render Flag|render flag]].}}
}}
 
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
Line 278: Line 291:
 
     |type=bool
 
     |type=bool
 
     |set=1
 
     |set=1
     |text=Get or set the Show Custom Only Flag which controls whether or not non custom parameters are display in parameter dialogs.
+
     |text=Get or set the Show Custom Only Flag which controls whether or not non custom parameters are display in[[Parameter Dialog | parameter dialogs]].}}
}}
 
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
Line 285: Line 297:
 
     |type=bool
 
     |type=bool
 
     |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|show docked flag]]. This controls whether this node is visible or hidden when it is docked to another node.}}
}}
 
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
Line 292: Line 303:
 
     |type=bool
 
     |type=bool
 
     |set=1
 
     |set=1
     |text=Get or set viewer flag.
+
     |text=Get or set [[Viewer Flag|viewer flag]].}}
}}
 
 
{{SubSection|title=Appearance
 
{{SubSection|title=Appearance
 
|text=
 
|text=
 
}}
 
}}
{{SubSection|title=Connection
+
{{ClassMember
|text=See also the <code>OP.parent</code> methods.  To connect components together see [[COMP_Class#Connection]] section.
+
    |class=OP
 +
    |name=color
 +
    |type=tuple(r, g, b)
 +
    |set=1
 +
    |text=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.
 
}}
 
}}
{{SubSection|title=Cook Information
+
{{ClassMember
|text=
+
    |class=OP
}}
+
    |name=comment
{{SubSection|title=Type
+
    |type=str
|text=
+
    |set=1
 +
    |text=Get or set comment string.
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
     |name=childrenCookAbsFrame
+
     |name=nodeHeight
     |type=float
+
     |type=int
 +
    |set=1
 +
    |text=Get or set node height, expressed in [[NetworkEditor Class|network editor]] units.}}
 +
{{ClassMember
 +
    |class=OP
 +
    |name=nodeWidth
 +
    |type=int
 +
    |set=1
 +
    |text=Get or set node width, expressed in [[NetworkEditor Class|network editor]] units.}}
 +
{{ClassMember
 +
    |class=OP
 +
    |name=nodeX
 +
    |type=int
 +
    |set=1
 +
    |text=Get or set node X value, expressed in [[NetworkEditor Class|network editor]] units, measured from its left edge.}}
 +
{{ClassMember
 +
    |class=OP
 +
    |name=nodeY
 +
    |type=int
 +
    |set=1
 +
    |text=Get or set node Y value, expressed in [[NetworkEditor Class|network editor]] units, measured from its bottom edge.}}
 +
{{ClassMember
 +
    |class=OP
 +
    |name=nodeCenterX
 +
    |type=int
 +
    |set=1
 +
    |text=Get or set node X value, expressed in [[NetworkEditor Class|network editor]] units, measured from its center.}}
 +
{{ClassMember
 +
    |class=OP
 +
    |name=nodeCenterY
 +
    |type=int
 +
    |set=1
 +
    |text=Get or set node Y value, expressed in [[NetworkEditor Class|network editor]] units, measured from its center.}}
 +
{{ClassMember
 +
    |class=OP
 +
    |name=dock
 +
    |type=OP
 +
    |set=1
 +
    |text=Get or set the [[OP Class|operator]] this operator is docked to.  To clear docking, set this member to None.}}
 +
{{ClassMember
 +
    |class=OP
 +
    |name=docked
 +
    |type=list
 
     |set=0
 
     |set=0
     |text=The absolute frame on which childrenCookTime is based.
+
     |text=The (possibly empty) list of [[OP Class|operators]] docked to this node.}}
 +
{{SubSection|title=Connection
 +
|text=See also the <code>OP.parent</code> methods.  To connect components together see [[COMP_Class#Connection]] section.
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
     |name=childrenCookTime
+
     |name=inputs
     |type=float
+
     |type=list
 
     |set=0
 
     |set=0
     |text=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.
+
     |text=List of input [[OP Class|operators]] to this operator. To get the number of inputs, use len(OP.inputs).}}
}}
 
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
     |name=childrenGPUCookAbsFrame
+
     |name=outputs
     |type=float
+
     |type=list
 
     |set=0
 
     |set=0
     |text=The absolute frame on which childrenGPUCookTime is based.
+
     |text=List of output [[OP Class|operators]] from this operator.}}
}}
 
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
     |name=childrenGPUCookTime
+
     |name=inputConnectors
     |type=float
+
     |type=list
 
     |set=0
 
     |set=0
     |text=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.
+
     |text=List of input [[Connector Class|connectors]] asssociated with this operator.}}
}}
 
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
     |name=color
+
     |name=outputConnectors
     |type=tuple(r, g, b)
+
     |type=list
     |set=1
+
     |set=0
     |text=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.
+
     |text=List of output [[Connector Class|connectors]] associated with this operator.}}
 +
{{SubSection|title=Cook Information
 +
|text=
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
     |name=comment
+
     |name=cookFrame
     |type=str
+
     |type=float
     |set=1
+
     |set=0
     |text=Get or set comment string.
+
     |text=Last frame at which this operator cooked.
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
     |name=cookAbsFrame
+
     |name=cookTime
 
     |type=float
 
     |type=float
 
     |set=0
 
     |set=0
     |text=Last absolute frame at which this operator cooked.
+
     |text='''Deprecated''' Duration of the last measured cook (in milliseconds).
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
     |name=cookEndTime
+
     |name=cpuCookTime
 
     |type=float
 
     |type=float
 
     |set=0
 
     |set=0
     |text=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.
+
     |text=Duration of the last measured cook in CPU time (in milliseconds).
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
     |name=cookFrame
+
     |name=cookAbsFrame
 
     |type=float
 
     |type=float
 
     |set=0
 
     |set=0
     |text=Last frame at which this operator cooked.
+
     |text=Last absolute frame at which this operator cooked.
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
Line 378: Line 436:
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
     |name=cookTime
+
     |name=cookEndTime
 
     |type=float
 
     |type=float
 
     |set=0
 
     |set=0
     |text=Duration of the last measured cook (in milliseconds).
+
     |text=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.
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
     |name=cookedPreviousFrame
+
     |name=cookedThisFrame
 
     |type=bool
 
     |type=bool
 
     |set=0
 
     |set=0
     |text=True when this operator has cooked the previous frame.
+
     |text=True when this operator has cooked this frame.
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
     |name=cookedThisFrame
+
     |name=cookedPreviousFrame
 
     |type=bool
 
     |type=bool
 
     |set=0
 
     |set=0
     |text=True when this operator has cooked this frame.
+
     |text=True when this operator has cooked the previous frame.
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
     |name=cpuMemory
+
     |name=childrenCookTime
     |type=int
+
     |type=float
 
     |set=0
 
     |set=0
     |text=The approximate amount of CPU memory this Operator is using, in bytes.
+
     |text='''Deprecated''' The total accumulated cook time of all children of this operator during the last frame. Zero if the operator is not a [[COMP Class|COMP]] and/or has no children.}}
}}
 
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
     |name=curPar
+
     |name=childrenCPUCookTime
     |type=td.Par
+
     |type=float
 
     |set=0
 
     |set=0
     |text=The parameter currently being evaluated. Can be used in a parameter expression to reference itself.
+
     |text=The total accumulated cook time of all children of this operator during the last frame. Zero if the operator is not a [[COMP Class|COMP]] and/or has no children.}}
}}
 
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
     |name=dock
+
     |name=childrenCookAbsFrame
     |type=OP
+
     |type=float
     |set=1
+
     |set=0
     |text=Get or set the operator this operator is docked to.  To clear docking, set this member to None.
+
     |text='''Deprecated''' The absolute frame on which childrenCookTime is based.
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
     |name=docked
+
     |name=childrenCPUCookAbsFrame
     |type=list
+
     |type=float
 
     |set=0
 
     |set=0
     |text=The (possibly empty) list of operators docked to this node.
+
     |text=The absolute frame on which childrenCPUCookTime is based.
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
     |name=error
+
     |name=gpuCookTime
     |type=str
+
     |type=float
     |set=1
+
     |set=0
     |text=Get or set the error message associated with this OP.
+
     |text=Duration of GPU operations during the last measured cook (in milliseconds).
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
     |name=gpuCookTime
+
     |name=childrenGPUCookTime
 
     |type=float
 
     |type=float
 
     |set=0
 
     |set=0
     |text=Duration GPU operations cook on the last measured cook (in milliseconds).
+
     |text=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.
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
     |name=inputConnectors
+
     |name=childrenGPUCookAbsFrame
     |type=list
+
     |type=float
 
     |set=0
 
     |set=0
     |text=List of input connectors asssociated with this operator.
+
     |text=The absolute frame on which childrenGPUCookTime is based.
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
     |name=inputs
+
     |name=totalCooks
     |type=list
+
     |type=int
 
     |set=0
 
     |set=0
     |text=List of input operators to this operator. To get the number of inputs, use len(OP.inputs).
+
     |text=Number of times the operator has cooked.
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
     |name=isBase
+
     |name=cpuMemory
     |type=bool
+
     |type=int
 
     |set=0
 
     |set=0
     |text=True if the operator is a Base (miscellaneous) component.
+
     |text=The approximate amount of CPU memory this Operator is using, in bytes.
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
     |name=isCHOP
+
     |name=gpuMemory
     |type=bool
+
     |type=int
 
     |set=0
 
     |set=0
     |text=True if the operator is a CHOP.
+
     |text=The amount of GPU memory this OP is using, in bytes.
 +
}}
 +
{{SubSection|title=Type
 +
|text=
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
     |name=isCOMP
+
     |name=type
     |type=bool
+
     |type=str
 
     |set=0
 
     |set=0
     |text=True if the operator is a component.
+
     |text=Operator type as a string. Example: 'oscin'.
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
     |name=isDAT
+
     |name=subType
     |type=bool
+
     |type=str
 
     |set=0
 
     |set=0
     |text=True if the operator is a DAT.
+
     |text=Operator subtype. Currently only implemented for [[Components|components]]. May be one of: 'panel', 'object', or empty string in the case of base components.}}
}}
 
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
     |name=isMAT
+
     |name=OPType
     |type=bool
+
     |type=str
 
     |set=0
 
     |set=0
     |text=True if the operator is a Material.
+
     |text=Python operator class type, as a string. Example: 'oscinCHOP'. Can be used with COMP.create() method.
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
     |name=isObject
+
     |name=label
     |type=bool
+
     |type=str
 
     |set=0
 
     |set=0
     |text=True if the operator is an object.
+
     |text=Operator type label. Example: 'OSC In'.
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
     |name=isPanel
+
     |name=icon
     |type=bool
+
     |type=str
 
     |set=0
 
     |set=0
     |text=True if the operator is a Panel.
+
     |text=Get the letters used to create the operator's icon.
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
     |name=isSOP
+
     |name=family
     |type=bool
+
     |type=str
 
     |set=0
 
     |set=0
     |text=True if the operator is a SOP.
+
     |text=Operator family. Example: CHOP. Use the global dictionary families for a list of each operator type.
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
     |name=isTOP
+
     |name=isFilter
 
     |type=bool
 
     |type=bool
 
     |set=0
 
     |set=0
     |text=True if the operators is a TOP.
+
     |text=True if operator is a filter, false if it is a generator.
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
     |name=nodeCenterX
+
     |name=minInputs
 
     |type=int
 
     |type=int
     |set=1
+
     |set=0
     |text=Get or set node X value, expressed in network editor units, measured from its center.
+
     |text=Minimum number of inputs to the operator.
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
     |name=nodeCenterY
+
     |name=maxInputs
 
     |type=int
 
     |type=int
     |set=1
+
     |set=0
     |text=Get or set node Y value, expressed in network editor units, measured from its center.
+
     |text=Maximum number of inputs to the operator.
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
     |name=nodeHeight
+
     |name=isMultiInputs
 +
    |type=bool
 +
    |set=0
 +
    |text=True if inputs are ordered, false otherwise. Operators with an arbitrary number of inputs have unordered inputs, example [[Merge CHOP]].}}
 +
{{ClassMember
 +
    |class=OP
 +
    |name=visibleLevel
 
     |type=int
 
     |type=int
     |set=1
+
     |set=0
     |text=Get or set node height, expressed in network editor units.
+
     |text=Visibility level of the operator. For example, expert operators have visibility level 1, regular operators have visibility level 0.
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
     |name=nodeWidth
+
     |name=isBase
     |type=int
+
     |type=bool
     |set=1
+
     |set=0
     |text=Get or set node width, expressed in network editor units.
+
     |text=True if the operator is a Base (miscellaneous) [[Component|component]].}}
}}
+
{{ClassMember
 +
    |class=OP
 +
    |name=isCHOP
 +
    |type=bool
 +
    |set=0
 +
    |text=True if the operator is a [[CHOP]].}}
 +
{{ClassMember
 +
    |class=OP
 +
    |name=isCOMP
 +
    |type=bool
 +
    |set=0
 +
    |text=True if the operator is a [[Component|component]].}}
 +
{{ClassMember
 +
    |class=OP
 +
    |name=isDAT
 +
    |type=bool
 +
    |set=0
 +
    |text=True if the operator is a [[DAT]].}}
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
     |name=nodeX
+
     |name=isMAT
     |type=int
+
     |type=bool
     |set=1
+
     |set=0
     |text=Get or set node X value, expressed in network editor units, measured from its left edge.
+
     |text=True if the operator is a [[Material]].}}
}}
 
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
     |name=nodeY
+
     |name=isObject
     |type=int
+
     |type=bool
     |set=1
+
     |set=0
     |text=Get or set node Y value, expressed in network editor units, measured from its bottom edge.
+
     |text=True if the operator is an [[object]].}}
}}
 
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
     |name=outputConnectors
+
     |name=isPanel
     |type=list
+
     |type=bool
 
     |set=0
 
     |set=0
     |text=List of output connectors associated with this operator.
+
     |text=True if the operator is a [[Panel]].}}
}}
 
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
     |name=outputs
+
     |name=isSOP
     |type=list
+
     |type=bool
 
     |set=0
 
     |set=0
     |text=List of output operators from this operator.
+
     |text=True if the operator is a [[SOP]].}}
}}
 
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
     |name=totalCooks
+
     |name=isTOP
     |type=int
+
     |type=bool
 
     |set=0
 
     |set=0
     |text=Number of times the operator has cooked.
+
     |text=True if the operators is a [[TOP]].}}
}}
 
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
     |name=warning
+
     |name=licenseType
 
     |type=str
 
     |type=str
     |set=1
+
     |set=0
     |text=Get or set the warning message associated with this OP.
+
     |text=Type of [[License Class|License]] required for the operator.}}}}
}}}}
 
 
{{ClassMethodSection|empty=
 
{{ClassMethodSection|empty=
 
|Sectionsummary=
 
|Sectionsummary=
 
|items=
 
|items=
+
{{SubSection|title=General
 +
        |text='''NOTE''': <code>create()</code>, <code>copy()</code> and <code>copyOPs()</code> is done by the parent operator (a component).  For more information see [[COMP Class#Methods|COMP.create, COMP.copy and COMP.copyOPs methods]].
 +
 
 +
}}
 +
{{ClassMethod
 +
    |class=OP
 +
    |name=pars
 +
    |call=pars(pattern)
 +
    |returns=list
 +
    |text=Returns a (possibly empty) list of [[Par Class|parameter objects]] that match the pattern.
 +
*pattern - Is a string following the [[Pattern Matching]] rules, specifying which parameters to return.
 +
<syntaxhighlight lang=python>
 +
newlist = op('geo1').pars('t?', 'r?', 's?') #translate/rotate/scale parameters
 +
</syntaxhighlight>}}
 +
{{ClassMethod
 +
    |class=OP
 +
    |name=cook
 +
    |call=cook(force=False, recurse=False)
 +
    |returns=None
 +
    |text=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.
 +
}}
 
{{ClassMethod
 
{{ClassMethod
 
     |class=OP
 
     |class=OP
Line 597: Line 694:
 
     |text=Returns a (possibly empty) list of OPs that match the patterns, relative to this OP.
 
     |text=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.
 
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.
+
*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.
+
Note a version of this method that searches relative to '/' is also in the global [[td Module|td module]].
 
<syntaxhighlight lang=python>
 
<syntaxhighlight lang=python>
 
newlist = n.ops('arm*', 'leg*', 'leg5/foot*')
 
newlist = n.ops('arm*', 'leg*', 'leg5/foot*')
</syntaxhighlight>
+
</syntaxhighlight>}}
}}
 
 
{{ClassMethod
 
{{ClassMethod
 
     |class=OP
 
     |class=OP
     |name=storeStartupValue
+
     |name=copyParameters
     |call=storeStartupValue(key, value)
+
     |call=copyParameters(OP, custom=True, builtin=True)
     |returns=
+
     |returns=None
     |text=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.
+
     |text=Copy all of the parameters from the specified [[OP Class|operator]]Both operators should be the same type.
*key - A string name for the storage startup entry.
+
*OP - The operator to copy.
*value - The startup value/object to store.
+
*custom - (Keyword, Optional) When True, custom parameters will be copied.  
 +
*builtin - (Keyword, Optional) When True, built in parameters will be copied.
 
<syntaxhighlight lang=python>
 
<syntaxhighlight lang=python>
n.storeStartupValue('sales5', 1) # 'sales5' will have a value of 1 when the file starts up.
+
op('geo1').copyParameters( op('geo2') )
</syntaxhighlight>
+
</syntaxhighlight>}}
}}
 
 
{{ClassMethod
 
{{ClassMethod
 
     |class=OP
 
     |class=OP
     |name=resetNodeSize
+
     |name=changeType
     |call=resetNodeSize()
+
     |call=changeType(OPtype)
     |returns=
+
     |returns=OP
     |text=Reset the node tile size to its default width and height.
+
     |text=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|td module]].
{{ClassMethod
 
    |class=OP
 
    |name=unstore
 
    |call=unstore(keys1, keys2..)
 
    |returns=
 
    |text=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.
 
 
<syntaxhighlight lang=python>
 
<syntaxhighlight lang=python>
n.unstore('sales*') # removes all entries from this OPs storage that start with 'sales'
+
n = op('wave1').changeType(nullCHOP) #changes 'wave1' into a Null CHOP
</syntaxhighlight>
+
n = op('text1').changeType(tcpipDAT) #changes 'text1' operator into a TCPIP DAT
}}
+
</syntaxhighlight>}}
 
{{ClassMethod
 
{{ClassMethod
 
     |class=OP
 
     |class=OP
Line 642: Line 731:
 
{{ClassMethod
 
{{ClassMethod
 
     |class=OP
 
     |class=OP
     |name=pars
+
     |name=evalExpression
     |call=pars(pattern)
+
     |call=evalExpression(str)
     |returns=list
+
     |returns=value
     |text=Returns a (possibly empty) list of parameter objects that match the pattern.
+
     |text=Evaluate the expression from the context of this OP.  Can be used to evaluate arbitrary snippets of code from arbitrary locations.
*pattern - Is a string following the Pattern Matching rules, specifying which parameters to return.
+
*str - The expression to evaluate.
 
<syntaxhighlight lang=python>
 
<syntaxhighlight lang=python>
newlist = op('geo1').pars('t?', 'r?', 's?') #translate/rotate/scale parameters
+
op('wave1').evaluateExpression('me.digits') #returns 1
 
</syntaxhighlight>
 
</syntaxhighlight>
}}
+
If the expression already resides in a parameter, use that parameters [[Par Class|evalExpression()]]() method instead.}}
 
{{ClassMethod
 
{{ClassMethod
 
     |class=OP
 
     |class=OP
     |name=cook
+
     |name=destroy
     |call=cook(force=False, recurse=False)
+
     |call=destroy()
 
     |returns=None
 
     |returns=None
     |text=Cook the contents of the operator if required.
+
     |text=Destroy the operator referenced by this OP. An exception will be raised if the OP's operator has already been destroyed.
*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.
 
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
 
     |class=OP
 
     |class=OP
     |name=openParameters
+
     |name=var
     |call=openParameters()
+
     |call=var(name, search=True)
 +
    |returns=str
 +
    |text=Evaluate a[[Variables | 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|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.}}
 +
{{ClassMethod
 +
    |class=OP
 +
    |name=openMenu
 +
    |call=openMenu(x=None, y=None)
 
     |returns=None
 
     |returns=None
     |text=Open a floating dialog containing the operator parameters.
+
     |text=Open a node menu for the operator at x, y.  Opens at mouse if x & y are not specified.
 +
*x - (Keyword, Optional) The X coordinate of the menu, measured in screen pixels.
 +
*y - (Keyword, Optional) The Y coordinate of the menu, measured in screen pixels.  
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
 
     |class=OP
 
     |class=OP
     |name=clearScriptErrors
+
     |name=relativePath
     |call=clearScriptErrors(recurse=False, error='*')
+
     |call=relativePath(OP)
     |returns=None
+
     |returns=str
     |text=Clear any errors generated during script execution. These may be generated during execution of DATs, Script Nodes, Replicator COMP callbacks, etc.
+
     |text=Returns the relative path from this operator to the OP that is passed as the argument.   See OP.shortcutPath for a version using expressions.
*recurse - Clear script errors in any children or subchildren as well.
 
*error - Pattern to match when clearing errors
 
<syntaxhighlight lang=python>
 
op('/project1').clearScriptErrors(recurse=True)
 
</syntaxhighlight>
 
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
 
     |class=OP
 
     |class=OP
     |name=warnings
+
     |name=shortcutPath
     |call=warnings(recurse=False)
+
     |call=shortcutPath(OP, toParName=None)
 
     |returns=str
 
     |returns=str
     |text=Get warning messages associated with this OP.
+
     |text=Returns an expression from this operator to the OP that is passed as the argument. See OP.relativePath for a version using relative path constants.
 +
*toParName - (Keyword, Optional) Return an expression to this parameter instead of its operator.
 +
}}
 +
{{SubSection|title=Errors
 +
        |text=
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
 
     |class=OP
 
     |class=OP
     |name=destroy
+
     |name=addScriptError
     |call=destroy()
+
     |call=addScriptErrors(msg)
 
     |returns=None
 
     |returns=None
     |text=Destroy the operator referenced by this OP. An exception will be raised if the OP's operator has already been destroyed.
+
     |text=Adds a script error to a node.
 +
*msg - The error to add.
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
 
     |class=OP
 
     |class=OP
     |name=unstoreStartupValue
+
     |name=addError
     |call=unstoreStartupValue(keys1, keys2..)
+
     |call=addError(msg)
 
     |returns=None
 
     |returns=None
     |text=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.
+
     |text=Adds an error to an operator.  Only valid if added while the operator is cooking. (Example Script SOP, CHOP, DAT).
*keys - The name or pattern defining which key/value pairs to remove from the storage startup dictionary.
+
*msg - The error to add.
<syntaxhighlight lang=python>
 
n.unstoreStartupValue('sales*') # removes all entries from this OPs storage startup that start with 'sales'
 
</syntaxhighlight>
 
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
 
     |class=OP
 
     |class=OP
     |name=addError
+
     |name=addWarning
     |call=addError(msg)
+
     |call=addWarning(msg)
 
     |returns=None
 
     |returns=None
     |text=Adds an error to a node. Only valid if error is added while a node is cooking.
+
     |text=Adds a warning to an operator. Only valid if added while the operator is cooking. (Example Script SOP, CHOP, DAT).
 +
*msg - The error to add.
 +
}}
 +
{{ClassMethod
 +
    |class=OP
 +
    |name=errors
 +
    |call=errors(recurse=False)
 +
    |returns=str
 +
    |text=Get error messages associated with this OP.
 +
*recurse - Get errors in any children or subchildren as well.
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
 
     |class=OP
 
     |class=OP
     |name=evalExpression
+
     |name=warnings
     |call=evalExpression(str)
+
     |call=warnings(recurse=False)
     |returns=value
+
     |returns=str
     |text=Evaluate the expression from the context of this OP.  Can be used to evaluate arbitrary snippets of code from arbitrary locations.
+
     |text=Get warning messages associated with this OP.
*str - The expression to evaluate.
+
*recurse - Get warnings in any children or subchildren as well.
<syntaxhighlight lang=python>
 
op('wave1').evaluateExpression('me.digits')  #returns 1
 
</syntaxhighlight>
 
If the expression already resides in a parameter, use that parameters evalExpression() method instead.
 
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
 
     |class=OP
 
     |class=OP
     |name=addScriptError
+
     |name=scriptErrors
     |call=addScriptErrors(msg)
+
     |call=scriptErrors(recurse=False)
     |returns=None
+
     |returns=str
     |text=Adds a script error to a node.
+
     |text=Get script error messages associated with this OP.
 +
*recurse - Get errors in any children or subchildren as well.
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
 
     |class=OP
 
     |class=OP
     |name=copyParameters
+
     |name=clearScriptErrors
     |call=copyParameters(OP)
+
     |call=clearScriptErrors(recurse=False, error='*')
 
     |returns=None
 
     |returns=None
     |text=Copy all of the parameters from the specified operatorBoth operators should be the same type.
+
     |text=Clear any errors generated during script executionThese may be generated during execution of DATs, Script Nodes, Replicator COMP callbacks, etc.
*OP - The operator to copy.
+
*recurse - Clear script errors in any children or subchildren as well.
 +
*error - Pattern to match when clearing errors
 
<syntaxhighlight lang=python>
 
<syntaxhighlight lang=python>
op('geo1').copyParameters( op('geo2') )
+
op('/project1').clearScriptErrors(recurse=True)
 
</syntaxhighlight>
 
</syntaxhighlight>
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
 
     |class=OP
 
     |class=OP
     |name=changeType
+
     |name=childrenCPUMemory
     |call=changeType(OPtype)
+
     |call=childrenCPUMemory()
     |returns=OP
+
     |returns=int
     |text=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.
+
     |text=Returns the total CPU memory usage for all the children from this COMP.}}
*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.
+
{{ClassMethod
<syntaxhighlight lang=python>
+
    |class=OP
n = op('wave1').changeType(nullCHOP) #changes 'wave1' into a Null CHOP
+
    |name=childrenGPUMemory
n = op('text1').changeType(tcpipDAT) #changes 'text1' operator into a TCPIP DAT
+
    |call=childrenGPUMemory()
</syntaxhighlight>
+
    |returns=int
 +
    |text=Returns the total GPU memory usage for all the children from this COMP.}}   
 +
{{SubSection|title=Appearance
 +
        |text=
 +
}}
 +
{{SubSection|title=Appearance
 +
        |text=
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
 
     |class=OP
 
     |class=OP
     |name=store
+
     |name=resetNodeSize
     |call=store(key, value)
+
     |call=resetNodeSize()
     |returns=value
+
     |returns=None
     |text=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.
+
     |text=Reset the node tile size to its default width and height.
*key - A string name for the storage entry. Use this name to retrieve the value using fetch().
+
}}
*value - The value/object to store.
+
{{SubSection|title=Viewers
<syntaxhighlight lang=python>
+
        |text=
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.
 
</syntaxhighlight>
 
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
 
     |class=OP
 
     |class=OP
     |name=fetchOwner
+
     |name=closeViewer
     |call=fetchOwner(key)
+
     |call=closeViewer(topMost=False)
     |returns=OP
+
     |returns=None
     |text=Return the operator which contains the stored key, or None if not found.
+
     |text=Close the floating content viewers of the OP.
*key - The key to the stored entry you are looking for.
+
*topMost - (Keyword, Optional) If True, any viewer window containing any parent of this OP is closed instead.
 
<syntaxhighlight lang=python>
 
<syntaxhighlight lang=python>
who = n.fetchOwner('sales5') #find the OP that has a storage entry called 'sales5'
+
op('wave1').closeViewer()
 +
op('wave1').closeViewer(topMost=True) # any viewer that contains 'wave1' will be closed.
 
</syntaxhighlight>
 
</syntaxhighlight>
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
 
     |class=OP
 
     |class=OP
     |name=errors
+
     |name=openViewer
     |call=errors(recurse=False)
+
     |call=openViewer(unique=False, borders=True)
    |returns=str
 
    |text=Get error messages associated with this OP.
 
}}
 
{{ClassMethod
 
    |class=OP
 
    |name=addWarning
 
    |call=addWarning(msg)
 
 
     |returns=None
 
     |returns=None
     |text=Adds a warning to a node. Only valid if warning is added while a node is cooking.
+
     |text=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.
 +
<syntaxhighlight lang=python>
 +
op('geo1').openViewer(unique=True, borders=False) # opens a new borderless viewer window for 'geo1'
 +
</syntaxhighlight>
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
Line 801: Line 904:
 
op('/').resetViewer(recurse=True) # reset the viewer for all operators in the entire file.
 
op('/').resetViewer(recurse=True) # reset the viewer for all operators in the entire file.
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
}}
 +
{{ClassMethod
 +
    |class=OP
 +
    |name=openParameters
 +
    |call=openParameters()
 +
    |returns=None
 +
    |text=Open a floating dialog containing the operator parameters.
 +
}}
 +
{{SubSection|title=Storage
 +
        |text=
 +
[[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 <code>n.store()</code> as explained below, expressions and operators that depend on it will automatically re-cook.  It is retrieved with the <code>n.fetch()</code> function.
 +
 +
Storage is saved in <code>.toe</code> and <code>.tox</code> 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 <code>None</code>.
 +
 +
See the [[Examine DAT]] for procedurally viewing the contents of storage.
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
Line 818: Line 940:
 
{{ClassMethod
 
{{ClassMethod
 
     |class=OP
 
     |class=OP
     |name=scriptErrors
+
     |name=fetchOwner
     |call=scriptErrors(recurse=False)
+
     |call=fetchOwner(key)
     |returns=str
+
    |returns=OP
     |text=Get script error and warning messages associated with this OP.
+
    |text=Return the operator which contains the stored key, or None if not found.
 +
*key - The key to the stored entry you are looking for.
 +
<syntaxhighlight lang=python>
 +
who = n.fetchOwner('sales5') #find the OP that has a storage entry called 'sales5'
 +
</syntaxhighlight>
 +
}}
 +
{{ClassMethod
 +
    |class=OP
 +
    |name=store
 +
    |call=store(key, value)
 +
     |returns=value
 +
     |text=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.
 +
<syntaxhighlight lang=python>
 +
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.
 +
</syntaxhighlight>
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
 
     |class=OP
 
     |class=OP
     |name=var
+
     |name=unstore
     |call=var(name, search=True)
+
     |call=unstore(keys1, keys2..)
     |returns=str
+
     |returns=None
     |text=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.
+
     |text=For key, remove it from the OP's storage dictionary. Pattern Matching is supported as well.
*name - The variable name to search for.
+
*keys - The name or pattern defining which key/value pairs to remove from the storage dictionary.
*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.
+
<syntaxhighlight lang=python>
 +
n.unstore('sales*') # removes all entries from this OPs storage that start with 'sales'
 +
</syntaxhighlight>
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
 
     |class=OP
 
     |class=OP
     |name=openViewer
+
     |name=storeStartupValue
     |call=openViewer(unique=False, borders=True)
+
     |call=storeStartupValue(key, value)
     |returns=
+
     |returns=None
     |text=Open a floating content viewer for the OP.
+
     |text=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.
*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.
+
*key - A string name for the storage startup entry.
*borders - (Keyword, Optional) If true, the floating window containing the viewer will have borders.
+
*value - The startup value/object to store.
 
<syntaxhighlight lang=python>
 
<syntaxhighlight lang=python>
op('geo1').openViewer(unique=True, borders=False) #opens a new borderless viewer window for 'geo1'
+
n.storeStartupValue('sales5', 1) # 'sales5' will have a value of 1 when the file starts up.
 
</syntaxhighlight>
 
</syntaxhighlight>
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
 
     |class=OP
 
     |class=OP
     |name=closeViewer
+
     |name=unstoreStartupValue
     |call=closeViewer(topMost=False)
+
     |call=unstoreStartupValue(keys1, keys2..)
 
     |returns=None
 
     |returns=None
     |text=Close the floating content viewers of the OP.
+
     |text=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.
*topMost - (Keyword, Optional) If True, any viewer window containing any parent of this OP is closed instead.
+
*keys - The name or pattern defining which key/value pairs to remove from the storage startup dictionary.
 
<syntaxhighlight lang=python>
 
<syntaxhighlight lang=python>
op('wave1').closeViewer()
+
n.unstoreStartupValue('sales*') # removes all entries from this OPs storage startup that start with 'sales'
op('wave1').closeViewer(topMost=True) # any viewer that contains 'wave1' will be closed.
 
 
</syntaxhighlight>
 
</syntaxhighlight>
}}}}
+
}}
 +
{{SubSection|title=Miscellaneous
 +
        |text=
 +
}}
 +
{{ClassMethod
 +
    |class=OP
 +
    |name=__getstate__
 +
    |call=__getstate__()
 +
    |returns=dict
 +
    |text=Returns a dictionary with persistent data about the object suitable for pickling and deep copies.
 +
}}
 +
{{ClassMethod
 +
    |class=OP
 +
    |name=__setstate__
 +
    |call=__setstate__()
 +
    |returns=dict
 +
    |text=Reads the dictionary to update persistent details about the object, suitable for unpickling and deep copies.
 +
}}
 +
}}
 
<section end=HELPBODY />
 
<section end=HELPBODY />
 
{{History}}
 
{{History}}
 
{{#invoke:Category|list|Python Reference}}
 
{{#invoke:Category|list|Python Reference}}

Revision as of 10:33, 22 March 2019

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. The digits can be in the middle of the name if there are none at the end of the name.

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

curPartd.Par (Read Only):

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

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.

numChildrenint (Read Only):

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

numChildrenRecursiveint (Read Only):

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

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

  • 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 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 = 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.

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

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

Common Flags[edit]

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


activeViewerbool :

Get or set viewer active flag.

allowCookingbool :

Get or set cooking flag. Only COMPs can disable this flag.

bypassbool :

Get or set bypass flag.

cloneImmunebool :

Get or set clone immune flag.

currentbool :

Get or set current flag.

displaybool :

Get or set display flag.

exposebool :

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

lockbool :

Get or set lock flag.

selectedbool :

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

pythonbool :

Get or set parameter expression language as python.

renderbool :

Get or set render flag.

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.

viewerbool :

Get or set viewer flag.

Appearance[edit]

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.

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.

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.

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.

Connection[edit]

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


inputslist (Read Only):

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

outputslist (Read Only):

List of output operators from this operator.

inputConnectorslist (Read Only):

List of input connectors asssociated with this operator.

outputConnectorslist (Read Only):

List of output connectors associated with this operator.

Cook Information[edit]

cookFramefloat (Read Only):

Last frame at which this operator cooked.

cookTimefloat (Read Only):

Deprecated Duration of the last measured cook (in milliseconds).

cpuCookTimefloat (Read Only):

Duration of the last measured cook in CPU time (in milliseconds).

cookAbsFramefloat (Read Only):

Last absolute frame at which this operator cooked.

cookStartTimefloat (Read Only):

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

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.

cookedThisFramebool (Read Only):

True when this operator has cooked this frame.

cookedPreviousFramebool (Read Only):

True when this operator has cooked the previous frame.

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

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

childrenCookAbsFramefloat (Read Only):

Deprecated The absolute frame on which childrenCookTime is based.

childrenCPUCookAbsFramefloat (Read Only):

The absolute frame on which childrenCPUCookTime is based.

gpuCookTimefloat (Read Only):

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

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.

childrenGPUCookAbsFramefloat (Read Only):

The absolute frame on which childrenGPUCookTime is based.

totalCooksint (Read Only):

Number of times the operator has cooked.

cpuMemoryint (Read Only):

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

gpuMemoryint (Read Only):

The amount of GPU memory this OP is using, in bytes.

Type[edit]

typestr (Read Only):

Operator type as a string. Example: 'oscin'.

subTypestr (Read Only):

Operator subtype. Currently only implemented for components. May be one of: 'panel', 'object', or empty string in the case of base components.

OPTypestr (Read Only):

Python operator class type, as a string. Example: 'oscinCHOP'. Can be used with COMP.create() method.

labelstr (Read Only):

Operator type label. Example: 'OSC In'.

iconstr (Read Only):

Get the letters used to create the operator's icon.

familystr (Read Only):

Operator family. Example: CHOP. Use the global dictionary families for a list of each operator type.

isFilterbool (Read Only):

True if operator is a filter, false if it is a generator.

minInputsint (Read Only):

Minimum number of inputs to the operator.

maxInputsint (Read Only):

Maximum number of inputs to the operator.

isMultiInputsbool (Read Only):

True if inputs are ordered, false otherwise. Operators with an arbitrary number of inputs have unordered inputs, example Merge CHOP.

visibleLevelint (Read Only):

Visibility level of the operator. For example, expert operators have visibility level 1, regular operators have visibility level 0.

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.

licenseTypestr (Read Only):

Type of License required for the operator.

Methods[edit]

General[edit]

NOTE: create(), copy() and copyOPs() is done by the parent operator (a component). For more information see COMP.create, COMP.copy and COMP.copyOPs methods.


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.

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.

  • OP - The operator to copy.
  • custom - (Keyword, Optional) When True, custom parameters will be copied.
  • 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 CHOP
n = 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').evaluateExpression('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.

  • x - (Keyword, Optional) The X coordinate of the menu, measured in screen pixels.
  • y - (Keyword, Optional) The Y coordinate of the menu, measured in screen pixels.

relativePath(OP)str:

Returns the relative path from this operator to the OP that is passed as the argument. See OP.shortcutPath for a version using expressions.

shortcutPath(OP, toParName=None)str:

Returns an expression from this operator to the OP that is passed as the argument. See OP.relativePath for a version using relative path constants.

  • toParName - (Keyword, Optional) Return an expression to this parameter instead of its operator.

Errors[edit]

addScriptErrors(msg)None:

Adds a script error to a node.

  • msg - The error to add.

addError(msg)None:

Adds an error to an operator. Only valid if added while the operator is cooking. (Example Script SOP, CHOP, DAT).

  • msg - The error to add.

addWarning(msg)None:

Adds a warning to an operator. Only valid if added while the operator is cooking. (Example Script SOP, CHOP, DAT).

  • msg - The error to add.

errors(recurse=False)str:

Get error messages associated with this OP.

  • recurse - Get errors in any children or subchildren as well.

warnings(recurse=False)str:

Get warning messages associated with this OP.

  • recurse - Get warnings in any children or subchildren as well.

scriptErrors(recurse=False)str:

Get script error messages associated with this OP.

  • recurse - Get errors in any children or subchildren as well.

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)

childrenCPUMemory()int:

Returns the total CPU memory usage for all the children from this COMP.

childrenGPUMemory()int:

Returns the total GPU memory usage for all the children from this COMP.

Appearance[edit]

Appearance[edit]

resetNodeSize()None:

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

Viewers[edit]

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.

openViewer(unique=False, borders=True)None:

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'

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.

openParameters()None:

Open a floating dialog containing the operator parameters.

Storage[edit]

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.

See the Examine DAT for procedurally viewing the contents of storage.


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)

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'

Miscellaneous[edit]

__getstate__()dict:

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:

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.

There are four types of shortcuts: Application Shortcuts that are built-in to TouchDesigner's authoring interface, Panel Shortcuts that you create for any custom built panels, Parent Shortcuts for accessing a component from within that component, and Global OP Shortcuts that access a unique component from anywhere in TouchDesigner.

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

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 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 which operate on Channels (a series of numbers) which are used for animation, audio, mathematics, simulation, logic, UI construction, and many other applications.

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.

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.

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.

TouchDesigner's original built-in Command scripting language prior to Python.

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.