You can use `print()` to write the value of properties to the output in the script editor window or to the log viewer if used as a global script or in a scripted graph. (You can set up the Octane workspace so the API browser and log viewer are always visible).
Here is a test script, you can paste it in the script editor of a test scene and play with it. I have flattened the callbacks functions.
Code: Select all
-- Look for a node.
local rootGraph = octane.project.getSceneGraph()
local items = rootGraph:findItemsByName("Render target", true)
local nodeRenderTarget = items[1]
-- Callback called by the renderer, passing intermediate render results.
-- The current result is passed in as a PROPS_RENDER_RESULT.
local function renderCallback(propsRenderResult)
print("In render callback")
print("\tsamples: " .. propsRenderResult.samples)
-- TODO: Test if cancelled, call octane.render.callbackStop().
end
-- Callback called by the renderer, passing intermediate render statistics.
-- The current statistics are passed in as a PROPS_RENDER_RESULT_STATISTICS.
local function statisticsCallback(propsRenderResultStatistics)
print("In statistics callback")
print("\tbeautySamplesPerSecond: " .. propsRenderResultStatistics.beautySamplesPerSecond)
print("\trenderTime: " .. propsRenderResultStatistics.renderTime)
print("\testimatedRenderTime: " .. propsRenderResultStatistics.estimatedRenderTime)
end
-- Properties to start the render. See octane.render.PROPS_RENDER_START.
local propsRenderStart = {
callback = renderCallback,
doUpdate = true,
maxRenderTime = 2,
renderTargetNode = nodeRenderTarget,
restart = true,
statisticsCallback = statisticsCallback
}
-- Start rendering.
local result = octane.render.start(propsRenderStart)
print("Render finished.")
print("\trenderTime" .. result.renderTime)