Iray environment properties

how we can do this using c++?
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(); Scene.addNode(new DzEnvironmentNode()); Scene.addNode(new DzTonemapperNode()); render_manager.getRenderElementObjects().forEach(function (element) { if (element.className() === "DzEnvironmentNode") { element.findPropertyByLabel("Draw Dome").setDoubleValue(1); } });
Post edited by MehdiZangenehBar on
Comments
A problem is that the SDK 4.5+ does not know about zEnvironmentNode and DzTonemapperNode. They were created after this version of the SDK was released.
One option to work around that problem is to create those nodes using a script called by your plugin. If you are so inclined, you could just get your plugin to call your whole script.
However, since this is an SDK forum let’s do what we can using the SDK.
Sorry I do not have a great deal of free time so not the best code it is verbose and has redundant checking. Use at your own risk, hopefully it will be of use to you and others.
CREDIT: apart from any spelling mistakes this code is simply an adaption from DAZ's examples(included with the SDK) and in the SDk documentation and from many previous forum contributors.
ok, thanks, code you please wrap your code using <pre> code </pre> tag? it is very hard to read in single line (that is forum problem)
OK, I just saw your code, so there no way to instansiate a class by name or any other trick?
for the first part, checking classname is not better way?
I don't undrstand why DzEnvironmentNode is not exposed in SDK!, but don't undrstand more why a scene node used to store environment data!
I also don't undrstand why auto creation of the environment and tonemap nodes will be executed synchronously?! the code should not be executed line by line?!