Prev | Next


RenderMan Display Event Handlers


RenderMan Display Event Handlers are tcl scripts that are executed by 'it' on receipt and completion of display connections. The scripts can either be set globally in the 'it' Preferences window or you can embed them within a RIB file. One example use of a close handler is in the Render Setttings dialog where in the "Passes" tab you can add an "Extra Output Setting" called "Iceman Post-render". This is in fact a close handler that ultimately gets sent to it.

When embedding in RIB we use the standard RiDisplay string parameter dspyParams to transmit the scripts. Generally the dspyParams string is used for a number of independent purposes including re-rendering support and display context characterization. The simple syntax of the dspyParams string is a series of independent fields beginning with a unique keyword and terminated by a semicolon. We extend this syntax to better support embedded tcl-scripts, but recommend you do not over-burden the dspyParams string with complex tcl. Rather, we suggest you rely on the tcl-extension mechanism to define standard tcl procedures that you reference within dspyParams.

We currently support two events:



Example

This simple example creates a new catalog on receipt of a rendering connection. When rendering completes, the simple edge script executes, producing a new image in the same catalog.

My.rib

Display "main" "it" "rgba" 
 "string dspyParams" ["itOpenHandler {MyNewPal %arglist};;; itCloseHandler {MyEdge;MySave};;;"]

MyItExtensions.tcl

proc MyNewPal arglist {
  global myGlobalState
  ::RAT::LogMsg NOTICE "MyNewPalette called with $arglist"
  set c [it NewCatalog]
  it SetCurrentCatalog $c
  set myGlobalState(catalog) $c
}
proc MyEdge {} {
  global myGlobalState
  $myGlobalState ExecuteIceManScript "MyIceManEdge(e0)"
}
proc MySave {} {
   set c [it GetCurrentCatalog]
   set dir [workspace GlobalizePath [workspace GetDir itsession]]
   set savestr {}
   foreach i [$c GetImageList] {
       set fn [$i GetFilename]
       if [string equal $fn "<script result>"] {
           set h [$i GetHandle]
           set fn [file join $dir $h.tif]
           ::RAT::LogMsg NOTICE "saving: img:[$i GetHandle]:$fn"
           append savestr "$h Save(\"$fn\")\n"
       }
   }
   if ![string equal {} $savestr] {
       $c ExecuteIceManScript $savestr
   }
}

MyIceManExtensions.io

MyIceManEdge := method(imgh,
   result := imgh - imgh Blur(5,5)
 )
 

 


Prev | Next


 

 

Pixar Animation Studios
Copyright© Pixar. All rights reserved.
Pixar® and RenderMan® are registered trademarks of Pixar.
All other trademarks are the properties of their respective holders.