Hello, I have just started with Daz scripting. I'm trying to load a file, add a canvas and save the rendered image as a png. I have been able to load a file, start the render and activate the canvases but I can't find out how to add an Emission or Glossy canvases. I have been able to render an image but I can't activate the render to file. Here is the current code:
var TempFile = "Z:/01Test.duf";
var oContentMgr = App.getContentMgr();
oContentMgr.openFile(TempFile, false);
print("scene Loaded");
var TempRenderer = App.getRenderMgr();
var TempRenderOptions = TempRenderer.getRenderOptions();
TempRenderOptions.renderImgFilename = "Z:/01TestSave.png";
TempRenderOptions.renderImgTarget = 2; // Direct to file (doesn't work)
TempRenderOptions.applyChanges();
//TempRenderOptions.renderImgTold = 2; // Tried this but also doesn't seem to work
print(TempRenderOptions.renderImgFilename);
if (!TempRenderer.doRender(TempRenderOptions))
{
MessageBox.critical("Render Canceled. ","Render","&OK","");
}
else
{
//TempRenderer.saveLastRender(); // Manual save
}
var TempData = App.getRenderMgr().getRenderElementObjects();
if(TempData[1].name == "NVIDIA Iray Render Options")
{
if(TempData[1].getProperty(3).name == "Max Time")
{
var TempProperty = TempData[1].getProperty(3); // Max Time
TempProperty.setValue(200);
print("Max Time:"+TempProperty.getValue());
TempData[1].renderToCanvases = true;
// I have manually added a canvas for testing how to add one and this gives me it's name but I can't add one by script
print("Canvas:"+TempData[1].getCanvasDefinition(0).name);
//TempData[1].clearCanvasDefitions();
}
else
{
MessageBox.critical("Property 'Max Time' not found.","Render","&OK","");
}
}
else
{
MessageBox.critical("Could not find 'NVIDIA Iray Render Options'.","Render","&OK","");
}
print("Script Ended.");
This thread has helped a lot but I'm missing information on how to add a canvas: https://www.daz3d.com/forums/discussion/196346/how-to-access-advanced-section-in-iray-render-settings
Thanks.