EyeonTips:Script/Reference/Applications/Fuse/Classes/ScriptOperator/AddOutput

From VFXPedia

< EyeonTips:Script | Reference/Applications/Fuse/Classes/ScriptOperator
Revision as of 11:39, 16 December 2010 by Tilt (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Additional Outputs

It might be useful to add additional outputs that other inputs can connect to. For example, the Tracker provides several outputs for its stabilized and unstabilized coordinates. This snippet is from the FlareCircle Fuse, that publishes additional coordinates like this:

OutActualPosition = self:AddOutput("Actual Position", "ActualPosition", {
   LINKID_DataType = "Point",
   })
OutOrientation = self:AddOutput("Orientation", "Orientation", {
   LINKID_DataType = "Number",
   })

If you use additional outputs like this, you also need to handle the PreCalcProcess event. This function is used to tell Fusion about the expected image size, DoD and so on, before the actual Process() function is called. By default it will only handle the main image output causing tools connected to the additional outputs to fail. No biggie, just override PreCalcProcess() and produce valid values for all your outputs:

function PreCalcProcess(req)
   local img = InImage:GetValue(req)
 
   -- of course you would need to calculate proper return values here...
   OutActualPosition:Set(req, Point(0.5,0.5))
   OutOrientation:Set(req, Number(180))
   -- output image with no data
   local out = Image({IMG_Like = img, IMG_NoData = true})
   OutImage:Set(req, out)
end