OMC::SceneUnitConverter Class Reference

Detailed Description

A converter utility for changing between OGL units and scene units.

Provided by the OMC::Scene::unit_converter.

Scenes within Harmony use field units, but most graphical operations use OpenGL units. Depending on the function and the context, conversion between these units are necessary and are done with the unit_converter. This converter (OMC::SceneUnitConverter) will use the scene's metric information to convert between the units.

Conversion from OGL to Field Units

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.
unit_converter = scene.unit_converter #The unit converter for this scene.
open_gl_point = harmony.Point3d( 1.0, 1.0, 1.0 ) #A Point3D object in 'OpenGL' units.
field_point = unit_converter.to_field( open_gl_point ) #Convert it.
#Print the converted field units.
print( "Field Units: %s %s %s"%(field_point.x, field_point.y, field_point.z) )

Public Member Functions

double to_ogl (double value, const QString &axis)
 
double to_field (double value, const QString &axis)
 
OMC::Point3dto_ogl (const OMC::Point3d *val)
 
OMC::Point3dto_field (const OMC::Point3d *val)
 

Member Function Documentation

◆ to_field() [1/2]

double OMC::SceneUnitConverter::to_field ( double  value,
const QString &  axis 
)

Converts a 2D position on an axis from OGL to fields in the worldspace.

◆ to_field() [2/2]

OMC::Point3d* OMC::SceneUnitConverter::to_field ( const OMC::Point3d val)

Converts a 2D point from OGL to fields in the worldpspace.

◆ to_ogl() [1/2]

double OMC::SceneUnitConverter::to_ogl ( double  value,
const QString &  axis 
)

Converts a 2D position on an axis from fields in the worldspace to OGL.

◆ to_ogl() [2/2]

OMC::Point3d* OMC::SceneUnitConverter::to_ogl ( const OMC::Point3d val)

Converts a 2D point from fields in the worldspace to OGL.

Inheritance diagram for OMC::SceneUnitConverter:
Collaboration diagram for OMC::SceneUnitConverter: