OMC::ExpressionColumn Class Reference

Detailed Description

Represents and provides the methods for an expression column in a scene.

An Expression Column provides a double value based on a javascript expression set on the column. This expression column can provide dynamic values based on other variables in the project.

Create an Expression Column

from ToonBoom import harmony #Import the Harmony Module
sess = harmony.session() #Get access to the Harmony session, this class.
proj = sess.project #Get the active session's currently loaded project.
scene = proj.scene #Get the top scene in the project.
columns = scene.columns #The overall column list of the scene.
new_expr_col = columns.create( "EXPR", "EXPR_COL_NAME" ) #Create the expression column
#A multiline expression -- in this case, a self-referential fibonacci sequence.
expr = """
function fibonacci( frame )
{
if( frame < 1 )
return 0;
else if( frame == 1 )
return 1;
return value( "%s", frame-2 ) + value( "%s", frame-1 );
}
fibonacci( currentFrame );
"""%( new_expr_col.name, new_expr_col.name )
new_expr_col.text = expr
#The first 10 frames of the fibonacci sequence
for frame in range( 1, 10+1 ):
print( "Frame %s: %s"%(frame, new_expr_col[frame] ) )

Public Member Functions

QVariant get_entry (double atFrame, int subColumnIndex=-1) const virtual QVariant getEntry(double atFrame
 Returns the value of a cell in a column. More...
 
void set_entry (double atFrame, QVariant value, int subColumnIndex=-1)
 Sets the value of a cell in a column. More...
 
void scale (double scale_factor)
 Scales the values in a column by a scaling factor.
 

Public Attributes

QString text
 Get/set the expression text in the identified column.
 
QString name
 Get/set the name of the column. This is the internal name of the column which is used as a unique identifier.
 
QString display_name
 Get/Set the displayable name of the column (like it would appear in the xSheet view).
 
QString type
 Get the type of the node.
 
QString anonymous
 Get/set the anonymous state of the column.
 
QList< OMC::Node * > linked_nodes
 Identifies nodes that are linked to the column.
 
QList< OMC::Attribute * > linked_attributes
 Identifies attributes that are linked to the column.
 

Member Function Documentation

◆ get_entry()

QVariant OMC::Column::get_entry ( double  atFrame,
int  subColumnIndex = -1 
) const
inherited

Returns the value of a cell in a column.

Parameters
atFrame: The frame number at which to retrieve the value from.
subColumnIndex: The index of the sub-column. Only 3D Path columns support sub-column. They have sub-columns for the X, Y, Z and velocity values on the 3D Path. Each sub-column has an index:
  • X = 1
  • Y = 2
  • Z = 3
  • Velocity = 4
Returns
Returns the value of a cell in a column.

◆ set_entry()

void OMC::Column::set_entry ( double  atFrame,
QVariant  value,
int  subColumnIndex = -1 
)
inherited

Sets the value of a cell in a column.

Parameters
atFrameThe frame number at which to set the value to.
value: the new value
subColumnIndex: The index of the sub-column. Only 3D Path columns support sub-column. They have sub-columns for the X, Y, Z and velocity values on the 3D Path. Each sub-column has an index:
  • X = 1
  • Y = 2
  • Z = 3
  • Velocity = 4
Inheritance diagram for OMC::ExpressionColumn:
Collaboration diagram for OMC::ExpressionColumn: