Set Iray Settings

I want to set a parameter in environment settings.
This is my method:
var viewport_manager = MainWindow.getViewportMgr();
var draw_style = viewport_manager.findUserDrawStyle("NVIDIA Iray");
var viewport = viewport_manager.getActiveViewport();
var viewport_3d = viewport.get3DViewport();
viewport_3d.setDrawStyle(draw_style);
var render_manager = App.getRenderMgr();
render_manager.rebuildRenderElements();
render_manager.getRenderElementObjects().forEach(function (element)
{
if (element.className() === "DzEnvironmentNode")
{
element.findPropertyByLabel("Draw Dome").setDoubleValue(1);
}
});
problem is when we switch to Iray, it seems environemt node will be created in background, so setting property will happen immidiatly at time, while the node is not created yet.
Comments
You need the node befoer you can set non-default values in general.
Also, that property is not a double, and that is a very messy way to find the property.
If you want to set the property when the DzEnvironmentNode does not yet exist, you will need to create it yourself when
Scene.findSingletonNode(sEnvironmentNodeID);
returns null before continuing.first of all how you framed the code? it is a challlange for me :)
ok, my concern is not how to find and set the property (thanks for you points).
I don't know how to switch to I ray and immidiatly set environment properties.
how i can create those nodes myself?
I figure it out:
Scene.addNode(new DzEnvironmentNode())
Scene.addNode(new DzTonemapperNode())
I used a pre block as code blocks have been broken in the forum for...quite a few years now.