Difference between revisions of "Cell Class"

From TouchDesigner Documentation
Jump to: navigation, search
(Cell Class Auto Create)
(Cell Class Auto Create)
Line 10: Line 10:
 
     |class=Cell
 
     |class=Cell
 
     |name=owner
 
     |name=owner
     |returns=
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=The OP to which this object belongs.
 
     |text=The OP to which this object belongs.
Line 17: Line 17:
 
     |class=Cell
 
     |class=Cell
 
     |name=val
 
     |name=val
     |returns=
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=Get or set the cell contents, which are always stored as a string value.
 
     |text=Get or set the cell contents, which are always stored as a string value.
Line 24: Line 24:
 
     |class=Cell
 
     |class=Cell
 
     |name=valid
 
     |name=valid
     |returns=
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=True if the referenced cell currently exists, False if it has been deleted.
 
     |text=True if the referenced cell currently exists, False if it has been deleted.
Line 31: Line 31:
 
     |class=Cell
 
     |class=Cell
 
     |name=col
 
     |name=col
     |returns=
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=The numeric column of the cell.
 
     |text=The numeric column of the cell.
Line 38: Line 38:
 
     |class=Cell
 
     |class=Cell
 
     |name=row
 
     |name=row
     |returns=
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=The numeric row of the cell.
 
     |text=The numeric row of the cell.
Line 46: Line 46:
 
|items=
 
|items=
 
 
{{ClassMethod
 
    |class=Cell
 
    |name=offset
 
    |call=offset(r, c)
 
    |returns=
 
    |text=: -> Cell or None
 
The cell offset to this cell by the specified amount, or None.
 
r - The number of rows from the cell.  Positive values count down, while negative values count up.
 
c - The number of columns from the cell.  Positive values count right, while negative values count left.
 
c = op('table1')['March', 'Sales']
 
d = c.offset(-1, 2)  # one row up, two columns right of cell C
 
}}
 
 
{{ClassMethod
 
{{ClassMethod
 
     |class=Cell
 
     |class=Cell
Line 72: Line 60:
 
  delayRef - (Keyword, Optional) Specifies an optional operator from which the delay time is derived.
 
  delayRef - (Keyword, Optional) Specifies an optional operator from which the delay time is derived.
 
  arg - (Optional) Arguments that will be made available to the script in a local tuple named args.
 
  arg - (Optional) Arguments that will be made available to the script in a local tuple named args.
 +
}}
 +
{{ClassMethod
 +
    |class=Cell
 +
    |name=offset
 +
    |call=offset(r, c)
 +
    |returns=
 +
    |text=: -> Cell or None
 +
The cell offset to this cell by the specified amount, or None.
 +
r - The number of rows from the cell.  Positive values count down, while negative values count up.
 +
c - The number of columns from the cell.  Positive values count right, while negative values count left.
 +
c = op('table1')['March', 'Sales']
 +
d = c.offset(-1, 2)  # one row up, two columns right of cell C
 
}}}}
 
}}}}
 
<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 Cell Class describes the contents of a single cell from a DAT operator table. The DAT Class offers many ways of accessing its individual cells. DAT cells are always internally stored as strings, but may be accessed as numeric values.


Members[edit]

owner(Read Only):

The OP to which this object belongs.

val(Read Only):

Get or set the cell contents, which are always stored as a string value.

valid(Read Only):

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

col(Read Only):

The numeric column of the cell.

row(Read Only):

The numeric row of the cell.

Methods[edit]

run(endFrame=False, fromOP=None, , group=None, delayFrames=0, delayMilliSeconds=0, delayRef=me, arg1, arg2...):

: -> Run

Run the contents of the cell as a script, returning a Run object which can be used to optionally modify its execution. endFrame - (Keyword, Optional) If set to True, the execution will be delayed until the end of the current frame. fromOP - (Keyword, Optional) Specifies an optional operator from which the execution will be run relative to. group - (Keyword, Optional) Can be used to specify a group label string. This label can then be used with the td.runs object to modify its execution. delayFrames - (Keyword, Optional) Can be used to delay the execution a specific amount of frames. delayMilliSeconds - (Keyword, Optional) Can be used to delay the execution a specific amount of milliseconds. This value is rounded to the nearest frame. delayRef - (Keyword, Optional) Specifies an optional operator from which the delay time is derived.

arg - (Optional) Arguments that will be made available to the script in a local tuple named args.

offset(r, c):

: -> Cell or None

The cell offset to this cell by the specified amount, or None. r - The number of rows from the cell. Positive values count down, while negative values count up. c - The number of columns from the cell. Positive values count right, while negative values count left. c = op('table1')['March', 'Sales']

d = c.offset(-1, 2) # one row up, two columns right of cell C

TouchDesigner Build:

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.