Surface Emitter Raycount Pickups
FRED Optimum's Parameter Pickups capability provides a mechanism for dynamically linking two or more parameters together. The user defines the two variables that will be linked (the "source" and "destination" variables), and the functional relationship between them. User defined scripts can be used to access the less common parameters in the model. This is demonstrated below.
The file in this example has two surface emitter sources which are linked in a Parameter Pickup so when the user needs to change the ray count of both the sources they only need to edit one of them. The other is updated automatically.
The Parameter Pickup definition is shown below. The "Source Variable" is defined on the right side to be the "Sphere 1 Emitter" source, and the "Destination Variable" is defined on the left side to be "Sphere 2 Emitter." The parameters to be linked are shown in the red boxes above. These are not one of the default selections available in the "Type" drop down selector so the User-defined script is used to point towards this parameter.
The user-defined script below obtains the numRays member of the T_SOURCEPOSSURFACE structure, and conveniently in this case the same script can be used in both the source and destination variable definitions. The statement "If g_setvar Then" is true for the destination variable and the next two lines of code sets this parameter to be g_var (i.e. the "source variable"); and for the source variable this if statement is false and therefore the line of code in the Else block retrieves the current value from the model and defines the g_var variable.
Example File: SurfaceEmitterRaycountPickups.frd