OMH::HarmonyRenderHandler Class Reference

Detailed Description

The render-handler object for Harmony.

The render handler is a temporary object-type that provides render access to nodes in the scene. The render handler will not block the application and will require callbacks where needed.

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.
render_handler = proj.create_render_handler() #The new render handler that has been generated; will not have any changes from other handlers.
render_handler.blocking = True #This handler will block the main application. Optional.
scn = proj.scene
node = scn.nodes["Top/Write"] #Get the Top/Write node by name.
print( "Rendering : %s"%(node) )
if node:
render_handler.node_add( node ) #The render handler will render any nodes added to it.
render_handler.render() #In the case of write nodes, the write node's parameters will define the settings of the exported frame.
print( "COMPLETE!" ) #Prints only when complete, due to blocking above--

Signals

void frame_ready (const OMC::Node *, int frame, const OMC::Cel *frameImage)
 Signal that is emit when a frame is ready from the actively rendering job.
 
void render_state_changed ()
 Signal that is emit when the state of the actively rendering job is changed.
 
void progress (int prog)
 Signal that is emit when the progress of the job changes.
 

Public Member Functions

void reset_resolution ()
 Resets the resolution to the scene's default values.
 
std::vector< NODE_OBJ > nodes () const
 Provides the list of nodes that will be rendered.
 
void node_add (OMC::Node *node)
 Add a node to a list of nodes to render.
 
void node_remove (OMC::Node *node)
 Remove a node from the list of nodes to render.
 
void node_add (std::vector< OMC::Node *> &node)
 Add nodes to a list of nodes to render.
 
void node_remove (std::vector< OMC::Node *> &node)
 Remove nodes from the list of nodes to render.
 
void node_clear ()
 Remove a node from the list of nodes to render.
 
void render ()
 Render the entire scene.
 
void render (int fromFrame, int toFrame)
 Render a part of the scene.
 
void cancel ()
 Cancel the rendering scene.
 
void block_until_complete ()
 Blocks script execution until the job has completed. More...
 
virtual void on_frame_ready (const OMC::Node *, int frame, const OMC::Cel *frameImage)
 Slot that can be overridden in custom class to appropriately handle saving finished frames at render.
 
virtual void on_render_state_changed ()
 Slot that can be overridden in custom class to appropriately handle render job changing states.
 
virtual void on_progress (int percentage)
 Slot that can be overridden in custom class to appropriately handle render job progress updates.
 

Public Attributes

bool combine
 Set if rendered frames sets should be combined and in which order. Specify these options if you are rendering in PAL or NTSC format.
 
bool second_field_first
 Sets the order in which the fields should be ordered.
 
QString field_type
 Sets the frame output format. More...
 
OMC::Colourbackground
 Set the background color to use when rendering in scene machine mode.
 
OMC::Rect2DIresolution
 Get and set the render resolution.
 
QString resolution_name
 Set the render resolution by name.
 
bool thumbnail_cropping
 Enable or disable thumbnail cropping for the render. Mainly used when rendering thumbnails.
 
bool blocking
 Defines whether this render handler blocks or does not. More...
 
int blocking_time
 Defines how long to block in scripting when rendering (how long until render times out)
 
QString state
 Identifies if Harmony is actively rendering.
 
QStringList formats_available
 View available formats for the cel conversion at render.
 
PyFunction frame_ready_callback
 Provide a callback function for the frame-ready event. More...
 
PyFunction render_state_changed_callback
 Provide a callback function for the render-state-changed event. More...
 
PyFunction progress_callback
 Provide a callback function for the progress event. More...
 

Member Function Documentation

◆ block_until_complete()

void OMH::HarmonyRenderHandler::block_until_complete ( )

Blocks script execution until the job has completed.

Parameters
timeout- Time in seconds to wait before timing out and unblocking

Member Data Documentation

◆ blocking

bool OMH::HarmonyRenderHandler::blocking
readwrite

Defines whether this render handler blocks or does not.

Note, if the render handler does not block and it is being handled in an external Python interpreter – the rendering threads need to be processed intermittently to properly synchronize with the main python thread. In order to do this, please see process_messages().

◆ field_type

QString OMH::HarmonyRenderHandler::field_type
readwrite

Sets the frame output format.

Parameters
type- frame output format: None, NTSC, PAL

◆ frame_ready_callback

OMH::HarmonyRenderHandler::frame_ready_callback

Provide a callback function for the frame-ready event.

If a callback function is provided, it will be called every time a frame is ready. This callback function should be in the form:

def frame_ready_callback( node, frame, cel )

◆ progress_callback

OMH::HarmonyRenderHandler::progress_callback

Provide a callback function for the progress event.

If a callback function is provided, it will be called every time the progress of the job updates. The value is provided as an integer representing the percent completion.

def progress_callback( )

◆ render_state_changed_callback

OMH::HarmonyRenderHandler::render_state_changed_callback

Provide a callback function for the render-state-changed event.

If a callback function is provided, it will be called every time the render state changes for this render handler's job.

def render_state_changed_callback( )

Inheritance diagram for OMH::HarmonyRenderHandler:
Collaboration diagram for OMH::HarmonyRenderHandler: