Difference between revisions of "OP Class"

From TouchDesigner Documentation
Jump to: navigation, search
(OP Class Auto Create)
Line 4: Line 4:
 
|Sectionsummary=
 
|Sectionsummary=
 
|items=
 
|items=
 +
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
 
     |name=activeViewer
 
     |name=activeViewer
     |returns=BOOL
+
     |type=
     |set=1
+
     |set=0
 
     |text=Get or set viewer active flag.
 
     |text=Get or set viewer active flag.
 
}}
 
}}
Line 14: Line 15:
 
     |class=OP
 
     |class=OP
 
     |name=allowCooking
 
     |name=allowCooking
     |returns=BOOL
+
     |type=
     |set=1
+
     |set=0
 
     |text=Get or set cooking flag. Components only.
 
     |text=Get or set cooking flag. Components only.
 
}}
 
}}
Line 21: Line 22:
 
     |class=OP
 
     |class=OP
 
     |name=base
 
     |name=base
     |returns=string
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=Returns the beginning portion of the name occurring before any digits.
 
     |text=Returns the beginning portion of the name occurring before any digits.
Line 28: Line 29:
 
     |class=OP
 
     |class=OP
 
     |name=bypass
 
     |name=bypass
     |returns=BOOL
+
     |type=
     |set=1
+
     |set=0
 
     |text=Get or set bypass flag.
 
     |text=Get or set bypass flag.
 
}}
 
}}
Line 35: Line 36:
 
     |class=OP
 
     |class=OP
 
     |name=children
 
     |name=children
     |returns=list
+
     |type=
 
     |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 operators contained within this operator.  Only component operators have children, otherwise an empty list is returned.
Line 42: Line 43:
 
     |class=OP
 
     |class=OP
 
     |name=childrenCookAbsFrame
 
     |name=childrenCookAbsFrame
     |returns=float
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=The absolute frame on which childrenCookTime is based.
 
     |text=The absolute frame on which childrenCookTime is based.
Line 49: Line 50:
 
     |class=OP
 
     |class=OP
 
     |name=childrenCookTime
 
     |name=childrenCookTime
     |returns=float
+
     |type=
 
     |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=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.
Line 56: Line 57:
 
     |class=OP
 
     |class=OP
 
     |name=childrenGPUCookAbsFrame
 
     |name=childrenGPUCookAbsFrame
     |returns=float
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=The absolute frame on which childrenGPUCookTime is based.
 
     |text=The absolute frame on which childrenGPUCookTime is based.
Line 63: Line 64:
 
     |class=OP
 
     |class=OP
 
     |name=childrenGPUCookTime
 
     |name=childrenGPUCookTime
     |returns=float
+
     |type=
 
     |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=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.
Line 70: Line 71:
 
     |class=OP
 
     |class=OP
 
     |name=cloneImmune
 
     |name=cloneImmune
     |returns=BOOL
+
     |type=
     |set=1
+
     |set=0
 
     |text=Get or set clone immune flag.
 
     |text=Get or set clone immune flag.
 
}}
 
}}
Line 77: Line 78:
 
     |class=OP
 
     |class=OP
 
     |name=color
 
     |name=color
     |returns=tuple
+
     |type=
     |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=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.
 
}}
 
}}
Line 84: Line 85:
 
     |class=OP
 
     |class=OP
 
     |name=comment
 
     |name=comment
     |returns=BOOL
+
     |type=
     |set=1
+
     |set=0
 
     |text=Get or set comment string.
 
     |text=Get or set comment string.
 
}}
 
}}
Line 91: Line 92:
 
     |class=OP
 
     |class=OP
 
     |name=cookAbsFrame
 
     |name=cookAbsFrame
     |returns=float
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=Last absolute frame at which this operator cooked.
 
     |text=Last absolute frame at which this operator cooked.
Line 98: Line 99:
 
     |class=OP
 
     |class=OP
 
     |name=cookEndTime
 
     |name=cookEndTime
     |returns=float
+
     |type=
 
     |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=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.
Line 105: Line 106:
 
     |class=OP
 
     |class=OP
 
     |name=cookFrame
 
     |name=cookFrame
     |returns=float
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=Last frame at which this operator cooked.
 
     |text=Last frame at which this operator cooked.
Line 112: Line 113:
 
     |class=OP
 
     |class=OP
 
     |name=cookStartTime
 
     |name=cookStartTime
     |returns=float
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=Last offset from frame start at which this operator cook began, expressed in milliseconds.
 
     |text=Last offset from frame start at which this operator cook began, expressed in milliseconds.
Line 119: Line 120:
 
     |class=OP
 
     |class=OP
 
     |name=cookTime
 
     |name=cookTime
     |returns=float
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=Duration of the last measured cook (in milliseconds).
 
     |text=Duration of the last measured cook (in milliseconds).
Line 126: Line 127:
 
     |class=OP
 
     |class=OP
 
     |name=cookedPreviousFrame
 
     |name=cookedPreviousFrame
     |returns=BOOL
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=True when this operator has cooked the previous frame.
 
     |text=True when this operator has cooked the previous frame.
Line 133: Line 134:
 
     |class=OP
 
     |class=OP
 
     |name=cookedThisFrame
 
     |name=cookedThisFrame
     |returns=BOOL
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=True when this operator has cooked this frame.
 
     |text=True when this operator has cooked this frame.
Line 140: Line 141:
 
     |class=OP
 
     |class=OP
 
     |name=cpuMemory
 
     |name=cpuMemory
     |returns=BOOL
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=The approximate amount of CPU memory this Operator is using, in bytes.
 
     |text=The approximate amount of CPU memory this Operator is using, in bytes.
Line 147: Line 148:
 
     |class=OP
 
     |class=OP
 
     |name=curPar
 
     |name=curPar
     |returns=parameter
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=The parameter currently being evaluated. Can be used in a parameter expression to reference itself.
 
     |text=The parameter currently being evaluated. Can be used in a parameter expression to reference itself.
Line 154: Line 155:
 
     |class=OP
 
     |class=OP
 
     |name=current
 
     |name=current
     |returns=BOOL
+
     |type=
     |set=1
+
     |set=0
 
     |text=Get or set current flag.
 
     |text=Get or set current flag.
 
}}
 
}}
Line 161: Line 162:
 
     |class=OP
 
     |class=OP
 
     |name=customPages
 
     |name=customPages
     |returns=list
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=A list of all custom pages.
 
     |text=A list of all custom pages.
Line 168: Line 169:
 
     |class=OP
 
     |class=OP
 
     |name=customPars
 
     |name=customPars
     |returns=list
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=A list of all custom parameters.
 
     |text=A list of all custom parameters.
Line 175: Line 176:
 
     |class=OP
 
     |class=OP
 
     |name=customTuplets
 
     |name=customTuplets
     |returns=list
+
     |type=
 
     |set=0
 
     |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.
 
     |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.
Line 182: Line 183:
 
     |class=OP
 
     |class=OP
 
     |name=digits
 
     |name=digits
     |returns=int or None
+
     |type=
 
     |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.
Line 189: Line 190:
 
     |class=OP
 
     |class=OP
 
     |name=display
 
     |name=display
     |returns=BOOL
+
     |type=
     |set=1
+
     |set=0
 
     |text=Get or set display flag.
 
     |text=Get or set display flag.
 
}}
 
}}
Line 196: Line 197:
 
     |class=OP
 
     |class=OP
 
     |name=dock
 
     |name=dock
     |returns=OP or None
+
     |type=
     |set=1
+
     |set=0
 
     |text=Get or set the operator this operator is docked to.  To clear docking, set this member to None.
 
     |text=Get or set the operator this operator is docked to.  To clear docking, set this member to None.
 
}}
 
}}
Line 203: Line 204:
 
     |class=OP
 
     |class=OP
 
     |name=docked
 
     |name=docked
     |returns=list
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=The (possibly empty) list of operators docked to this node.
 
     |text=The (possibly empty) list of operators docked to this node.
Line 210: Line 211:
 
     |class=OP
 
     |class=OP
 
     |name=error
 
     |name=error
     |returns=string
+
     |type=
     |set=1
+
     |set=0
 
     |text=Get or set the error message associated with this OP.
 
     |text=Get or set the error message associated with this OP.
 
}}
 
}}
Line 217: Line 218:
 
     |class=OP
 
     |class=OP
 
     |name=expose
 
     |name=expose
     |returns=BOOL
+
     |type=
     |set=1
+
     |set=0
 
     |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.
 
}}
 
}}
Line 224: Line 225:
 
     |class=OP
 
     |class=OP
 
     |name=ext
 
     |name=ext
     |returns=extension object
+
     |type=
 
     |set=0
 
     |set=0
     |text=The object to search for parent extensions.
+
     |text=The object to search for parent extensions. Example: me.ext.MyClass
<syntaxhighlight lang=python>
 
me.ext.MyClass
 
</syntaxhighlight>
 
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
 
     |name=gpuCookTime
 
     |name=gpuCookTime
     |returns=float
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=Duration GPU operations cook on the last measured cook (in milliseconds).
 
     |text=Duration GPU operations cook on the last measured cook (in milliseconds).
Line 241: Line 239:
 
     |class=OP
 
     |class=OP
 
     |name=inputConnectors
 
     |name=inputConnectors
     |returns=list
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=List of input connectors asssociated with this operator.
 
     |text=List of input connectors asssociated with this operator.
Line 248: Line 246:
 
     |class=OP
 
     |class=OP
 
     |name=inputs
 
     |name=inputs
     |returns=list
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=List of input operators to this operator. To get the number of inputs, use len(OP.inputs).
 
     |text=List of input operators to this operator. To get the number of inputs, use len(OP.inputs).
Line 255: Line 253:
 
     |class=OP
 
     |class=OP
 
     |name=isBase
 
     |name=isBase
     |returns=BOOL
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=True if the operator is a Base (miscellaneous) component.
 
     |text=True if the operator is a Base (miscellaneous) component.
