Closed benjamin-heasly closed 9 years ago
We can implement this in a flexible way to allow different styles of RenderToolbox3 configuration.
RenderToolbox3ConfigurationTemplate
and custom scripts derived from it can use setpref()
to set a RenderToolbox3 defaultConfigurationScript
preference. This will probably be the name of the script that's calling setpref()
.
Once the defaultConfigurationScript
preference is set, the assumption will that it's OK for anyone to call this script any time, to put the machine in a reasonable, functional state for RenderToolbox3.
Users might want to invoke the defaultConfigurationScript
before rendering in order to avoid configuration surprises for their own projects.
Users who make strange changes to RenderToolbox3 configuration might want to invoke the defaultConfigurationScript
after rendering, in order to prevent their strange changes from causing surprises for other users.
The RecipeAPI can also use the defaultConfigurationScript
.
Each recipe can include a setUp
script and a cleanUp
script. Each of these could be the name of a configuration script, or be left empty. The setUp
script would help recipe authors avoid surprises by establishing consistent configuration before recipe execution. The cleanUp
script would help recipe authors be courteous to other users by leaving behind consistent configuration after execution.
The setUp
script or cleanUp
script could be set to a special value, perhaps the value 'defaultConfigurationScript'
, in order to specify the script that was set in the defaultConfigurationScript
preference. This would allow recipe authors to use the defaultConfigurationScript
without having to go look up its name. It would also prevent recipe authors from having to edit all their recipes in case the value of the defaultConfigurationScript
preference changes.
This would also make recipes more portable. A given recipe might be be packed up, moved to a new machine, and unpacked before being executed. If the recipe specified 'defaultConfigurationScript'
for its setUp
script, it would be able to invoke the local defaultConfigurationScript
on any new machine, and expect to run with reasonable, functional configuration.
Currently, users must manage machine-specific configuration scripts that set configuration like the file paths where renderers are located. For regular recipes, this means manually executing an appropriate script before rendering. The RecipeAPI can execute configuration scripts automatically, but it is still up to the user to specify the correct configuration script if they unpack a recipe on a new machine.
It might be useful to include a machine "default" configuration script name along with other configuration stored with getpref(). This could allow batch rendering utilities to invoke the configuration script automatically. It would also allow the RecipAPI to automatically detect the correct configuration file when unpacking a recipe on a new machine.