|
Custom operator fcurve callbacks
This example shows how to add and remove custom operator fcurve callback
functions.
- package require Sw_memcommands
- package require Sw_saacommands
- package require Sw_ucommands
- package require Sw_types
- package require SW_library
- package require SW_constants
- package require Sw_genConsts
- package provide SoftWish15 1.0
- # Procedure for Init entry point of persistent effect
- proc SoftWishInit {} {
- global SAA_Constants
- if [catch { SoftWishInitInside } err ] {
- freeSAA
- SAA_statusBarSet err $SAA_Constants(SAA_ERROR_CODE)
- return -code error $err
- }
- }
- proc SoftWishInitInside {} {
- global saaArr
- global SAA_Constants
- global customContext
- set customContext CustomContext1
- # Allocate and retrieve current scene
- set saaArr(curSceneID) [ SAA_AllocScene ]
- SAA_sceneGetCurrent $saaArr(curSceneID)
- # Allocate and retrieve icon for the effect
- set saaArr(iconID) [ SAA_AllocElem ]
- SAA_customContextGetIcon $customContext $saaArr(iconID)
- # For each OAT name register a callback for the fcurve.
- foreach oatName { VarX VarY VarZ } {
- SAA_cusOperatorAddFcurveCallback $saaArr(curSceneID) $saaArr(iconID) oatName
$customContext "testFcurveCallback $oatName" ${oatName}_Handle
- }
- }
- # Procedure for Update entry point of the persistent effect
- proc SoftWishUpdate {} {
- puts "We are in SoftWishUpdate"
- puts "SoftWishUpdate is done"
- }
- # Procedure for Cleanup entry point of the persistent effect
- proc SoftWishCleanup {} {
- global customContext
- For each OAT name remove a callback for the fcurve.
- foreach oatName { VarX VarY VarZ } {
- SAA_cusOperatorRemoveFcurveCallback $saaArr(curSceneID) $saaArr(iconID) oatName
$customContext "testFcurveCallback $oatName" ${oatName}_Handle
- }
- freeSAA
- }
- # Procedure for memory freeing
- proc freeSAA {} {
- global saaArr
- foreach item [array names saaArr] {
- SAA_Free $saaArr($item)
- }
- catch { unset saaArr }
- }
- # Fcurve callback procedure
- proc testFcurveCallback {OATname} {
- puts "testFcurveCallback for $OATname is called"
- update
- }
|