Line 262: Line 260:
 
     |class=OP
 
     |class=OP
 
     |name=isCHOP
 
     |name=isCHOP
     |returns=BOOL
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=True if the operator is a CHOP.
 
     |text=True if the operator is a CHOP.
Line 269: Line 267:
 
     |class=OP
 
     |class=OP
 
     |name=isCOMP
 
     |name=isCOMP
     |returns=BOOL
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=True if the operator is a component.
 
     |text=True if the operator is a component.
Line 276: Line 274:
 
     |class=OP
 
     |class=OP
 
     |name=isDAT
 
     |name=isDAT
     |returns=BOOL
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=True if the operator is a DAT.
 
     |text=True if the operator is a DAT.
Line 283: Line 281:
 
     |class=OP
 
     |class=OP
 
     |name=isMAT
 
     |name=isMAT
     |returns=BOOL
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=True if the operator is a Material.
 
     |text=True if the operator is a Material.
Line 290: Line 288:
 
     |class=OP
 
     |class=OP
 
     |name=isObject
 
     |name=isObject
     |returns=BOOL
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=True if the operator is an object.
 
     |text=True if the operator is an object.
Line 297: Line 295:
 
     |class=OP
 
     |class=OP
 
     |name=isPanel
 
     |name=isPanel
     |returns=BOOL
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=True if the operator is a Panel.
 
     |text=True if the operator is a Panel.
Line 304: Line 302:
 
     |class=OP
 
     |class=OP
 
     |name=isSOP
 
     |name=isSOP
     |returns=BOOL
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=True if the operator is a SOP.
 
     |text=True if the operator is a SOP.
Line 311: Line 309:
 
     |class=OP
 
     |class=OP
 
     |name=isTOP
 
     |name=isTOP
     |returns=BOOL
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=True if the operators is a TOP.
 
     |text=True if the operators is a TOP.
Line 318: Line 316:
 
     |class=OP
 
     |class=OP
 
     |name=lock
 
     |name=lock
     |returns=BOOL
+
     |type=
     |set=1
+
     |set=0
 
     |text=Get or set lock flag.
 
     |text=Get or set lock flag.
 
}}
 
}}
Line 325: Line 323:
 
     |class=OP
 
     |class=OP
 
     |name=mod
 
     |name=mod
     |returns=mod object
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=Get a module on demand object that searches for DAT modules relative to this operator.
 
     |text=Get a module on demand object that searches for DAT modules relative to this operator.
Line 332: Line 330:
 
     |class=OP
 
     |class=OP
 
     |name=name
 
     |name=name
     |returns=string
+
     |type=
     |set=1
+
     |set=0
 
     |text=Get or set the operator name.
 
     |text=Get or set the operator name.
 
}}
 
}}
Line 339: Line 337:
 
     |class=OP
 
     |class=OP
 
     |name=nodeCenterX
 
     |name=nodeCenterX
     |returns=float
+
     |type=
     |set=1
+
     |set=0
 
     |text=Get or set node X value, expressed in network editor units, measured from its center.
 
     |text=Get or set node X value, expressed in network editor units, measured from its center.
 
}}
 
}}
Line 346: Line 344:
 
     |class=OP
 
     |class=OP
 
     |name=nodeCenterY
 
     |name=nodeCenterY
     |returns=float
+
     |type=
     |set=1
+
     |set=0
 
     |text=Get or set node Y value, expressed in network editor units, measured from its center.
 
     |text=Get or set node Y value, expressed in network editor units, measured from its center.
 
}}
 
}}
Line 353: Line 351:
 
     |class=OP
 
     |class=OP
 
     |name=nodeHeight
 
     |name=nodeHeight
     |returns=float
+
     |type=
     |set=1
+
     |set=0
 
     |text=Get or set node height, expressed in network editor units.
 
     |text=Get or set node height, expressed in network editor units.
 
}}
 
}}
Line 360: Line 358:
 
     |class=OP
 
     |class=OP
 
     |name=nodeWidth
 
     |name=nodeWidth
     |returns=float
+
     |type=
     |set=1
+
     |set=0
 
     |text=Get or set node width, expressed in network editor units.
 
     |text=Get or set node width, expressed in network editor units.
 
}}
 
}}
Line 367: Line 365:
 
     |class=OP
 
     |class=OP
 
     |name=nodeX
 
     |name=nodeX
     |returns=float
+
     |type=
     |set=1
+
     |set=0
 
     |text=Get or set node X value, expressed in network editor units, measured from its left edge.
 
     |text=Get or set node X value, expressed in network editor units, measured from its left edge.
 
}}
 
}}
Line 374: Line 372:
 
     |class=OP
 
     |class=OP
 
     |name=nodeY
 
     |name=nodeY
     |returns=float
+
     |type=
     |set=1
+
     |set=0
 
     |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.
 
}}
 
}}
Line 381: Line 379:
 
     |class=OP
 
     |class=OP
 
     |name=op
 
     |name=op
     |returns=OP or None
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=The OPFinder object, for accessing operators through paths or shortcuts.
 
     |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.
 
Note a version of this method that searches relative to the current operator is also in the global td module.
<syntaxhighlight lang=python enclose="none">op(pattern1, pattern2...) -> OP or None</syntaxhighlight>
+
op(pattern1, pattern2...) -> OP or None
 
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>
 
 
b = n.op('project1')
 
b = n.op('project1')
 
b = n.op('foot*', 'hand*')
 
b = n.op('foot*', 'hand*')
 
b = n.op(154)  #or alternatively op(154), as its not relative to this operator.
 
b = n.op(154)  #or alternatively op(154), as its not relative to this operator.
</syntaxhighlight>
+
op.shortcut -> OP
<syntaxhighlight lang=python enclose="none">op.shortcut -> OP</syntaxhighlight>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>
 
 
b = me.op.Videoplayer  #or alternatively op.Videoplayer, as its not relative to this operator.
 
b = me.op.Videoplayer  #or alternatively op.Videoplayer, as its not relative to this operator.
</syntaxhighlight>
 
 
To list all Global OP Shortcuts:
 
To list all Global OP Shortcuts:
<syntaxhighlight lang=python>
+
 
 
for x in op:
 
for x in op:
print(x)
+
print(x)
</syntaxhighlight>
 
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
 
     |name=outputConnectors
 
     |name=outputConnectors
     |returns=list
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=List of output connectors associated with this operator.
 
     |text=List of output connectors associated with this operator.
Line 415: Line 409:
 
     |class=OP
 
     |class=OP
 
     |name=outputs
 
     |name=outputs
     |returns=list
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=List of output operators from this operator.
 
     |text=List of output operators from this operator.
Line 422: Line 416:
 
     |class=OP
 
     |class=OP
 
     |name=par
 
     |name=par
     |returns=parameter collection object
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=An intermediate parameter collection object, from which a specific parameter can be found. Example: n.par.tx
 
     |text=An intermediate parameter collection object, from which a specific parameter can be found. Example: n.par.tx
Line 429: Line 423:
 
     |class=OP
 
     |class=OP
 
     |name=parent
 
     |name=parent
     |returns=OP or None
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=The ParentFinder object, for accessing parent components through indices or shortcuts.
 
     |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.
 
Note a version of this method that searches relative to the current operator is also in the global td module.
<syntaxhighlight lang=python>parent(n)</syntaxhighlight>
+
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>p = me.parent(2) #grandfather</syntaxhighlight>
+
p = me.parent(2) #grandfather
<syntaxhighlight lang=python>parent.shortcut</syntaxhighlight>
+
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>n = me.parent.Videoplayer</syntaxhighlight>
+
n = me.parent.Videoplayer
 
See also Parent Shortcut for more examples.
 
See also Parent Shortcut for more examples.
 
}}
 
}}
Line 446: Line 440:
 
     |class=OP
 
     |class=OP
 
     |name=path
 
     |name=path
     |returns=string
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=Full path to the operator.
 
     |text=Full path to the operator.
Line 453: Line 447:
 
     |class=OP
 
     |class=OP
 
     |name=python
 
     |name=python
     |returns=BOOL
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=Get or set parameter expression language as python.
 
     |text=Get or set parameter expression language as python.
Line 460: Line 454:
 
     |class=OP
 
     |class=OP
 
     |name=render
 
     |name=render
     |returns=BOOL
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=Get or set render flag.
 
     |text=Get or set render flag.
Line 467: Line 461:
 
     |class=OP
 
     |class=OP
 
     |name=replicator
 
     |name=replicator
     |returns=OP o None
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=The replicatorCOMP that created this operator, if any.
 
     |text=The replicatorCOMP that created this operator, if any.
Line 474: Line 468:
 
     |class=OP
 
     |class=OP
 
     |name=selected
 
     |name=selected
     |returns=BOOL
+
     |type=
 
     |set=0
 
     |set=0
 
     |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. This controls if the node is part of the network selection. (yellow box around it).
Line 481: Line 475:
 
     |class=OP
 
     |class=OP
 
     |name=showCustomOnly
 
     |name=showCustomOnly
     |returns=BOOL
+
     |type=
 
     |set=0
 
     |set=0
 
     |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 dialogs.
Line 488: Line 482:
 
     |class=OP
 
     |class=OP
 
     |name=showDocked
 
     |name=showDocked
     |returns=BOOL
+
     |type=
 
     |set=0
 
     |set=0
     |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
 
{{ClassMember
 
     |class=OP
 
     |class=OP
 
     |name=storage
 
     |name=storage
     |returns=dict
+
     |type=
 
     |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
 
     |name=tags
 
     |name=tags
     |returns=str
+
     |type=
 
     |set=0
 
     |set=0
     |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>n.tags = ['effect', 'image filter']</syntaxhighlight>
+
Example: n.tags = ['effect', 'image filter']
  
<syntaxhighlight lang=python>n.tags.add('darken')</syntaxhighlight>
+
Example: n.tags.add('darken')
 
}}
 
}}
 
