Help fetching Iray render property and adding step value
First off, I'm a complete beginner at this, for as long as I've been around this forum best I can do is follow and combine existing examples, so beginner-level explanation would be appreciated.
Let's say I want to fetch the DzIrayRenderer property like Environment Intensity, but I want to add step value via script, for an example increase value by 0.5 to existing one every time script is innitiated. From my understanding I would use Render Settings - Find Property to locate Environment Intensity property but anything I do afterwards to set value doesn't function and I would appreciate some guildelines.
Beginning so far is consistent:
/==============================================================================////==============================================================================function getEnvironmentIntensity(){ var renderMgr = App.getRenderMgr(); var renderer = renderMgr.getRenderer( "DzIrayRenderer" ); if( !renderer ) { return( 0 ); } var renderElements = renderMgr.getRenderElementObjects(); var element = renderElements[1]; // NVIDIA Iray var propGroups = element.getPropertyGroups(); var prop = propGroups.findProperty( "Environment Intensity" );
but here on I don't know how to manipulate further to get to getValue or setValue within the property that would match with the first part let alone step values like increasing by a number (I tried similar examples per nodes and objects but they must've led me rather wrong cause I can't make them work), so I'll just spare you all the fails I had and appreciate it if anyone would be willing to help :) Thanks.
Comments
By my reading, the scripting documenation says that that getRenderer() method of a DzRenderMgr object takes a Number argument, not a string. You could find the correct number value for Iray by using the getNumberRenderers() method as the index of a loop, calling getRenderer() for each index and then using the getName() method on the DzRenderer object.
The documentation says nothing about the getRenderElementObjects() method, so without writing test code to investigate it's hard to say whether your usage will work as you expect it to.
In the past I have used the getPropertyHolder() method of the DzIrayRenderer object to get a DzElement object that holds the properties of the renderer. Then the getPropertyList() method in the DzElement will get you an array of all the properties, or use findPropertyByLabel() to get a given property by name. I have been able to set Min and Max Samples, and Max Time values by this method but do not know if Environment Intensity is available via this approach.
Had another thought, and I think I have found it by way of the getPropertyGroups() method of the DzElement object.
Wow thank you so much! This works perfect for what I need, and it's probably the only way I didn't try to call it in last night, it drove me completely crazy.