{{ClassMember
 
{{ClassMember
 
     |class=OP
 
     |class=OP
 
     |name=time
 
     |name=time
     |returns=OP
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=Time Component that defines the operator's time reference.
 
     |text=Time Component that defines the operator's time reference.
Line 521: Line 515:
 
     |class=OP
 
     |class=OP
 
     |name=totalCooks
 
     |name=totalCooks
     |returns=float
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=Number of times the operator has cooked.
 
     |text=Number of times the operator has cooked.
Line 528: Line 522:
 
     |class=OP
 
     |class=OP
 
     |name=valid
 
     |name=valid
     |returns=BOOL
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=True if the referenced operator currently exists, False if it has been deleted.
 
     |text=True if the referenced operator currently exists, False if it has been deleted.
Line 535: Line 529:
 
     |class=OP
 
     |class=OP
 
     |name=viewer
 
     |name=viewer
     |returns=BOOL
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=Get or set viewer flag.
 
     |text=Get or set viewer flag.
Line 542: Line 536:
 
     |class=OP
 
     |class=OP
 
     |name=warning
 
     |name=warning
     |returns=str
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=Get or set the warning message associated with this OP.
 
     |text=Get or set the warning message associated with this OP.
Line 549: Line 543:
 
     |class=OP
 
     |class=OP
 
     |name=id
 
     |name=id
     |returns=int
+
     |type=
 
     |set=0
 
     |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.
 
     |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.
Line 556: Line 550:
 
     |class=OP
 
     |class=OP
 
     |name=passive
 
     |name=passive
     |returns=BOOL
+
     |type=
 
     |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).
Line 564: Line 558:
 
|items=
 
|items=
 
 
 +
{{ClassMethod
 +
    |class=OP
 +
    |name=ops
 +
    |call=ops(pattern1, pattern2..)
 +
    |returns=
 +
    |text=: -> 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*')
 +
}}
 
{{ClassMethod
 
{{ClassMethod
 
     |class=OP
 
     |class=OP
Line 569: Line 575:
 
     |call=storeStartupValue(key, value)
 
     |call=storeStartupValue(key, value)
 
     |returns=
 
     |returns=
     |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=:
*key - A string name for the storage startup entry.
+
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.
*value - The startup value/object to store.
+
key - A string name for the storage startup entry.
<syntaxhighlight lang=python>n.storeStartupValue('sales5', 1) # 'sales5' will have a value of 1 when the file starts up.</syntaxhighlight>
+
value - The startup value/object to store.
 +
n.storeStartupValue('sales5', 1) # 'sales5' will have a value of 1 when the file starts up.
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
Line 579: Line 586:
 
     |call=resetNodeSize()
 
     |call=resetNodeSize()
 
     |returns=
 
     |returns=
     |text=Reset the node tile size to its default width and height.
+
     |text=:
 +
Reset the node tile size to its default width and height.
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
 
     |class=OP
 
     |class=OP
     |name=openViewer
+
     |name=unstore
     |call=openViewer(unique=False, borders=True)
+
     |call=unstore(keys1, keys2..)
 
     |returns=
 
     |returns=
     |text=Open a floating content viewer for the OP.
+
     |text=:
*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.
+
For key, remove it from the OP's storage dictionary. Pattern Matching is supported as well.
*borders - (Keyword, Optional) If true, the floating window containing the viewer will have borders.
+
keys - The name or pattern defining which key/value pairs to remove from the storage dictionary.
<syntaxhighlight lang=python>op('geo1').openViewer(unique=True, borders=False) #opens a new borderless viewer window for 'geo1'</syntaxhighlight>
+
n.unstore('sales*') # removes all entries from this OPs storage that start with 'sales'
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
 
     |class=OP
 
     |class=OP
     |name=destroy
+
     |name=dependenciesTo
     |call=destroy()
+
     |call=dependenciesTo(OP)
 
     |returns=
 
     |returns=
     |text=Destroy the operator referenced by this OP. An exception will be raised if the OP's operator has already been destroyed.
+
     |text=: -> list
 +
Returns a (possibly empty) list of operator dependency paths between this operator and the specified operator. Multiple paths may be found.
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
 
     |class=OP
 
     |class=OP
     |name=resetViewer
+
     |name=pars
     |call=resetViewer(recurse=False)
+
     |call=pars(pattern)
 
     |returns=
 
     |returns=
     |text=Reset the OP content viewer to default view settings.
+
     |text=: -> list
*recurse - (Keyword, Optional) If True, this is done for all children and sub-children as well.
+
Returns a (possibly empty) list of parameter objects that match the pattern.
<syntaxhighlight lang=python>op('/').resetViewer(recurse=True) # reset the viewer for all operators in the entire file.</syntaxhighlight>
+
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
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
 
     |class=OP
 
     |class=OP
     |name=fetch
+
     |name=cook
     |call=fetch(key, default, search=True, storeDefault=False)
+
     |call=cook(force=False, recurse=False)
     |returns=value
+
     |returns=
     |text=Return an object from the OP storage dictionary.  If the item is not found, and a default it supplied, it will be returned instead.
+
     |text=:
*key - The name of the entry to retrieve.
+
Cook the contents of the operator if required.
*default - (Optional) If provided and no item is found then the passed value/object is returned instead.
+
force - (Keyword, Optional) If True, the operator will always cook, even if it wouldn't under normal circumstances.
*storeDefault - (Keyword, Optional) If True, and the key is not found, the default is stored as well.
+
recurse - (Keyword, Optional) If True, all children and sub-children of the operator will be cooked.
*search - (Keyword, Optional) If True, the parent of each OP is searched recursively until a match is found
 
<syntaxhighlight lang=python>v = n.fetch('sales5', 0.0)</syntaxhighlight>
 
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
 
     |class=OP
 
     |class=OP
     |name=evalExpression
+
     |name=openParameters
     |call=evalExpression(str)
+
     |call=openParameters()
     |returns=value
+
     |returns=
     |text=Evaluate the expression from the context of this OP.  Can be used to evaluate arbitrary snippets of code from arbitrary locations.
+
     |text=:
*str - The expression to evaluate.
+
Open a floating dialog containing the operator parameters.
<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=store
+
     |name=clearScriptErrors
     |call=store(key, value)
+
     |call=clearScriptErrors(recurse=False, error='*')
     |returns=value
+
     |returns=
     |text=Add the key/value pair to the OP's storage dictionary, or replace it if it already existsIf 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=:
*key - A string name for the storage entry. Use this name to retrieve the value using fetch().
+
Clear any errors generated during script executionThese may be generated during execution of DATs, Script Nodes, Replicator COMP callbacks, etc.
*value - The value/object to store.
+
recurse - Clear script errors in any children or subchildren as well.
<syntaxhighlight lang=python>
+
error - Pattern to match when clearing errors
n.store('sales5', 34.5) # stores a floating point value 34.5.
+
op('/project1').clearScriptErrors(recurse=True)
n.store('moviebank', op('/project1/movies')) # stores an OP for easy access later on.
 
</syntaxhighlight>
 
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
 
     |class=OP
 
     |class=OP
     |name=unstoreStartupValue
+
     |name=warnings
     |call=unstoreStartupValue(keys1, keys2..)
+
     |call=warnings(recurse=False)
 
     |returns=
 
     |returns=
     |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=:Get warning messages associated with this OP.
*keys - The name or pattern defining which key/value pairs to remove from the storage startup dictionary.
 
<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=addWarning
+
     |name=destroy
     |call=addWarning(msg)
+
     |call=destroy()
 
     |returns=
 
     |returns=
     |text=Adds a warning to a node. Only valid if warning is added while a node is cooking.
+
     |text=:
 +
Destroy the operator referenced by this OP. An exception will be raised if the OP's operator has already been destroyed.
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
 
     |class=OP
 
     |class=OP
     |name=closeViewer
+
     |name=unstoreStartupValue
     |call=closeViewer(topMost=False)
+
     |call=unstoreStartupValue(keys1, keys2..)
 
     |returns=
 
     |returns=
     |text=Close the floating content viewers of the OP.
+
     |text=:
*topMost - (Keyword, Optional) If True, any viewer window containing any parent of this OP is closed instead.
+
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.
<syntaxhighlight lang=python>
+
keys - The name or pattern defining which key/value pairs to remove from the storage startup dictionary.
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>
 
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
 
     |class=OP
 
     |class=OP
     |name=ops
+
     |name=addError
     |call=ops(pattern1, pattern2..)
+
     |call=addError(msg)
     |returns=list
+
     |returns=
     |text=Returns a (possibly empty) list of OPs that match the patterns, relative to this OP.
+
     |text=:
Multiple patterns may be provided. Numeric OP ids may also be used.
+
Adds an error to a node. Only valid if error is added while a node is cooking.
*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.
 
<syntaxhighlight lang=python>
 
newlist = n.ops('arm*', 'leg*', 'leg5/foot*')
 
</syntaxhighlight>
 
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
 
     |class=OP
 
     |class=OP
     |name=addScriptError
+
     |name=evalExpression
     |call=addScriptErrors(msg)
+
     |call=evalExpression(str)
 
     |returns=
 
     |returns=
     |text=Adds a script error to a node.
+
     |text=: -> 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.
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
 
     |class=OP
 
     |class=OP
     |name=openParameters
+
     |name=addScriptError
     |call=openParameters()
+
     |call=addScriptErrors(msg)
 
     |returns=
 
     |returns=
     |text=Open a floating dialog containing the operator parameters.
+
     |text=:
 +
Adds a script error to a node.
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
 
     |class=OP
 
     |class=OP
     |name=clearScriptErrors
+
     |name=copyParameters
     |call=clearScriptErrors(recurse=False, error='*')
+
     |call=copyParameters(OP)
 
     |returns=
 
     |returns=
     |text=Clear any errors generated during script executionThese may be generated during execution of DATs, Script Nodes, Replicator COMP callbacks, etc.
+
     |text=:
*recurse - Clear script errors in any children or subchildren as well.
+
Copy all of the parameters from the specified operatorBoth operators should be the same type.
*error - Pattern to match when clearing errors
+
OP - The operator to copy.
<syntaxhighlight lang=python>
+
op('geo1').copyParameters( op('geo2') )
op('/project1').clearScriptErrors(recurse=True)
 
</syntaxhighlight>
 
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
 
     |class=OP
 
     |class=OP
     |name=scriptErrors
+
     |name=changeType
     |call=scriptErrors(recurse=False)
+
     |call=changeType(OPtype)
 
     |returns=
 
     |returns=
     |text=Get script error and warning messages associated with this OP.
+
     |text=: -> 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
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
 
     |class=OP
 
     |class=OP
     |name=var
+
     |name=store
     |call=var(name, search=True)
+
     |call=store(key, value)
    |returns=str
 
    |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.
 
*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=warnings
 
    |call=warnings(recurse=False)
 
 
     |returns=
 
     |returns=
     |text=Get warning messages associated with this OP.
+
     |text=: -> 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.
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
Line 738: Line 735:
 
     |name=fetchOwner
 
     |name=fetchOwner
 
     |call=fetchOwner(key)
 
     |call=fetchOwner(key)
     |returns=OP
+
     |returns=
     |text=Return the operator which contains the stored key, or None if not found.
+
     |text=: -> OP
*key - The key to the stored entry you are looking for.
+
Return the operator which contains the stored key, or None if not found.
<syntaxhighlight lang=python>
+
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'
 
who = n.fetchOwner('sales5') #find the OP that has a storage entry called 'sales5'
</syntaxhighlight>
 
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
 
     |class=OP
 
     |class=OP
     |name=copyParameters
+
     |name=errors
     |call=copyParameters(OP)
+
     |call=errors(recurse=False)
 
     |returns=
 
     |returns=
     |text=Copy all of the parameters from the specified operator.  Both operators should be the same type.
+
     |text=:Get error messages associated with this OP.
*OP - The operator to copy.
 
<syntaxhighlight lang=python>
 
op('geo1').copyParameters( op('geo2') )
 
</syntaxhighlight>
 
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
 
     |class=OP
 
     |class=OP
     |name=addError
+
     |name=addWarning
     |call=addError(msg)
+
     |call=addWarning(msg)
 
     |returns=
 
     |returns=
     |text=Adds an error to a node.  Only valid if error is added while a node is cooking.
+
     |text=:
 +
Adds a warning to a node.  Only valid if warning is added while a node is cooking.
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
 
     |class=OP
 
     |class=OP
     |name=unstore
+
     |name=resetViewer
     |call=unstore(keys1, keys2..)
+
     |call=resetViewer(recurse=False)
 
     |returns=
 
     |returns=
     |text=For key, remove it from the OP's storage dictionary. Pattern Matching is supported as well.
+
     |text=:
*keys - The name or pattern defining which key/value pairs to remove from the storage dictionary.
+
Reset the OP content viewer to default view settings.
<syntaxhighlight lang=python>
+
recurse - (Keyword, Optional) If True, this is done for all children and sub-children as well.
n.unstore('sales*') # removes all entries from this OPs storage that start with 'sales'
+
op('/').resetViewer(recurse=True) # reset the viewer for all operators in the entire file.
</syntaxhighlight>
 
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
 
     |class=OP
 
     |class=OP
     |name=cook
+
     |name=fetch
     |call=cook(force=False, recurse=False)
+
     |call=fetch(key, default, search=True, storeDefault=False)
 
     |returns=
 
     |returns=
     |text=Cook the contents of the operator if required.
+
     |text=: -> value
*force - (Keyword, Optional) If True, the operator will always cook, even if it wouldn't under normal circumstances.
+
Return an object from the OP storage dictionary.  If the item is not found, and a default it supplied, it will be returned instead.
*recurse - (Keyword, Optional) If True, all children and sub-children of the operator will be cooked.
+
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)
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
 
     |class=OP
 
     |class=OP
     |name=errors
+
     |name=scriptErrors
     |call=errors(recurse=False)
+
     |call=scriptErrors(recurse=False)
 
     |returns=
 
     |returns=
     |text=Get error messages associated with this OP.
+
     |text=:Get script error and warning messages associated with this OP.
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
 
     |class=OP
 
     |class=OP
     |name=changeType
+
     |name=var
     |call=changeType(OPtype)
+
     |call=var(name, search=True)
     |returns=OP
+
     |returns=
     |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=: -> str
*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.
+
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.
<syntaxhighlight lang=python>
+
name - The variable name to search for.
n = op('wave1').changeType(nullCHOP) #changes 'wave1' into a Null CHOP
+
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.
n = op('text1').changeType(tcpipDAT) #changes 'text1' operator into a TCPIP DAT
 
</syntaxhighlight>
 
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
 
     |class=OP
 
     |class=OP
     |name=pars
+
     |name=openViewer
     |call=pars(pattern)
+
     |call=openViewer(unique=False, borders=True)
     |returns=list
+
     |returns=
     |text=Returns a (possibly empty) list of parameter objects that match the pattern.
+
     |text=:
*pattern - Is a string following the Pattern Matching rules, specifying which parameters to return.
+
Open a floating content viewer for the OP.
<syntaxhighlight lang=python>
+
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.
newlist = op('geo1').pars('t?', 'r?', 's?') #translate/rotate/scale parameters
+
borders - (Keyword, Optional) If true, the floating window containing the viewer will have borders.
</syntaxhighlight>
+
op('geo1').openViewer(unique=True, borders=False) #opens a new borderless viewer window for 'geo1'
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
 
     |class=OP
 
     |class=OP
     |name=dependenciesTo
+
     |name=closeViewer
     |call=dependenciesTo(OP)
+
     |call=closeViewer(topMost=False)
     |returns=list
+
     |returns=
     |text=Returns a (possibly empty) list of operator dependency paths between this operator and the specified operator. Multiple paths may be found.
+
     |text=:
 +
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.
 
}}}}
 
}}}}
 
<section end=HELPBODY />
 
<section end=HELPBODY />
 
{{History}}
 
{{History}}
 
{{#invoke:Category|list|Python Reference}}
 
{{#invoke:Category|list|Python Reference}}

Revision as of 15:11, 15 September 2017

The OP class defines a reference to a single operator.


Members[edit]

activeViewer(Read Only):

Get or set viewer active flag.

allowCooking(Read Only):

Get or set cooking flag. Components only.

base(Read Only):

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

bypass(Read Only):

Get or set bypass flag.

children(Read Only):

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

childrenCookAbsFrame(Read Only):

The absolute frame on which childrenCookTime is based.

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

childrenGPUCookAbsFrame(Read Only):

The absolute frame on which childrenGPUCookTime is based.

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

cloneImmune(Read Only):

Get or set clone immune flag.

color(Read Only):

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.

comment(Read Only):

Get or set comment string.

cookAbsFrame(Read Only):

Last absolute frame at which this operator cooked.

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

cookFrame(Read Only):

Last frame at which this operator cooked.

cookStartTime(Read Only):

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

cookTime(Read Only):

Duration of the last measured cook (in milliseconds).

cookedPreviousFrame(Read Only):

True when this operator has cooked the previous frame.

cookedThisFrame(Read Only):

True when this operator has cooked this frame.

cpuMemory(Read Only):

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

curPar(Read Only):

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

current(Read Only):

Get or set current flag.

customPages(Read Only):

A list of all custom pages.

customPars(Read Only):

A list of all custom parameters.

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

digits(Read Only):

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

display(Read Only):

Get or set display flag.

dock(Read Only):

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

docked(Read Only):

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

error(Read Only):

Get or set the error message associated with this OP.

expose(Read Only):

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

ext(Read Only):

The object to search for parent extensions. Example: me.ext.MyClass

gpuCookTime(Read Only):

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

inputConnectors(Read Only):

List of input connectors asssociated with this operator.

inputs(Read Only):

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

isBase(Read Only):

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

isCHOP(Read Only):

True if the operator is a CHOP.

isCOMP(Read Only):

True if the operator is a component.

isDAT(Read Only):

True if the operator is a DAT.

isMAT(Read Only):

True if the operator is a Material.

isObject(Read Only):

True if the operator is an object.

isPanel(Read Only):

True if the operator is a Panel.

isSOP(Read Only):

True if the operator is a SOP.

isTOP(Read Only):

True if the operators is a TOP.

lock(Read Only):

Get or set lock flag.

mod(Read Only):

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

name(Read Only):

Get or set the operator name.

nodeCenterX(Read Only):

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

nodeCenterY(Read Only):

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

nodeHeight(Read Only):

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

nodeWidth(Read Only):

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

nodeX(Read Only):

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

nodeY(Read Only):

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

op(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...) -> OP or None 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 -> OP 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)

outputConnectors(Read Only):

List of output connectors associated with this operator.

outputs(Read Only):

List of output operators from this operator.

par(Read Only):

An intermediate parameter collection object, from which a specific parameter can be found. Example: n.par.tx

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

path(Read Only):

Full path to the operator.

python(Read Only):

Get or set parameter expression language as python.

render(Read Only):

Get or set render flag.

replicator(Read Only):

The replicatorCOMP that created this operator, if any.

selected(Read Only):

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

showCustomOnly(Read Only):

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

showDocked(Read Only):

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

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

tags(Read Only):

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:

Example: n.tags = ['effect', 'image filter']

Example: n.tags.add('darken')

time(Read Only):

Time Component that defines the operator's time reference.

totalCooks(Read Only):

Number of times the operator has cooked.

valid(Read Only):

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

viewer(Read Only):

Get or set viewer flag.

warning(Read Only):

Get or set the warning message associated with this OP.

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

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

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

:

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():

: Open a floating dialog containing the operator parameters.

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

:

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

:Get warning messages associated with this OP.

destroy():

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

unstoreStartupValue(keys1, keys2..):

:

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

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

: Adds a script error to a node.

copyParameters(OP):

:

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

:Get error messages associated with this OP.

addWarning(msg):

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

resetViewer(recurse=False):

:

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

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

:

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:

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.

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

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.

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.

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

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

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.

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

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

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.